POV-Ray : Newsgroups : povray.binaries.utilities : Q: Cylinder calculus? : Re: Q: Cylinder calculus? Server Time
6 Oct 2024 13:08:39 EDT (-0400)
  Re: Q: Cylinder calculus?  
From: Roland Mas
Date: 19 Oct 1998 08:27:40
Message: <m3btn8iydb.fsf@rpc66.acr.atr.co.jp>
Vidar Madsen <vid### [at] prosalgno> writes:

> - I have two end-points point1=<0,0,0> and point2=<x,y,z>
> - I create four vertices around each end-point. For the first, this
>   would be:
>   <-thickness,0,0>,<+thickness,0,0>,<0,0,-thickness>,<0,0,+thickness>
> - Now I need to rotate these four, so that they are planar (?) to the
>   second end-point. This is where my math skills fail me miserably..

Well.  I guess all you need is that your four vectors (say, two of them and
their opposites) are orthogonal to the N=<x,y,z> vector.  In that case, I
suggest using vector cross-products.

  Take a vector V, any vector V at all.  Just make it non-colinear with
<x,y,z>.  Take its vcross with N, you'll get a vector V1.  This one is
orthogonal to N.  You can then use it, after vnormalize-ing it and
multiplying it by thickness and -thickness, as two of your, er, vertices.
Then, take its vcross with N again.  You'll get V2, orthogonal to N *and*
to V1.  Same as above: vnormalize it, multiply it by thickness and


> It's pretty basic math, but I never got that far in my studies. ;-)

  Don't worry...  You'll regret the good ol'times when you'll have to cope
with cross-products.  Then you'll regret not to have listened to your
teachers when it was still time for it :-)

Roland.
-- 
Les francophones m'appellent Roland Mas,
English speakers call me Rowlannd' Mass,
Nihongode hanasu hitoha [Lolando Masu] to iimasu.
Choisissez ! Take your pick ! Erande kudasai !


Post a reply to this message

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