POV-Ray : Newsgroups : povray.newusers : traditional math : Re: traditional math Server Time
29 Jul 2024 06:20:44 EDT (-0400)
  Re: traditional math  
From: Leroy
Date: 9 Jun 2006 23:48:34
Message: <448A40BE.9070700@joplin.com>
Here is a macro to make a mesh cone I use it as part of making trees.
It's a good example of the math you need.
I use a macro made by Paul T Dawson and modified some.
I hope this helps...

// From meshcone.inc
//
// Macro for one "cone" made from triangles.
//
// By: Paul T. Dawson
// edited for Winter 3/30/02 by Leroy

#macro MeshCone ( StartPoint, Endpoint, Rd1, Rd2)
// If INCREMENT is lower, there will be more triangles!

         #local INCREMENT = 30;// <=120 in degrees
         #local VL = StartPoint- Endpoint;
         #local VP = VPerp_To_Vector(VL);

// Go around the edges of the cone, do one section at a time.

         #local A = 0; #while ( A < 360 )

             //Starting locations
          #local Corner1 = vaxis_rotate(VL+VP*Rd1,VL,A+INCREMENT)+Endpoint;
          #local Corner2 = 
vaxis_rotate(VL+VP*Rd2,VL,A+INCREMENT)+Endpoint-VL;
          #local Corner3 = vaxis_rotate(VL+VP*Rd2,VL,A)+Endpoint-VL;
          #local Corner4 = vaxis_rotate(VL+VP*Rd1,VL,A)+Endpoint;

             // Make the triangles.
          triangle { Corner1 Corner2 Corner3 }
          triangle { Corner1 Corner3 Corner4 }

          #declare COUNT_TRIANGLES = COUNT_TRIANGLES + 2;
  #local A = A + INCREMENT; #end

#end


Post a reply to this message

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