<<

PROPERTIES CALCULATED FROM THE VERTEX NEIGHBORHOODS

Wm. Randolph Franklin

Electrical, Computer, and Systems Engineering Dept. 00213 J.E.C. Rensselaer Polytechnic Institute Troy, NY, 12180, USA (518) 2GG-6077

franklinOcsv.rpi.edu

ABSTRACT INTRODUCTION

Calculating properties of polyhedra given only the Topological considerations have been an import.ant set of the locations and neighborhoods of the vertices is element of computer aided design for some time. -111 easy. Possible properties include volume, surface , early polygon boolean combination algorithm was and containment testing. No global topological presented by [Eastman72]. A rigorous theoretical basis information at all is explicitly needed (although the com- for modeling and and some non-manifold plete global topology could be recovered). The neighbor- modeling are discussed in (WeilerSG]. Some of the topo- hood of the vertex means the directions of the edges and logical degeneracies in hidden surface removal are solved I’accs on it but not their extents. These vertex-based by [Blinn]. Euler space operations are handled formulae are dual to the usual formulae that use the by[Mantyla82] and [Mantyla84]. An early mention of facts. They have been implemented and the stability some topological issues in cartography was by [Whitei’i]. against inconsistent data tested. AiteI’native data struc- Using topology to convert wireframe models to surfstce lures and formulae for calculation are inipor- models is presented by [Courter%]. Dual data struc- tures for planar graphs are presented in [Guibas83]. 2111 lallt since special CFxW.S aV2 % function partly of the dRtk% structure, and because different methods have different earlier version of some of t,he vertex neighborhood eon- nllmcricsl accuracy and error detection propertics. cepts was presented in [Franklin83]. Consider a polygon P that may be concave with multiple disconnected nested Components, and whose complete description requires a directed tree showing the components inclusions. It is in fact sufficient for most purposes to ignore the global topology, and work with only the set of edges, each containing the ordered list of ACKNOWLEDGEMENTS its 2 vertices. However hcrc each doesn’t esplicitly This work was supported by the National Science how which other components it is adjacent to, although Il’ouudation under PYI grant no. ECS-83.51942. It was that could be determined. For example, to determine partly pcrfolmed at the Center for Interactive Compute1 point contdnment, WC count how msny edges cross a (:raphics at RPI. ray without needing to know how the edges are globally structured. To determine any mass property, such as area, we construct a from each edge to the ori- gin, calculate the property on that triangle, and stm. We c~ln also determine Boolean combinations of Lhc with this data structure, (l?r:ulklin82]. Mally others have also inrlepcntlcntly usctl silllililr Hlg~~ritllIIIH.

Permission to copy without fee all or part of this material is granted provided that All the above also applies LO pol.Vllcdra. the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the puWzation and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or Lo republish. requires a fee and/or specific permission. 0 1987 ACM 0-89791-231-4/87/0006/0110 754

110 Tlicsc tlikt s1~11eLurcs arc ~)arLicIll;Wly appq~riak when wc have ~1lisc:tl scl, of inlinitc lilies and arc crcsnl.- ing v,zriolls polygons of conkplicatctl Lopology fro111 it subset of the lines’ intcrscctions. WC can detclminc 511~11 a polygoll’s 1nCiS.7 Rlld point COllti~illlll~llt l)l’O~Jc’l~l.iCS

without ever determining its topology. Wl1(~ITit8 IOCill~iOll is (:1., $I). I: RIltl ,S il.rC I‘RYS from V The next scc’tious will sllow i) Llic tlcl,e~nlill;llic~~i 01 ill tllc dirccl,ioii of tllc Lwo edges incident on V. If we a characteristic function X(2 ,y ) for lhe polygon Tr011l r&&c from It to ,5; in il positive direction we will sweep the vertex neighl~orliood, ii) an alternative tl~lhi~ sl rltc- iusitle the polygon. See figure 1. Note that we do not ture, the augmented ray, iv) the derivation of the 111~~ know explicitly the other vertex that R passes through properties, v) the 3-D case, vi) error detection, ant1 aid 2.1~0 have 110 link in the data. structure with the finally vii) implementation. coi7+esponcling ray from that vertex that is opposite to R .

