POV-Ray : Newsgroups : povray.advanced-users : the twist : Re: the twist Server Time
4 Oct 2024 17:25:24 EDT (-0400)
  Re: the twist  
From: Samuel Benge
Date: 17 Sep 2007 00:21:58
Message: <46ee00e6@news.povray.org>
Okay, I think I may have arrived at a resolution to my little problem. I
swapped Point_At_Trans for Reorient_Trans inside the vtransform
statements. I thought they were essentially the same thing, but no,
Reorient_Trans produces a better result. It seems I can tweak the heck
out of my spline without getting the twists. Yay!

// the updated code (requires POV-Ray with subdivision)

#declare sp=spline{
  natural_spline
  -0.5,   <0,-1,2>,
  0.0,     <-1,-1,1.5>,
  0.25,   <-1,0,1>,
  0.5,    <0,.75,0>,
  0.75,   <1,0,-1>,
  1.0,     <1,-1,-1.5>,
  1.5,   <0,-1,-2>
}

#declare incre  = 1/10;
#declare rv     = 360/6;

mesh{
  #declare V=0;
  #while(V<1-incre)
   #declare R=0;

   #while(R<360)

    #declare p1=vrotate(<.5-V*.499,0,0>,y*(R-rv/2));
    #declare p2=vrotate(<.5-V*.499,0,0>,y*(R+rv/2));
    #declare p3=vrotate(<.5-(V+incre)*.499,0,0>,y*(R-rv/2));
    #declare p4=vrotate(<.5-(V+incre)*.499,0,0>,y*(R+rv/2));

    #declare pp1=( sp(V-incre/2) - sp(V+incre/2) );
    #declare pp2=( sp(V+incre/2) - sp(V+incre*1.5) );


    #declare p1=
     vtransform(p1,transform{ Reorient_Trans(y, pp1 )
      translate sp(V)}
     );
    #declare p2=
     vtransform(p2,transform{ Reorient_Trans(y, pp1 )
      translate sp(V)}
     );
    #declare p3=
     vtransform(p3,transform{ Reorient_Trans(y, pp2 )
      translate sp(V+incre)}
     );
    #declare p4=
     vtransform(p4,transform{ Reorient_Trans(y, pp2 )
      translate sp(V+incre)}
     );

    triangle{p1,p2,p3}
    triangle{p2,p3,p4}

    #declare R=R+rv;
   #end

   #declare V=V+incre;
  #end
  subdivision{substeps 3}
  pigment{rgb<0,.5,.25> }
  finish{specular 1 roughness .0125 reflection{0,1 falloff 3}}
}

// end code

Now I can cap the ends and adjust the thickness with another spline.
Should I release it when I'm finished? It wouldn't support smoothing 
unless you used POV-Sub...

Sam


Post a reply to this message

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