POV-Ray : Newsgroups : povray.programming : math and trig question : Re: math and trig question Server Time
28 Jul 2024 16:19:48 EDT (-0400)
  Re: math and trig question  
From: Fabian BRAU
Date: 29 Mar 2000 02:30:16
Message: <38E1B101.2D0E5474@umh.ac.be>
Your plugin is interesting! Send me more information, I will have
a look to this :).

Fabian.


> 
> I have a question for a problem relating to 3D rotations.
> I'm working on a bspline plug-in dll for Moray.  Its very close to being
> ready for release once I get this small problem fixed.
> 
> So here it is:
> 
> I'm creating a tube like object for the spline by using a series of 'discs'
> along the path of the spline and orientating its surface or normal to point
> to the next joint or point along the spline.  Using the following math and
> trig functions that Sean Worle provided:
> 
>   rz = atan2(dx, dy);
>   rx = atan2(sqrt(dx*dx + dy*dy), dz);
> 
> atan2 = arctangent of y/x (in radians)
> 
> where dx, dy, dz are the differences between the current point and the next
> point in the spline.
> rz and rx are the amount to rotate the disc in the z and x axis.  The disc
> is created in the X-Y plane.
> 
> The problem is when I create a b-spline object along the Z axis, which looks
> like a straigt cylinder (or tube) - it is fine.  But if one of the points
> moves in the x direction, then the disc is rotated by 90 degrees along the Z
> axis which is not good.  But it does this because when using atan2 and the
> dx goes negative it returns -90.
> 
> I certainly would appreciate any help.  I can provide pictures if needed.
> 
> --
> Mike
> 
> wk: mik### [at] pyxiscom  www.pyxis.com
> hm: mwe### [at] sciticom  www.geocities.com/mikepweber


Post a reply to this message

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