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)
 From: And Subject: A method creat uniform thick shell Date: 21 Oct 2013 07:05:06 Message:
```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}
}
}
```

Attachments:

Preview of image 'spheroid shell diffuse .jpg'

 From: And Subject: Re: A method creat uniform thick shell Date: 21 Oct 2013 07:30:01 Message:
```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...)
```

Attachments:

Preview of image 'spheroid shell transparency.jpg'

 From: And Subject: Re: A method creat uniform thick shell Date: 21 Oct 2013 07:45:00 Message:
```"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.
```
 From: And Subject: Re: A method creat uniform thick shell Date: 21 Oct 2013 10:50:01 Message:
```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)}
contained_by{box{<-3,0,-1><3,1.3,3>}}
all_intersections
}
isosurface{
function{f_quartic_normalized(y,x)+0.04}
contained_by{box{<-3,0-CSG_OVERLAP,-1-CSG_OVERLAP><3,1.3,3+CSG_OVERLAP>}}
all_intersections
}
}
```

Attachments:

Preview of image 'isosurface shell.jpg'

 From: Fractracer Subject: Re: A method creat uniform thick shell Date: 24 Oct 2013 12:30:01 Message:
```"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)}
> contained_by{box{<-3,0,-1><3,1.3,3>}}
> all_intersections
> }
> isosurface{
> function{f_quartic_normalized(y,x)+0.04}
> 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...
```
 From: Fractracer Subject: Re: A method creat uniform thick shell Date: 24 Oct 2013 12:30:02 Message:
```"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)}
> contained_by{box{<-3,0,-1><3,1.3,3>}}
> all_intersections
> }
> isosurface{
> function{f_quartic_normalized(y,x)+0.04}
> 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!
```
 From: And Subject: Re: A method creat uniform thick shell Date: 26 Oct 2013 07:45:00 Message:
```"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)
)
}
```
 From: And Subject: Re: A method creat uniform thick shell Date: 26 Oct 2013 15:35:01 Message:
```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}
contained_by{box{<-5,-1,-1.5><5,2,1.5>}}
all_intersections
}
isosurface{
function{f_sin(x,z,2.5)+0.08}
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.
```

Attachments:

Preview of image 'sin.jpg'

 From: And Subject: Re: A method creat uniform thick shell Date: 26 Oct 2013 15:55:00 Message:
```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}
contained_by{box{<-5,-1,-1.5><5,2,1.5>}}
all_intersections
}

isosurface{
function{f_sin_normalized(x,z,2.5)+0.08}
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!!
```

Attachments:
```Nice!