Computer-Aided
OolO-4485(95hMo62-3
Design,
Vol. 26, No. 617. pp. 463493 1996 Published by Elsevtw Science Ltd Printed in Great Britain 00104465/96 $15.00 + 0.00
Local shape control for free-form solids in exact CSG representation Baining Guo and Jai Menon classification computer 3. The RCE provides powerful solutions to several critical and often computationally intractable solid modelling problems, including spatial sweeping, Minkowski operations, NC machining, and touch-sense probing 4*5.However, designing free-form solids in CSG is often cumbersome, partly because CSG solids do not have the shape control mechanism that parametric B-reps enjoy.
We present a shape control scheme for free-form solids represented in CSG as Boolean combinations of low-degree algebraic halfspaces. In this scheme, we can create manifold solids of arbitrary topology through Polyhedral smoothing, and the resulting shapes may be modified by changing control points and/or control weights, with each control point and weight having a local effect. As a solid changes shape, incremental B-rep-CSG conversions are used for fast updates of the corresponding CSG representation. A key ingredient of our scheme, and a main contribution of this paper, is an algorithm that uses Kuhn-Tucker conditions to efficiently compute valid control points. Published by Elsevier Science Ltd
Modifying CSG solids with control points /weights We present a shape control scheme for free-form solids represented in CSG as Boolean combinations of lowdegree halfspaces (a free-form solid is a manifold solid of arbitrary topology and with tangent-plane continuous boundaT). This scheme extends the control polygon based techniques of parametric B-reps to CSG free-form solids. As in parametric surface design, we create free-form CSG solids of arbitrary topology through polyhedral smoothing, and refine the resulting shapes into desired ones by changing either control points or control weights. Between a CSG solid and its control points/weights, we establish a relation somewhat similar to that between NURBSsurfaces and their control points/weights 6. In particular, the effects of control points/weights are guaranteed to be local. As is described in Reference 1, there is a rudimentary shape control scheme for a free-form solid S in CSG (see Figure 8 in Reference 1). Roughly speaking, the boundary of S lies inside a ‘polyhedral hull’, whose vertices include the so-called ‘apexes’. Within the polyhedral hull, it is straightforward to modify the shape of S by changing the control weights associated with the apexes. However, shape modifications with control weights alone are not sufficient for free-form shape design - the situation is similar to designing a NURBS surface without the ability to change its control point@. To overcome this limitation, we develop a scheme that uses the vertices of the polyhedral hull as control points, thus allowing shape control with both control weights and control points. A main difficulty with changing control points is that
Keywords: geometric modelling, constructive solid geometry, shape control
Shape control is important in free-form geometric modelling, and is becoming increasingly popular as the performance of graphics work stations continue to improve. In parametric surface design, a common technique is to specify a control polygon that generates an initial shape, which is then refined into the final desired shape through interactive adjustments of control points and/or weights. In principle, this technique works well for solids in boundary representation (B-rep) consisting of parametric patches. In Reference 1, a method for an exact representation of free-form solids in Constructive Solid Geometry (CSG) is proposed by one of us. This method represents a free-form solid (e.g. a turbine blade) as a CSG combination of low-degree algebraic halfspaces - an extension to the quadratic halfspaces in traditional CSG solid modelling systems*. These CSG free-form solids are particularly useful in the environment of the RayCasting Engine (RCE), a massively parallel CSG University of Toronto, Department of Computer Science, Toronto, Ontana, M5S lA4 Canada and IBM Research, T J Watson Research Center, Yorktown Heights, NY 10598, USA Paper received: I May 1995. Revised: 20 June 1995
483
Local shape control for free-form solids in exact CSG representation:
of ensuring a valid polyhedral hull, which is crucial for the smoothness of B-rep(S) and the correctness of CSGLS). Given arbitrary target locations of the control points, we cast the control points computation as a series of least distance programming problems of small size’. With these problems in hand, we use the fundamental Kuhn-Tucker conditions from nonlinear programming’ to move the control points as close to their target positions as possible under polyhedral hull validity constraints. When creating an initial free-form solid from polyhedral smoothing, we also use least distance programming to produce a valid polyhedral hull. As a shape control operation modifies the boundary of the solid S, the CSG representation of S needs to be updated. In the CSG representation, the boundary of S corresponds to a thick shell whose building blocks are truncated tetrahedra called ‘trunctets”. Because our shape control scheme is local, we can efficiently identify the trunctets affected by the shape control operation and update them incrementally.
B Guo and J Menon
then converted to CSG(S1. As a sequence of shape control operations change B-rep(S), we incrementally update CSGL‘3. These successive steps are detailed in the following subsections. We note that some concepts used below are not new - in particular, the polyhedral hulls we use have been described by Dahmen and Thamm-Schaar’5. whereas exact free-form solids in CSG were proposed by Menon’. The main new concepts are those related to the ‘dual control polygons’. Notations: We use lower case boldface for vectors, lower case italics for scalars, capital italics for point sets in R”, and calligraphies for collections of sets in R”. For example, /x/l = (x.x)‘/~ is the length of vector x, and Of is the gradient of a scalar function. We use [v,,...v,] to denote the k-simplex spanned by a set of points {vo, .. . , v,}, e.g. [vOv,] for an edge. General concepts A collection E of simplices forms a simpliciaf complex If it satisfies the following conditions:
Other related work Very little of the work on parametric patches has proven applicable to CSG representations. The main reason is that halfspaces induced via implicitization of parametric patches are of high degrees, leading to difficult separation, combinatorial, and numerical problems in B-rep-CSG conversions. Ghan’ represents free-form solids by extending the leaves of CSG trees to include parametric patches, but this hybrid representation fails to fully exploit CSG’s elegant divide-andconquer algorithms, often degrading CSG’s robustness. Dunnington et al.” construct polyhedral approximations using an Inner Set Outer Set (ISOS) approach, yielding polyhedra that are either in the solid or that contain the solid. Recently, Wyvill and Van Overveld” presented a method for modelling with CSG combinations of virtually unlimited variety of ‘soft’ objects (objects bounded by general implicit surfaces; see also Reference 12). They demonstrate that the boundaries of solids in this constructive ‘soft’ geometry can be efficiently polygonized. In general, primitive soft objects are not localized, as such their combinations can produce a variety of interesting and subtle shape effects. On the down side, modifying a primitive may have a global effect. The shape control scheme we derive uses a few results from previous research. Our B-rep-CSG conversions are applications of the general B-rep-CSG conversion techniques developed by Shapiro and Vossler1”,i4. For creating an initial B-rep, we use a surface fitting method due to Dahmen and Thamm-Schaar”. Similar tetrahedron-based surface fitting methods have been explored by others’6m18. In particular, we mention the polyhedral smoothing method by Bajaj et al.” that guarantees ‘hull validity’. As an alternative to tetrahedron-based methods, Middleditch and Dimas have developed a promising heptahedron-based technique for modelling free-form solids in CSGi9. DESIGNING
FREE-FORM
SOLIDS IN CSG
To design a free-form solid S, we first use polyhedral smoothing to construct an initial B-rep(S), which is 484
( 1) for a simplex K of X’, the boundary simplices of K
are in E’, and (2) for two simplices of ‘8’, their intersection simplex in g.
is also a
Two simplices satisfying the Condition 2 are referred to as properly joined (see Reference 20). A simplical complex % can have a subcomplex E”, which is a simplicial complex satisfying 5?’ c ‘~5’. The underlying space 1%“)of a simplical complex E’ is the union of all of its simplices. We call a tetrahedron over which a polynomial in Bernstein-Bezier form (BB form) has been defined a Bezier tetrahedron. A simplical complex whose tetrahedra are Bezier tetrahedra is a Bezier simplicial complex. Two tetrahedra of a Bezier simplicial complex are smoothly joined if, on their common boundary simplex, their polynomials meet with continuous function value and gradient. A Bezier simplical complex 9 is smoothly joined if every two simplices of 93’ are smoothly joined. We regard a smoothly joined Bezier simplical complex .3 as a smooth piecewise polynomial function f(x) defined on the underlying space 191.
Initial free-form solids in B-rep We construct the B-rep of an initial free-form solid S from a simplicial polyhedron P (a manifold) whose vertices are Ix ,, . . . ,xJ, with a normal nk prescribed at each vertex xk (k = 1,. .., n). The B-rep construction produces as output a smooth surface M = B-rep(S) that interpolates both the vertices of P and the prescribed normals. The construction uses a surface fitting method due to Dahmen and Thamm-Schaar15, which takes the following steps: ( 1) build a polyhedral hull 3, and (2) define a trivariate function f(x) whose zero contour is MCl&4. First, consider building the polyhedral hull 3, which is a simplicial complex consisting of face tetrahedra,
Local shape control for free-form solids in exact CSG representation: B Guo and J Menon
wedges, and their boundary simplices. The face tetrahe-
dra and wedges are obtained as follows: Face tetrahedra Fi = [xi, xj2 xi,] be a face of P, with the face normal nF, pointing to the outside of P. A pair of face tetrahedral are built on each side of the plane ( Fi> that contains Fi. One is the exterior face tetrahedra Ai = [x. xi x. v,‘], which is a pyramid using vi’ as its apex a& fi. ai its base. The term exterior indicates that the apex ;i+ lies on the side of (4 > pointed to by n,,. The other tetrahedron is the interior Vi = [xi x. x. v-1, which is similar to Ai except the apex vi- he’,’ 0’; ;he side of ( Fi> pointed to by - nFi. The point vi+ (vi-) is called the exterior (interior) apex of Fi. Let
Wedges A pair of wedges is situated between the exterior face tetrahedra Ai and Ak of two faces Fi = [xi xi xi31 and Fk = [xk, xk2,xk,] sharing an edge [xi2 xi) =jxk, x,+1. These wedges are V ik =[mi+kxi xi,vT] and Vki= [mli xk x,+vk+],with the wedge spkngpoint m&= rn$ being in the interior of the line segment [vi’ $1. Similarly, a pair of interior wedges A ik and A ki are between the interior face tetrahedra Vi and V,. Figure I provides a 2D analogue of the above construction. The two wedges v ik and v ki may be combined into a single wedge, but doing so complicates the construction of surface M (see Reference 15). It remains to define the function f(x) whose zero contour is the final surface M. For this, a cubic polynomial is constructed inside each tetrahedron of 3X The constructions of cubic polynomials inside the tetrahedra of 3 ensure that on the entire underlying space m, the function f(x) is not only well defined, but also continuously differentiable. Consequently, the zero contour of f(x), M = {x E 1&4I f(x) = 01, is a tangentplane continuous surface. In order for M to interpolate both the vertices of P and the prescribed normals, the function f(x) must satisfy the interpolation condition: f(xk) = 0 and Vf(x,> = nk (k = 1,. . . , n). The interpolation condition and the tangent-continuity of M do not completely determine f(x). For every face I;;: of P, both f(vT> > 0 and f(v;> < 0 are left as free shape parameters that can be adjusted for shape control (in fact, this leads to the rudimentary shape control scheme in Reference 1). Knowing the shape parameters, we can set the other free parameters in f(x) using the approximating quadrics technique: on each tetrahedron of 3, f(x) is made to approximate a
quadratic polynomial’5. The purpose of approximating quadrics is to ensure that the surface patch inside each tetrahedron of Z’ is single sheeted and is free of shape defects. While this technique provides no theoretical guarantee (there are methods that do18), it has been observed to work well in practice. In the following, we will assume that the surface patches inside the tetrahedra of % are single sheeted. To summarize, we say that the first step of the Brep construction builds a polyhedral hull X, and the second step turns 3? into a Bezier simplical complex f(x) that is smoothly joined and satisfies the interpolation condition. In this paper, we concentrate on the problem of building an initial polyhedral hull and maintaining its validity during shape control. We will not discuss the construction of f(x); procedures for finding the initial interpolant and for local updating of f(x) during shape control can be derived from Reference 15 quite easily. Converting
to CSG
We describe two known methods - shell-core and protrusion-depression’ - for converting the initial B-rep of solid S to CSG. In this work, we will be concentrating on normal constructions’ in which the tetrahedra of Z’ do not overlap. Let us first introduce the concepts of trunctets, shells, and cores. The polynomial a(x) defined on each tetrahedron T decomposes th? tetrahedron into two trunctets: & = T n H, and T,, = T n H,, where H, = {ala I 0) is an algebraic halfspace with complement H, = {xla(x) 2 OF ?nd n denotes regularized set intersection. We call Ti an inner trunctet and T,, an outer trunctet. The union of all inner trunctets constitutes an inner shell ‘S, which is associated with an inner core ‘C=S-‘S (here ‘-’ denotes a regularized set difference operation). Figure 2a shows a 2D example of an inner core. The shell-core method for normal constructions generates CSG(S) as CSG(‘S) u CSG(‘C1. Here CSG(i.9 is a Convective Shell Representation (CSR) of S (computed as the union of CSG representations of inner trunctets) and CSG(‘C) the CSG representation of the polyhedron ‘C (computed from B-rep(‘C)13).
. _.-* ._.* QQQ *We assume that n(x) defines a single sheeted surface patch in 7’ and thus obviatinfi the separating halfspaces required for describing trunctets in CSG .
face tetrahedron .
wedge 1
face tetrahedron
x
. . . . . .*. .f. .
*_..
‘.
.*’
..
“._‘_
i..
.---.
.. .:.
..
.:--
..
:: . . . .
..
..
--.
-.
..
-.,.
:
:
*. -.
(4
Figure 1 Understanding polyhedral hull 2
(b)
a polyhedral hull; (a) the polyhedral P, (b) the face tetrahedra -
.a’
*.-. .
:
,’ . . .
:
-.
a-
..
:
:
.*.
.’
-*...-
. ..___.
(4
with the interior face tetrahedra shaded, and (c) the
485
Local shape control for free-form solids in exact CSG representation:
protrusion
‘:.
B Guo and J Menon
,,’
.,,. / +i
Figure 2 cl&y)
‘.* : ‘.., / :.. ,.,: .
/
(a) Inner core and protrusion/depression _
trunctets.
(b) Changmg
To describe the protrusion-depression method, we observe that some trunctets are protrusions relative to P, while others are depressions (see Figure 2a). More precisely, a protrusion corresponds to the inner trunctet of an exterior face tetrahedron or wedge, whereas a depression corresponds to the outer trunctet of an interior face tetrahedron or wedge. Let 9 (~2) denote the set of the protrusion (depression) trunctets. The protrusion-depression method computes CSG (S) by taking the union of the protrusion trunctets with P, and then subtracting the depression trunctets, i.e. CSGW = [CSG(P) U CSG(9a)l- CSG@). The CSG representations of 9 and 9 follow directly from the trunctet definitions; CSG(P) is obtained from Brep(P) through a polyhedral B-rep-CSG conversion”. Figzue 3 shows a CSG solid rendered with transparency to illustrate some of its trunctets.
Figwre 3
486
A CSG solid rendered
with transparency
an apex or weight can affect the inner core (wedges
are ignored
for
Dual control polygons for CSG solids Now we are ready to describe our scheme for shape control. The set of control points of S consists of the vertices of the polyhedron P and the apexes of the polyhedral hull &4 The vertices of P are interpolative (A4 passes through these vertices), whereas the apexes are non-interpolative. For each face F, of the polyhedron P, both apexes v,’ and v,- have control weights, derived from the shape parameters of M = B-rep(S) as follows:
1
_andw,-= M’g’- .f
1
- __
f (v,->.
The interpolative control points have weights 0~.
to show some of its tnmctets
Local shape control for free-form solids in exact CSG representation: B Guo and J Menon
The control points determine
two related polygons
larger
class
of problems known as incremental conuersion. For the solid S, let S denote
P+ and P-, which are the outer and inner boundaries
B-rep-CSG
of 1&4.The vertices of exterior (interior) control polygon are the vertices of P plus the exterior (interior) apexes (we ignore the wedge splitting points since they do not influence the shape of 3% The polygon pair P+ and P- are symmetric with respect to P and meet at the vertices of P. We call this pair the dual control polygons of S and M = B-rep(S). Figure 4 illustrates the dual control polygons and the effect of control weights/points. The relation between B-rep(S) = A4 and its control points/weights is somewhat similar to that between a NUREEsurface and its control points/weights. For example,
the result of a boundary tweaking, and suppose that B-rep(S) is computed using a known B-rep-CSG conversion procedure. An incremental B-rep-CSG conversion seeks to obtain CSG(S) using both CSG(S) and the knowledge of the changes to B-rep(S). To this end, the protrusion-depression method compares favourably with the shell-core method. When CSG(S) is obtained using the shell-core method, two steps are required for incremental B-rep-CSG conversion:
P+ (P-I
Control points: the surface
M follows the control points in an intuitive manner (but A4 does not interpolate a control point unless it has weight of 03). Control weights: increasing a control weight ‘pulls’ the surface it4 towards the corresponding control point. The polyhedral-hull property: the surface M always lies inside the polyhedral hull.
While these similarities reflect no connections between the underlying mathematical models, they do allow the user to apply control polygon based techniques to control the shape of S. In a later section, we will discuss some limitations of our control points when compared to Nums control points. The implementation of the dual control polygons raises several complicated issues, among which the most challenging one is that of ensuring a valid polyhedral hull during shape control. We address these issues in the follow sections.
Incremental CSG updates Once CSGLS) has been computed, the problem of updating CSGLS) under shape control falls under a
(1) upatat;he (2) perform core.
inner tnmctets a B-rep-CSG
affected by shape con-
conversion
on the inner
The second step is needed because ‘C could be modified even if only a weight or an apex changes (Figure 2b). In contrast, when CSGM is obtained using the protrusion-depression method, Step 1 suffices unless the polyhedron P is modified.
CONTROL POINTS COMPUTATION The most challenging problem in the implementation of the dual control polygons is that of finding the control points. When the user specifies target positions for the control points, these positions may or may not determine a valid polyhedral hull. The objective of the control points computation is to move control points as close as possible to their target positions without violating the polyhedral hull validity constraints. The constraints on the control points are global, nonlinear inequalities. For smoothing a polyhedron P, any set of apexes satisfying these constraints suffices. To find such apexes, Dahmen and Thamm-Schaar” first choose apexes satisfying a partial set of the constraints and then traverse the faces of P in some fixed order, making corrections when necessary. Their expe-
:,...... __.... . i) v+
.-...
‘.
:
..
:
..-...
._...*
_..-
(4
(b) q
Interpolative Control Point Solid Boundary
Figure 4 (a) A free-form solid obtained through smoothing a polyhedron. This polyhedron, drawn with dotted lines, has v+ as one of its exterior apexes. (b) The result of increasing the weight of v+ while keeping v+ stationary. 6) The result of moving v+. In both (b) and (c), we draw the dual control polygons with dotted lines (beware that the 2D drawing has a misleading effect: the interpolative control points appear to be inside the polyhedral hull, even though in 3D they are actually on the polyhedral hull boundary)
487
Local shape control for free-form solids in exact CSG representation:
riences indicate that after a few traversals, apexes arc usually found to satisfy all the constraints. As our goal is to find control points close to their target positions while respecting the constraints, we handle constraints differently. First, we derive some constraints that involve the interpolative control points only (i.e. the vertices of P). We do so using a linear form of the fundamental Kuhn-Tucker conditions from nonlinear programminga. The constraints on interpolative control points will be referred to as the existence conditions of polyhedral hulls, because the conditions determine, from the polyhedron P and its vertex normals, whether a valid polyhedral hull X exists. The existence conditions of polyhedral hulls are weak conditions that can be satisfied for most cases of practical importance. This enables us to move the interpolative control points to their exact target positions. The next step is to find the noninterpolative control points (the apexes of 33. We accomplish this step using a quadratic form of Kuhn-Tucker conditions. More specifically, we first break the global, nonlinear inequalities into local, linear inequalities and then we use least distance programming to move the apexes as close as possible to their target positions under the local constraints. As a result, a target position change will affect only the control points and (hence the trunctets) nearby. Before we detail the control points computation, let us make a simple observation. A polyhedral hull &r has two subcomplexes: (1) the exterior hull 3&:,t of exterior wedges, and their (2) the interior hull q,,t of interior wedges, and their
exterior face tetrahedra, boundary simplices, and interior face tetrahedra, boundary simplices.
These two subcomplexes form a symmetric partition of &: Because of this symmetry, we can concentrate on the exterior hull Z$ in the following discussion. Constraints
on control points -
general
In order to define a valid polyhedral hull ;Iv; the control points must satisfy a set of constraints. We will describe the constraints that determine a valid polyhedral hull according to the polyhedral hull model of Dahmen and Thamm-Schaar15, with minor modifications. The purpose of these constraints is to achieve the proper joining of tetrahedra in 3’ and facilitate surface construction on 1&“I. We list in the following the constraints on gXt; similar constraints apply to q”, . (a) Tangent containment:
for each vertex x, of a face fiL of P, the apex vl of the exterior face tetrahedron A, satisfy condition (vi - x,1.11,> 0. (b) Wedge validity: for each pair of faces fi; and FL sharing edge E,, = F, f? Fk, the corresponding exterior face tetrahedra A, and Ak intersect only along the edge E,, , that is, A, n A, = E,, Cc) Vkbility: for each pair of faces F, = [x,, x,_ x,?] and Fk = [xk, xk2 xk,] sharing a common edge [,,z x,,] = [xkz xk 1, the corresponding apexes v,+ and v; are mutually visible, that is, the line segment [v,’ vi ] lies outside P. These constraints
488
are illustrated in Figures 5a and 56.
I3 Guo and J Menon
The first two constraints are necessary for building a polyhedral hull 37 whose tetrahedra are properly joined and whose underlying space M contains the surface M = B-rep(S). Specifically, the purpose of the tangent containment is to ensure that LZl locally contains the tangent plane defined by the prescribed normal at each vertex. Indeed, together with its counterpart for the interior hull Z&, the tangent containment described above guarantees that at each vertex x,, there is some positive E such that m contains a tangent disk D, centred at x,, where D, = {x In;(x - xi) = 0, [Ix- xi11< E}. As for the wedge validity, it is a prerequisite for constructing the wedges. The visibility constraint, even though not necessary, provides a simple way for constructing the wedges. More precisely, when wedge validity and visibility constraints are satisfied for two faces F, = [x1, xl2 x,>l and F, = [xk, xk, xk3], four tetrahedra A, = [xi, xttzxi7 v,‘], AL = [xk xk, xki v:], v ,k = [m:k x,? XL3v; 1, and ’ hr = [mt, xi xk vl ] are properly joine-d for any point m,; = rnk: in the interior of line segment [v,’ vcl. In theory, the above constraints do not guarantee that the exterior hull Z& is a simplical complex. Since the constraints only restrict the face tetrahedra of two faces sharing an edge, we may find face tetrahedra A, and A, intersect in case such as: (a) the corresponding faces F, and Fk share only a vertex, or (b) F, and Fk are disjointed. In practical terms, however, the above constraints have been observed to always restrict xXt to a simplicial complex. The problems with the constraints can also be handled, at the expense of increasing conceptual or computational complexity. Case (a> can be avoided rather easily by replacing the second constraint with a more restrictive one, so that at each vertex of P, all incident face tetrahedra and wedges are properly joined. In fact, this more restrictive constraint has been implemented in our system - even though we find the constraint has little practical impact for all the data that we have experimented with. Case (b) presents a problem that is intrinsically global. A possible solution is to clip, without affecting the relevant surface patches of M, some face tetrahedra and wedges so that the clipped tetrahedra do not overlap.
Constraints
on interpolative
control points
From the general constraints on Z, we can derive a set of constraints that do not involve the noninterpolative control points. We call such constraints the existence conditions of polyhedral hulls. As is mentioned earlier, these conditions determine, from the polyhedron P and the normals prescribed at its vertices, whether a valid polyhedral hull 3 exists. We study the existence conditions of polyhedral hulls for two reasons. First, these conditions determine to what extent we can move the interpolative control points. Even though the existence conditions are satisfied in most practical cases, identifying these conditions
Local shape control for free-form solids in exact CSG representation: B Guo and J Menon
has some theoretical merits. The second reason for studying the existence conditions is that they form the basis of our algorithm for efficient computation of control points. We start by considering a face F = [x1 x2 x3] of the polyhedron P and the local geometry near this face. As is illustrated in Figure 5c, each edge Ek (k = 1,2,3) opposite to vertex xk is shared by F with another face Fk of P. The vertices of Fk are those of Ek plus a new vertex xi, and the face Fk is separated from F by the dividing plane of Ek, P;” = {x Isk(x) = 01, which passes through Ek and satisfies conditions sk(xk) > 0 and s,Jx;) < 0. When the internal dihedral angle formed by F and Fk is less than m, the visibility plane of Ek, P,” = {x I q(x) = O}, passes through Ek and induces an open halfspace H,” = {x Iv,(x) < O} whose closure contains both F and Fk; the visibility plane is not necessary if the dihedral angle is greater than T. Denoting the mid-point of edge Ek by
6)
(4
Dividing cone: the dividing cone C, is formed by the dividing planes: C, = n 15 k s 3 H,k, where H:
= {x ISk. (x - 5,) > 0} is an open halfspace bounded by a dividing plane. Visibility cone: the visibility cone C, is formed by the visibility planes: C, = n 1d k s &, where H,” = {x Ivk *(x - jz,) > 0) is an open halfspace bounded by a visibility plane.
Having constructed these cones, we can restate the constraints of the previous subsection as follows: for every face F of P, the apex vF+ of the exterior face tetrahedron lies inside the feasible apex set A, = C, n C, n C, n H,. Here we use the open halfspace H, to specify that vi is an exterior apex. With face normal f, and centroid xF of F, H, may be written as (x If, .(x XJ > 01. Exterior hulls satisfying these constraints exist if and only if the feasible apex set is nonempty for every face of P. This leads to the following: Existence conditions of polyhedral hulls:Exterior
we can rewrite the linear functions defining the dividing and visibility planes as Sk(x) = Sk. (x - X,) and v,(x) = Vk’(X - xk), where Sk and v, are the normals of P,” and P,“, respectively. Now we express the constraints of the previous subsection in terms of the local geometry near face F. To do this, we construct several cones for F. An open cone with vertex v,, is an open set C such that A (x - v,,) + v. E C for any x E C and A > OS. We construct the following cones: (a) Tangent cone: the tangent cone C, is formed by the H/, where H: = tangent planes: C, = f7 l 0) is an open halfspace bounded by a tangent plane.
hulls satisfying tangent containment, wedge validity, and visibility constraints exist if and only if for each face F of P, ak = b, =ck = d = 0 (k= 1,2,3) are the only nonnegative constants satisfying the following constraints: (1) x_:=1 (ak nk + b,V, + cksk) + df, = 0, and (2) xi=, (ak nk’xk + bkVk’j& + cksk’&) + dfr’xr A similar statement
2 0.
can be made about interior hulls.
In the Appendix, we prove the existence condition for exterior hulls using a linear form of Kuhn-Tucker conditions. Constraint 1 has an intuitive explanation. For a set of vectors yI, .. . , yk, the cone spanned by these vectors Set {y Iy = AIyI + -“f AI&, Yl,..., Yk is the Vector A 1,. . . , A, 2 O}(e.g. see Reference 8). Constraint 1 sim-
(b) 0dividing
Cc) Figure 5
plane
(4
Constructing the polyhedral hull % (a) face tetrahedra and wedges, (b) the polyhedral hull constraints, (c) the local
F, and (d) the visibility and dividing planes
geometrynear face
Local shape control for free-form solids in exact CSG representation:
ply says that the cone spanned by f, and nk (k = 1,2,3) intersects that spanned by -v, and - sk Ck = 1,2,3X Before leaving this section, we note that the above analysis applies to other models of polyhedral hulls as well. For example, we may choose to drop the visibility constraint since it is not a necessary one.
Initial control points and updates Now we are ready for the control points computation. which takes two steps:
(1) determine the interpolative control points. and (2) find the noninterpolative control points. In short, we determine the polyhedron I-’ before finding the apexes of _ZY Determining the polyhedron P is simple if WC assume that P and its vertex normals satisfy the existence condition of polyhedral hulls, which we do. When we are given an initial input polyhedron P, nothing needs to be done. As a vertex xk of P is changed during shape control, we only need to update the normal n,. This is done with a simple averaging scheme: the new nk is set to a weighted average of the normals of the incident faces, with each face normal inversely weighted by the area of the face. This averaging scheme is also used when we are given an initial polyhedron P with no prescribed normals at its vertices. Finding the apexes is more complicated. Moving apexes to their exact target positions can easily create an invalid polyhedral hull. Instead, we move apexes as close as possible to their target positions under the polyhedral hull validity constraints. From the previous subsection, we see that the computation of such apexes requires that we find, for each edge of P, a dividing plane and a visibility plane. The first question is then: should we determine these planes before or during the computation of the apexes? Determining the dividing and visibility planes durmg the computation of the apexes presents a fundamental difficulty, namely, that of solving a global system of nonlinear inequalities. With the cones described earlier for every face, the global system relating the apexes, the dividing and visibility planes can be easily derived. This system is global because the apexes are related through the dividing and visibility planes, each of which is used by two faces of P (see Figure 5d). To verify that the system is nonlinear, recall that the apex V; satisfies constraints of the sort sk .(v,‘- jf,) > 0 Ck = 1,2,3). These constraints are nonlinear if both vg and So are unknowns. We avoid the above difficulty by choosing dividing and visibility planes before the computation of apexes. We call this a divide-first approach. For each edge E,, of P, we set the dividing plane to pass through Elk and bisect the dihedral angle formed by the two faces F, and Fk sharing Elk. As for the visibility plane, we let it pass through Elk and have normal i
B Guo and J Menon
f,:.(v;-xF)>O,
n,.(v,+-xk)>O, s,.(x~-%~J>O, and v, .(v,t - X,) > 0 (k = 1,2,3). This system of constraints determines the feasible apex set A,. In the following, we use the face F as an example to demonstrate the computation of apexes. Let v< be the target position of the apex v;. To move vr as close as possible to v~+ without violating the polyhedral hull validity constraints, we compute the apex vg by solving the following least distance programming (LDP) problem Minimize
II+ - vt+llZ
bubject to
s,.(V;:--Xk)2E,Vk.(V~-jZk) 2 E,nk.(v>--xk) 2 E (k = 1,2,3), and f,.tvdx,)
r E,,
where E is a small positive constant. The constraints in this LDP problem model the feasible apex set A,; within an error tolerance of E, and the constant Ed controls the minimum distance between the apex v; and the face F. We use an LDP algorithm by Lawson and Hanson, who also give their FORTRAN code7. Like most algorithms for solving LDP problems, the Lawson-Hanson algorithm uses a quadratic form of Kuhn-Tucker conditions and implicitly verifies the existence condition to determine whether the above LDP problem has solutions. For an initial input polyhedron P with no target apex positions, we set v: = xr, which has the effect of avoiding ‘sharp’ wedges. We note that LDP can be efficiently solved despite the fact that it is a form of quadratic programming (QPl, which minimizes a general quadratic function c. x + xMx subject to a set of linear inequality constraints. The computational complexity of QP varies according to the symmetric matrix M. QP is NP-complete if M is indefinite’. A QP with positive semidefinite M is referred to as a co11vex problem, and is solved in practice with efficient methods whose worst case behaviour is exponential but whose expected running time is polynomial. Finally, LDP has a positive definite matrix M and can be solved with methods that are efficient in both theoretical and practical senses7. Of course, our procedure for computing an apex takes constant time because we solve an LDP of 10 inequality constraints. The procedure we have described so far is for computing the exterior apexes. A procedure for computing the interior apexes can be obtained by what we call normalflipping. Because of the symmetry between interior hulls and exterior hulls, we compute an interior hull by following the exterior hull procedure with flipped vertex and face normals, i-n,, . . , -n,} and 1- f, I F is a face of P).
EXAMPLES AND DISCUSSIONS Overall, our experiments indicate that the shape control scheme is effective, both in creating initial shapes from polyhedral smoothing and in shape refinements through adjustments of control points and weights. Let
Local shape control for free-form solids in exact CSG representation: B Guo and J Menon
Figure 6 Polyhedral smoothing examples; left column: the initial polyhedra, centre column: the initial polyhedra with polyhedral hulls, right column: resulting solids Fignre 8 Left: the original shape (obtained via polyhedral smoothing). Right: the result of changing a control point (an apex) and its weight. In contrast to the torus examples, we see a completely local shape effect here
Figure 7 The torus refined into different shapes, with the corresponding control polygons shown in the left column. Many local shape control operations are combined to modify a half of the torus (the bottom row) and the entire torus (the top row)
us show some sample results. Figure 6 provides polyhedral smoothing examples, with wireframe polyhedral hulls and Gouroud-shaded trunctets colour-coded according to the faces of the initial polyhedra. Note that objects of complicated topology (genus eight is the bottom example) are handled easily. In Figure 7, the torus in Figure 6 is refined into different shapes through adjustments of control points/weights. A similar example is given in Figure 8. In all the examples, the boundaries of solids are tangent-plane continuous, but may contain curvature discontinuities. The shape control scheme we derive does have some limitations when compared to its parametric surfaces counterparts. First, the movements of our apexes (and, to some extent, the vertices of P> are subject to the polyhedral hull validity constraints, whereas the control points of parametric surfaces move freely. Second, the interpolative control points in our system have side effects. When the user moves a vertex xk of P, the constraints for the apexes of all faces incident to xk (and only these faces) change. If the change of con-
straints makes an apex violate the polyhedral hull validity constraints, our system will move this apex to the nearest position where the validity constraints are satisfied. The control points of parametric surfaces do not have such side effects. In the control points computation, we have assumed that the existence conditions of polyhedral hulls are satisfied for the polyhedron P and its (derived or prescribed) vertex normals. This assumption holds in most cases - not only for the initial polyhedron but also for polyhedra in shape refinements, if these polyhedra are obtained from the initial polyhedron through small adjustments of vertices. However, there are cases in which our assumption fails, as is the case with the polyhedron shown in Figure 9. To handle a polyhedron P of this sort, we have developed a successful heuristic method. Because the apexes computation verifies the existence conditions of polyhedral hulls for each face of P, we can use the results of the verification to locate the sharp features in P that cause the violation of the existence conditions. We remove these sharp features by locally applying a subdivision surface technique*l (see Figure 9). Of course, this is a heuristic method and, like any other heuristic, can be made to fail on pathological examples.
CONCLUSIONS We have presented a scheme for local shape control of free-form solids in CSG through incremental updates. This scheme, based on the fundamental Kuhn-Tucker conditions for valid control points computations, extends the control polygon based techniques for parametric B-reps to CSG solids. As a result, we can effectively design free-form solids in CSG and use the RayCasting Engine to efficiently support solid modelling applications on these solids4y5. Several important issues remain to be explored. In particular, we note that the flexibility of shape control is compromised by the simplicity of normal constructions for B-rep-CSG conversions. For efficient B491
Local shape control for free-form solids in exact CSG representation:
B Guo and J Menon
3
4
5
10
11 Fire 9 Top left: a polyhedron needing subdivision. Top right: the subdivided polyhedron. Bottom left: the subdivided polyhedron with a polyhedral hull. Bottom right: a resulting solid
12
13
rep-CSG conversions, normal constructions forbid the tetrahedra in a polyhedral hull to overlap. However, avoiding overlapping tetrahedra not only tends to restrict the flexibility of shape control, but also makes efficient B-rep constructions difficult. We are currently working on developing a technique that accommodates the conflicting goals of efficient B-rep-CSG conversions, B-rep constructions, and flexible shape control. Eventually, we would like to provide this technology in a dual representation B-rep/CSG system with bilateral representation conversions, so that algorithmic conveniences as well as application support in both schemes become available for free-form solids. ACKNOWLEDGEMENTS We thank Professor Jorg Peters (Purdue University) for the multihandled polyhedron and Dr Henry Moreton (SGI) for the TetraThing polyhedron. The raytraced vases are produced using the software of Dr Bill Bouma (Purdue University). Many thanks to Professor Lou Billera (Cornell University) for pointing out the connection between polyhedral hulls and the duality theorem of linear programming, to Professor Herb Voelcker (Cornell University) for his invaluable advice on CSG and CSR issues, and to Professor Gershon Kedem (Duke University) as well as the Cornell Programmable Automation team for RCE-related support. We are grateful to the anonymous referees, whose comments have enhanced the clarity of our presentation. Guo is supported by NSF grant (GER-9452931).
14 1s 16 17 18
19
70 21 L2
Ellis, .I L, Kedem, G, Lyerly, T C, Thielman, D G, Marisa, R J, Menon, J P and Voelcker, H B ‘The RayCasting Engine and ray representation: a technical summary’ Int. J. Comput. Geom. Appl. Vol4 No 2 (1991) pp 347-380 Menon, J P and Robinson, D M ‘Advanced NC verification via massively parallel raycasting: extensions to new phenomena and geometric domains’ ASME Mfg Rev Vol 6 No 2 (1993) pp 141-154 Menon, J P, Marisa, R J and Zagajac, J ‘More powerful solid modelling through ray representations’ IEEE Comput. Grph. Appl. Vol 14 No 3 (1994) pp 22-35 Piegl, L ‘Modifying the shape of rational B-splines. Part 2: surfaces’ Cornput-Aided Des. Vol 21 No 9 (1989) pp 538-546 Lawson, C and Hanson, R Solving Least Square Problems Prentice-Hall (1974) Bazaraa, M S, Sherali, H D and Shetty, C M Nonlinear Programming: Theory and Algorithms John Wiley (1993) Chan, K--C ‘Solid modelhng of parts with quadric and free-form surfaces’ PhD Thesis Deoartment of Mechanial Eneineerine. “, University of Hong-Kong (Nov 1987) Dunnington, A, Saia, D R and de Pennington, A ‘Constructive solid geometry with sculptured primitives using inner and outer sets’ in Strasser, W and Seidel, H P (Eds) Theory and Practice of Geometric Modelling Springer-Verlag (1989) pp 1277142 Wyvill, B and van Gverveld, K ‘Constructive ‘soft’ geometry: an unification of CSG and implicit surfaces’ Preprim Department of Computer Science, University of Calgary (1995) Duff, T ‘Interval arithmetic and recursive subdivision for implicit functions and constructive solid geometry’ Comput. Graph. Vol 26 No 2 (1992) pp 131-138 Shapiro, V and Vossler, D L ‘Construction and optimization of CSG representations’ Cornput-Aided Des Vo123 No 1 (1991) pp 4-19 Shapiro, V and Vossler, D L ‘Separation for boundary to CSG conversion’ ACM Trans. Graph. Vol 12 No 1 (1993) pp 35-55 Dahmen, W and Thamm-Schaar, T -M ‘Cubicoids: modeling and visualization’ Comput. Aided Geom. Des. Vol 10 (1993) pp 89-108 Sederberg, T W ‘Piecewise algebraic surface patches’ Compur. Aided Geom. Des. Vol2 (1985) pp 53-59 Guo, B ‘Modelling arbitrary smooth objects with algebraic surfaces’ PhD Thesis Cornell University (Aug 1991) Bajaj, C, Chen, J and Xu, G ‘Smooth low degree approximations of polyhedra’ Technical Report TR-94-002 Department of Computer Science, Purdue University (1994) Middleditch, A E and Dimas, E ‘Solid models with piecewise algebraic free-form faces’ Proc. Set-theoretic Solid Modeling: Techniques and Applications - CSG ‘94 Winchester, UK (1994) 133-148 Hocking, J G and Young, G S Topology Addison-Wesley (1961) Loop, C ‘Smooth subdivision surfaces based on triandes’ M S Thesis Department of Mathematics, University of Utah (1987) Schrijver, A Theory of Linear and Integer Programming John Wiley (1986)
APPENDIX Polyhedral
hull existence
We prove the existence condition of polyhedral hulls stated earlier. The following theorem is taken from Reference 22, p 95 (33). Theorem 1 (Carver): For a matrix A, Ax > b has a solution, ifan only if y = 0 is the only solution for yA = 0, y. b 2 0, y 2 0. The feasible apex set A, can be defined as follows:
REFERENCES 1
2
492
Menon, J P ‘Constructive shell representations for free-form surfaces and solids’ IEEE Comput. Graph. Appl. Vol 14 No 2 (1994) pp 24-36 Requicha, A A G ‘Representations for rigid solids: theory, methods and systems’ ACM Comput. Surv. Vol 12 No 4 (1980) pp 437-464
{xIfF.(x-xXF)>O,nk.(x-xXk)>O, v, . (x - Xk) > 0, Sk. (x - Xk) > 0
(k = 1,2,3)1
Local shape control for free-form solids in exact CSG representation: 6 Guo and J Menon
To see when A, is nonempty, we construct a 10 X 3 matrix A whose row vectors are IQ, v,, sk (k = 1,2,3), and f,. We also construct two 10 component vectors
An application of Carver’s theorem gives the existence condition for simplicial hulls. Carver’s theorem is a variant of the duality theorem of linear programming, which is a linear form of Kuhn-Tucker conditions. Even though Kuhn-Tucker conditions only became well known through the historical paper of Kuhn and Tucker in 19518, Carver’s theorem is part of a much earlier result, namely, thefindumental theorem of linear inequalities due to Farkas, Minkowski, Caratheodory, and Weyl (see p 209 of Reference 22 for historical notes - in particular, the connection between the duality theorem of linear programming and Kuhn-Tucker conditions is discussed on p 220).
-I
Baining Guo is currently a visiting assktant professor in the Computer Science Department at the Universi~ of Toronto, Canada. His research interests include volume visualization, geometric modelling, and paralkl computation. Guo received his BS from Beijing lJniversi& China, in 1982, and his MS and PhD from Cornell University, USA, in 1989 and 1991. He is a member of the ACM.
Jai Menon received a BTech from the Indian Institute of Technology, India, in 1986, and an MS and PhD from Cornell Universitv, USA, in 1989 and 1992, respectively. Since then he has been working as a research staff member at the IBM T J Watson Research Center. His research interests lie broadly in design and manufacturing and he is now working on problems in graphics, virtual reality, geometric modelling and paralkl computation. He is currently leading a project on graphics and multimedia in networked product data management. He has received several IBM awards, is on the executive committee of the ASME, and is a member of the ACM, IEEE and Phi Kappa Phi.
493