POV-Ray : Newsgroups : povray.binaries.images : A method creat uniform thick shell Server Time
31 Oct 2024 21:24:54 EDT (-0400)
  A method creat uniform thick shell (Message 16 to 25 of 45)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: posfan12
Subject: Re: A method creat uniform thick shell
Date: 21 Jul 2018 02:35:00
Message: <web.5b52d387dce0719a34baa4ef0@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
> 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}
> }
> }

How do I add a "c" parameter to the ellipsoid, in addition to "a" and "b"? I can
see how to add "c" to "f_spheroid" function. But I don't understand what's going
on in "f_spheroid_normalized". Thanks.


Mike


Post a reply to this message

From: posfan12
Subject: Re: A method creat uniform thick shell
Date: 21 Jul 2018 02:40:00
Message: <web.5b52d476dce0719a34baa4ef0@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
> 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}
> }
> }


(This may be a double post. Not sure. Sorry!)

The above function as the "a" and "b" parameters for the ellipsoid. How do I add
the "c" parameter for the third axis? I can see where it goes in "f_spheroid",
but I don't understand "f_spheroid_normalized". Thanks.


Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: A method creat uniform thick shell
Date: 21 Jul 2018 02:51:24
Message: <5b52d7ec$1@news.povray.org>
On 7/21/2018 2:36 AM, posfan12 wrote:
> "And" <49341109@ntnu.edu.tw> wrote:
>> 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}
>> }
>> }
> 
> 
> (This may be a double post. Not sure. Sorry!)
> 
> The above function as the "a" and "b" parameters for the ellipsoid. How do I add
> the "c" parameter for the third axis? I can see where it goes in "f_spheroid",
> but I don't understand "f_spheroid_normalized". Thanks.
> 
> 
> Mike
> 

Never mind. I figured it out.

Mike


Post a reply to this message

From: And
Subject: Re: A method creat uniform thick shell
Date: 22 Jul 2018 06:20:01
Message: <web.5b545a3ddce0719ae897ce530@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> On 7/21/2018 2:36 AM, posfan12 wrote:
> > "And" <49341109@ntnu.edu.tw> wrote:
> >> 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}
> >> }
> >> }
> >
> >
> > (This may be a double post. Not sure. Sorry!)
> >
> > The above function as the "a" and "b" parameters for the ellipsoid. How do I add
> > the "c" parameter for the third axis? I can see where it goes in "f_spheroid",
> > but I don't understand "f_spheroid_normalized". Thanks.
> >
> >
> > Mike
> >
>
> Never mind. I figured it out.
>
> Mike

Is it ok?


Post a reply to this message

From: Mike Horvath
Subject: Re: A method creat uniform thick shell
Date: 22 Jul 2018 10:43:49
Message: <5b549825$1@news.povray.org>
On 7/22/2018 6:19 AM, And wrote:
> Mike Horvath <mik### [at] gmailcom> wrote:
>>
>> Never mind. I figured it out.
>>
>> Mike
> 
> Is it ok?
> 

Yes, it works well!

The routine would be very helpful in this object collection:

http://lib.povray.org/searchcollection/index2.php?objectName=ShapeGrid&version=1.11&contributorTag=SharkD

Would it be okay if I added it there? The license for the collection is 
CC-LGPL.

Thanks!

Mike


Post a reply to this message

From: And
Subject: Re: A method creat uniform thick shell
Date: 23 Jul 2018 08:00:01
Message: <web.5b55c221dce0719ae897ce530@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> On 7/22/2018 6:19 AM, And wrote:
> > Mike Horvath <mik### [at] gmailcom> wrote:
> >>
> >> Never mind. I figured it out.
> >>
> >> Mike
> >
> > Is it ok?
> >
>
> Yes, it works well!
>
> The routine would be very helpful in this object collection:
>
>
http://lib.povray.org/searchcollection/index2.php?objectName=ShapeGrid&version=1.11&contributorTag=SharkD
>
> Would it be okay if I added it there? The license for the collection is
> CC-LGPL.
>
> Thanks!
>
> Mike

I saw your links and not very understand what is that object function. Can you
describe?


Post a reply to this message

From: Mike Horvath
Subject: Re: A method creat uniform thick shell
Date: 23 Jul 2018 19:16:42
Message: <5b5661da$1@news.povray.org>
On 7/23/2018 7:55 AM, And wrote:
> I saw your links and not very understand what is that object function. Can you
> describe?
> 

Normally, a person might create internal lines of latitude and longitude 
on a sphere by drawing one outer shape and then simply scaling it 
smaller as you go deeper inside the sphere. The macros I linked to 
ensure that the *lines* are always the same thickness, throughout the 
entire object.

An offset surface such as what is generated by your macro is ideal for 
this purpose, when it's not possible to use regular CSG objects to 
accomplish the same. (Isosurfaces are kind of slow.)


Mike


Post a reply to this message

