POV-Ray : Newsgroups : povray.general : Smooth isofurface twist Server Time
1 Nov 2024 19:14:26 EDT (-0400)
  Smooth isofurface twist (Message 1 to 4 of 4)  
From: StephenS
Subject: Smooth isofurface twist
Date: 6 Feb 2011 19:55:00
Message: <web.4d4f41ade75cfce7f01c2f680@news.povray.org>
From a scene file saved in 2005, I have a piece of code containing an isosurface
with a smooth twist. I would like to extend this from 1/4 turn into many turns.
Ultimatly it would be part of an ornate fence.

// +w320 +h240
background { color rgb <1.000,1.000,1.000> }

#declare Default_Red =
texture {
 pigment {
  color rgbft <1.000,0.000,0.000,0.000,0.000>
 }

}

#default{ texture{ Default_Red } }

#declare Gray_80_ =
texture {
 pigment {
  color rgbft <0.800,0.800,0.800,0.000,0.000>
 }

}

#declare Camera =
camera {
 perspective
 location <-3.377,5.850,-12.283>
 up y
 right 1.333*x
 angle 15.096
 sky <0.136,0.904,0.407>
 look_at < 0.623, -0.150, -0.283 >
}  // end Camera

#local fn_A=function(x){abs(x)-.5};
#local fn_B=function{abs(z)-3/16/2};
#local fn_C=function{abs(y)-.5};
#local N=.25;
#local fn_Smooth=function(x){x*x*x*(10+x*(6*x-15))};
#local fn_twistY=function{z*sin(fn_Smooth(x)*2*pi*N) +
y*cos(fn_Smooth(x)*2*pi*N)};
#local fn_twistZ=function{z*cos(fn_Smooth(x)*2*pi*N) -
y*sin(fn_Smooth(x)*2*pi*N)};
#local
fn_twist_Box=function{max(fn_A(x-.5),fn_B(x,fn_twistY(x,y,z),fn_twistZ(x,y,z)),fn_C(x,fn_twistY(x,y,z),fn_twistZ(x,y,z)
))};
isosurface {
   function {
      fn_twist_Box(x-.5,y,z)
   }
   contained_by {box{<.5,-.5,-.5>,<1.5,.5,.5>}}
   threshold 0
   accuracy 0.001
   max_gradient 1.58
   max_trace 9

scale <1,1,1>
rotate <0,0,0>
translate <0,0,0>
}


light_source {  // Light_Source
 < 0.000000, 0.000000, 0.000000 >, color rgb <1.000,1.000,1.000>
 fade_power 0.000
 fade_distance 100.000
 media_attenuation off
 media_interaction on
 translate <3.000000,10.000000,-12.500000>
}  // end Light_Source

union {  // CSG0
 box {  // Box0
  < -1.2500000, -0.5000000, -0.0937500 >, < 1.2500000, 0.5000000, 0.0937500 >
  translate <-0.750000,0.000000,0.000000>
 }  // end Box0

 box {  // Box1
  < -1.0000000, -0.0937500, -0.5000000 >, < 1.0000000, 0.0937500, 0.5000000 >
  translate <2.500000,0.000000,0.000000>
 }  // end Box1

 texture{ Gray_80_ }
}  // end CSG0


camera{ Camera }
// end code


I can change the cross section to:
#local fn_B=function{abs(z)-.25};
#local fn_C=function{abs(y)-.25};
to get my 1/2" wrought iron bar, but i'm stumped at getting multiple turns over
a desired length.
Help would be appreciated.

Stephen S


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Smooth isofurface twist
Date: 7 Feb 2011 15:47:41
Message: <4d505a6d@news.povray.org>
StephenS wrote:

> I would like to extend this from 1/4 turn into many turns.

Hint: N = 0.25 ;)

You also need to increase max_gradient when making sharper turns.


Post a reply to this message

From: StephenS
Subject: Re: Smooth isofurface twist
Date: 7 Feb 2011 17:00:01
Message: <web.4d506a5a824d792b94cabfe30@news.povray.org>
Christian Froeschlin <chr### [at] chrfrde> wrote:
> StephenS wrote:
>
> > I would like to extend this from 1/4 turn into many turns.
>
> Hint: N = 0.25 ;)
>
> You also need to increase max_gradient when making sharper turns.

I think "N" means, 1/4 turn over one unit length(pitch?).
If I simply extend the bounding box, the rotations don't continue.
Oh wait... more turns then scale (stretch) seems to work.

Thanks for the nudge.
(and of course the title should be 'isosurface', no wonder I can't find my older
posts)

Stephen S


Post a reply to this message

From: StephenS
Subject: Re: Smooth isofurface twist
Date: 7 Feb 2011 22:50:00
Message: <web.4d50bc41824d792b4d5ec6a70@news.povray.org>
....
> Oh wait... more turns then scale (stretch) seems to work.
....
Image with the updated isosurface in p.b.i

#local fn_A=function(x){abs(x)-1};
#local fn_B=function{abs(z)-.25};
#local fn_C=function{abs(y)-.25};
#local N=1.;
#local fn_Smooth=function(x){x*x*x*(10+x*(6*x-15))};
#local fn_twistY=function{z*sin(fn_Smooth(x)*2*pi*N) +
y*cos(fn_Smooth(x)*2*pi*N)};
#local fn_twistZ=function{z*cos(fn_Smooth(x)*2*pi*N) -
y*sin(fn_Smooth(x)*2*pi*N)};
#local
fn_twist_Box=function{max(fn_A(x-1),fn_B(x,fn_twistY(x,y,z),fn_twistZ(x,y,z)),fn_C(x,fn_twistY(x,y,z),fn_twistZ(x,y,z))
)};
isosurface {
   function {
      fn_twist_Box(x-.5,y,z)
   }
   contained_by {box{<.5,-.5,-.5>,<1.5,.5,.5>}}
   threshold 0
   accuracy 0.001
   max_gradient 10.58
   max_trace 9

translate <-.5,0,0>
scale <10,1,1>
rotate <0,0,0>
}


Post a reply to this message

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