There was discussion about it before http://www.pascalgamedevelopment.com...hlight=catmull
and here: http://www.pascalgamedevelopment.com...ll=1#post45456
Current implementation for Catmull-rom curve in nxPascal:
https://code.google.com/p/nxpascal/s.../nxMath.pas#87
3D curve in nxMath3D.pas is not so different either:
Code:
function Catmull(const a,b,c,d: TVector; const delta: single): TVector;
begin
result.x:=nxMath.Catmull(a.x, b.x, c.x, d.x, delta);
result.y:=nxMath.Catmull(a.y, b.y, c.y, d.y, delta);
result.z:=nxMath.Catmull(a.z, b.z, c.z, d.z, delta);
end;
The advantage of this kind of curve is, that you don't need any separate keypoints. The nodes on the "road path" are all the key points you need, and the curve will go through them all.
Bookmarks