POV-Ray : Newsgroups : povray.binaries.images : A method creat uniform thick shell Server Time: 19 Jan 2019 04:31:05 GMT
  A method creat uniform thick shell (Message 1 to 10 of 45)  
Goto Latest 10 Messages Next 10 Messages >>>
From: And
Subject: A method creat uniform thick shell
Date: 21 Oct 2013 07:05:06
Message: <web.5264d1b954cff585cc1fd1150@news.povray.org>
Hi,
I have a method using isosurface render spheroid shell below.

use this two function

#declare f_spheroid=function(var1,var2,var3, a,b){
var1*var1/a/a+var2*var2/a/a+var3*var3/b/b-1
}

#declare f_spheroid_normalized=function(var1,var2,var3, a,b){
f_spheroid(var1,var2,var3, a,b)
/sqrt(4*(var1*var1+var2*var2)/pow(a,4)+4*var3*var3/pow(b,4))
}


//than difference these two isosurfaces
difference{
isosurface{
function{f_spheroid(x,y,z,1,3)}
}
isosurface{
function{f_spheroid_normalized(x,y,z,1,3)+thickness}
}
}


Post a reply to this message


Attachments:
Download 'spheroid shell diffuse .jpg' (28 KB)

Preview of image 'spheroid shell diffuse .jpg'
spheroid shell diffuse .jpg


 

From: And
Subject: Re: A method creat uniform thick shell
Date: 21 Oct 2013 07:30:01
Message: <web.5264d704dce0719acc1fd1150@news.povray.org>
And the transparency version below:

this method just modify mathematic function f by divide a factor
sqrt((&#8706;f/&#8706;x)^2+(&#8706;f/&#8706;y)^2+(&#8706;f/&#8706;z)^2)
It can be used in many well-behaved mathematic function(differentiable and
continue function and no singularity I think...)


Post a reply to this message


Attachments:
Download 'spheroid shell transparency.jpg' (28 KB)

Preview of image 'spheroid shell transparency.jpg'
spheroid shell transparency.jpg


 

From: And
Subject: Re: A method creat uniform thick shell
Date: 21 Oct 2013 07:45:00
Message: <web.5264daf0dce0719acc1fd1150@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
> this method just modify mathematic function f by divide a factor
> sqrt((&#8706;f/&#8706;x)^2+(&#8706;f/&#8706;y)^2+(&#8706;f/&#8706;z)^2)

It can't show the symbol...
....I mean
f_normalized(x,y,z)=
f(x,y,z)
/sqrt(
(partial derivative of f(x,y,z) in x)^2
+(partial derivative of f(x,y,z) in y)^2
+(partial derivative of f(x,y,z) in z)^2
)

then set a threshold to displacement it by a (not too large) thickness.


Post a reply to this message

From: And
Subject: Re: A method creat uniform thick shell
Date: 21 Oct 2013 10:50:01
Message: <web.5265061bdce0719acc1fd1150@news.povray.org>
This is another function and picture:
#declare CSG_OVERLAP=0.000001;
#declare f_quartic=function(var1,var2){
pow(var1,4)+2*var1*var1*var2*var2+var1*var1-1
}

#declare f_quartic_normalized=function(var1,var2){
f_quartic(var1,var2)
/sqrt(16*pow(var1,6)+(48*var2*var2+16)*pow(var1,4)+(16*pow(var2,4)+16*var2*var2+4)*var1*var1)
}

difference{
isosurface{
function{f_quartic(y,x)}
max_gradient 10
contained_by{box{<-3,0,-1><3,1.3,3>}}
all_intersections
}
isosurface{
function{f_quartic_normalized(y,x)+0.04}
max_gradient 10
contained_by{box{<-3,0-CSG_OVERLAP,-1-CSG_OVERLAP><3,1.3,3+CSG_OVERLAP>}}
all_intersections
}
}


Post a reply to this message


Attachments:
Download 'isosurface shell.jpg' (28 KB)

Preview of image 'isosurface shell.jpg'
isosurface shell.jpg


 

From: Fractracer
Subject: Re: A method creat uniform thick shell
Date: 24 Oct 2013 12:30:01
Message: <web.5269119cdce0719aa8e6d28b0@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
> This is another function and picture:
> #declare CSG_OVERLAP=0.000001;
> #declare f_quartic=function(var1,var2){
> pow(var1,4)+2*var1*var1*var2*var2+var1*var1-1
> }
>
> #declare f_quartic_normalized=function(var1,var2){
> f_quartic(var1,var2)
>
/sqrt(16*pow(var1,6)+(48*var2*var2+16)*pow(var1,4)+(16*pow(var2,4)+16*var2*var2+4)*var1*var1)
> }
>
> difference{
> isosurface{
> function{f_quartic(y,x)}
> max_gradient 10
> contained_by{box{<-3,0,-1><3,1.3,3>}}
> all_intersections
> }
> isosurface{
> function{f_quartic_normalized(y,x)+0.04}
> max_gradient 10
> contained_by{box{<-3,0-CSG_OVERLAP,-1-CSG_OVERLAP><3,1.3,3+CSG_OVERLAP>}}
> all_intersections
> }
> }

I've tried to use yours functions but I have an error message:
Parse Error: Floating-point exception detected in function
'f_quartic_normalized'. Your function either attempted a division by zero, used
a function outside its domain or called an internal function with invalid
parameters.
I don't know what happens...


Post a reply to this message

