POV-Ray : Newsgroups : povray.advanced-users : Boneheaded 3D trig question : Boneheaded 3D trig question Server Time
29 Jul 2024 22:26:41 EDT (-0400)
  Boneheaded 3D trig question  
From: Rick Gutleber
Date: 12 Sep 2000 12:25:18
Message: <39be58ee@news.povray.org>
I've got a simple question that's bugged me for years.  The answer's got to
be simple, but I just can't figure it out.

I'm writing a C++ program to programmatically generate a Christmas tree and
I'm trying to put needles on the branches.  I have the start and end point
of the branch so I figured I would create the needles as if the branch
started at the origin and pointed straight up and then just translate and
rotate the union of the resulting needles so they actually appear on the
branch in the scene.  This translatation/rotation can occur in my C++ code
or the generated POV script, whichever is easier.

I've got an arbitary unit vector that reflects the orientation of the branch
(from VNormalize( ) in POV, or the good old Pythagorean distance function in
my C++ code), how do I turn that into an equivalent rotate < x, y, z >
statement so the needles end up on the branch?  I'm sure it's just the right
combination of atan( ) calls, but the details elude my addled brain.

Thanks for the help!

Rick
ric### [at] hiscom


Post a reply to this message

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