[ODE] An embarassingly basic geometry question

Shamyl Zakariya zakariya at earthlink.net
Wed Jun 11 14:44:01 2003


Embarrassingly, I figured it out about 30 seconds after writing for an 
explanation of how to use it.

So it goes.

On Wednesday, June 11, 2003, at 05:41  PM, Martin C. Martin wrote:

>
>
> Shamyl Zakariya wrote:
>>
>> OK, I looked up the prototype from rotation.h, but since it's not in
>> the ode docs, I never know about it... Anyway, the prototype is
>> deceptively simple:
>>         void dRFromZAxis (dMatrix3 R, dReal ax, dReal ay, dReal az);
>>
>> What is it looking for? what do ax, ay, & az represent? is that a
>> vector?
>
> Yes.  The ODE convention is that, when a vector is an input to a 
> function,
> the function takes 3 reals.  This lets you write
>
> dMatrix3 R;
> dVector3 a, b;
>
> // fill a & b
>
> dRFromZAxis(R, a[0] - b[0], a[1] - b[1], a[2] - b[2]);
>
> if dRealFromZAxis() took a dVector3 instead, you'd need to declare a 
> third
> vector, then fill each of its fields from a & b.  That's a lot more
> verbose, and therefore harder to understand, more error prone, etc.
>
>> Is it returning the angle between the z axis and a line from
>> the origin (0,0,0) to (ax,ay,az) ?
>
> No, it's returning a rotation matrix.  You can pass that rotation 
> matrix
> straight to dsDrawCylinder() (or dGeomSetRotation() or
> dBodySetRotation().)  From drawstuff.h, I see that cylinders are 
> already
> aligned along the z axis, so you're all set.
>
>>
>> On Wednesday, June 11, 2003, at 04:56  PM, Martin C. Martin wrote:
>>
>>> Why not just use dRFromZAxis()?  For the z axis, use b - a.  Then, 
>>> make
>>> sure the axis of the cylinder is the z axis, and you're all set.
>>>
>>> rotation.h is your friend...
>>>
>>> - Martin
>>> _______________________________________________
>>> ODE mailing list
>>> ODE@q12.org
>>> http://q12.org/mailman/listinfo/ode
>>>
>>>
>> Shamyl Zakariya
>>    "this is, after all, one of those movies where people spend a great
>>    deal of time looking at things and pointing."
>>         From a review of _Fantastic Voyage_
>
>
Shamyl Zakariya
   "this is, after all, one of those movies where people spend a great
   deal of time looking at things and pointing."
	From a review of _Fantastic Voyage_