DIRECTORY G3dBasic, G3dMatrix, G3dSpline, IO, Rope; G3dCurve: CEDAR DEFINITIONS ~ BEGIN Error: SIGNAL [code: ATOM, reason: ROPE ฌ NIL]; -- able to resume this error Triple: TYPE ~ G3dBasic.Triple; RealSequence: TYPE ~ G3dBasic.RealSequence; Matrix: TYPE ~ G3dMatrix.Matrix; Spline: TYPE ~ G3dSpline.Spline; SplineSequence: TYPE ~ G3dSpline.SplineSequence; STREAM: TYPE ~ IO.STREAM; ROPE: TYPE ~ Rope.ROPE; Curve: TYPE ~ REF CurveRep; CurveRep: TYPE ~ RECORD [ length: CARDINAL ฌ 0, totalLength: REAL ฌ 0.0, element: SEQUENCE maxLength: CARDINAL OF Section ]; Section: TYPE ~ RECORD [ spline: Spline ฌ NIL, -- cubic coefficients of this section accumLength: REAL ฌ 0.0, -- total length of curve up to this section length: REAL ฌ 0.0, -- approximate length of this section fragments: Fragments ฌ NIL -- res number of pieces of this section ]; Fragment: TYPE ~ RECORD [ t0: REAL ฌ 0.0, -- parametric start of this fragment t1: REAL ฌ 0.0, -- parametric end of this fragment dt: REAL ฌ 0.0, -- parametric difference length: REAL ฌ 0.0, -- approximate length of this fragment accumLength: REAL ฌ 0.0]; -- total length of curve up to this fragment Fragments: TYPE ~ REF FragmentsRep; FragmentsRep: TYPE ~ RECORD [s: SEQUENCE length: CARDINAL OF Fragment]; Spot: TYPE ~ RECORD [ spline: Spline ฌ NIL, -- a cubic spline section t: REAL ฌ 0.0 -- parametric position within spline ]; CurveSequence: TYPE ~ REF CurveSequenceRep; CurveSequenceRep: TYPE ~ RECORD [ length: CARDINAL ฌ 0, element: SEQUENCE maxLength: CARDINAL OF Curve ]; CurveFromSplines: PROC [splines: SplineSequence, res: NAT ฌ 100] RETURNS [Curve]; Transform: PROC [curve: Curve, matrix: Matrix]; SpotFromT: PROC [c: Curve, t: REAL] RETURNS [Spot]; SpotFromArcLength: PROC [c: Curve, arcLength: REAL] RETURNS [Spot]; ArcLengthFromT: PROC [c: Curve, t: REAL] RETURNS [REAL]; ArcLengthFromTs: PROC [c: Curve, t0, t1: REAL] RETURNS [REAL]; PositionT: PROC [c: Curve, t: REAL] RETURNS [Triple]; VelocityT: PROC [c: Curve, t: REAL] RETURNS [Triple]; AccelerationT: PROC [c: Curve, t: REAL] RETURNS [Triple]; CurvatureT: PROC [c: Curve, t: REAL] RETURNS [Triple]; CurvatureMagT: PROC [c: Curve, t: REAL] RETURNS [REAL]; PositionA: PROC [c: Curve, arcLength: REAL] RETURNS [Triple]; VelocityA: PROC [c: Curve, arcLength: REAL] RETURNS [Triple]; AccelerationA: PROC [c: Curve, arcLength: REAL] RETURNS [Triple]; CurvatureA: PROC [c: Curve, arcLength: REAL] RETURNS [Triple]; CurvatureMagA: PROC [c: Curve, arcLength: REAL] RETURNS [REAL]; Write: PROC [out: STREAM, c: Curve, name: ROPE ฌ NIL]; Read: PROC [in: STREAM] RETURNS [Curve]; CopyCurveSequence: PUBLIC PROC [curves: CurveSequence] RETURNS [CurveSequence]; AddToCurveSequence: PUBLIC PROC [curves: CurveSequence, curve: Curve] RETURNS [CurveSequence]; LengthenCurveSequence: PUBLIC PROC [curves: CurveSequence, amount: REAL ฌ 1.3] RETURNS [new: CurveSequence]; END. n G3dCurve.mesa Copyright ำ 1985, 1992 by Xerox Corporation. All rights reserved. Bloomenthal, October 21, 1992 4:59 pm PDT Notes A curve is a sequence of three-dimensional cubic splines such that the last point of one spline is the first point of the next spline. A curve returned by G3dSpline.Interpolate or InterpolateCyclic will feature C2 continuity at each of the spline endpoints. This interface features procedures for the evaluation of a curve given an arc-length or parametric value along the curve. Each curve segment is presumed to be defined parametrically on [0..1]. Errors Imported Types Curve Definitions Creation Allocate the curve and compute the lengths needed for subsequent arc-length evaluation. The number of lengths is determined by res. Tranformation Transform the spline segments by matrix. Conversion Between Parametric and Arc-length Values Return the section and parametric position at t of the curve. Return the section and parametric position at arcLength along the curve. Return the (approximate) arcLength along the curve from 0 to t. Return the (approximate) arcLength along the curve from t0 to t1. Evaluation Given Parameter t These procedures are comparable to those in G3dSpline, except that t IN [0..1] corresponds to the first spline segment of the curve, t IN [1..2] corresponds to the second spline segment in the curve, etc. t not IN [0..curve.length] raises ERROR[$BadT]. Return the point of the curve at position t. Return the unnormalized tangent of the curve at position t. Return the unnormalized acceleration of the curve at position t. Return the unnormalized curvature vector of the curve at position t. Return the magnitude of the curvature vector at position t. Evaluation Given Arc Length These procedures are comparable to those in G3dSpline, except that arc length specifies location on the curve. Since no analytic measure for arc-length exists (except for the uncommon arc-length parameterized curve), the results of these procedures are necessarily approximate, and depend upon the res argument given to CurveFromSplines. arcLength not IN [0..curve.length] raises ERROR[$BadArcLength]. Return the point of the curve at arc-length. Return the unnormalized tangent of the curve at arc-length. Return the unnormalized acceleration of the curve at arc-length. Return the unnormalized curvature vector of the curve at arc-length. Return the magnitude of the curvature vector at arc-length. IO Write the header "Curve: splines:" to the output stream, followed by each spline in c. If name # NIL then insert it in the header after "Curve" Read the curve from the input stream. The input stream should be positioned at the beginning of the curve header. Can raise Error[$BadInputFormat]. Sequences Return a copy of the input sequence of curves. Add curve to the sequence. Return a copy of the input sequence whose maxLength is amount*input.maxLength. สฃ•NewlineDelimiter –"cedarcode" style™™ Jšœ ฯeœ6™BJ™)J˜Jšฯk œ*˜3J˜—šะblœžœž ˜J˜—Jšœž˜headšฯl™Jšœล™ล—š ™Jš ฯnœžœžœ žœžœฯc˜P—š ™Jšœ žœ˜"Jšœžœ˜,Jšœ žœ˜#Jšœ žœ˜#Jšœžœ˜1Jšžœžœžœžœ˜Jšžœžœžœ˜—š ™Jšœ žœžœ ˜šœ žœžœ˜Jšœ žœ˜Jšœžœ˜Jšœžœ žœžœ˜5J˜J˜—šœ žœžœ˜Jšœžœข%˜AJšœžœ ข+˜IJšœ žœ ข%˜@Jšœžœข'˜FJ˜J˜—šœ žœžœ˜Jšœ žœ ข$˜=Jšœ žœ ข"˜;Jšœ žœ ข˜1Jšœ žœ ข&˜AJšœžœ ข,˜KJ˜—Jšœ žœžœ˜%š œ žœžœžœ žœžœ ˜HJ˜—šœ žœžœ˜Jšœžœข˜5Jšœ žœข'˜;Jšœ˜J˜—Jšœžœžœ˜-šœžœžœ˜"Jšœžœ˜Jšœžœ žœžœ˜4J˜——š ™šกœžœ žœžœ ˜QJ™WJ™+——š  ™ šก œžœ ˜/J™(——š 3™3šก œžœžœžœ˜3J™=J™—šกœžœžœžœ˜CJ™HJ™—š กœžœžœžœžœ˜8J™?J˜—š กœžœžœžœžœ˜>J™A——š ™JšœEฯsœ@ฃœC™ฬJšœฃœฃœ™/J™šก œžœžœžœ ˜5J™,J˜—šก œžœžœžœ ˜5J™;J˜—šก œžœžœžœ ˜9J™@J˜—šก œžœžœžœ ˜6J™DJ™—š ก œžœžœžœžœ˜7J™;——š ™Jšœา™าJšœฃœฃœ™?J™šก œžœžœžœ ˜=J™,J˜—šก œžœžœžœ ˜=J™;J˜—šก œžœžœžœ ˜AJ™@J˜—šก œžœžœžœ ˜>J™DJ™—š ก œžœžœžœžœ˜?J™;——š ™š กœžœžœžœžœ˜6J™ZJšœ ฃœ+™8J™—šกœžœžœžœ˜(J™%J™KJ™!——š  ™ šกœžœžœžœ˜OJ™.—J™šกœžœžœ&˜EJšžœ˜J™J™—šกœžœžœ!žœ˜NJšžœ˜J™N——J™Jšžœ˜J˜—…— ฺ๋