From: Fractracer
Subject: Re: A method creat uniform thick shell
Date: 24 Oct 2013 12:30:02
Message: <web.5269127edce0719aa8e6d28b0@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
> This is another function and picture:
> #declare CSG_OVERLAP=0.000001;
> #declare f_quartic=function(var1,var2){
> pow(var1,4)+2*var1*var1*var2*var2+var1*var1-1
> }
>
> #declare f_quartic_normalized=function(var1,var2){
> f_quartic(var1,var2)
>
/sqrt(16*pow(var1,6)+(48*var2*var2+16)*pow(var1,4)+(16*pow(var2,4)+16*var2*var2+4)*var1*var1)
> }
>
> difference{
> isosurface{
> function{f_quartic(y,x)}
> max_gradient 10
> contained_by{box{<-3,0,-1><3,1.3,3>}}
> all_intersections
> }
> isosurface{
> function{f_quartic_normalized(y,x)+0.04}
> max_gradient 10
> contained_by{box{<-3,0-CSG_OVERLAP,-1-CSG_OVERLAP><3,1.3,3+CSG_OVERLAP>}}
> all_intersections
> }
> }

Ooops! I don't know why but with pov 3.7 it works! Not with 3.6!


Post a reply to this message

From: And
Subject: Re: A method creat uniform thick shell
Date: 26 Oct 2013 07:45:00
Message: <web.526b72eddce0719a965ff2ad0@news.povray.org>
"Fractracer" <lg.### [at] gmailcom> wrote:
>
> I've tried to use yours functions but I have an error message:
> Parse Error: Floating-point exception detected in function
> 'f_quartic_normalized'. Your function either attempted a division by zero, used
> a function outside its domain or called an internal function with invalid
> parameters.
> I don't know what happens...

Hum...
I just tried and this have parse error in pov-ray 3.6 truly.

Or you can use below function instead:

#declare f_quartic_normalized=function(var1,var2){
select(
abs(var1)-0.01,
-1,
f_quartic(var1,var2)
/sqrt(16*pow(var1,6)+(48*var2*var2+16)*pow(var1,4)+(16*pow(var2,4)+16*var2*var2+4)*var1*var1)
)
}


Post a reply to this message

From: And
Subject: Re: A method creat uniform thick shell
Date: 26 Oct 2013 15:35:01
Message: <web.526bdfe2dce0719a84f168e50@news.povray.org>
I explain this method. The basic concept is just that specifying different
threshold values to a function will produce different but similar isosurfaces.
For instance, in the right picture, upper surface of the shell is
y-sin(2.5*x)= 0.08 , lower surface is
y-sin(2.5*x)=-0.08

Use csg difference in pov-ray between these two isosurface objects can produce a
shell.

//---------------------code----------------------------

#declare f_sin=function(var1,var2,k){
var2-sin(k*var1)
}


#declare CSG_OVERLAP=0.000001;
difference{
isosurface{
function{f_sin(x,z,2.5)-0.08}
max_gradient 2
contained_by{box{<-5,-1,-1.5><5,2,1.5>}}
all_intersections
}
isosurface{
function{f_sin(x,z,2.5)+0.08}
max_gradient 2
contained_by{box{<-5,-1-CSG_OVERLAP,-1.5-CSG_OVERLAP><5,2+CSG_OVERLAP,1.5>}}
all_intersections
}
}

//-----------------------end of code-----------------------

But the shell's thickness is not a canstant. I found a method modifying the
function to let it have uniform thickness at least in a small range.


Post a reply to this message


Attachments:
Download 'sin.jpg' (130 KB)

Preview of image 'sin.jpg'
sin.jpg


 

From: And
Subject: Re: A method creat uniform thick shell
Date: 26 Oct 2013 15:55:00
Message: <web.526be5c5dce0719a84f168e50@news.povray.org>
The method had been represented the other day. The modified function for sin
function is
(y-sin(2.5*x))/sqrt(2.5^2*cos(2.5*x)^2+1)= 0.08 ,
(y-sin(2.5*x))/sqrt(2.5^2*cos(2.5*x)^2+1)=-0.08
                                          ^^^^^^
                                           0.08 represent the thickness/2

Then use pov-ray's csg difference:

//---------------------------code---------------------------
#declare f_sin=function(var1,var2,k){
var2-sin(k*var1)
}

#declare f_sin_normalized=function(var1,var2,k){
f_sin(var1,var2,k)
/sqrt(k*k*pow(cos(k*var1),2)+1)
}

#declare CSG_OVERLAP=0.000001;
difference{
isosurface{
function{f_sin_normalized(x,z,2.5)-0.08}
max_gradient 2
contained_by{box{<-5,-1,-1.5><5,2,1.5>}}
all_intersections
}

isosurface{
function{f_sin_normalized(x,z,2.5)+0.08}
max_gradient 2
contained_by{box{<-5,-1-CSG_OVERLAP,-1.5-CSG_OVERLAP><5,2+CSG_OVERLAP,1.5>}}
all_intersections
}
}
//--------------------------end of code--------------------------
Drew the picture!!


Post a reply to this message


Attachments:
Download 'sin_normalized.jpg' (117 KB)

Preview of image 'sin_normalized.jpg'
sin_normalized.jpg


 

From: Cousin Ricky
Subject: Re: A method creat uniform thick shell
Date: 26 Oct 2013 16:10:00
Message: <web.526be845dce0719a306548240@news.povray.org>
Nice!


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2008 Persistence of Vision Raytracer Pty. Ltd.