Advertisement

Curvature

Started by January 28, 2003 01:46 PM
6 comments, last by Bucko 22 years ago
I have a curve that I can sample which will give me a 4x4 matrix of its rotation and pos. Does anybody know of a simple method of tesselating the curve into segments of more or less equal curvature? Or...if I have two 4x4 matrices mat0 and mat1 and I want to calculate the rotation between mat0 and mat1 ALONG the translational vector between them. Any help wouyld be gratly appreciated. / Bucko aka Backman
/ Bucko aka Backman
I believe you''re looking to tesselate the curve into segments that have more or less the same length , not curvature. The latter is not really possible unless the curve has constant curvature, e.g., it is a perfect circle (constant finite curvature) or a perfectly straight line (constant infinite curvature).

Therefore, you are looking for what is called an "arc-length" parameterization of the curve. And I have a great link for you:

www.magic-software.com/Documentation/MovingAtConstantSpeed.pdf

As for the second question, one approach is to represent both orientations as quaternions, and do a slerp between the two quaternions as you move along the translation vector between the two endpoints. Again, I''ll point you to something on Dave Eberly''s magic site.

www.magic-software.com/Documentation/KeyframeAnimation.pdf

Lots more good articles there for the taking.

Hope that helps!

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Advertisement
Well, I''ll try to make myself clearer:
Let''s say we want to aproximate a spline with several straight but we want to use as few segments as possible ie few long ones on straights and many smaller where the spline bends.
Aside from having a curve shape, the curve also rotates along itself (typical camera spline) and if we were to draw the curve with as few 3d primitives (triangular prisms for example) as possible to appear both smoothly curving and smoothly twisting along its axis.
Curvature can be measured by aproximating with small line segments and measuring the errors compared to the spline. The twisting along the curve axis is tricker and is what I need information on. Any help or links would be appreciated.

Thanks for the links BTW, I have Eberly''s Engine book but hadn''t checked his site for other stuff until now.

/ Bucko aka Backman
/ Bucko aka Backman
IF by ''twisting'' you mean orientation or rotation in 3D space the simplest (or at least easiest to work with) mathematical model is quaternions.

Quaternions can be treated as unit vectors in 4D space, mapping out a unit hypersphere in this space, and this is a natural space to work with them in. It should be possible to look at the curvature in 4D of the path traced out by the quaternion describing the orientation, disregarding any curvature due to them lying on a hypersphere. Then proceed as in 3D.
John BlackburneProgrammer, The Pitbull Syndicate
OK,

That clears up your question a bit. I''d still point you to Eberly''s documents. I believe one of them discusses rotation splines, which may help.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
By twisting I mean rotating along the direction of travel.
Let''s say the spline represents a aeroplanes flight. The spline describes the path taken and the amtrixes/quats represents the planes roll,pitch and yaw. I need to find how much the plane rolls while moving along the path.



/ Bucko aka Backman
/ Bucko aka Backman
Advertisement
quote:
Original post by Bucko
By twisting I mean rotating along the direction of travel.
Let''s say the spline represents a aeroplanes flight. The spline describes the path taken and the amtrixes/quats represents the planes roll,pitch and yaw. I need to find how much the plane rolls while moving along the path.


Right, I got that. I thought I remembered seeing something in Eberly''s documentation that discussed that idea. Perhaps not. The rotation about the direction of travel is often called the "bank" angle.

Are you actually representing the flight of an airplane? Or was that to illustrate your question. Reason I ask is that the approach to finding the bank angle would be different for following an airplane, compared to just a bank angle computed as a function of the curve. For example, if you really have an airplane, the bank angle would be a function of the physics of the airplane, not the geometry of the curve.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
It''s not for an aeroplane, I need it to easily create a monorail system. The level designers create the part by placing points for the spline and rotate the keys as they want the rail to turn. I am given a model that I can extrude along the spline. As the model is straight I have to add together longer or shorter copies of it to fake curvature.
The problem is that as the cross section of the model isn''t circular I also need to add segments when the spline banks.
Lets say we have a straight section that turns 90 degrees along its length and we allow max 5 degrees mismatch between segments. I would then need 18 segments. If I didn''t have to allow for the banking I could do with 1 segment as the segment was straight.


/ Bucko aka Backman
/ Bucko aka Backman

This topic is closed to new replies.

Advertisement