CHAPTER 2 PARAMETRIC CURVES


This chapter introduces the types of parametric curves which can be defined in the Sculptured Surfaces system. These curves will be used in subsequent chapters to define sculptured surfaces patches and for machine tool control. Section 2.1 is concerned with conic arcs defined by a CURSEG statement. Section 2.2 introduces spline curves and Section 2.3 is concerned with compound curves. The internal storage of the curves is considered in Section 2.4 where the canonical array is described in detail; the material in this section may be omitted by those whose main interest is in the use of the system.

2.1 CONIC ARCS. (CURSEG DEFINITION)

A conic is a plane curve which can in two dimensional space be represented by a quadratic equation in x and y. Possible types of curve are straight lines, circles, ellipses, parabolas and hyperbolas, all of which can be obtained as plane sections of a cone. The Sculptured Surfaces system makes it possible to precisely define arcs of any of these curves, the type of curve produced being dependent upon the input data. Note that in all cases an arc of finite length is defined, not the complete conic. Essential differences between these curves and the conic definitions described in volume 1 chapter 9 are their finite length and the fact that the curve need no longer be defined in the xy plane, but must still be a plane curve. The general form of the definition is CNAME = SCURV/CURSEG, followed by 5 or less points and associated vector constraints.

2.1.1 PARAMETRIC LINE

If the CURSEG definition contains only two points with no tangent or normal constraints, the resulting conic arc can only be the straight line connecting these points. 13 blank 14 For example, the line connecting the point P1 with cartesian co-ordinates (2,3,4) to the point P2 with co-ordinates (5,2,6) could be defined by P1 = POINT/2,3,4 P2 = POINT/5,2,6 L1 = SCURV/CURSEG,P1,P2 or by L1 = SCURV/CURSEG,(POINT/2,3,4),(POINT/5,2,6) In either case L1 is a parametric representation of the line from P1 to P2. P1 corresponds to the parameter value t = 0, P2 has parametric value t = 1 and all intermediate points along the line correspond to values of the parameter between 0 and 1. Provided P1 and P2 are distinct points, there can be no error states with this form of the CURSEG definition.

2.1.2 CIRCULAR ARCS

If the CURSEG definition contains precisely 3 constraints, which may be 3 points, 2 end points and a tangent vector, or 2 points and a normal direction; a unique circular arc is defined. Once more this is a parametric curve with the parameter ranging from 0 to 1 along the arc. The simplest definition of a circular arc is in terms of its two end points and an intermediate point. For example the points (-2,4,1),(5,5,1) and (7,1,1) are on a circle of radius 5 with centre at (2,1,1) in the plane z = 1 which is parallel to the X-Y plane. This circular arc is defined by the part program PARTNO CIRCLE P1 = POINT/-2,4,1 P2 = POINT/5,5,1 P3 = POINT/7,1,1 C1 = SCURV/CURSEG,P1,P2,P3 FINI The resulting arc is shown in Figure 2.1. The corresponding verification listing is shown overleaf 15 Figure 2.1 16 VERIFICATION LISTING FOR SCURV C1 FINAL SCURV HEADER TABLE 1.000 = 1. APT FILE RECORD NUMBER 1.000 = 2. NUMBER OF BLOCKS FOR HEADER 3.000 = 3. 1 = COMBIN, 2 = SPLINE, 3 = CURSEG 1.000 = 4. NUMBER OF CUBIC ARCS 25.000 = 5. LOCATION OF FIRST CUBIC ARC 0.000 = 6. NUMBER OF ROWS FOR FLOW DATA 0.000 = 7. LOCATION OF FIRST FLOW ROW 0.000 = 8. NUMBER OF ROWS FOR SEGMENTS 0.000 = 9. LOCATION OF FIRST ROW OF SEGMENTS 0.000 = 10. TOTAL NUMBER OF FLOW SPLINES 0.000 = 11. LOCATION OF FIRST FLOW SPLINE 48.000 = 12. TOTAL SIZE OF STRUCTURE 1.000 = 13. FIRST LOCATION OF STRUCTURE CURVE SHAPE-DISPLAYED BY CUBIC ARCS PARAM XCOORD YCOORD ZCOORD UTAN-I UTAN-J UTAN-K ARC NUMBER 1 0.0000 -2.0000 4.0000 1.0000 0.6000 0.8000 0.0000 0.2500 0.1918 5.6616 1.0000 0.9323 0.3616 0.0000 0.5000 3.5811 5.7434 1.0000 0.9487 -0.3162 0.0000 0.7500 6.2435 3.6443 1.0000 0.5289 -0.8487 0.0000 1.0000 7.0000 1.0000 1.0000 -1.0000 0.0000 0.0000 UNORMI UNORMJ UNORMK CURVATURE RADIUS 0.8000 -0.6000 0.0000 0.2000 5.000 0.3616 -0.9323 0.0000 0.2000 5.000 -0.3162 -0.9487 0.0000 0.2000 5.000 -0.8487 -0.5239 0.0000 0.2000 5.000 -1.0000 0.0000 0.0000 0.2000 5.000 ---END OF SYNTHETIC CURVE VERIFICATION--- 17 Figure 2.2 18 The entries in the header table of this listing are mainly concerned with the contents of the canonical array which will be described in section 2.4. The geometric data gives for points on the curve the parameter value, the co-ordinates, the 3 components of a unit vector in the direction of the tangent, the components of a unit vector normal to the curve and finally the curvature and radius of curvature. Note that the curvature is the reciprocal of the radius of curvature and that in this case the radius of curvature is given as 5.0 for all points along the curve. This geometric data is always given for the two end points of the arc and for 3 intermediate points at equally spaced parameter values. In this case the point P2 is not displayed but its parameter value clearly lies between t = 0.5 and t = 0.75. The same circular arc can be defined in other ways by defining the two end points and either a tangent or normal direction at one of these points. The statements P1 = POINT/-2,4,1 P3 = POINT/7,1,1 T1 = VECTOR/3,4,0 C2 = SCURV/CURSEG,P1,TANSPL,T1,P3 will define precisely the same circular arc with an identical verification listing. The resulting curve is shown in Figure 2.2. The word TANSPL in the definition of C2 identifies the vector T1 as a tangent vector at the point P1. 19 Figure 2.3 20 The third alternative definition would be P1 = POINT/-2,4,1 P3 = POINT/7,1,1 N2 = VECTOR/-1,0,0 C3 = SCURV/CURSEG,P1,P3,NORMAL,N2 From Figures 2.2 and 2.3, the normal to the circle at P3 is seen to be parallel to the x axis and N2 defines a vector in this direction. The definition of C3 identifies N2 not only as the normal to the curve at P3 but also as the normal to any sculptured surface which is subsequently defined as containing the curve C3. Figure 2.3 shows the curve defined by these statements. Note that with the CURSEG definition it is not possible to define a complete circle as a single circular arc, although arcs up to 180 degrees can be defined in this way. An attempt to define too large an arc by the 3 point definition produces the error message: DEFINITION ERROR 5910 THE MID POINT OF THREE CONSECUTIVE POINTS PROJECTED OUTSIDE THE RANGE OF THE SURROUNDING TWO. If a complete circle is required it can be defined as 2 or more arcs which are then joined by a COMBIN statement (see Section 2.3).

