import javax.media.j3d.*; import javax.vecmath.*; import java.util.*; // Vector /* note the change from Vector3f to Point3f (and similar change Function3f to Curve3f */ public class ParametricCurve3D extends Shape3D { Vector pointList; Vector timeList; float epsilon; float t0; float t1; Curve3f fun; float zmin; float zmax; public ParametricCurve3D( float tZero, float tOne, float e, Curve3f f ) { t0 = tZero; t1 = tOne; epsilon = e; fun = f; timeList = new Vector(64); timeList.addElement( new Float(t0) ); pointList = new Vector(64); Point3f p = fun.valueAt(t0); pointList.addElement( p ); zmin = p.z; zmax = p.z; buildVector ( t1 ); buildGeometry(); } public void buildVector ( float t1 ) { float t0 = ((Float)timeList.lastElement()).floatValue(); while ( Math.abs ( t1 - t0 ) >= epsilon ) { buildVector ( (t0 + t1)/2 ); t0 = ((Float)timeList.lastElement()).floatValue(); } Point3f p0 = (Point3f)pointList.lastElement(); t0 = ((Float)timeList.lastElement()).floatValue(); Point3f p1 = fun.valueAt(t1); while ( ! p1.epsilonEquals( p0, epsilon ) ) { buildVector ( (t0 + t1)/2 ); t0 = ((Float)timeList.lastElement()).floatValue(); p0 = (Point3f)pointList.lastElement(); } timeList.addElement(new Float(t1)); pointList.addElement(p1); zmin = (zmin>p1.z)? p1.z : zmin; zmax = (zmax