Modification of geometric models through variational
geometry Robert Light and David Gossard* Systems for computer-aided mechanical design use geometric models for drafting, analysis and programming of NC machines. Because design is iterative in nature, the topology, geometry or dimensioning of a geometric model must be modified many times during the design cycle. The effectiveness of future CAD systems will depend in large part upon the ease with which geometric models can be created and modified. This paper presents the results o f a research effort to develop flexible procedures for the definition and modification of geometric models. A central idea of this effort is that dimensions, such as appear on a mechanical drawing, are a natural descriptor of geometry and provide the most appropriate means for altering a geometric model. A procedure is described by. which geometry is determined from a set of dimensions. The geometry corresponding to an altered dimension is found through the simultaneous solution of the set of constraint equations. Presented in this paper are the basic approach to modifications of geometric models, a procedure for significant reduction of the number of constraint equations to be solved, and the effect of sparse matrix methods in reducing the time required to solve the equations. computer-aided design, geometric model, variational geometry
In this paper a procedure is described by which geometry is determined from a set of dimensions. A geometric model is defined with respect to a set of characteristic points in 3-space. Dimensions are treated as constraints limiting the permissible locations of these characteristic points. Each dimensional constraint is described by a nonlinear equation involving the coordinates of associated characteristic points. A given dimensioning scheme is represented by a set of such equations. The geometry corresponding to an altered dimension is found through the simultaneous solution of the set of constraint equations. These techniques were incorporated into a prototype 2D CAD system. This system allows freehand sketch input to define the general shape of the part. The user interactively defines the dimensioning scheme and the desired values of the dimensions. By solving the system of constraint equations, the geometry of the part is updated to be consistent with the new set of dimensional values. Presented in this paper are the basic approach to modification of geometric models, a procedure for signifiDeere and Company Technical Center, Moline, I L, USA *Computer-Aided Design Laboratory, Department of Mechanical Engineering,MassachusettsInstitute of Technology, Cambridge, MA, USA
volume 14 number 4 july 1982
cant reduction of the number of constraint equations to be solved and the effect of sparse matrix methods in reducing the time required to solve the equations. BACKGROUND
The use of constraints to define geometry can be seen in Sutherland's early work. ~ Sutherland made use of constraints as a design aid in the creation of a part, but did not use geometric constraints for definition and modification of part geometry. Requicha= used directed graphs to represent the relationship between dimensions and geometry. Three graphs were constructed to show the dimensional relations in the x, y and z directions. Hence, this approach is limited to geometries consisting of rectilinear segments. Gopin 3 made the first use of directed-graphs to define and modify geometry in an interactive CAD system. This CAD system restricted the part geometries to rectilinear segments and dimensions. More recently, Hillyard and Braid4'5 showed that small variations in geometry could be related to variations in dimensions by a 'rigidity matrix'. Light 6 and Lin et al 7 showed that generalized dimensional constraints could be used to modify geometry through large shape variations, and that geometric properties could be used to constrain geometry. This was demonstrated on prototype 2D and 3D CAD systems. GEOMETRY
As shown in Figure 1, the geometry of an object is defined by a set of N characteristic points. This set includes points XTYT -,
- Xe
Xl ~1
Xa ~
Figure 1. Shape definition points
0010-4485/82/040209-06 $03.00 © 1982 Butterworth & Co (Publishers) Ltd
209
used for construction as well as points on the object. The complete set of characteristic points is described by a geometry vector, x, contianing their Cartesian coord inates: x
= { X l , Y1, Z l , . . . ,
Xu, YN, ZN) T
or
X = {Xl, X2, X3. . . . .
Xn_2, Xn_l, Xn}T
where n = 3N All higher order entities (edges, surfaces and dimensions) are defined with respect to those characteristic points. Any given point in the geometry vector may therefore represent a vertex, the centre of a circular arc, part of a cubic spline, or a vertex of the bounding polyhedron of a Bdzier surface.
GENERALIZED
DIMENSIONAL CONSTRAINTS
Dimensions, whether implicit (such as right angles) or explicit (such as specifying the distance between two points), impose constraints on the permissible location of characteristic points to which they refer. The constraints may be expressed analytically by nonlinear equations of the following form. Fi(Xld) = 0 where
i=],2,...,m
(1)
d = the vector of dimensional values x = the geometry vector m = the number of constraints
Six constraint equations must be supplied to prevent 3D rigid body translation and rotation. The remaining (m-6) equations are determined by the designer's specific choice of dimensions. The 2D constraint equations for a number of common drafting conventions are shown in Table I. It should be noted that the set of constraint equations is not unique, but is determined by the arrangement of dimensions chosen by the designer.
GEOMETRIC CONSTRAINTS Geometric properties, such as area, may be used to constrain geometry as well. For example, the area of an N-sided 2D polygon is defined by equation 2. The inner
PX
Figure 2. Polygon with inner 'holes' summation is positive if one moves around the contour anti-clockwise. The area of a shape containing a number of polygons, with some polygons as 'holes', as in Figure 2, can also be determined in the same way, traversing each polygon in the direction which keeps the inside of the bounded region to the left.
A=~
1
~, i
(2)
[x(XiYi+]-YiXi,l)] i
i = 1,2,..., j = 1, 2 , . . . ,
number of points in contour number of contours
If a circular segment is included in the shape, the area of the segment must be included in the constraint equation. Thus, equation 2 becomes, 1 N
AT =2n
((~X/Yi+ 1 - YiXi+I) + [~.SjR~/
( o ~ j - ~ j )])
(3) Table 1. Selected dimensional constraint equations
where
j=
1,...a
i = 1,...p
o = number of arcs in contour p = number of points; point indices are sequential around contour N = number of countours
Dimension name
Entities constrained
Equation
n = 1,...N
Horizontal distance
P~, P~
X1- X2- D = 0
Vertical distance
PI, P2
YI - Y~ - D = O
Cl = chord o f a r c j Rj = radius of arc/ ej =
Linear distance
P1, P2
(X~ -X=) 2 + (V~ - Y2) 2 - O 2 = 0
Distance from point to line
P~, P~P~
I~lX V - D = 0 (j
V =(x=-x,) Angular dimension
210
• PIP2,
P3;~
IPIP2 X P3 - Tan(A ) = 0
-1 if defining an exterior boundary The parameters C, R and e are given in terms of the coordinates of the centre point and the end points of the arc:
(x~ - x2J j + (Ys - Y2 ) -J
I P2P3 I
angle o f a r c j
Sj = +1 if defining a hole
I P=P~ I i +(Y=-
Y,) i
I /(PIP= • P3P )
C = [(X, - X 2 ) 2 + (V, - V2) 21 ~ R = [(X, -Xc) = + (Y, - Yc) 2] ~ o~ = t a n - l ( [ ( X l - X c ) ( Y = - Yc) - (Y1 - Yc)(X2 -Xc)] l (X, -Xc)(X2 - X c ) + (Y, - Yc)(Y2 - Yc)]} where
X1, Y1 and X2, Y2 are the end points of the arc Xc, Yc is the centre of the arc
computer-aided design
6.38-=
THE JACOBIAN
27'25 II
The Jacobian, J, is an (m x n) matrix containing the partial derivatives of each constraint equation ith respect to each degree of freedom: fit
f12 ' ' • f i n
30"24
i =
(~ XY
fml
......
f
.17/?--/
fmn
where
a&
=
33-61
~
3"52R 4'46D
Blinking dimensions are redundant
ax;
circled points are under-constroined
It expresses the relationship between variations in dimensions and variations in coordinates and is a more generalized form of the rigidity matrix referred to by Hillyard. s
coordinates and the redundant dimensions may be identified as in Figure 3. This permits a precise method for evaluating and 'debugging' a dimensioning scheme.
S O L V I N G FOR G E O M E T R Y Simultaneous solution of the constraining equations (1) yields the geometry corresponding to the set of dimensions• When the Newton-Raphson method is used, changes in the geometry vector for each iteration are found by solving the matrix equation:
J Ax
= r
(4)
where Ax is the vector of displacements and r is the vector of residuals. Ax
Figure 3. Indication of invalid dimensioning scheme
= {~xl, ~'2, • -., ~x.) T
r = {-FI,-F2 .... ,-Fro) T
The displacement vector is added to the geometry vector to obtain a new geometry vector, and the process is repeated until the residuals, r, vanish.
USING T H E SPARSE J A C O B I A N The Jacobian, J, in equation (4) is sparse, and lends itself to sparse matrix methods. In particular, the Harwell 8 subroutine library permits the sparse matrix solution to equation (4) to be accomplished in O(n) + O(r) computations where the n x n matrix contains r non-zeros. On average, each row of the Jacobian contains a constant number of non-zeros. Therefore, the number of non-zeros in the Jacobian is of O(n) and the complete matrix solution can be accomplished in O(n) computations. The Harwell storage requirements are also of O(n). The use of sparse matrix techniques results in a substantial saving over the O(n 3) Gaussian reduction.
D E C O U P L I N G OF C O N S T R A I N T S TREATMENT SCHEMES
OF I N V A L I D D I M E N S I O N I N G
A valid dimensioning scheme is one in which the locations of all characteristic points are constrained by the set of equations. The Jacobian is structurally singular if the number of constraint equations, m, does not equal n, the number of degrees of freedom (coordinates) in the geometry vector. If m > n, the shape is overdimensioned, and if m < n, the shape is underdimensioned. If m = n, the J acobian can be numerically singular, signifying a redundant dimensioning scheme. This results when a portion of the shape is overdimensioned and a portion is underdimensioned. Thus, a necessary and sufficient condition for a valid dimensioning scheme is that the Jacobian, I, be non-singular. An invalid dimensioning scheme results when the designer specifies too few dimensions (m < n), too many dimensions (m > n) or redundant dimensions• In the course of interactive input, the occurence of an invalid dimensioning scheme is quite likely, and it is desirable to have some means by which such cases may be treated. A modified Doolittle method, 6 using column pivoting, may be used to solve the system of equations (4) when the J acobian is singular• With this method, the unconstrained
volume 14 number 4 july 1982
When a set of dimensional changes affects only a portion of the total geometry, significant reduction in computation can be achieved by identifying the affected geometry. This reduction is achieved because a minimum set of constraint equations must be solved. This section describes a method by which this may be accomplished. Each iteration of Newton's method requires the solution of.the system of equations (4) which are of the form: Ax= b Permutation matrices P and Q may be found such that PAQ is lower block triangular. The derivation of these matrices will be explained later.
E Amm_lj All
A22
PAQ =
zero non-zero .elements elements " _
(5)
The lower block triangular matrix, PAQ, of order n has m (1 < m < n) square sub-matrices on the diagonal which cannot in turn be permuted to block triangular form.
211
Zeros exist above the diagonal blocks. Equation (5) may now be written: (P A O) Q Tx = e b
(6)
The permutation matrix P reorders the rows and Q reorders the columns of A. Two additional matrices must be determined, P', Q', to reorder the diagonal blocks Aii of the lower block triangular PAQ. For example: I A33 A22 zero elements ]
P' (P A Q) Q' =
i non-zero elements
(7)
/
[ A~s J
Under this permutation, the original blocks are reordered on the diagonal and matrix pt (PAQ) Q~ remains block triangular. Matrices P' and Qt are chosen such that the diagonal blocks in PAQ 'associated' with the non-zero elements in Pb are as low as possible in the matrix P' (PAQ) Q', where the block Aii in rows £ through k in PAQ is 'associated' with thejth non-zero component of Pb if ~ ~
• Step i: Assign the designation c~to the first diagonal block associated with a non-zero right-hand side element (Go to step ii.) • Step ii: Assign the temporary designations ~ to the block below o~, and/3 to the diagonal block to the right of L~. (Go to step iii.) • Step iii: Ill3 is not associated with a non-zero right-hand side element and ~Y= O, then permute ~ and/3 using row and column operations, and go to step ii, otherwise go to step iv. • Step iv: Extend e to include ~ and/3. This extended diagonal block retains the designation e. If~ is not the last block, go to step ii, otherwise stop. The row and column operations determined in step iii are collected in P' and 0 t. This algorithm is also of O(n). At no time in this procedure is the inverse of the Jacobian computed. Because the dimensioning scheme can be decoupled, the solution techniques never need to solve the total system of equations. This is a major improvement over the decoupling algorithm presented by Light 8 which used A -1 to decouple the system of equations Ax = b.
J /
(8)
+
! ,i
Letting A' = P' PAQQ', x' = Q' TQTx and b' = P'Pb, the above equation has the structure: iI
The square matrix A'22 consists of all the diagonal blocks associated with the non-zero elements on the right-hand side, bt2. The original columns which are permuted into A'22 correspond to the set of coordinates which are affected by a dimensional change. The original rows which 'are permuted to AF22 correspond to the set of constraints needed to determine the new geometry. The use of equation (8) decouples the dimensioning scheme so that only a subset of the total system must be solved. The computations need only be executed using the equation: A'22 x'2 = bt=. The order of the matrix A'== may be considerably smaller than the order of the original matrix A. Using this formulation, equation (4) becomes: (P'PJQQ') Q' TQTAx = P'Pr
+
i
/
f
_
4-
\~
I)
<_--
Figure 4. Definition of approximategeometry
d]KIL M N 0 P aIR I 1415 l
(10)
Since only permutation matrices are used, the selection of P, Q, P', Q' are based solely on positions of the non-zero elements of the Jacobian. The zero/non-zero structure of J is determined by the dimensioning scheme and is independent of geometry. In addition, the matrices P and Q need only be determined once per dimensioning scheme. The matrices P' and Q' must be determined each time the numeric values for a set of dimensions are altered. Matrices P and Q are determined using routine MC13D of the Harwell subroutine library which implements Tarjan's algorithm ~ for the block triangularization of a matrix. This algorithm requires O(n) + O(~') operations. Since ~- is of O(n), the total triangularization procedure is of O(n). The permutation matrices P' and Q' must be determined each time a set of dimensions is altered. The following algorithm operates on the lower block triangular matrix PAQ.
212
(
I'
_
iI .,/
i
HLZN VLIN
,
RANG POIS ANGL LDES NDIS VDIS PLIN
RhOX AREA T£)I5 DEL
DONE NEW
DRAW
Figure 5. Assigningdimensional constraints computer-aided design
IMPLEMENTATION
A prototype 2D CAD system was developed to evaluate the variational geometry approach. It is called DIMENSION and was written in FORTRAN on a DEC VAX 11/780. All input from the operator is obtained through graphic keypad and menu using a data tablet. Display to the operator is provided by a Megatek refresh display terminal. The following figures illustrate the definition and modification of geometry using the DIMENSION system. Figure 4 shows the use of a data tablet and tracking cross to define approximate geometry. Lines are defined by a rubber band technique and are delimited by pressing of the data tablet pen. Circular arcs are denoted by prolonged contact with the data tablet surface. Single points are defined by pressing of the data pen twice at the same location. When the approximate geometry has been defined, engineering dimensions are then selected from a menu and assigned to the shape as shown in Figure 5. The DIMENSION system provides constraints for lines to be horizontal, vertical, or perpendicular and parallel to other lines. Linear, angular, radial and diametric dimensions may be specifies. Throughout this input procedure, the user is notified of the number of constraints that remain to be specified for a sufficiently dimensioned shape. When a complete set of dimensions has been assigned to the geometry, the numeric value of each dimension is specified by the operator through a keypad displayed on the screen. Figure 6 shows the selection of a radial dimension. Figure 7 shows the entry of the numeric value for that dimension at the keypad.
When all dimension values have been entered, the algorithm described earlier calculates the exact geometry which corresponds to the specified set of dimensions, as shown in Figure 8. There are three circumstances in which the new geometry cannot be obtained: when the operator has inadvertently specified too few dimensions for some portion of the geometry, when the operator has specified too many dimensions for some portion of the geometry, and when the operator has specified the correct number of dimensions but has specified an inappropriate numeric value of a dimension, and the geometry cannot be physically realized. In all three cases, the DIMENSION system describes the problem graphically as in Figure 3 and allows the user to make corrections. Once the geometry has been determined, area properties such as perimeter, area, centroid and polar moments of inertia are calculated and displayed as shown in Figure 9.
R
4.06 D
.,:
,43 ° ~
25. 14
~
.
.
~
I
BI •0 R
27. 2 8
Figure 8. Modified geometry
I
ABCD!EIFGHT J K - I"1N O P Q R
S r U j v J~ I X Y E ~
123 4 5 6
P~T~171.94733 ^REA - eT&~sse - .143~. 3 5 3 5 2
HX .¥ ZX Ty
7 B 9
. iucr
0
= ~aass. zsas7
~.1.27374. 953.1.3 = 7~b"2. 7~313 ~ -6194.. 4 7 5 5 9
I"XY
X CENTROID== Y CENTROID ~ <
27. 28
:~l
'
\
I
~
9:-'~- R
I II II J ll GO
STEP
II II II
NEW 'J^VE ZOOlq VIEW ~ L X
.1.5. 3:~951 .1.6. 4.B749
I I
DSPL EXIT ZNSP ALTR COPY LOW
F-Ii--I
PROP r'SZZ
Figure 6. Selection o f a dimensional constraint
lB. Ol~
ABCD F-OHZ JKLYNOPOR LS T U V W X Y Z cLR
4_29 456
~ ~ B . 60 R
<
7 8 9 26, Ill
SP
8
ENT
51
ENTER VALUE 6.88
Figure 7. Entering numeric value
volume 14 number 4 july 1982
3~. I~e _
_
"~6.
66 R
Figure 9. Calculation of geometric properties
213
CD'E'FGH2 L M!N!O P 0 R ,!'T U V W X YZ=,,
123 4 5 6 789 .
I
GO
err
STEP NEW SAVE ZOOM VIEW RELX D ~ L
PERt"METER = .1.76.0880i AREA = I~. ~73 MX = 1868e. 13672 MY = 1S~98. 18555 TX = i 739E7. 1875~ ZY = ~k~,?,2±. 5 6 2 5 0 ZXY = 1.2214. .~i~781 X CE.NTROI"D= £6. 098L7 Y CENTROID= 18. 68812
EXiT ~NSP ALTR COPY LOW
122
PROP CS~E
T
fled clearances. This would give the designer a quantitative basis for specifying tolerances. For applications in which the engineering relationships between associated dimensions of components in a complex assembly can be related mathematically, geometric changes on all components can be automatically determined from a minimum of operator input. Today, a major use of geometric models if for the creation of drawings. Since these drawings are interpreted by humans, the 'do not scale' concept can be tolerated. Unfortunately, these geometric models must be used for such purposes as the generation of finite element meshes, mass properties, and NC tool paths. These operations require that the geometry and the dimensions be consistent. Therefore, as human interpretation is replaced by machine interpretation, the requirement that geometry be consistent with dimensions will be come more stringent. Variational geometry provides an effective means for accomplishing this goal.
ACKNOWLEDGEMENTS AREA =1000, 00
~6.00
R
Figure I O. Result of modification of area The operator is also able to constrain the area of the part shape. In Figure 10 the area constraint has been substituted for a point-to-point dimension. The desired value of the area is specified and the geometry is updated to satisfy the area constraint while maintaining all other constraints.
CONCLUSIONS Interactive, high-level modification of part geometry via a change in dimensions is a powerful tool for CAD applications. As shown above, the need for precise input of geometry can be eliminated. It provides the designer with a very natural 'back-of-the-envelope' method for specifying part geometry. The ability to sketch appropriate geometry and subsequently supply numeric values for dimensions may provide a procedure by which existing drawings prepared by manual means (where the geometry and dimensional values are rarely consistent) can be assimilated into a CAD system. Families of parts, where parts differ dimensionally, may be stored as a single representation together with lists of numeric values for dimensions. This will result in a substantial saving in disc storage as well as providing a concise method for relating similarly dimensioned parts. The ability to alter the geometry of a part by varying the numeric values of the dimensional constraints, permits direct analysis of a tolerancing scheme. The effect of a single tolerance or the complete set of tolerances on the total shape can be directly evaluated. Using the same mathematical techniques, one could specify the nominal dimension and the clearances between mating parts, and the system could then compute the maximum variation in dimensions (tolerances) that would maintain the speci-
214
The authors gratefully acknowledge the financial sponsorship of the research at MIT by the Computervision Corporation, Bedford, MA, USA. REFERENCES 1 Sutherland, I E 'Sketchpad: a man-machine graphical communication system' MIT Lincoln, Lexington, MA, USA (January 1963) 2 Requicha, A A G 'Part and assembly description languages: dimensioning and tolerancing' Production Automation Project, University of Rochester, Rochester, NY, USA (May 1977) 3 Gopin, A M Development of a dimension based data structure for two-dimensional computer graphics Unpublished Master's Thesis, MIT, USA (1978) 4 Hillyard, R C and Braid, I C 'Analysis of dimensions and tolerances in computer-aided mechanical design' Comput. -AidedDes. Vol 10 No 3 (June 1978) pp 161-166
5 Hillyard, R C 'Dimensions and tolerances in shape design' Technical Report No 8, University of Cambridge Computer Laboratory, Cambridge, UK (1978) 6 Light, R A Symbolic dimensioning in computer-aided design Unpublished Master's Theseis, MIT, USA (1980) 7 Lin, V C, Gossard, D C and Light, R A 'Variational geometry in computer-aided design' Proceedings of SIGGRAPH (1981) 8 Harwell Subroutine Library, Systems Division, AERE Harwell, Oxfordshire, UK (1979) 9 Duff, I S and Reid, J K 'An implementation of Tarjan's algorithm for block triangularization of a matrix' CSS Report No 29, AERE Harwell, Oxfordshire, UK (April
1976)
computer-aided design