2.1.3 GENERAL CONIC DEFINED BY 5 CONDITIONS

A unique conic arc can generally be drawn through 5 coplanar points. The same arc could also be defined by any appropriate combination of 5 constraints made up of points, tangent directions or normal directions. For a proper CURSEG definition the two end points must be defined and the possible alternative definitions reduce to 5 points 4 points and a tangent or normal 3 points and two tangents or normals. Depending upon the actual constraints the resulting curve will be an arc of a circle, ellipse, parabola or hyperbola. 21 Figure 2.4 Figure 2.5 22 The statements P1 = POINT/-4,0.71,0.71 P2 = POINT/-3,2.11,-0.69 P3 = POINT/-1,2.76,-1.34 P4 = POINT/0,2.83,-1.41 P5 = POINT/2,2.55,-1.13 C1 = SCURV/CURSEG,P1,P2,P3,P4,P5 define an elliptic arc in the plane y+z = 1.42; this arc is shown in Figure 2.4. Note that when defining a conic arc in this way it is essential that the 5 points should lie in a plane. If this is not the case an error message (DEFINITION ERROR 5751) will be produced. As an example of a conic arc defined by a combination of points and vector constraints the statements below define a conic, in fact a hyperbola, in the plane z = 2 P1 = POINT/1,6,2 P2 = POINT/2,3,2 P3 = POINT/3,2,2 V1 = VECTOR/2,-3,0 V2 = VECTOR/2,3,0 C2 = SCURV/CURSEG,P1,P2,TANSPL,V1,P3,NORMAL,V2 This curve is illustrated in Figure 2.5. The verification listing for this curve contains the geometric data: PARAM XCOORD YCOORD ZCOORD UTAN-1 UTAN-J UTAN-K 0.0000 1.0000 6.0000 2.0000 0.1644 -0.9864 0.0000 0.2500 1.2581 4.7691 2.0000 0.2551 -0.9669 0.0000 0.5000 1.6154 3.7142 2.0000 0.3988 -0.9170 0.0000 0.7500 2.1429 2.7999 2.0000 0.6078 -0.7941 0.0000 1.0000 3.0000 2.0000 2.0000 0.8321 -0.5547 0.0000 UNORMI UNORMJ UNORMK CURVATURE RADIUS 0.9864 0.1644 0.0000 0.0533 18.755 0.9669 0.2551 0.0000 0.1000 9.999 0.9170 0.3988 0.0000 0.1806 5.537 0.7941 0.6078 0.0000 0.2738 3.653 0.5547 0.8321 0.0000 0.2560 3.906 Note that unlike the earlier circular example the radius of curvature now varies continuously along the curve. The local centre of curvature lies along the normal vector (UNORM) at a distance equal to the radius of curvature. 23 24 If the definition of V2 is changed to V2 = VECTOR/3,2,1 so that it defines a vector which is not in the plane of the curve, an attempt to run the corresponding part program will produce the error message: DEFINITION ERROR 5752 IN A 'CURSEG' DEFINITION ALL OF THE TANGENT CONSTRAINTS DO NOT LIE IN A PLANE. This message could be misleading since on this occasion it is the normal which is out of the plane of the rest of the data but it does indicate that one of the two vector constraints is erroneous. Even when the 5 constraints are coplanar and define a proper conic, the CURSEG definition can still be invalid. For example the points (-6,-2), (-4,-3), (2,6), (3,4) and (6,2) all lie on the rectangular hyperbola xy = 12 but the statements P1 = POINT/-6,-2,0 P2 = POINT/-4,-3,0 P3 = POINT/2,6,0 P4 = POINT/3,4,0 P5 = POINT/6,2,0 C1 = SCURV/CURSEG,P1,P2,P3,P4,P5 will produce the error message: DEFINITION ERROR 5910 THE MID POINT OF THREE CONSECUTIVE POINTS PROJECTED OUTSIDE THE RANGE OF THE SURROUNDING TWO. The explanation is that a hyperbola has two separate sections and in this case P1 and P2 are in one section of the curve whilst P3,P4,P5 are in the other section, there can be no continuous arc through these points. 25 Figure 2.6 26

