|
![](/i/fill.gif) |
Peter Popov wrote:
>
> I am following myself here, as it seems I didn't state the problem
> clearly enough. What I need is a #macro that works like the "Reorient"
> #macro on #Macroscope, but is used with a vector. Why?
>
> Suppose you have a point A rotating around the origin in the xz
> plane.Move the poiont up at the same time and you get a helix. What I
> want to do is a helix whose axis is defined by a function (a #macro,
> actually), so that it can be coiled aroind a circle, sine wave, or
> whatever else. How?
Well, to reorient a point (or a vector), it would go like this:
#macro vreorient(org_vec,start_vec,end_vec)
// org_vec is the point you want to perform the operation on
// start_vec is the original forward vector
// end_vec is the finishing forward vector
#local v_S=vnormalize(start_vec);
#local v_E=vnormalize(end_vec);
#local v_A=vcross(v_S,v_E);
#if (vlength(v_A)=0)
(org_vec)
#else
v_PS=vnormalize(vcross(v_A,v_S));
v_PE=vnormalize(vcross(v_A,v_E));
(vdot(org_vec,v_A)*v_A+vdot(org_vec,v_S)*v_E+vdot(org_vec,v_PS)*v_PE)
#end
Hope this helps,
John
Post a reply to this message
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
On Tue, 02 Feb 1999 18:48:11 -0500, John VanSickle
<van### [at] erols com> wrote:
>Well, to reorient a point (or a vector), it would go like this:
>
<code>
>Hope this helps,
>John
Thanks, I'll try it.
Peter
Post a reply to this message
|
![](/i/fill.gif) |