curd

curd defines a 3D curve by number: a polyline, a cubic spline through control points, a circular arc through three points, or a side of a surface.

Syntax

curd number lp3 x y z [ x y z ... ] ; [ operator ... ; ]
curd number csp3 option [ end_value ... ] x y z [ x y z ... ] ; [ operator ... ; ]
curd number arc3 option point point point [ operator ... ; ]
curd number sdedge surface.side [ operator ... ; ]
  • number: the curve’s number, a whole number of 1 or more. cur, curf, cure and curs refer to the curve by it.
  • lp3: a polyline through the points, in order.
  • csp3: a cubic spline through the points.
  • arc3: a circular arc, or a whole circle, through three points.
  • sdedge: a side of a surface. se is another spelling.
  • x y z: the coordinates of a control point. A curve of lp3 or csp3 needs at least two, and the count of numbers must be a multiple of three.
  • point: a point in a coordinate system, rt x y z, cy rho theta z or sp rho theta phi, the angles in degrees.
  • surface.side: one word, the number of a surface that sd defined, a dot and a side number from 1 to 4, as in 1.3.
  • operator: an optional transformation, the operators of tr, ended by ;. James applies it to the control points, to the three points of arc3 or to the curve of a side.

A curd holds one type group, lp3, csp3, arc3 or sdedge. Extra ; after the point list are ignored.

csp3 takes an option first. It is the word loop, which closes the spline into a smooth loop and takes no end value, or two digits. The first digit says how the first point is held and the second digit how the last is held:

Digit Condition at that end Values that follow the option
0 natural: second derivative zero none
1 a derivative vector three reals dx dy dz
2 matches the first end of another curve a curve number and a magnitude
3 matches the last end of another curve a curve number and a magnitude

The values of the first digit come before those of the second. A match takes the other curve’s unit tangent at the named end and scales it by the magnitude.

arc3 takes an option first, one of three words:

Option The curve
seqnc The arc from the first point through the second to the third.
cmplt The rest of the circle: the arc from the first point to the third that does not pass through the second.
whole The whole circle, starting at the first point and passing the second and the third before it returns. It is a loop.

What it does

curd adds one curve to the table of 3D curves. A curve is geometry for the attach commands to use and moves nothing by itself; the surfaces rule3d, crule3d, pipe, blend3, blend4 and r3dc are built from curves as well. lp3 is exact geometry: straight segments. csp3 solves a cubic spline whose parameter runs by unit steps between control points, and every end condition is honoured. arc3 is exact too: James holds the circle’s centre, radius and plane, and works out lengths, tangents and nearest points from them. sdedge is the side of the surface as the geometry chapter numbers it, taken in the direction its parameter increases; a straight side becomes a polyline, a circle or an arc an arc3, and a side that is a copy of one of the surface’s own curves that curve, and any other side a cubic spline through 257 points of it, with the side’s own tangents at its ends. A transformation list that scales one axis turns a circle side into a cubic spline through 257 points of its ellipse.

When James applies it

When it is read, in any phase. curd is a definition, not a step of the hierarchy. A curve that csp3 matches must be defined before the curve that matches it, and the surface of an sdedge before the curd. James builds the side when the geometry is built, before any part is meshed.