2.1.4 CONIC ARCS DEFINED BY 4 CONDITIONS

This is the potentially ambiguous case of the CURSEG definitions. Whereas 2 points define a unique line, 3 points a unique circular arc and 5 points a unique conic it is possible to fit many different conics to 4 data points. The ambiguity is removed by selecting the ellipse, or in some extreme cases the parabola, of minimum eccentricity which fits the input data. (The eccentricity of an ellipse is related to the ratio of the lengths of the major and minor axes; the greater this ratio the greater the eccentricity). Since a circle is an ellipse of eccentricity O this implies that a circular arc will be produced whenever the input data is consistent with this result. Example: P1 = POINT/-2,4,1 P2 = POINT/5,5,1 P3 = POINT/7,1,1 T1 = VECTOR/3,4,0 C1 = SCURV/CURSEG,P1,TANSPL,T1,P2,P3 This is a 4 constraint CURSEG definition consistent with the circular arc defined in Section 2.1.2 and the results will be identical. In general the 4 constraints in this type of definition can be: 4 points 3 points and 1 tangent or normal 2 end points and 2 tangents or normals. Example: P1 = POINT/-4,0.71,0.71 P2 = POINT/2,2.55,-1.13 T1 = VECTOR/0,1,-1 T2 = VECTOR/1,-0.3,0.3 C2 = SCURV/CURSEG,P1,TANSPL,T1,P2,TANSPL,T2 These statements define an elliptic arc from P1 to P2 with end tangents in the directions of T1 and T2 respectively. The resulting curve is illustrated in Figure 2.6. The error messages which can be produced from these types of CURSEG definition are precisely the same as those described in Section 2.1.3. The usual sources of error are non-coplanar constraints or data points inconsistent with a single arc. 27 28

2.2 SPLINE CURVES

The most general type of synthetic curve definition is the SCURV/SPLINE definition. This defines the curve as a spline curve each arc of which is a cubic parametric curve. The number of arcs in the curve will be one less than the number of points in the definition. At the data points the curves are continuous and share a common tangent direction but continuity of the curvature is only approximate. Unlike the CURSEG definitions there is no requirement that the input data should be coplanar and the SPLINE definition can be used to define a twisted curve in 3 dimensional space. The maximum number of points in a spline definition is 30, which implies a maximum of 29 for the number of arcs. If required, longer spline curves can be produced by using the COMBIN statement described in Section 2.3.

2.2.1 SIMPLE EXAMPLE

A simple 2 points SPLINE definition will produce precisely the same straight line as the corresponding CURSEG definition. With 3 or more points the results produced by a SPLINE definition will not coincide with the conic arcs produced by CURSEG. For example, using the same 3 data points as in Section 2.1.2 the statements: P1 = POINT/-2,4,1 P2 = POINT/5,5,1 P3 = POINT/7,1,1 C1 = SCURV/SPLINE,P1,P2,P3 produce in their verification listing: 29 Figure 2.7 Figure 2.8 30 CURVE SHAPE-DISPLAYED BY CUBIC ARCS PARAM XCOORD YCOORD ZCOORD UTAN-I UTAN-J UTAN-K ARC NUMBER 1 0.0000 -2.0000 4.0000 1.0000 0.7894 0.6139 0.0000 0.2500 -0.2183 5.0581 1.0000 0.9161 0.4009 0.0000 0.5000 1.6842 5.6213 1.0000 0.9882 0.1535 0.0000 0.7500 3.4946 5.6239 1.0000 0.9847 -0.1743 0.0000 1.0000 5.0000 5.0000 1.0000 0.8007 -0.5990 0.0000 UNORMI UNORMJ UNORMK CURVATURE RADIUS 0.6139 -0.7894 0.0000 0.1244 8.042 0.4009 -0.9161 0.0000 0.1195 8.371 0.1535 -0.9882 0.0000 0.1473 6.790 -0.1743 -0.9847 0.0000 0.2266 4.414 -0.5990 -0.8007 0.0000 0.3373 2.965 ARC NUMBER 2 0.0000 5.0000 5.0000 1.0000 0.8007 -0.5990 0.0000 0.2500 5.7046 4.2612 1.0000 0.5784 -0.8158 0.0000 0.5000 6.2392 3.3000 1.0000 0.4064 -0.9137 0.0000 0.7500 6.6541 2.1888 1.0000 0.3049 -0.9524 0.0000 1.0000 7.0000 1.0000 1.0000 0.2631 -0.9648 0.0000 UNORMI UNORMJ UNORMK CURVATURE RADIUS -0.5990 -0.8007 0.0000 0.3631 2.754 -0.8158 -0.5784 0.0000 0.2395 4.175 -0.9137 -0.4064 0.0000 0.1293 7.733 -0.9524 -0.3049 0.0000 0.0601 16.652 -0.9648 -0.2631 0.0000 0.0123 80.891 The most obvious difference from the results in Section 2.1.1 is that the curve is now listed as 2 separate arcs joining at P2. More detailed examination shows that the radius of curvature is no longer constant showing that the curve is not part of a circle. For each arc the parameter ranges from 0 to 1, the point P2 corresponding to parameter t = 1 on the first arc and t = 0 on arc number 2. At this point the tangent vectors are clearly the same but there is a curvature variation between the arcs. The curve defined is displayed in Figure 2.7. Figure 2.8 shows this curve superimposed upon the corresponding circular arc which highlights the geometric distinction. 31 Figure 2.9 Figure 2.10 32

