POV-Ray : Newsgroups : povray.advanced-users : Tricky object alignment problem : A solution Server Time
28 Jul 2024 10:27:50 EDT (-0400)
  A solution  
From: Orchid XP v2
Date: 27 May 2006 11:43:03
Message: <44787387$1@news.povray.org>
This seems to work...

#macro DrawPoly(Points, Radius)
   #local A = Points[0];
   #local B = Points[1];
   #local C = Points[2];

   #local AB = B - A;
   #local AC = C - A;
   #local Norm = vnormalize(vcross(AB, AC));

   #local V1 = Norm;
   #local V2 = vnormalize(AB);
   #local V3 = vcross(V1, V2);

   prism
   {
     linear_sweep
     linear_spline
     -Radius, +Radius, dimension_size(Points, 1),

     #local lp = 0;
     #while (lp < dimension_size(Points, 1))
       <vdot(V3, Points[lp]), vdot(V2, Points[lp])>

       #local lp = lp + 1;
     #end

     translate +y*vdot(A, Norm)
     Reorient_Trans(y, Norm)
   }
#end

In case it way be of use to anybod else...


Post a reply to this message

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