From: And
Subject: Re: A method creat uniform thick shell
Date: 24 Jul 2018 08:25:00
Message: <web.5b571a06dce0719ae897ce530@news.povray.org>
Mike Horvath <mik### [at] gmailcom> wrote:
> On 7/23/2018 7:55 AM, And wrote:
> > I saw your links and not very understand what is that object function. Can you
> > describe?
> >
>
> Normally, a person might create internal lines of latitude and longitude
> on a sphere by drawing one outer shape and then simply scaling it
> smaller as you go deeper inside the sphere. The macros I linked to
> ensure that the *lines* are always the same thickness, throughout the
> entire object.
>
> An offset surface such as what is generated by your macro is ideal for
> this purpose, when it's not possible to use regular CSG objects to
> accomplish the same. (Isosurfaces are kind of slow.)
>
>
> Mike

Well, I permit you to release it on CC-LGPL. But my macro is still far from what
you want I think


Post a reply to this message

From: And
Subject: Re: A method creat uniform thick shell
Date: 24 Jul 2018 08:40:00
Message: <web.5b571d64dce0719ae897ce530@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
> I have written a macro which uses above technique to make an isosurface thin
> shell. I post it below. But I found that it is only for a small thickness or it
> don't have a constant thickness result. Furthermore, for many functions its
> result is not expect.
>
> So, don't take too much expect with it.
>
> //-------------------macro-----------------------------
>
> #macro Shape_ThinShellOf3DFunction(input_function, _min_extent, _max_extent,
> _thickness, _max_gradient)
> #local CSG_OVERLAP=0.001;
> #local h=0.00001;
> #local normalized_function =
> function(var1,var2,var3)
> {
> input_function(var1,var2,var3)
> /sqrt(
> pow((input_function(var1+h,var2,var3)-input_function(var1,var2,var3))/h,2)
> +pow((input_function(var1,var2+h,var3)-input_function(var1,var2,var3))/h,2)
> +pow((input_function(var1,var2,var3+h)-input_function(var1,var2,var3))/h,2)
> )
> }
> difference{
> isosurface{
> function{normalized_function(x,y,z)-_thickness/2}
> max_gradient _max_gradient
> contained_by{box{_min_extent,_max_extent}}
> all_intersections
> }
> isosurface{
> function{normalized_function(x,y,z)+_thickness/2}
> max_gradient _max_gradient
>
contained_by{box{_min_extent-<CSG_OVERLAP,CSG_OVERLAP,CSG_OVERLAP>,_max_extent+<CSG_OVERLAP,CSG_OVERLAP,CSG_OVERLAP>}
}
> all_intersections
> }
> }
> #end
>
>
>
>
>
> //---------------------Here is a good look example------
>
> #declare f_noise3d = function { internal(76) }
> #declare f_test=
> function(x,y,z){
> x*x+y*y+z*z-1- 0.5*f_noise3d(x/0.3,y/0.3,z/0.3)
> }
>
> difference{
> Shape_ThinShellOf3DFunction(f_test, <-1.3,-1.3,0>, <1.3,1.3,1.3>, 0.04, 10)
> box{<-1.5,-1.5,-0.1>,<1.5,0,1.5>}
> texture{
>     pigment{rgb<1,1,1>}
>     finish{
>         ambient 0.1
>         diffuse 0.6
>     }
> }
> }
>
> //----------------------------------------------------------


Use the macro. and input function below

#declare f_parabola=function(x,y,a){
y-a*x*x
}

#declare f_curve = function(x,y) {
pow(f_parabola(x,y,1), 2) + 0.2*y*y - 0.02
}

#declare f_circle = function(x,y) {
x*x + y*y - 0.5*0.5
}


#declare h = 0.5;


#declare f_test=
function(x,y,z){
(z/h)*f_curve(x,y) + (1-z/h)*f_circle(x,y) - 0.2*f_noise3d(x/0.2,y/0.2,z/0.2)
}


object{
Shape_ThinShellOf3DFunction(f_test, <-1.4,-1.3,0>, <1.4,1.4,0.5>, 0.024, 10)

texture{
    pigment{rgbt<0.014,0.011,0.007, 0.9>}
    finish{
        ambient 0.0
        diffuse 1.0

        reflection {0.01, 0.89 fresnel}conserve_energy
    }
}
interior{
    ior 1.46
    fade_colour rgb<0.6, 0.4, 0.3>
    fade_distance 2.6
    fade_power 1001
}
no_radiosity


}


Post a reply to this message


Attachments:
Download 'scene glass.png' (104 KB)

Preview of image 'scene glass.png'
scene glass.png


 

From: Paolo Gibellini
Subject: Re: A method creat uniform thick shell
Date: 25 Jul 2018 02:54:25
Message: <5b581ea1$1@news.povray.org>
And wrote on 24/07/2018 14:36:
> "And" <49341109@ntnu.edu.tw> wrote:
>> I have written a macro which uses above technique to make an isosurface thin
>> shell. I post it below. But I found that it is only for a small thickness or it
>> don't have a constant thickness result. Furthermore, for many functions its
>> result is not expect.
>>
>> So, don't take too much expect with it.
>>

Nice effect.
Now, I'm curious to see the jar filled of water.
;-)
Paolo


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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