2.2.2 SPLINE CURVES WITH VECTOR CONSTRAINTS

If the input data does not specify the directions of the end tangents for a SPLINE curve the system will automatically determine appropriate directions. These are computed internally by fitting a parabolic arc to the 3 data points nearest the end and equating the end tangent to the tangent of this parabola. The user can directly control the direction of the end tangent by setting the TANSPL to the desired vector value. Example: P1 = POINT/0,1,0 P2 = POINT/2,3,1 P3 = POINT/4,7,4 P4 = POINT/5,8,3 P5 = POINT/6,8,2 T1 = VECTOR/1,3,0 T5 = VECTOR/2,-5,1 C2 = SCURV/SPLINE,P1,TANSPL,T1,P2,P3,P4,P5, $ TANSPL,T5 This defines a twisted spline curve of 4 separate arcs which is shown in Figures 2.9 and 2.10. The two views clearly show that this is not a plane curve. Note that the lengths of the tangent vectors have no effect on the curve being defined; the tangent lengths are automatically adjusted by the processor after definition. The shape of the curve can be modified by moving the data points or by introducing new constraints. We could introduce a tangent constraint at P3 by defining: T3 = VECTOR/2,1,1 and redefining the curve as C3 = SCURV/SPLINE,P1,TANSPL,T1,P2,P3,TANSPL, $ T3, P4,P5,TANSPL,T5 33 Figure 2.11 Figure 2.12 34 This change means that the curve is now in fact defined as two separate spline curves one from P1 to P3 and the second from P3 to P5. Both curves have the specified tangent direction at P3. The result is illustrated in Figures 2.11 and 2.12. The verification listing shows curvatures of 0.16 and 4.2492 at P3 in arcs 2 and 3 respectively. This abrupt change in curvature is due to the processor treating P1 to P3 and P3 to P5 as distinct curves. The verification listing confirms that the effect of the additional constraint is to change the entire curve, not just the sections between P2 and P4. Other vector constraints which can be imposed at points in a spline curve, or end points of a CURSEG curve, are NORMAL constraints and CRSSPL constraints. A NORMAL constraint is not a direct constraint on the normal to the curve, it is specifying the direction of the normal to any surface subsequently defined using a GENCUR definition or to any MESH surface having this spline curve as part of its definition. Since the tangent to any curve in the surface must be perpendicular to the surface normal, the NORMAL constraint is a partial constraint on the tangent direction. As with a TANSPL constraint the effect of including a NORMAL constraint at an interior point of a spline curve is to split the curve into 2 separate spline curves. A CRSSPL constraint has no effect upon the curve currently being defined, it is specifying the direction of the tangent to the cross spline curve (the 2nd parametric family of curves on the biparametric surface) at that particular point. For a well defined surface the CRSSPL direction should not be nearly parallel to the tangent vector at the point concerned. (See Chapter 5 for further details). As an example, if with the previous point and vector definitions we define C4 = SCURV/SPLINE,P1,TANSPL,T1,P2,P3,CRSSPL,T3,P4,P5,TANSPL,T5 the result is an identical curve to C2. All the examples given so far have included only a single vector constraint at a given point but the most general form of the SCURV statement allows a SPLINE curve, or a CURSEG to be input with up to 3 vector constraints (TANSPL, NORMAL, CRSSPL) at each point. Particular care should be taken when inputting multiple vector constraints including the NORMAL because the directions of the TANSPL and CRSSPL vectors should be at right angles to the normal. If the input data does not satisfy this condition the directions of the TANSPL and CRSSPL are automatically adjusted, by projecting them onto the 35 tangent plane with the specified normal, before defining the parametric curve. The result is a curve which does not have the chosen tangent properties. If both TANSPL and NORMAL are included at a point of a CURSEG curve the TANSPL is used to determine the plane of the curve provided the direction of the TANSPL is consistent with the NORMAL. In this way it is possible to specify a direction for the surface normal which is not in the plane of the conic arc. The example below illustrates the effect of including inconsistent TANSPL and NORMAL constraints in a CURSEG definition. P1 = POINT/-2,4,0 P2 = POINT/5,5,0 P3 = POINT/7,1,0 T1 = VECTOR/3,4,0 V1 = VECTOR/1,2,3 C1 = SCURV/CURSEG,P1,TANSPL,T1,NORMAL,V1,P2,P3 Running a part program including these statements produces the error message DEFINITION ERROR 5752 IN A 'CURSEG' DEFINITION ALL OF THE TANGENT CONSTRAINTS DO NOT LIE IN A PLANE. This message is clearly false since the 3 points lie on a circular arc of radius 5 centred at the point (2,1,0) in the plane z = 0 and T1 is the correct tangent vector. However V1 is not orthogonal to T1 (the scalar product is 3x1 + 4x2 + 0x3 which is non zero, and the system has automatically modified T1 to the new direction (0.5475, 0.6005, -0.5828) , not in the plane z = 0, before attempting to construct the curve. This direction can be verified by modifying the definition of C1 to define a SPLINE curve; the direction is computed from T1 by subtracting its component in the direction of V1. The intended circular arc is obtained from this example by replacing V1 by any vector, such as (-4,3,2) which is orthogonal to T1. 36

2.2.3 SEGMENTS OF LINES AND CIRCLES - THE SEG DEFINITION

A third method of defining a simple parametric SCURV in the Sculptured Surfaces system makes use of the APT4 geometric definitions of lines and circles. The SEG definition makes it possible to define a parametric curve as a segment of a line or circle but this definition only applies to curves in the xy plane (z=0). The curve and the end points are all defined in terms of APT4 geometries. The end points are determined by finding the intersection with another line or circle. Since, in general, a circle intersects another line or circle in two points the potential ambiguity in this definition is removed by using the qualifiers POSX, NEGX, POSY or NEGY. POSX is interpreted as an instruction to select from the two intersection points the one which has the larger x coordinate (which need not be positive). NEGX selects the point with the smaller x coordinate. POSY and NEGY make a similar selection based upon the y coordinates. Note that even in the simple case of two intersecting lines, the format of the input statement requires one of these qualifiers to be present. The general form of the definition statement is CNAME = SCURV/SEG,CURVE1,CURVE2,qualifier,CURVE3,qualifier where CURVE1,CURVE2,CURVE3 are the names of previously defined APT4 circles or lines and each qualifier takes one of the values POSX,NEGX,POSY or NEGY. The parametric curve is then defined as the segment of CURVE1 between its intersection with CURVE2 and its intersection with CURVE3. Example: L1 = LINE/-1,0,0,2,3,0 C1 = CIRCLE/CENTER,0,0,0,RADIUS,5 C2 = CIRCLE/CENTER,2,2,0,RADIUS,4 S1 = SCURV/SEG,C2,C1,NEGY,L1,POSY The three APT4 construction curves defined here all lie in the plane z=0. L1 is an infinite line of unit slope passing through the points (-1,0) and (2,3) in the xy plane. C1 is a circle of radius 5 centred at the origin and C2 is a circle centred at (2,2) and of radius 4. Figure 2.13 shows these curves and their interestions. S1 is defined as the shortest segment of C2 which lies between the lower intersection P1 with C1 and the higher intersection P2 with L1. These intersections are uniquely identified by the use of NEGY and 37 Figure 2.13 Figure 2.14 38 POSY respectively. Precisely the same circular arc could have been defined by the statement S1 = SCURV/SEG,C2,C1,POSX,L1,POSX The resulting curve is illustrated in Figure 2.14. A careful examination of the verification listing for this curve shows that internally it is represented by a simple CURSEG definition consisting of the two end points P1 and P2 and the tangent vector at P1. The first part of this listing is: VERIFICATION LISTING FOR SCURV S1 INTERIM SCURV HEADER TABLE 0.000 = 1. APT FILE RECORD NUMBER 1.000 = 2. NUMBER OF BLOCKS FOR HEADER 3.000 = 3. 1 = COMBIN, 2 = SPLINE, 3 = CURSEG 2.000 = 4. NUMBER OF CUBIC ARCS CANONICAL ARRAY FOLLOWS INDEX = 1 0.000 1.000 3.000 2.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.0000 INDEX = 25 4.951 -0.701 0.000 0.000 -2.701 -2.951 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 INDEX = 49 4.284 5.284 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 (Note: in the original print-out this data is arranged with 3 blocks of 4 numbers per row.) 39 blank 40 The third entry in the header table identifies the curve as a CURSEG (i.e. conic arc) type. The 4th entry in fact refers to the number of points rather than the number of arcs as the caption suggests. The detailed interpretation of the canonical array will be explained in section 2.4. Elements from index 1 to 24 refer to the header block, elements 25 to 48 are associated with the first point of the curve and elements 49 to 72 refer to P2. P1 is identified as having co-ordinates (4.951,-0.701,0.000) with a tangent vector in the direction (-2.701,-2.951,0,000). P2 is identified as having coordinates (4.284,5.284,0.000) with no tangent or normal constraint. As far as the sculptured surfaces processor is concerned the curve is now indistinguishable from a CURSEG circular arc defined by two points and a tangent vector. The final verification listing is identical to that produced from the corresponding CURSEG definition.

2.2.4 RETRIEVAL OF GEOMETRIC DATA FROM CURVES

Provision is made in the sculptured surfaces processor for geometric data to be extracted from any point of a parametric curve (SCURV). This data is obtainable by using the INTOF command together with a parameter value to identify the particular point on the curve. If the curve has been given a FLOW value (see Chapter 3) the point on the curve may be referenced by a FLOW value rather than a simple parameter value. Vectors associated with the curve (TANSPL,NORMAL,CRSSPL or BINORM) can be obtained in a similar way. Once this data has been obtained it can be used in further geometric definitions or for tool control applications. To extract the co-ordinates of a point the format of the command is PNAME = POINT/INTOF,CNAME,PARAM,u,N where PNAME is the assigned point name, CNAME is a previously defined SCURV, u is the parameter value and N is an integer identifying the arc of the curve. In the simplest cases N will be the actual arc number and u will have a value between 0 and 1 to identify the particular point of the arc. 41 Figure 2.15 42 For example, the values u = 0.5, N = 2 refer to the parametric mid point of the second arc of the curve. An alternative method of referring to the same point is to set N = 0 and u = 1.5; in this case the value N = 0 signals that the parameter will take values between 0 and 1 on the first arc, 1 and 2 on the second arc and so on. A third method of referring to the same point is by counting the arcs from the other end of the curve. If the curve had 4 arcs the values u = 0.5, N = -3 would refer to precisely the same point. If the reference is by FLOW value the word PARAM in the INTOF statement is replaced by FLOW; the interpretation of u and N is exactly similar except that u now refers to a value of the FLOW parameter. As defined, a parametric SCURV is a bounded curve but it is possible to refer to points beyond the extremities of the curve. In such a case the curve is continued as a straight line by extending its end tangent vector. A negative value of u refers to a point on the linear extension before the start of the curve and a value of u greater than 1 (or greater than the parametric range if N = 0) refers to a point on the linear extension beyond the end of the curve. Individual arcs of the curve can be extended in the same way. Example: C1 = SCURV/SPLINE,(POINT/1,2,0),(POINT/2,3,1), $ (POINT/3,5,2),(POINT,6,5,4),(POINT/7.3.4) - P1 = POINT/INTOF,C1,PARAM,0.6,1 P2 = POINT/INTOF,C1,PARAM,2.4,0 P3 = POINT/INTOF,C1,PARAM,1.5,4 P4 = POINT/INTOF,C1,PARAM,1.8,1 P5 = POINT/INTOF,C1,PARAM,-0.7,0 The points referenced by the above statements are shown in Figure 2.15. C1 is a spline curve consisting of 4 arcs. P1 is an interior point of the first arc. P2 is an interior point of the third arc. P3 is on the linear extension of the 4th arc (i.e. beyond the end of the curve). P4 is a point on the tangent at the end of the first arc and P5 is on the linear extension before the start of the curve. Note that P2 could also have been referred to by the u,N values 0.4,3 or 0.6,-2. Vector functions associated with the curve are evaluated in a similar manner. For example V1 = VECTOR/INTOF,C1,PARAM,0.6,1,TANSPL sets V1 equal to the value of the tangent vector to the curve C1 at the point in the first arc with parametric value 0.6. If a unit vector is required this is achieved by the statement 43 Figure 2.16 44 V1 = VECTOR/INTOF,C1,PARAM,0.6,1,TANSPL,UNIT The word TANSPL in this statement can be replaced by the words NORMAL, BINORM or CRSSPL where NORMAL refers to the surface normal at this point, BINORM denotes the binormal to the curve (normal to the circle of curvature at this point) and CRSSPL is the direction of the tangent to the cross-spline curve at the designated point. TANSPL and BINORM should be available at all points of a curve but NORMAL and CRSSPL are generally only available at the ends of arcs where they have previously been input.

2.3 COMBIN CURVES

Previous sections have introduced the simple SCURV definitions of CURSEG, SPLINE or SEG to define a continuous parametric curve. More complex curves can be constructed by joining two or more of these curves together using the COMBIN statement. The general format for this is CNAME = SCURV/COMBIN,C1,C2,...,CN where CNAME is the chosen name for the compound curve and C1,C2,...,CN are previously defined SCURVs of any of the standard types. It is quite permissible to mix curves of different types within a single COMBIN statement but it is up to the user to ensure the appropriate continuity conditions between the separate curves at their junction points.

2.3.1 SIMPLE EXAMPLE

P1 = POINT/0,0,0 P2 = POINT/2,0,0 P3 = POINT/3,4,1 P4 = POINT/4,6,2 V1 = VECTOR/1,1,0 C1 = SCURV/CURSEG,P1,P2 C2 = SCURV/SPLINE,P2,TANSPL,V1,P3,P4 C3 = SCURV/COMBIN,C1,C2 In the above example C1 is defined as the line from P1 to P2. C2 is the spline curve passing through P2,P3 and P4 with specified tangent vector V1 at P2. C3 is then the compound curve formed by combining C1 and C2, which is illustrated in Figure 2.16. Since the end of C1 coincides with the first point of C2 the curve C3 is continuous but the curve has a slope discontinuity at this point. This discontinuity of tangent direction can only be removed by re-defining V1 as (1,0,0) so that the tangent vector is in the same direction as the line P1P2. 45 The verification listing for C3 shows a curve consisting of 3 arcs. For the first arc the curve is identical to C1 and the second and third arcs coincide with the two arcs of C2. The listing also contains the message: DEFINITION WARNING 5129 THE TANGENT VECTORS AT THE JUNCTION OF CONSECUTIVE CURVES IN A 'COMBIN' DEFINITION HAVE DIFFERENT DIRECTIONS This is, however, only a warning message and the normal processing can continue using this curve definition. If, however, the first point of C2 is changed the message produced by the processor is: DEFINITION ERROR 5128 THE JUNCTION POINTS OF TWO CONSECUTIVE CURVES IN 'COMBIN' DEFINITION DID NOT MATCH This is now a fatal error which halts further processing of the program.

2.3.2 APPLICATIONS OF COMBIN CURVES

Apart from the obvious application of making it possible to join curves of different types together, the COMBIN facility has a variety of uses. The fact that the COMBIN definition permits tangent discontinuities at junction points makes it possible to use curves of this type to produce surfaces with a 'high line' or feature line. When used in conjunction with CURSEG definitions COMBIN can be used to produce a curve each segment of which is a conic arc. For example, a rectangular profile with rounded corners could be produced by combining 4 line segments with 4 quadrants of circles. Although each separate conic segment is a planar curve the final COMBIN curve need not be planar. A complete circle can be defined as the COMBIN of two semi-circles. COMBIN may also be used to overcome the limitation of having no more than 30 points in a SPLINE curve. A continuous spline curve through a large number of points can be produced by first dividing the points into sets of 30 or less. A SPLINE curve is then defined on each set of points in turn. Tangent continuity can be ensured by making use of the INTOF facility to extract the TANSPL vector at the end of each spline curve. This vector is then used as an initial TANSPL constraint when defining the next SPLINE curve. 46 Finally, the separate curves are joined as a COMBIN curve. As an example: C1 = SCURV/SPLINE,P1,P2,....,P30 V1 = VECTOR/INTOF,C1,PARAM,1,-1,TANSPL C2 = SCURV/SPLINE,P30,TANSPL,V1,P31,...,P48 C3 = SCURV/COMBIN,C1,C2 The above statements would define C3 as a continuous spline curve passing through the 48 points P1 to P48. One less obvious application of the COMBIN statement is when it is used with a single component curve. If the curve C, of 3 arcs, has been previously defined, the statement CF = SCURV/COMBIN,C,FLOW,ARC,0,3,SEG,0,3 can be used to subsequently add a FLOW structure to C. The significance of FLOW will be described in Chapter 3.

2.4 CANONICAL ARRAYS USED FOR SCURV

Internally the computer used by the Sculptured Surfaces processor stores all the data necessary to construct a parametric SCURV in a standardised format called the canonical array. Although there are essentially 3 distinct types of SCURV namely CURSEG, SPLINE and COMBIN they all have the same internal data structure. For each simple curve there are in fact two associated canonical arrays which are printed out as part of the verification listing. These are the interim canonical array which essentially contains the input data and the final canonical array which is used as a data structure for all the internal geometric computations associated with the curve.

2.4.1 INTERIM SCURV ARRAY

Each of the canonical arrays is divided into blocks of 24 real numbers. The first block in each case contains the header table and some details of its contents are printed out as part of the verification listing. The data in the header block is relevant to the entire curve. In the interim array there is a further block of data for each point of definition for the curve. This block contains all the input data relevant to that particular point and the data is stored in a simple Cartesian co-ordinate format. The detailed nature of this data is best illustrated by a simple example. 47 P1 = POINT/-2,4,1 P2 = POINT/5,5,1 P3 = POINT/7,7,1 V1 = VECTOR/1,2,3 V2 = VECTOR/3,4,0 V3 = VECTOR/-4,3,0 C1 = SCURV/SPLINE,P1,TANSPL,V2,NORMAL,V3,P2, $ CRSSPL,V1,P3 These statements define C1 as a spline curve through the 3 points P1,P2,P3 with vector constraints at P1 and P2. The corresponding verification listing gives: INTERIM SCURV HEADER TABLE 0.000 = 1. APT FILE RECORD NUMBER 1.000 = 2. NUMBER OF BLOCKS FOR HEADER 2.000 = 3. 1 = COMBIN, 2 = SPLINE, 3 = CURSEG 3.000 = 4. NUMBER OF CUBIC ARCS INDEX = 1 0.000 1.000 2.000 3.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000. 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 INDEX = 25 -2.000 4.000 1.000 0.000 3.000 4.000 0.000 1.000 0.000 0.000 0.000 0.000 4.000 -3.000 0.000 1.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 INDEX = 49 5.000 5.000 1.000 0.000 0.000 0.000 0.000 0.000 1.000 2.000 3.000 1.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 INDEX = 73 7.000 1.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 48 Note that each block of the canonical array consists of 6 groups of 4 real numbers. In the line printer output they are arranged in two rows per block. The captions at the top of the canonical array identify the entries in the first group of the header block. The APT file record number is a reference number used for external storage of the canonical array; it is 0 in this case because the interim canonical array is not saved. All the other entries in the header block are self explanatory except for 'NUMBER OF CUBIC ARCS'. This caption in fact refers to the number of blocks after the header block and is equal to the number of points defining the curve. The index number of the first entry of each block is given. Each block after the header block contains data about one point of the curve in a standard format. The first group of 4 numbers contains the point co-ordinates in its first 3 locations. The second group contains the TANSPL vector, if any, with the fourth entry 1.000 if a TANSPL is defined. The third and fourth groups contain equivalent data for the CRSSPL and NORMAL constraints. The fifth group contains the 'WEIGHT' in its first location; the significance of this will be explained in Chapter 3 where smoothing of curves is described. For a simple curve the WEIGHT is 1.0. The final group of the block is reserved for the original co-ordinates in cases where the data point is moved in a smoothing operation.

2.4.2 FINAL SCURV ARRAY

The final canonical form is produced after the parametric curve has been processed. Regardless of the type of input constraint each arc of the curve is represented in its internal format by the two end points and two derivative vectors. In order to provide a common format for the CURSEG and SPLINE data these points and vectors are described in terms of homogeneous co-ordinates. After the header block, each block of the canonical array corresponds to one arc of the curve. Continuing the example introduced in 2.4.1, the final part of the verification listing gives 49 FINAL SCURV HEADER TABLE 1.000 = 1. APT FILE RECORD NUMBER 1.000 = 2. NUMBER OF BLOCKS FOR HEADER 2.000 = 3. 1 = COMBIN, 2 = SPLINE, 3 = CURSEG 2.000 = 4. NUMBER OF CUBIC ARCS 25.000 = 5. LOCATION OF FIRST CUBIC ARC 0.000 = 6. NUMBER OF ROWS FOR FLOW DATA 0.000 = 7. LOCATION OF FIRST FLOW ROW 0.000 = 8. NUMBER OF ROWS FOR SEGMENTS 0.000 = 9. LOCATION OF FIRST ROW OF SEGMENTS 0.000 = 10. TOTAL NUMBER OF FLOW SPLINES 0.000 = 11. LOCATION OF FIRST FLOW SPLINE 72.000 = 12. TOTAL SIZE OF STRUCTURE 1.000 = 13. FIRST LOCATION OF STRUCTURE INDEX = 1 1.000 1.000 2.000 2.000 25.000 0.000 0.000 0.000 0.000 0.000 0.000 72.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.800 -0.600 0.000 1.000 INDEX = 25 -2.000 5.000 4.513 5.917 4.000 5.000 6.017 -4.521 1.000 1.000 0.000 0.000 1.000 1.000 0.000 0.000 0.267 0.535 0.802 1.000 0.000 0.000 0.000 0.000 INDEX = 49 5.000 7.000 3.222 1.309 5.000 1.000 -2.466 -4.799 1.000 1.000 0.000 0.000 1.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 50 Once more the contents of the header block are explained by the printed captions. Locations 6 to 11 of the header block relate to flow and segment data and do not apply to a simple curve. After the header block, the canonical array contains one block of 24 numbers per arc of the curve. Like the interim array these blocks are sub-divided into 6 groups of 4 but the significance of the individual groups is completely different in the final array. For each arc of the curve 6 vector quantities can be stored. These are the two end points, the derivative of the parametric vector function defining the curve at each end point and (if needed) the NORMAL and CRSSPL constraint vectors at the finish of the arc. The co-ordinates and the derivatives are stored as homogeneous co-ordinates (X,Y,Z,W), which can be related, for the end points, to the Cartesian co-ordinates (x,y,z) by the equations x = X/W, y = Y/W and z = Z/W. The first group in each block contains all the X co-ordinates, the second group the Y co- ordinates, the third group the Z co-ordinates and the fourth group the W coordinates. Within each group of 4 numbers the order is: start point, end point, start derivative, end derivative. In the above example data for the first arc starts in location 25 and the homogeneous co-ordinates (X0,Y0,Z0,W0) of the first point are (-2,4,1,1) retrievable from locations (25,29,33,37). Note that the co-ordinates of the second point are repeated as the start point of the second arc. The derivative vectors at each end of arc 1 have homogeneous co-ordinates (4.513, 6.017, 0.000, 0.000) and (5.917, -4.521, 0.000, 0.000). The first of these is a vector in the direction of the TANSPL constraint vector (3,4,0) and the second is in the direction of the unit tangent vector (0.7966, -0.6046, 0) at the end of arc 1. Note, however, that the magnitudes of these vectors have changed because the magnitude of the derivative vector influences the shape of the curve. For a SPLINE curve the W co-ordinate of each end point is always 1 and the first 3 components of the derivative vector always define a tangent vector. The final two groups of each block contain respectively a unit CRSSPL vector and a unit NORMAL vector. These vectors relate to the final point of the arc and the fourth element of each group is set to 1.0 to indicate the presence of such a constraint vector. For constraints at the beginning of the first arc the constraint vectors are stored in the last two groups of the header block. Thus in the above example, elements 21 - 24 of the header block are 0.8, -0.6, 0, 1.0 which denotes the presence of a NORMAL constraint in the direction (4,-3,0) at the beginning of the curve. 51

2.4.3 CURSEG CANONICAL ARRAY

For a conic arc defined by a CURSEG statement the interpretation of the canonical array is less simple because the W co-ordinates are not simply 1 or 0. This is a consequence of the fact that the parametric function defining such a curve has a rational quadratic form rather than a simple cubic form. If we follow the example of 2.4.1 but define C2 by the statement C2 = SCURV/CURSEG,P1,TANSPL,V2,NORMAL,V3,P2,P3 the interim canonical array is very similar to that given for C1 except that the 3rd element is 3.0 and the CRSSPL vector is omitted. The final canonical array, however, differs considerably; it is INDEX = 1 2.000 1.000 3.000 1.000 25.000 0.000 0.000 0.000 0.000 0.000 0.000 48.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.800 -0.600 0.000 1.000 INDEX = 25 -2.089 7.312 8.803 10.000 4.179 1.045 2.214 -8.482 1.045 1.045 -1.429 -1.429 1.045 1.045 -1.429 1.429 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 The most obvious difference from the data for C1 is that the canonical array now contains only two blocks because the curve is defined by a single arc. The interpretation of the arc data in the second block is exactly the same as for C1 but the numerical values differ considerably. The first point now has homogeneous co-ordinates (-2.089,4.179,1.045,1.045) which correspond, after division by W, to the Cartesian co-ordinates (-2,4,1) of P1. The first derivative vector (corresponding to P1) is (8.803,2.214,-1.429,-1.429) which corresponds to the Cartesian vector (-6.160,-1.549,1.000). Unlike the SPLINE curve case this vector is not directly related to the tangent vector at this point although it is possible to calculate the tangent from the derivative vector and the co-ordinates of P1. 52