R-Cl. 0)

Figure 1: The Vertex Data Structure

/ \ 0 /T S :\ 0 E \ / \ / ‘1-a 1 / \ / 5 ,?,I \ , / \ / \ / \ \

Figure 2: y Functdon* on Convex and Concave Vertices

111 POLYGON CHARACTERISTIC FUNCTION Lemma For all R >0 s x(QVQ =O. Definition IQ-VI

Then Q tP ill S (Q ) = 1.

Wc have tlcnionstrnted a point conlainnient f’O~lllUli~ that uses only the set of vertex neighborhoods. x was determined by postulating the existence of some such general function and then solving for the actual weights for each region. The solution given is unique. Alternatively the weights can be derived from the angular deficiency (n-4) at each vertex since the angIe deficiencies sum to 2~. This 2-D characteristic function may be compared to the 1-D case. A polygon corresponds to a set of nono- I \ I \ verlapping segments (1i, ri ). The cross function for / \ / \ a general point, a , relative to a left endpoint, 1; is / \ I \ x(x) =

112 \ I \ I \ i \ \ ’ \ 1 \ I

zi?4 +zj --.& =o

----_ ------_

I \ \

Figure 4: Proof of Characteristic Function for a Triangle

Figure 5a: Proof of Addition of x Function for CU+@

Figure 5b: Addition of x for a+@>~

113 -

The right endpoint is the reverse, +P [$R2+xoj (tan LY- tan /3) - -pR ’

POLYGON MASS PROPERTIES if the point (O&o) has a positive weight = - The characteristic function can be used to deter- - (iR”+x$) (tancr-tan/3)-+pR2 mine P’s area, for example. We cannot calculate otherwise [ix@ ,I 1 dx dy

as the area of one x since that diverges. However, we Although normally one can ignore terms tending to can use a sequence of weight functions, WR, that get zero in the limit, here we ignore terms tending to co in broader and broader and satisfy the following. the limit, since we know that for well-formed polygons they will cancel. This gives a modified weighted area of 1. lim wR(z,y)‘o and X=

3. for all c>O and for all r there exists R n such that +x2(tanff-tan@ R >R, and x2+y2

A = JJ WR(x ,Y ) x(x ,Y ) dx dy ZY

114 MASS PROPERTIES USING AUGMENTED RAYS A ? = ( V2, N2, 1)

III [ l~‘rankIin83] each vertex neighborhood is split Lemma into a set of two nugnlenterl rays, as shown in figure 6. f periwteter = - 1’ .N Definition Proof Sum the Icngth VF for each ray.

A modified version of this could also IX used for ~III:I.C V = (2: ,:y ) is the starting vertex, N is a unit point containment, although using cliaractcristic func- vector in tllc direction of the edge, and 6 is a bit flag tions is simpler. Let that is 1 if the polygon’s inside is to the left of the ray and -1 otherwise. Once the vertices are reformated a~ 1 if (Q-V).N>O d (Q-V)XN.e+O f contain= rays, the two rays from each vertex are not explicitly { 0 otherwise connected in the data structure. Then & CP ifl mod(C,f,,,tnin (V), 2) = 1. Now for any mass property, such as area, there is a functional from it to a function, j.,,, , on the rays such that the total polygon area is POLYGONS WITH CURVED EDGES area = c f oreo (A ) AtP Polygons whose edges are finite segments of curves can also be represented by rays provided that each curve Lemma has a unique distinguished point that is independent of the segment’s endpoints. Although dropping a f,,,,(A) =+ v.N VXiV.e3 4 from the origin to the curve is not always unique, the where e s is the unit vector (O,O,lj, and and X are,the distinguished point of an ellipse, for example, can he the point at Ymax. Lrector dot and cross products. Proof Consider the triangle defined by 0 , V, and F , the 3-D POINT CONTAINMENT foot of the perpendicmar dropped from 0 to the ray from V. The two rays defining an edge have the same Definition . F . See figure 7, where the edge V,V/, defines the 2 A cross function x( Q ) for a trihedral vertex V of a augmented rays A r and A ?. If polyhedron assigns a value to each point, & of E3 V/1V? depending on Q’s relation to the planes of the 3 faces N1 = 1 V,V? ( on V. Let the faces’ internal angles at V be OL,/3, and 7 for F r, F *, and F a resp. Whereas the 3-D x was sym- and metric around V, the 3-D case is antisymmetric. N, =-N, then A, =(V,,N,,-1) and

S R R s

-3 t

/ \ v Al- CV.R. 13 ~2- CV . R -4) V

Figure G: Splitting a Vertex into 2 Rays

115 -Vl.Nl F -VZ.N2 The 3-D characteristic formula could be derived from this theorem, which is a discrete version of the Gauss-Bonnet theorem over a closed surface: $$I< dA = 4x(1-g ) s

where K is the Gaussian curvature at each point and g is the genus of the surface. When more than three faces meet at a vertex, it may be simplest to decompose it into trihedral com- ponents.

3-D MASS PROPERTIES Figure 7: Calculation of the Area of V1V20 from the 2 Rays Definition A 3-D wedge is the analog to a 2-D augmented ray. It is the triple x(Q ) = w =(V,R,S) where V = (z ,y ,z ) is the vertes of the polyhedron P , 27F-a-p-7 if Q is inside all 3 planes R 4TT and and S are the rays of 2 adjacent edges on the vertex that have a face ,between them. R XS is a vec- ~-P-Y if Q is outside F 1 but inside F 2 and F, tor out of the plane of the face. 1 R 1 = 1 S 1 = 1. 4n ~-G--Y Just as in 2-D, there are mass property functions if Q is outside F 1 and F 2 but inside F 3 4?7 corresponding to each msss property. Lemma a+P+1L27r if Q is outside all 3 face planes 4?T =-v.R-e.S f edgelength The other 4 cmes, such as outside F 2 and inside F 1 and the total edge length of the polyhedron is and F3 are similar. Cj edgelength ( w ) Example WCP

For a vertex, a = p = 7 = t, and Lemma x(Q) = $, -&, +, and -$ for points inside 3, 2, 1, I or 0 face planes respectively. 1 V.R XS 2V.R V.S - R .S( ( W)?+( V.S)?] Lemma (3 I-(R .S )2 The characteristic function of a polyhedron, all of Proof whose vertices have 3 faces, is obtained by adding the Drop lines from the origin onto rays R and S and cross functions of its vertices. onto the plane defined by them. Together with V, they Proof define a tetrahedron whose volume is the above expres- Similar to the 2-D case. sion. The set of such tetrahedra partitions the Definition polyhedron. The deficiency, 6~) at a vertex, V, of a polyhedron is the amount by which the sum of the face angles at that vertex is less than 2n. Example ERROR DETECTION AND ANALYSIS

b = 7r/2 for each vertex of a . For a valid polygon or polyhedron to be defined the Theorem cross functions and rays must, be mutually consistent. For a polyhedron of genus 0, x6, = 4n. If the rays on which the cross functions a.re tlcfincd arc V not, consistent, then there will be regions of the ~~IiLll~,

116 IM.I\VIV’~I I III’ IL\\:0 r;~ys t11;11.8110111~1 roirrcitl(*, in which Lll(% SUMMARY so-c.:~lIc,tl (.I1:1I.:l.c.l.c~t~isl.icfliliclioii will I~:I.vc ;1 VillllC Lhal is ~~c.il,l~cr0 nor 1, so Lh error will be self-evident. This We have prcsentcd a Iicw method for tlctermillal.iol~ I)eIi:l.vior was v(~rilietl I)y ill~I~lcmeota.tio~~ a.? described in of polygon and polyheclron properties, calculation fr01n Ltlc IICSL secl.ioil. tl\e vertices and their local ~~cighborhootls, LhaL is tIllal to the usual method of calculation from the foes. The If Llic I’ilyS I)cing llsctl Lo determine ula.ss properties method is efficient, and is stable against inconsistencies do not coincide, then the calculated error will be propor- in the input data. tional to the discrepancy. More precisely, assume that the data for each ray is perturbed: Vi ’ = Vi + dV REFERENCFS Ni ’ = Ni + dN Blinn. Although each vertex and normal is represented James F. Blinn, A Method JOT h?e~t~~,tht~ ,~o~r~c twice in the ray data structure, we assume that these Degeneracies in fIidderr Ihe alld Ra,y Track, c!~,]- culations, JeL Propulsion Lab, undated. two occurrcnccs arc pcrtlubed independently SO that the t1al.a sLriic:Llirr is iiiconsiatciil~. GNrter8O. s. h4:lrli ~:ollrl.cq :1.1d .101111 A. IllY!Wl~l~ I,clllrIla III. “Automated Collversic)Ik of Curvi1ilrca.r Wire-I~‘rairic~ Models to Surface Boundary Models; A Topological

Approach,” ACM Computer Graphics, vol. 20, no. 4, PP. 171-178, August 198G. SIGGRAPI-I’EIG which is linear in the input error. Conference Proceedings. Lemma Eastman72. The error in the area formula is linear in the input C.M. Eastman and C.I. Yessios, An Eficient Algo- rithm /or Finding the Union, , aud Cl’l’Ol‘. Differences of Spatial Domains, Sept. 1972. Lemma Carnegie-Mellon University, Dept. of Computer Sci- The point containment formula produces an error ence only when the point lies between the two inconsistent Franlclin82. rays that should be coincident. Wm. Randolph Franklin, “Effkient Polyhedron Thus these data structures are reasonably stable. Intersection and Union,” Proc. Graphics Znter- face’??&, pp. 73-80, Toronto, 19-21 May 1982. Franklin83. Wm. Randolph Franklin, “Rays - New Representa- IMPLEMENTATION tion for Polygons antl Polyhedra,” Co?,lplrtcl, Graphics alld lrnage Processing , vol. 22, pp. 327- The characteristic function algorithm was imple- 338,1983. mented and use to test point inclusion with various Guibas83. points on some convex polygons. The only interesting L.J. Guibas and J. Stolll, “Primitives for the Msni- maltcr was calcillating the angle inclusions correctly; pulation of General Subdivisions and the Computa- given this, the results were as expected for points not on tion of Voronoi Diagrams,” Proc. 15th ACM Sympo- an extended edge. Extended edges are complicated since sium on the Theory of Computirlg, pp. 221-234, they are the boundary between two regions of some cross April 1983. also in ACM T. Graph. 4, 1985, 74-123. function. Mantyla82. To test the numerical robustness of the algorithm, M. Mantyla and R. Sulonen, “GWB: A Solid the database was perturbed so that the cross functions Modeler with the Euler Operators,” IEEE Conapde? did not align. Points between two lines that should Graphics and Applications, vol. 2, no. 7, pp. 17-31, have been coincident gave a value between 0 and 1 for September 1982. the characteristic function, while points is a consistent region of the plane gave the correct result. This was as Mantyla84. expected. The probability of a point being in an incon- M. Mantyla, “A Note on the Modeling Space of sist.cnL region is proportional to the size of the angle Euler Operators,” Con~yuter Vision, Graphics, wtd errors in the cross functions. Image Processing, vol. 2G, pp. 4560, 1984.

117 Weiler8G. Kevin J. Weiler, Topological Structures I’OI Geometric Modeling, Center for Interactive Com- puter Graphics, Rensselaer Polytechnic Institute, August 1986. PhD Thesis. White77. Denis White, “A New Method of Polygon Overlay,” An Advanced Study Symposium on Topological Data Structures for Geographic Injormation Systems, Laboratory for Computer Graphics and Spatial Analysis, Harvard University, Cambridge, MA, USA, 02138, Oct. X-21, 1977.

118