Rules James adds

  • One type group per curd. A second group on the same command is refused with E0608, a recognised type that James does not support with E0603, and an unknown word with E0104.
  • A transformation word that follows the point list on the same line as the last ; is read as part of the curd. A line that starts with ; continues the curd, so a transformation word after that ; belongs to it too. Case 153-curd-stray-semicolon-trans shows both: its curve 3 ends one line with ; and starts the next with ; mx 1;, and the IR gives curve 3 the transformation row.
  • A word that starts a new line is read as the next command, whatever it is. A transformation word such as mx there is not a command, and James reports it as not recognized (E0105).
  • A loop needs at least three points.
  • A curve number below 1 is refused.
  • The three points of arc3 may not lie on a line or coincide, and the option is seqnc, cmplt or whole (E0609). A point begins with rt, cy or sp (E1012).
  • An sdedge needs a surface defined earlier and a side from 1 to 4 (E0604). A side that the surface’s kind lacks is an error that the engine reports when it builds the curve, with exit code 2: any side of a plane, a cylinder, a sphere or another surface without sides, or a side beyond the surface’s last, as side 3 of a pipe. A side of no length, such as the rim of a revolution at an end that lies on the axis, is an error too. The messages are listed in the diagnostics reference.
  • A transformation list after the three points of an arc3 must be a similarity: it may rotate, reflect, translate and scale by one factor, and nothing else. A list that is not one stops the run with exit code 2 when James builds the geometry: 3D curve #0 has a transformation that is not a similarity; xsca scales one axis (ysca or zsca in place of xsca; a list that collapses the curve with no scale of one axis in it ends the line after similarity). The list of an sdedge is not held to this rule: a list that scales the circle’s plane unequally turns a circle side into a cubic spline through 257 points of its ellipse.
  • A transformation that collapses an sdedge curve to a point is refused as a curve of no length: 3D curve #0: the curve has zero length.
  • rmseg, which TrueGrid uses to remove the last segment of a curve of several segments, is a command and not a type, and James refuses it (E0100).

Diagnostics

  • E0601: a curve that csp3 matches is not defined.
  • E0602: fewer than two points.
  • E0603: a recognised curve type other than lp3, csp3, arc3 or sdedge. An unknown word is E0104.
  • E0604: the surface of an sdedge is not defined, or its side is outside 1 to 4.
  • E0605: the count of coordinates is not a multiple of three.
  • E0606: the csp3 option is not recognised, or its end values are the wrong number.
  • E0608: a second type group.
  • E0609: the arc3 option is not recognised, or its points lie on a line.
  • E1012: a point of arc3 begins with a word that is no coordinate system.
  • E0104: the curve number is missing or below 1.

Example

The script tests/corpus/153-curd-stray-semicolon-trans/input.tg, which make test runs:

curd 1 lp3 0 0 0 1 1 1 2 2 2;;
curd 2 lp3 0 0 0 1 1 1 2 2 2; ; mx 1;
curd 3 lp3 0 0 0 1 1 1;
; mx 1;
block 1 2;1 2;1 2;0 1;0 1;0 1;
endpart

The three curves are polylines. Curve 1 ends in two semicolons. Curve 2 has a stray ;, then mx 1 on the same line, which the IR holds as a transformation row. Curve 3 has two points, and its mx 1 is on the next line after a ;. The IR holds three curves and two transformation rows, and the part is unaffected.

The script tests/corpus/312-curd-arc3-three-options/input.tg, which make test runs:

c arc3, Vol. 2, pp. 89-91: the arc, its complement and the whole circle through P1, P2, P3
curd 1 arc3 seqnc rt 0 1 0 rt
.5 .8 0 rt 1 0 0 ;
curd 2 arc3
cmplt rt 0 1 0
rt .5 .8 0 rt 1 0 0 ;
curd 3 arc3
whole rt 0 1 0
rt .5 .8 0 rt 1 0 0 ;

Three points on one circle give the arc through them, the rest of the circle and the whole circle. The IR holds each curve’s option, seqnc, cmplt or whole.

The script tests/corpus/313-curd-sdedge/input.tg, which make test runs:

c sdedge, Vol. 2, pp. 72-73: curves made of sides of a ruled surface
curd 1 lp3 0 0 0 1 0 0;;
curd 2 lp3 0 1 0 1 1 0;;
sd 1 rule3d 1 2;
curd 3 sdedge 1.3
curd 4 sdedge 1.1 mz 2;
curd 5 se 1.2

The surface is the strip between two lines. Curve 3 is its side 3, the first curve. Curve 4 is side 1, the line between the curves’ starts, moved up by 2. Curve 5 is side 2 under the spelling se. The golden case tests/golden/068-sdedge-curs/input.tg attaches a block to two such curves with cur and curs.

See also

  • cur: puts an edge on a curve.
  • curf: the same, and freezes the edge.
  • cure: spreads an edge over the whole curve.
  • curs: a composite edge.
  • sd: defines the surfaces whose sides sdedge takes, and the surfaces built from curves.
  • tr: the transformation operators.
  • Geometry: 3D curves and sides.

James 0.8.0.

This site uses Just the Docs, a documentation theme for Jekyll.