The International Journal of Engineering and Science (The IJES)
Solving geometric constraints system
1. Computer-Aided Design, Vol. 30. No. 1, pp. 47-54, 1999
0 1999 Elsevier Science Ltd. All rights reserved
Printed in Great Britain
PII: SOOlO-4485(97)00052-3 001 O-4485/99/$1 9.00+0.00
ELSEVIER
Solving geometric constraint
systems. I. A global
propagation approach
Xiao-Shan Gao* and Shang-Ching Chout,*
The main difficulty of finding a construction procedure
We describe a geometric constraint solving method/system that for a declaratively described diagram is the existence of
takes the declarative description of geometric diagrams or loops in the description, i.e., more than one geometric
engineering drawings as input and outputs a sequence of steps to objects are constrained or referred simultaneously. We
construct the diagram with ruler and compass if it succeeds. We use a global propagation to solve constraint problems
extend the local propagation to a global one. Like the local with loops. Like the local propagation method”3’2, it
propagation. the global propagation tries to determine the position tries to determine the position of a geometric object from
of a geometric object from the set of geometric objects whose the set of geometric objects already drawn. But our propa-
positions are already known. However, our global propagation uses gation uses not only the constraints involving this object but
not only the constraints involving this object but also implicit also implicit information derived from other constraints.
information derived from other constraints. The algorithm can be The global information needed in the propagation comes
used to build intelligent CAD and interactive computer graphic from a geometry information base (GIB) built before the
systems. 0 1998 Elsevier Science Ltd. All rights reserved construction begins. The GIB for a configuration is a data-
base containing all the properties of he configuration that
Keywords: geometric constraint system solving, global propa- can be deduced using a fixed set of geometric axioms 13.
gation, intelligent CAD Other distinctive features of our method are as follows.
(1) Besides the dimensional constraints specifying a dis-
tance or an angle, we use many implicit constraints, such
as the congruence of line segments or angles and ratio of
INTRODUCTION line segments, to specify relations among geometric objects.
Using these implicit constraints, we can describe more con-
Motivation straint problems than using dimensional constraints alone.
(2) We use methods of automated geometry theorem prov-
ing from13,14,15 build the GIB, to solve the over-constraint
to
Solving geometric constraints is the central topic in much
problem, and to give proper conditions under which auxili-
of the current work of developing intelligent cad sys-
ary points can be added.
tems ‘,2*3,4s67 and interactive constraint-based graphic
Our program based on the global propagation method is
systems8X9X’0. The main advantage of using the constraint
implemented in Prologue. The program is used to solve 134
approach is that the resulting systems accept declarative
constraint problems with different type of loops. Statistics
descriptions of diagrams or engineering drawings, while for
on the running time for the 134 constraint problems can be
conventional systems the users need to specify how to draw
found in Section Section 5.
the diagrams.
Based on our previous work on automated geometry
theorem proving, this article describes a geometric con- Related work
straint solving system/method that takes the declarative
description of a geometric diagram as input and finds a Three main approaches were developed to solve geometric
procedure of how to draw the diagram using ruler and constraints: the construction approach, the numerical
compass. A diagram that can be drawn with ruler and com- approach, and the symbolic approach.
pass is called an rc-configuration. Rc-configurations, used In the construction approach, a pre-treatment is carried
in most commercial CAD softwares, are easy to compute out to transform the constraint problem into a new form that
and cover most of the practical design problems. is easy to draw. A majority of the work is to transform he
constraint problem to and rc-configuration3,4,5,6z’6. Once a
constraint diagram is transformed into constructive form, all
*Institute of Systems Science, Academia Sinica, Beijing 100080, P.R. its solutions can be computed efficiently. The gruphic-con-
China structive method is used to give complete methods of find-
TDepartment of Computer Science, The Wichita State University, Wichita,
KS 67208, USA
ing construction procedures for constraint problems without
$To whom correspondence should be addressed. loops 16. Effective methods of “breaking” loops are pre-
E-mail: chou@cs.twsu.edu. sented by Hoffmann, Kramer, Owen, and Verroust3”‘5”7. The
47
2. Solving geometric constraint systems: X-S Gao and S-C Chou
Table 1 The geometnc constraints
Constraint Geometnc meaning
DIS(A, B. 4 iABt = d
ANGLE(A. B. C. (I) i(ABC7 = t,
PLDIS(P. A, 8. tl) distance tiwn P to lint AR is (/
CONG(A, B. C. D) iARt = iCD1
EQANGLE(A. B. C. P. Q. K) i(ABC) = I(PQK)
COLL(A. B. C) A. R. C are collinear
PARA(A. B, P. Q, AB is parallel to PQ
PERP(A. B. P. Q, AB is perpendicular to PQ
MID(M. A. RI M is the midpoint ofAR
SRATIO(A. B. P, Q, r,. ,‘?) I~BlilPgl = r,/r?
basic idea is to divide the configuration into components
such that each component itself has no loops and all the
components can be put together in some way. This approach
is powerful enough to solve many difficult constrain pro-
blems. Another approach is to use techniques form AI such
as searching and rule-based systems to solve constraint pro-
blems ‘,276,7.
In the numerical approach, geometric constraints are
translated into algebraic equations and various numerical B P Q C
techniques are used to solve these equations. The first gen-
Figure 1 An example of a triangle with a quare inside
eration constraint-based systems, such as Sketchpad “’ and
ThingLab’. used numerical relaxation as the last resort of
solving constraint problems. Newton iteration methods were characteristic points. The main advantage of this approach is
used in Juno-2” and in the Variational Geometry’*. The that the number of constraints can be minimized. Fewer
main advantage of numerical methods is their generality. constraints usually lead to an easy so1ution.A construint
In contrast, it also needs further improvements in several problem is defined as follows
aspects: like finding stable solutions during animation.
In the symbolic approach’y,‘0.2’, we also transform the l1Q,~....e,,l,[~,~ . . .. ~,,I,Ic,~....G,11
geometric constraints into algebraic equations. Instead of
using numerical methods to solve the algebraic equations. where Q, are the points whose construction order, Q ,, ..Q ,,,,
in the symbolic approach, we first use general symbolic is given by the user; P, are the points whose construction
methods such as Wu-Ritt’s characteristic method or the order will be determined by the program; and C, are the
Griibner basis method to change the equation set to new constraints.
forms which are easy to solve, and then solve the new equa- An Example.
tions numerically. Kramer’s approach can also satisfy the Consider the constraint problem: “In u solid object, there
geometric constraints in a symbolic way”. In this approach, is u hollow triangle tunnel. We want to put u prism with u
there are no set of explicit equations created. Other related syuctre cross section into the tunnel in a position as shown in
approaches can be found in’-. Figure 1.” Note that all the collinear constraints in Figure I
The rest of the article is organized as follows. Section are not explicitly given. We only need to consider the
Section 2 presents the problem formulation. Section normal cross section. Then the problem is reduced to a
Section 3 presents the method. Section Section 4 presents plane constraint problem: to put a square into a triangle
more details of the method. Section Section 5 is a summary ABC. In this example, points A, B, C, are known. So we
of the article. can describe the problem as follows: [[A, B, C], [P, Q, S. R],
[the constraints]].The constraints:iABl = dl. IBCl = d2,
ICAi = d3PQNSR, SP//QR, lRSi = IRQIRQ is perpen-
dicular to BC
PROBLEM FORMULATION
Construction by ruler and compass
Geometric constraint systems
A geometric configuration that can be constructed using a
Some of the main constraints used by us are in Tuhlr I. ruler and a compass is called an rc-configurations.
Besides the dimensional constraints specifying a distance or Precisely, a diagram is an rc-co&wution if the points in
an angle, we use many implicit constraints, such as CONG. the diagram can be listed in an order (Pi,. .,Pk) such that
EQANGLE, MID, and SRATIO ( see Tub/e I ), specifying each point P, can be constructed using the following three
relations among geometric objects. Using these implicit basic constructions:
constraints, we can describe more constraint problems than
using dimensional constraints alone. The problems in ( 1) construction (POINT, P) takes a free point P in the
Figures I, and4 are such examples. Without using algebraic plane:
equations, we cannot describe this diagram with dimen- (2) construction (ON, P, o;
sional constraints. (3) construction (INTERSECTION), P, o,, 02) takes the
Our method uses points as the only basic geometric intersection P of a line or a circle o1 and another line
objects. Lines and circles are defined as functions of their or circle 0’.
48
3. Solving geometric constraint systems: X-S Gao and S-C Chou
We consider three cases. (1) s = 0. Point P is an
arbitrarily chosen (free) point. We add a new con-
struction C - (POINT, P) to CS. (2) There exist i # j
such that Ti # Tj and Lci and Lcj are not parallel lines
or concentric circles.? We add a new construction C =
(INTERSECTION, P, Lci, Lcj) to CS and remove Ti
and Tj from CT. (3) Otherwise, point P is a semi-free
point: it can move freely on a line or a circle. We add a
new construction C = (ON, P, Lc ,) to CS and remove
T1 from CT.
Figure 2 Hoffmann’s example in Ref. 3 (4) Now we check whether the remaining problem is over
constraint, that is, whether ICTl > 2*IPSI (note this
inequality is different from the one in Step 1). (1) If it
So for an rc-configuration, associated with each point is, the construction sequence is invalid. If P is from QS,
construction order (P,,. .,Pk) there is a construction the order given by the user cannot be constructed and
sequence (C ,,. . . ,C,) such that point Pi is determined by the method terminates. Otherwise, restore the removed
construction Ci. constraints and repeat the preceding step for a new point
Lines and circles are represented as functions of their from PS. (2) If it is not over-constraint, point P is con-
characteristic points. For instance, the following are some structed. We need to repeat the preceding step for a new
of the lines used in the method: (LINE, P, Q) is the line point.
passing through points P and Q; (PLINE, R, P, Q) is the line
passing through R and parallel to line PQ; (TLINE, R, P, Q) The crucial step of the previous method is how to deter-
is the line passing through R and perpendicular to line PQ; mine the locus Lc form a constraint T in Step 3. In what
(BLINE, P, Q) is the perpendicular bisector of segment PQ; follows, we will discuss this in detail. In the following, we
(DLINE, P, Q, d) is the locus of the points having distance d will always use A, B, C,... to represent known or con-
to PQ, i.e. it represents two lines. We also use the following structed points, and U, V, W,... to represent any points
forms of circles. (PCIR, 0, P) is the circle with center 0 and known or not. P is the current point to be constructed and
passing through P; (RCIR, 0, r) is the circle with center 0 T is the constraint.
and radius r; (ACIR, P, Q (Y) is the circle (or an arc)
consisting of the points R satisfying LPRQ = a; (CCIR, Determine a line
P, Q, R) is the circle passing through three points P, Q, and
R; (DCIR, P, Q) is the circle with PQ as a diameter. Our method allows partial properties of geometric objects t
For convenience, we use another construction: (MRATIO, be propagated. We consider three partial properties for a
P, Q, R, rl, r2) which constructs a point P-_on line QR line L: (Li) L has a fixed direction; (&) L passes through a
such that the ratio of the directed segments QPlPR is rl/ known point; (L3) L tangents to a known circle. We thus
r2, where rI and r2 could be numbers or algebraic have five possible forms to determine a line: (LiJj), i 5 j
expressions in geometric quantities. It is known that the and 0’ # 1).
construction MRATIO can be reduced to the three basic For case Li, we first have some basic situations which can
constructions. determine the direction of line L. The most frequently used
are (1) L passes through two known points; (2) L cuts a fixed
length between a pair of parallel lines; (3) L cuts a pair of
THE METHOD segments on the sides of a known angle such that the ratio of
the segments is known; (4) L cuts a pair of segments
between three known lines passing through a point such
The method takes a constraint problem as input, and finds a
that the ratio of the segments is known. Second, any line
construction sequence for it to succeed. The main steps of
with known direction will be propagated to a line with
the global propagation method are given later.
known direction by the following propagations: (1) parallel,
(1) For a constraint problem (2) perpendicular, and (3) forming a known angle. So the
direction of a line is usually determined by a sequence of
UQ ,....,Qml, [P,,...,P,J> [C,,...,C,nll, lines UIV1rl U,V, r2 . . . T,.~ U,V,, where Ui, Vi are points
let CT = { C1,...,Cm} be the constraint set, CS = 0
and ri are transformations. If the direction of U,V, is deter-
the construction sequence, QS = {Q ,,. . .,Q,] the points
mined by one of the basic situations, the direction of line
with given construction order, and PS = (P ,,. . .,P,} the
lJ,V, is known.
rest points to be constructed. We assume that the pro-
The previous process clearly demonstrates the global
blem is not over-constraint, i.e., we have ICTl 5 2*
feature of the propagation. It also demonstrates the advan-
iP,S - 3. For our treatment of over-constraint problems,
tage of using partial properties of geometry objects: even if
see Section 4.2.
the geometric object is unknown, some of its partial proper-
(2) Build the GIB as described in Section 4.5. Then repeat ties can be propagated.
the following steps first for QS and then for PS until Let us consider the example from3 (Figure 2). After con-
both QS and PS become empty. structing B, C, X, we need to construct D. Since IXDl is
(3) Take a point P from QS or PS. For each constraint known, we need only to know the direction of XD which
T E CT involving P, decide the locus Lc of P satisfying can be determined by global propagation: XD _L DE,
T, assuming all points constructed in CS are known. We L(DEA) = a2, AE I AB, and L(ABC) = al.
then obtain a set of triples
t We can check these conditions using automated theorem proving methods
such as Wu’s method’4,20 and the area method” which are quite fast.
49
4. Solving geometric constraint systems: X-S Gao and S-C Chou
Xl.
Figure 4 An example of the tirst kind of LC transformation
our method. By case (3) of L2, line UV passes through the
similarity center of circles 0, and O?, i.e., the intersection W
of line OIOz and a common tangent line TITz of the two
circles (which is easy to construct). Our GIB also contains
the fact (theorem) that the other intersection K of (CCIR, T,,
T. A) and (LINE A, W) is also on the circle to be constructed.
Let S be the intersection of circles (CCIR, TI,T,2,A) and
Figure 3 One of Appolonius’ problems
(PCIR, 02,T2) and H the intersection of lines AW and T2S.
Then OzV is perpendicular to HV. We hence can construct
point V. Then the circle to be constructed is (CCIR, V,K,A).
The process of determining a circle is similar to that of
Three cases lead to Lz. ( I) There is a known point A on L. determining a line. We will omit the details caused by limit
(2) If the ratio of the distances of two known points A and L on the length of the article.
is rIIr2 then L passes through a fixed point Q which can be
introduced by the construction (MRATIO, Q. A. B. rl. r?).
LC transformations
(3) If a circle is tangent to two known circles, the line con-
necting the two tangent points passes through the similarity
An LC truns~tirmation is a one-to-one map from the
center Q of the two known circles.
Euclidean plane to itself which transforms a line to a line
Four most frequently used cases for L3 are given below.
and a circle to a circle. We mainly use two kinds of LC
(1) Line L is tangent to a known circle. (2) Line L cuts a
transformations.
segment with fixed length in a known circle. In this case, L is
The first kind is related to the constraint SRATIO(P, Q, R,
tangent to a concentric circle of the known circle. which
Y,. r2). If points P, Q, and R are collinear and one of them,
passes the midpoint of any chord of the known circle with
say Q. is already known, then point P is on a line or a circle
the known length. (3) The chord cut by L on a known circle
if and only if point R is on a line or circle. The method works
faces a known inscribed angle on the circle. This case can be
as follows. Let P be the point to be constructed, Q a known
reduced to case (2). (4) L cuts a segment with fixed length
point. Then we will call the main method to see whether
between two known concentric circles.
point R is on a line or circle. If it is, we will compute the
corresponding line or circle that point P is on.
Determine a circle Consider the constraint problem in Figure 4. Suppose we
have constructed points A and B. Since i(ACB) = a ,, point
The most frequently used partial properties of a circle are C is on circle Cr = (ACIR, A, B, CI We construct the center
,).
given below. (C,) The center is known. (Cz) The center is on X, of circle Cr$. Since M is the midpoint of BC, point M is
a line. (C,) The center is on a circle. (C,) The radius of the on another circle (DCIR,X?,B). Hence M is the intersection
circle is known. (C,) The circle passes through a known of (RCIRJ,d,) and (DCIR,X2,B).
point. (C,) The circle is tangent to a known line. (C,) The A problem;n the construction of point C is: which con-
circle is tangent to a known circle. To determine a circle, straint will be removed from the constraint set. Constraint
we need three constraints. The most interesting cases are the iACB = a, must be removed. If we remove constraint
so-called Apollonius ‘s drawing problems. namely. deter- (COLL. M,B,C) or MB = MC, the further construction of
mining the circle if three constraints (C,. C,. Ck), point M will lead to inconsistency. The right choice is to
5 5 i i jsk 5 7 are given. In3, this kind of problem is remove constraint lAMI = d2. There is actually a generul
solved using algebraic techniques such as the GrGbner basis rule of’rrmoving constmints: if an LC transformation is used
method. Our program can provide geometric construction to construct a line or a circle, then the constraint leading to
for all of the ten Appolonius problems. Besides the two the original line or circle (before transformations) will be
trivial cases (CS,CS,CS) and (C6,C6.C6). five of them. removed. Related discussions can be found in Section 4.1.
(CS,CS,CS), (CS,CS,C7). (C5.C6,C6), (C5,C7.C7). and The second kind of LC transformations is as follows:
(C7,C7,C7), are included in our collection (problems 79. suppose that segment AB has a fixed direction and a fixed
103 > 100 3 105 and 106 in23). length then point A is on a line or a circle if and only of point
Figure 3(a)’ shows an engineering part which needs the
case (Cs,C7C7). Suppose that 0, and O2 are two known
circles and A is a known point. We need to construct a -1:
The center Q of C, can be constructed its follows: Take a point XI such
circle B which tangents to circles 0, and O2 and passes that .~_(ABX, ) = rr ,. Since BX, is a tangent line of circle Cr. X2 i< the
through point A. Figure 3(b) shows the solution given by interwction (BLINE. A.8) and (TLINE.B,B,X,).
50
5. Solving geometric constraint systems: X-S Gao and S-C Chou
the constraint to be transformed. Otherwise, inconsistency
will occur in the construction of the next point 44.
In some cases, such as in using the LC transformations,
this problem can be solved by proper selection of con-
straints. In more complicated cases, we use the following
methods. (1) Changing constraints. In some cases, to pre-
serve the consistency, we need not only to change the
involving constraint but also to change other constraints.
(2) Use new constructions. We have noticed that the incon-
sistency is caused by the existence of multiple solutions
Figure 5 An example of the second kind of LC transformation rising from taking the intersection of a circle with a line
or a circle. To discard the wrong solution, we just need to
collect all the constraints about the constructing point
B is on a line or a circle. An example is given in Figure 5.
and check which of the intersections satisfy them.
Suppose that points A and C were constructed. Next, we
We need to introduce the following new construction,
construct point B. Since LABC = al, B is on circle
(INTERSECTION, P, 1, c, e) where e is a set of constraints
Ct = (ACIR, A,C,a,). Similarly, point D is on circle C2 =
to be satisfied. The construction means that P is the inter-
(ACIR, A,(&). Since BD has a fixed direction and a fixed
section of line I and circle c that satisfies the constraints e.
length, point B must be on another circle C3, and B is the
Note that these logic expressions are used during the draw-
intersection of circles C2 and C3.
ing of the diagram; hence, all related variables in the logic
expression are numerical ones. The difficulty here is that if a
More construction methods
number is very small, we do not know whether it is zero.
Fortunately, most design problems do not contain such
We just mentioned three major techniques of obtaining a
cases. Actually such cases occur only when we change the
locus from a constraint. In our method, more methods of
diagrams dynamically, and can be taken care of by examin-
constructing loci are used. Some of these methods are
ing whether the denominator of an expression vanishes
targeted to certain problems such as those involving he
when evaluating it.
centroid of a triangle, angle bisectors, special properties of
Consider the constraint problem in Figure 5. After con-
squares, etc. Others are quite general. One such case is
structing points A,C,B and 0, two constraints are left for
related to constraint SRATIO. Suppose we wish to construct
point D: COLL(D,B,O) and DIS(D,B,dz). Then point D
point P which satisfies constraint PPIIPP2 = rJr2. One of
is the intersection of a line and a circle. But only one of
the eight solutions to this constraint used in our program are the two intersections is correct and can be constructed as
given below. If P, and P2 are on two known lines L, and L2
follows: (INTERSECTION, D, (LINE,B,O), (RCIR,B,d&
meeting a point A and PP2 have fixed directions then the
(ANGLEP,D,C&).
locus of P is the line passing through point A and the
intersection point of two lines having fixed distances to lines Over constraint
L1 and Lz, respectively. If LlllL2, the locus is also a line.
Solving the constraint problem in Figure 1 needs this Following Hoffmann3, a constraint diagram is call well
rule. Since RQIRS = l,RQIBC, and RSIIBC, R is on a line dejined if it has n characteristic points and 2*n - 3
BH, where H is the intersection of line (PLINE, C&B) and independent constraints. The shape of a well-defined
the line (DLINE,B,C, lBCl>. diagram is determined up to finite possibilities, while its
Another general technique is the base triangle method. position in the plane is totally free. To decide whether
The idea is that when the shape of a triangle ABC can be some concrete constraints are independent, generally speak-
determined while its position is unknown, we can draw a ing, we need general purpose al ebraic techniques such as
triangle A’B’C’ which is congruent to triangle ABC and then Wu-Ritt’s characteristic method !+ O,*‘.
transform A’B’C’ to the right position. The base triangle To solve over-constraint problems, we first remove the
method can be extended to the base polygon method. proper number of constraints and let the remaining problem
One of the special case is very useful. Suppose that become a well defined one, and then find a construction
points PI,P2,...,P, satisfy the following conditions: sequence for the new constraint problem. Suppose that the
DZS(PiP, + 1) = di, i = 1$...,n-l, ANGLE(P,,Pj + 1,Pj + new constraint diagram is an rc-configuration RC and that a
2) = fj j = l,..., n-2. Then P,P...P, is a known polygon. construction sequence is founded. Then there are two
In particular, the length of P lP, is known and if point PI is possibilities. (1) For an rc-configuration there exist very
known then point P, is on a circle. efficient methods of proving assertions about the configura-
tion such as the coordinate-based method in14 and the area
method in15. Using these methos, we can check whether the
POINTS OF FRICTION removed constraints are valid on the configuration RC. We
need simply remove those constraints which are valid on
Constraint transformation RC. (2) For those constraints not valid on RC, we can solve
the problem in the following special case. Suppose that the
The basic idea behind the method of breaking “loops” of extra constraint is a directional constraint, that is, a con-
constraints given in Section Section 3 is to transform a straint like parallel or perpendicular. Then we can move RC
constraint to a different but equivalent one. A problem to satisfy this constraint without changing the shape of RC.
related to the constraint transformation is that in some cases In other words, we need only to move RC to a new position.
a locally equivalent transformation may lead to incon- Consider the following example: “Draw a circumscribed
sistency in other constructions. For example, in solving the triangle ABC in a given circle 0, if IABI, IACI are known,
constraint problem in Figure 4, we must consider lAMI = d2 and BC is parallel to a given line XY.“Figure 6
51
6. Solving geometric constraint systems: X-S Gao and S-C Chou
problem in Figure 7 is a part of a larger constraint problem
and in the solution of the larger problem points 0 and P are
already constructed and we need to construct A and B. Then
we have to use the second construction sequence. This trick
was also used in the example of Section 2. I.
Multiple solutions
For a given construction sequence, different diagrams can
be constructed because some constructions such as the
Y X intersection of two circles give more than one point. A
Figure 6 Constructing a tipure by temporarily removing one or more
major advantage of using rc-configuration is that we can
constraints skip from one solution to another in the sam e construction
sequence without difficulty.
For a well defined constraint problem, we can use the
After removing the constraint BCIIXY, a triangle A’B’C’ method provided in” to show that by introducing some
can be drawn easily. Let M be the midpoint of B’C’. By (2) heuristics of selecting roots, the method can construct a
of case L) in Section 3. I, line BC is a tangent line of circle unique diagram which is “similar” to a given sketch.
(PCIR, O&f). Since BCllXy. we can draw ABC without Further, the diagrams constructed by using all possible con-
difficulty. struction sequences are congruent. To prove this fact, first
not that the rc-construction for a well defined diagram is a
Multiple construction sequences special case of the cluster formation in24. For a well defined
diagram, we need only taking the intersection of lines and
The search mechanism used by us may lead to different circles, and these constructions can be treated as cluster
construction sequences for the same constraint problem. formation. Therefore, by using the heuristics introduced
Different construction sequences might occur because for in “, all the resulting diagrams will be congruent. Here,
the sam construction order of points, certain points can be the construction of auxiliary points should also follow the
constructed in more than one way. But the majority of the heuristics. An interesting problem is the extend the result
different construction sequences are caused by different in ‘4 to the solutions of general triangular sets2’.
construction orders of points. Although these different If the constraint problem is under-cnnstruint, i.e.
construction sequences give the same picture, they might be ICTl < 2 * L - 3 where L is the number of points, the
quite different in computational complexity and have shape of the diagram may change continuously resulting
different geometric meanings. This allows us to select the in infinite solutions. In our program, the user is allowed to
best one among a set of construction sequences. For drag the free (constructed by POINT) or semi-free (con-
instance, we can find the construction sequence using the structed by ON) points in the diagram to change the dia-
least number of auxiliary points. In other words, the shortest gram. Under-constrained problems are rare in real design
construction sequence, which can be selected using the problems. In contrast, almost all problems from automated
breadth-first search or the depth-first iterative deepening geometry theorem proving are under-constrained.
search23.
Consider Figure 7. If the construction order is O,A,B,P. Geometry Information Base (GIB)
the construction sequence is easy to find. If the construction
order is O,P,A,B, the construction sequence can be given The geometric information needed in the global propagation
using case (2) of partial property L1 in Section 3.1. Speci- comes from the GIB. The GIB for a configuration is actually
fically, we need first to draw a chord XoX, of length di of a database containing all its properties that can be deduced
circle (RCIR,O,d,. Let X2 be the midpoint of the chord. from a fixed set of geometric axioms. To build a GIB for a
Then line AB is coincident with the tangent line drawn geometric configuration, first the original constraints should
from point P to circle (PCIR,0,X2). The second construction be put into the GIB. Then the program will keep applying a
sequence is more complicated, but it has a different fixed set of geometric rules (or axioms) to all the data in GIB
geometric meaning. Geometrically it means “in a given to get new data and to put the new data into the GIB until
circle, draw a chord that has a fixed length and passes nothing new can be obtained. The actual implementation is
through a known point.” much more complicated ‘?.
To construct a diagram in different point order is also The aim of the GIB here is to find collinear points and
useful in the following situation. Suppose that the constraint cyclic points as much as possible. The key concept is the
,fill-angles. which are the directed angles between lines”.
The basic rules about full-angles are (1) the generalization
of the inscribed angle theorem: “full-angle (PA,PB) = full-
angle (QA,QB) # 0 iff P,Q,A,B are on the same circle.” (2)
full-angle (OA,AB) = full-angle (AB,OB) # 0 iff OA =
OB. (3) full-angle (AB,CD) = full-angle (AB,UV) + full-
angle (UV.CD). (4) Triangles ABC and PQR are similar if
full-angle (AB,BC) = full-angle (PQ,QR) and full-angle
(AC.BC) = full-angle (PR,QR).
To enhance the speed of database construction, we pre-
sented the techniques of data-based search and structured
Figure 7 An example of multiple construction wquences dutahase’“. With these techniques, the building of GIB is
52
7. Solving geometric constraint systems: X-S Gao and S-C Chou
Table 2
Time % Time % Time % Time % Time %
< 0.5 18% < 1.0 47% < 2.0 77% < 5.0 94% < 22.0 100%
very fast. It costs less than one second for 70% of the 130 not WYSIWYG (what you see is what you get). Our next
difficult geometric problems tested in13. The time of build- goal is to integrate the two programs to implement a double
ing the GIB is tolerable, since we need only do that once for viewing and WYSIWYG system.
each problem. Table 2 contains statistics on the running times needed for
the Prologue based program to find the first solutions of for
Adding auxiliary points the 134 constraint problems on a Spare-20. The average
timing is 1.84 s. To find the shortest solutions is much
In most cases of breaking loops, we need to add auxiliary more time consuming.
points. Before adding an auxiliary point, the program first A problem with all construction approaches including the
searches the GIB to see whether here is a point satisfying all one in this paper is that it seems impossible to give a com-
the conditions of the auxiliary point. If it is, we need no plete set of construction rules because of the intrinsic diffi-
introduce the new point. Otherwise, a new point is added to culty of solving geometric constraint problems. A challenge
CS. After adding an auxiliary point, the GIB is enlarged to problem is to find a set of construction rules which can be
include the constraints for the new point. used to draw regular polygons with five or seventeen sides,
Another problem is that some extra conditions are needed which can be drawn with ruler and compass. An alternative
to guarantee the existence of the auxiliary points. For way to achieve completeness is to use symbolic computa-
instance, if the new point is the intersection of two lines, tion techniques. This is the topic of Part II of this article.
the two lines cannot be logically parallel, which can be
checked with the theorem proving method in14. A more
interesting case is that the two lines are not parallel if the ACKNOWLEDGEMENTS
diagram is in “general positions”, and in some specific cases
they might become parallel. In automated theorem proving The authors wish to thank Jianxin Ge of Zhejiang
these kinds of conditions are critical for the logic correct- University for helpful discussions. This work was supported
ness of the proofs. Since our main goal is to draw the dia- in part by the NSF Grant CCR-9420857 and was accom-
gram, this seems not a serious problem: diagrams satisfying plished at Wichita State University. Gao was also supported
extra conditions such as two “generally non-parallel” lines in part by Chinese National Science Foundation.
becoming parallel consist of a very small part of the set of
all diagrams (actually probability zero). During numerical
computation, these conditions usually correspond to the REFERENCES
vanishing of the denominators of some expressions and
have been taken care of using some special measures. I. F. Arbab & B. Wang, Reasoning About Geometric Constraints,
Intelligent CAD II, H. Yoshikawa and T. Holden (eds), North-
Holland, 93-107, 1990.
2. B. Brudelin, Constructing Three-Dimensional Geometric Objects
DISCUSSION Defined by Constraints, in Workshop on Interactive 30 Graphics,
p. 11 l-129, ACM, 1986.
This article demonstrates that for a large portion of rc- 3. C. Hoffmann, Geometric Constraint Solving in RZ and R3, in Comput-
ing in Euclidean Geometry, eds D.Z. Du and F. Huang, p. 266-298,
configurations described declaratively with loops, we can
World Scientific, 1995.
find construction sequences for them geometrically. We 4. G. Kramer, Solving Geometric Constraint Systems, MIT Press, 1992.
have searched from more than one thousand constraint 5. .I. Owen, Algebraic Solution for Geometry from Dimensional
problems and picked 134 each having different kinds of Constraints, in ACM symp. Found of Solid Modeling, ACM press,
loops. Our program has been used to solve all of them p. 397-407, Austin TX, 1991.
6. G. Sunde, Specification of Shape by Dimensions and Other Geometric
efficiently. Checking over-constraints in Step 4 of the Constraints, in Geometric Modeling for CAD Applications, M.J.
method is crucial to the performance of the method. Without Wozny, et al., eds, 199-213, North Holland, 1988.
this step, the method will search all the possible permuta- 7. R.C. Veltkamp, Geometric Constraint Management with Quanta,
tions of the points in the problem. Our experiments show Intelligent Computer Aided Design, DC. Brown et al., eds, 409-426,
North-Holland, 1992.
that this step prohibits most of the unsuccessful search at a
8. A. Borning, The Programming Language Aspect of ThingLab, ACN Trus.
very early stage. on Programming Language and Systems, Vol. 3, No. 4, 353-387, 1981.
The method is implemented in Prologue to take advan- 9. A. Heydon & G. Nelson, The Juno-2 Constraint-Based Drawing
tage of its search engine. After the generation of a construc- Editor, SRC Research Report 131a, 1994.
tion sequence, we draw the diagram using our C/Xwindow 10. I. Sutherland, Sketchpad, A Man-Machine Graphical Communication
System, in Proc. of the Spring Joint Comp. Conference, North-
based system Geometry Experts which is a geometry Holland, 329-345, 1963.
theorem prover and a dynamic diagram editor. In our cur- 11. G.L. Steele & G.L. Sussman, CONSTRAINTS A Language for
rent system, the generating of construction sequences and Expressing Almost-Hierarchical Descriptions, Arfi$cial Intelligence,
the drawing of the diagram are two separate phases, so it is p. l-39, Vol. 14, 1980.
12. W. Leler, Constraint Programming Languages, Addison Wesley,
1988.
13. S.C. Chou, X.S. Gao, & J.Z. Zhang, A Fixpoint Approach To Auto-
8 The programs are available via anonymous ftp carl.cs.twsu.edu:software/ mated Geometry Theorem Proving, WSUCS-95-2, CS Dept, Wichita
gex-sparctgzicadtgz State University, 1995.
53
8. Solving geometric constraint systems: X-S Gao and S-C Chou
14. S.C. Chou. Mrclrunrctri G‘rorwtn nwor-cwr Prowr~q. D. Reidel 14. I. Fudos and C. Hoffmann. Correctness Proof of a Geometric Con-
Publishing Company, Dordrecht, Netherlands, 1988. traint Solver, Int. J of Camp Geometry andApplic, vol. 6, Dec. 1996,
IS. SC. Chou. X.S. Gao. & J.Z. Zhang. Machine Proc@ ;,I C;roww1,. p. 405-420.
World Scientific, 1994. 75. X.S. Gao & SC. Chou, Solving Geometric Constraint Problems, II. A
16. Todd, P.. A k-tree Generalization that Characterizes Consistency oi Symbolic Approach and Decision of Rc-constructibility, WSUCS-96-3,
Dimensioned Engineering Drawings. SIAM J. ofDist,. M&L, 1989. 2. CS Dept. Wichita State University. 1996.
255-26 1.
17. A. Verrouqt. F. Schonek. and D. Roller. Rule-onented method to!
parameter&d computer-aided design. G~on~etric Aided De.~i,qn.
24(3), p, 53 1.540. October. 1992.
18. Lin. V.C.. Gosaard, D.C. and Light. R.A.. Variational Geometry
In Computer-Aided Design. Computer Graphics. 198 I. 15(3). I7 I -
177.
19. Kondo, K., Algebraic method for manipulation of dimensional rcla-
tionships in geometric models. Geometric Aided Design. 1992, 24(3).
141-147.
20. Wu Wen-tsiin, Bnsk Prim?ple.r of Mechanical Theorem P rrwir~,q 111 Xiu~~.vhrrn Gao wo bonl in Hebri province (v Chino in I963. He got his
Geometrirs. Springer-Verlag. 1993. Ph.D. from the Chinese Academy (d Sciences in 1988. His resecrrch
21. S.C. Chou & X.S. Gao, Mechanical Formula Derivation m Elementary iuterc,.st.s include: crutomuted rectsoning:. symbolic computation. compu-
Geometries. Proc. ISSAC-YU, ACM. New York, 1990. p. 265270. tcr graphics and intelligence CAD, und computer aided education. He
22. Zhang, J.Z.. Yang, L. and Yang. X.C.. The realization of Elementary htr.~ published one monograph and more than 40 research paprtx He
Configurations in Euclidean Space. Scirnw in China ( wrirs A). 1994. has uvn o ,first class award in natural sciences und NII Outstanding
37(l), 15-26. Youn,q Scientist Awurd of 1997from the Chinese Academy of Sciences.
23. S.C. Chou, X.S. Gao, & J.Z. Zhang, A Collection of 130 Geometric He is (I recipient of the Excellent Youth Grnntfrom the Chinese NSF,fiw
Constraint Problems and Their Solutions. WSUCS-96-2, CS Dept. 19YH-2000.
Wichita State University, 1996.
54