POV-Ray : Newsgroups : povray.general : Perpendicular to an arbitrary axis : Perpendicular to an arbitrary axis Server Time
2 Aug 2024 20:19:08 EDT (-0400)
  Perpendicular to an arbitrary axis  
From: Rick Measham
Date: 2 Aug 2004 18:05:00
Message: <web.410eba6fcd20604ecbae57f30@news.povray.org>
Thanks to those who helped last week when I needed to find a point on an
arbitrary axis between two points. The vnormalize has worked brilliantly.

Now I come to beg more wisdom from you.

Lets say there's two points: l_source and l_point_at. Last weeks question
gave me l_desitination which is a point on the axis between those two. I've
drawn a cylinder there with a matchine sphere at l_source.

I've hollowed the object and now need to punch some holes around the edge.
These holes have a focal point around the l_source and need to be angled
along the same axis as the cylinder. After learning about vnormalize I went
looking and found a couple of other v___ funtions. Hobbling them together I
got the following:

  union {
   // Put vent holes around the source
   #local x_point = vcross(l_source, l_point_at); // get a perpendicular
   #declare loop_index = 1;
   #while (loop_index <= hole_count)
    #local x_point = vaxis_rotate(x_point, vnormalize(l_source -
l_point_at), 360/hole_count);
    cylinder {
     <0,0,0>
     x_point
     snoot_radius / 20
     translate l_source
     pigment { Yellow }
    }
    #declare loop_index = loop_index + 1;
   #end
  }

Amazingly this works! Almost.

When l_point_at is <0,0,0> or some point along the path between l_source and
<0,0,0> I get a parse error:
Parse Error: Degenerate cylinder, base point = apex point.

I figure it's going to be as easy as extending something a little bit in
some direction somewhere. But where? Help me, O Learned Ones.

Cheers!
Rick


Post a reply to this message

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