Efficient Computation of Regularized Boolean Operations on n-Dimensional Orthogonal Polytopes Ricardo Pérez-Aguila Universidad Tecnológica de la Mixteca (UTM) Carretera Huajuapan-Acatlima, km. 2.5 Huajuapan de León, Oaxaca 69000, México [email protected] Abstract The first part of this work is devoted to describe the Extreme Vertices Model in the n-Dimensional Space (nD-EVM) and the way it represents nD Orthogonal Pseudo-Polytopes (nD-OPP’s) by considering only a subset of their vertices: the Extreme Vertices. This model has enabled the development of simple and robust algorithms for performing the most usual and demanding tasks on Polytopes Modeling. Although the EVM of an nD-OPP has been defined as a subset of its vertices, there is much more information about the polytope hidden within this subset of vertices. In the second part it is presented the way the nD-EVM performs some of the key operations between polytopes: Regularized Boolean Operations. These operations provide a way for combining polytopes in order to compose new ones. There are described the Regularized Boolean Operators and the way they assure the dimensional homogeneity. Algorithms for performing Boolean Operations under the nD-EVM will be described, and finally, details about an experimental time complexity analysis will be given in order to sustain the efficiency shared by the nD-EVM when these operations take place through the described procedures. Some practical applications of the nD-EVM are also commented. Keywords. Polytopes Representation Schemes, Computational Geometry, Geometrical and Topological Modeling, Regularized Boolean Operations. Resumen La primera parte de este trabajo está dirigida a describir al Modelo de Vértices Extremos en el Espacio n-Dimensional (nD-EVM) y la manera en que representa Pseudo-Politopos Ortogonales nD (nD-OPP’s) al considerar únicamente un subconjunto de sus vértices: los Vértices Extremos. Este modelo ha permitido el desarrollo de algoritmos simples y robustos a fin de efectuar las tareas más comunes y demandantes en el Modelado de Politopos. Aunque el EVM de un nD-OPP ha sido definido como un subconjunto de sus vértices, existe información importante acerca del politopo que se encuentra oculta dentro de este subconjunto de vértices. En la segunda parte es presentada la manera en la que el nD-EVM lleva a efecto algunas de las operaciones clave entre politopos: las Operaciones Booleanas Regularizadas. Estas operaciones proveen de una metodología para combinar politopos a fin de obtener nuevos objetos. Se describirán a los Operadores Booleanos Regularizados y la manera en la que éstos aseguran la homogeneidad dimensional. Se proporcionarán detalles acerca de dos algoritmos para efectuar Operaciones Booleanas bajo el nD-EVM. Finalmente, se describirá un análisis experimental de complejidad temporal a fin de sustentar la eficiencia proporcionada por el nD-EVM cuando estas operaciones se efectúan a través de los procedimientos presentados. También se comentarán algunas aplicaciones prácticas del nD-EVM. Palabras Clave. Esquemas para la Representación de Politopos, Geometría Computacional, Modelado Geométrico y Topológico, Operaciones Booleanas Regularizadas.

Introduction Polytopes Modeling is a recent area of wide development: If a polytope can be modeled in a way that its geometry is appropriately captured, then it will be possible to apply, on such polytope, a range of useful operations. Due to the need of modeling objects or phenomena as polytopes (for example in Computer Aided Design and Manufacturing, electronic prototypes, medical datasets, animation planning, collision detection, etc.) the development of a variety of specialized mechanisms to represent them has arisen. The representation schemes for polytopes are frequently divided in two large categories (although not all the representations are completely inside in one of them): n-Dimensional Boundary Representations and Hyperspatial Partitioning Representations. The first part of this work is devoted to describe the Extreme Vertices Model in the n-Dimensional Space (nD-EVM) and the way it represents nD Orthogonal Pseudo-Polytopes by considering only a subset of their vertices: the Extreme Vertices. The Extreme Vertices Model (3D-EVM) was originally presented, and widely described, by Aguilera & Ayala for representing 2-manifold Orthogonal Polyhedra (Aguilera,1997) and later considering both Orthogonal Polyhedra (3D-OP’s) and Pseudo-Polyhedra (3D-OPP’s) (Aguilera,1998). This model has enabled the development of simple and robust algorithms for performing the most usual and demanding tasks on solid modeling, such as solid splitting, set membership classification operations, and measure operations on 3D-OPP’s. It is natural to ask if the EVM can be extended for modeling n-Dimensional Orthogonal Pseudo-Polytopes (nD-OPPs). In this sense, some experiments were made, by Pérez-Aguila & Aguilera (2003), where the validity of the model was assumed true in order to represent 4D and 5D-OPPs. Finally, in (Pérez-Aguila,2006) was formally proved that the nD-EVM is a complete scheme for the representation of nD-OPPs. The meaning of complete scheme was based in Requicha's set of formal criteria that every scheme must have rigorously defined: Domain, Completeness, Uniqueness and Validity. The second part of this work is oriented to present the way the nD-EVM performs some of the key operations between polytopes: Closed and Regularized Boolean Operations. These operations provide a way for combining polytopes in order to compose new ones. There are described the Regularized Boolean Operators and the way they assure the dimensional homogeneity, that is, it is expected the regularized operations between nD polytopes always will generate nD polytopes, or the null object (the empty set). Algorithms for performing Boolean Operations under the nD-EVM will be described, and finally, details about an experimental time complexity analysis will be given in order to sustain the efficiency shared by the nD-EVM when these operations take place through the described procedures.

The n-Dimensional Orthogonal Pseudo-Polytopes Definition 1.1: A Singular n-Dimensional Hyper-Box in n is the continuous function I n : [0,1]n x



[0,1]n



I n ( x) = x

Definition 1.2: For all i, 1 ≤ i ≤ n, the two singular (n-1)D hyper-boxes I (ni ,0) and I (ni,1) are defined as

follows:

If

then

x ∈[0,1]n−1

I (ni ,0) ( x ) = I n ( x1 ,..., xi −1 , 0, xi ,..., xn −1 ) = ( x1 ,..., xi −1 , 0, xi ,..., xn −1 )

and

I (ni ,1) ( x ) = I n ( x1 ,..., xi −1 ,1, xi ,..., xn −1 ) = ( x1 ,..., xi −1 ,1, xi ,..., xn −1 )

Definition 1.3: In a general singular nD hyper-box c we define the (i,α)-cell as c( i ,α ) = c  I (ni ,α ) Definition 1.4: The orientation of a cell c  I (ni ,α ) is given by (−1)α +i . Definition 1.5: An (n-1)D oriented cell is given by the scalar-function product (−1)i +α ⋅ c  I (ni ,α ) Definition 1.6: A formal linear combination of singular general kD hyper-boxes, 1 ≤ k ≤ n, for a closed set A is called a k-chain. Definition 1.7 (Spivak,1965): Given a singular nD hyper-box In we define the (n-1)-chain, called the boundary of In, by ∂ ( I n ) = ∑  ∑ ( −1)i +α ⋅ I (ni ,α )  n

i =1

 α =0,1



Definition 1.8 (Spivak,1965): Given a singular general nD hyper-box c we define the (n-1)-chain, called the boundary of c, by ∂ (c ) = ∑  ∑ (−1)i +α ⋅ c  I n  ( i ,α ) n

i =1

 α = 0,1



Definition 1.9 (Spivak,1965): The boundary of an n-chain

∑c , i

where each ci is a singular

general nD hyper-box, is given by ∂ ( ∑ ci ) = ∑ ∂ (ci ) Definition 1.10: A collection c1, c2, …, ck, 1 ≤ k ≤ 2n, of general singular nD hyper-boxes is a combination of nD hyper-boxes if and only if k  n n n   ∩ cα ([0,1] ) = (0,...,0)   ∧ ( ∀i, j, i ≠ j , 1 ≤ i, j ≤ k ) ci ([0,1] ) ≠ c j ([0,1] )  = 1 α n  

(

)

The first part of the conjunction establishes that the intersection between all the hyper-boxes is the origin, while the second part establishes that there are not overlapping nD hyper-boxes. Definition 1.11: We say that an n-Dimensional Orthogonal Pseudo-Polytope p, or just an nD-OPP p, will be an n-chain composed by nD hyper-boxes arranged in such way that by selecting a vertex, in any of these hyper-boxes, we have that such vertex describes a combination of nD hyper-boxes (Definition 1.10) composed up to 2n hyper-boxes.

The Extreme Vertices Model in the n-Dimensional Space (nD-EVM) Definition 2.1: Let c be a combination of hyper-boxes in the nD space. An Odd Edge will be an edge with an odd number of incident hyper-boxes of c. Definition 2.2: A brink or extended edge is the maximal uninterrupted segment, built out of a sequence of collinear and contiguous odd edges of an nD-OPP. Definition 2.3: We will call Extreme Vertices of an nD-OPP p to the ending vertices of all the brinks in p. EV(p) will denote to the set of Extreme Vertices of p. Definition 2.4: Let p be an nD-OPP. EVi(p) will denote to the set of ending or extreme vertices of the brinks of p which are parallel to Xi-axis, 1 ≤ i ≤ n. Theorem 2.1 (Pérez-Aguila,2006): A vertex of an nD-OPP p, n ≥ 1, when is locally described by a set of surrounding nD hyper-boxes, is an extreme vertex if and only if it is surrounded by an odd number of such nD hyper-boxes. Theorem 2.2 (Pérez-Aguila,2006): Any extreme vertex of an nD-OPP, n≥1, when is locally described by a set of surrounding nD hyper-boxes, has exactly n incident linearly independent odd edges. Definition 2.5: Let p be an nD-OPP. A kD couplet of p, 1
• Let c ( I (ni ,α ) ( x )) = ( x1 ,.., xn ) be an (n-1)D cell embedded in the nD space. π j ( c( I (ni ,α ) ( x)) ) will denote the projection of the cell c ( I (ni ,α ) ( x )) onto an (n-1)D space embedded in nD space whose supporting hyperplane is perpendicular to Xj-axis: π j ( c( I (ni ,α ) ( x)) ) = ( x1 ,..., xˆ j ,..., xn ) • Let v = ( x1 ,..., xn ) a point in  n . The projection of that point in the (n-1)D space, denoted by π j (v) , is given by π j (v) = ( x1,..., xˆ j ,..., xn ) • Let Q be a set of points in  n . We define the projection of the points in Q, denoted by π j (Q) , as the set of points in  n −1 such that π j (Q ) = { p ∈  n −1 : p = π j ( x ), x ∈ Q ⊂  n } In all the cases xˆ j is the coordinate corresponding to Xj-axis to be suppressed. Definition 2.8: Consider an nD-OPP p. Let npi be the number of distinct coordinates present in the vertices of p along Xi-axis, 1 ≤ i ≤ n. Let Φ ik ( p) be the k-th (n-1)D couplet of p which is perpendicular to Xi-axis, 1 ≤ k ≤ npi. Definition 2.9: A Slice is the region contained in an nD-OPP p between two consecutive couplets of p. Sliceki ( p) will denote the k-th slice of p which is bounded by Φik ( p) and Φik +1 ( p) , 1≤k 1, resulting from the intersection between an nD-OPP p and a (n-1)D hyperplane perpendicular to Xi-axis, 1 ≤ i ≤ n, which not coincide with any (n-1)D-couplet of p. A section will be called external or internal section of p if it is empty or not, respectively. Ski ( p) will refer to the k-th section of p between Φik ( p) and Φik +1 ( p) , 1 ≤ k < npi.

Regularized Boolean Operations Independently of the scheme we consider for the representation of nD polytopes, it should be feasible to combine them in order to compose new objects (Foley,1995). One of the most common methods to combine polytopes are the set theoretical Boolean operations, as the union, difference, intersection and exclusive OR. However, the application of an ordinary set theoretical Boolean operation on two polytopes does not necessarily produce a polytope. For example, the ordinary intersection between two cubes with only a common vertex is a point. Instead of using ordinary set theoretical Boolean operators, The Regularized Boolean Operators (Putnam, 1986) & (Requicha,1977) will be used. The practical purpose of regularization of polytope models is to make them dimensionally homogeneous (Takala,1992). The regularization operation can be defined as Regularized(S) = Closure(Interior(S)) which results in a closed regular set. Each regularized Boolean operator is defined in function of an ordinary operator in the following way: A op* B = Closure (Interior(A op B)). In such way we will have: A ∪ * B = Closure (Interior(A ∪ B)) Regularized Union A ∩ * B = Closure (Interior(A ∩ B)) Regularized Intersection A ⊗ * B = Closure (Interior(A ⊗ B)) Regularized Exclusive OR A -* B = Closure (Interior(A - B)) Regularized Difference These operators are defined as the closure of the interior of the corresponding set theoretical Boolean operation (Requicha,1977) & (Mäntylä,1986). In this way, the regularized operations between polytopes always will generate polytopes (Takala,1992). Recapturing the previous example, the regularized intersection between two cubes with a common vertex is the null object (the empty set).

The Regularized XOR operation Relating Sections and Couplets Theorem 3.1 (Aguilera,1998): The projection of the set of (n-1)D-couplets, π i ( Φik ( P) ) , 1 ≤ i ≤ n, of an nD-OPP P, can be obtained by computing the regularized XOR (⊗) between the

projections

of

its

previous

π i ( S ki −1 ( P ) )

and

next

π i ( S ki ( P ) )

sections,

i.e.,

π i ( Φik ( P) ) = π i ( Ski −1 ( P) ) ⊗ * π i ( Ski ( P) ) , ∀k ∈[1, npi ]

Theorem 3.2 (Aguilera,1998): The projection of any section, π i ( S ki ( p ) ) , of an nD-OPP p, can be obtained by computing the regularized XOR between the projection of its previous section, π i ( S ki −1 ( p) ) , and the projection of its previous couplet π i ( Φ ik ( p ) ) . Or, equivalently, by computing k

the regularized XOR of the projections of all the previous couplets, i.e. π i ( S ki ( p ) ) = ⊗* π i ( Φ ij ( p) ) j =1

The Regularized XOR Operations on the nD-EVM The following theorem shows that the Regularized Exclusive OR (XOR) Operation over two nD-OPP’s can be easily carried out using the nD-EVM: Theorem 3.3 (Aguilera,1998): Let p and q be two nD-OPP’s having EVM n ( p) and EVM n (q) as their respective EVM’s in nD space, then EVM n ( p ⊗ *q) = EVM n ( p) ⊗ EVM n (q) . It should be noted that while nD-OPP’s p, q and p ⊗ *q are infinite sets of points, EVM n ( p) , EVM n (q) , and EVM n ( p ⊗ *q) are finite sets of points because they only contain the Extreme Vertices of p, q and p ⊗ *q respectively. The theorem allows expressing a formula for computing nD-OPP’s sections from couplets and vice-versa, by means of their corresponding Extreme Vertices Models. These formulae are obtained by combining Theorem 3.1 with Theorem 3.3; and Theorem 3.2 with Theorem 3.3, respectively: Corollary 3.1 (Aguilera,1998): EVM n −1 (π i (Φ ik ( p )) ) = EVM n−1 (π i ( S ki −1 ( p )) ) ⊗ EVM n−1 (π i ( S ki ( p )) ) Corollary 3.2 (Aguilera,1998): EVM n −1 (π i ( S ki ( p )) ) = EVM n−1 (π i ( S ki −1 ( p )) ) ⊗ EVM n−1 (π i (Φ ik ( p )) )

Basic Algorithms for the nD-EVM According to previous sections we can define the following primitive operations which are based in the functions originally presented in (Aguilera,1998): Output: An empty nD-EVM. Procedure InitEVM( ) { Returns the empty set. Input: An nD-EVM p Output: An (n-1)D-EVM embedded in (n-1)D space. Procedure ReadHvl(EVM p) { Extracts next (n-1)D couplet perpendicular to X1-axis from p. Input/Output: An (n-1)D-EVM p embedded in (n-1)D space. Input: A coordinate coord of type CoordType (CoordType is the chosen type for the vertex coordinates: Integer or Real) Procedure SetCoord(EVM p, CoordType coord) { Sets the X1-coordinate to coord on every vertex of the (n-1)D couplet p. For coord = 0 it performs the projection π 1 ( p ) . Input: Output:

}

}

}

An (n-1)D-EVM p embedded in nD space. A CoordType (CoordType is the chosen type for the vertex coordinates: Integer or Real) Procedure GetCoord(EVM p) { Gets the common X1 coordinate of the (n-1)D couplet p. } Input: An (n-1)D-EVM hvl embedded in nD space. Input/Output: An nD-EVM p Procedure PutHvl(EVM hvl, EVM p) { Appends an (n-1)D couplet hvl, which is perpendicular to X1-axis, to p.} Input: Two nD-EVM’s p and q. Output: An nD-EVM Procedure MergeXOR(EVM p, EVM q) { Applies the Exclusive OR operation to the vertices of p and q and returns the resulting set. }

Input: An nD-EVM p Output: A Boolean. Procedure EndEVM(EVM p) { Returns true if the end of p along X1-axis has been reached. Algorithm 1. Computing EVM n −1 (π 1 ( S ki ( p )) ) as EVM n −1 (π 1 ( S ki −1 ( p )) ) ⊗ EVM n −1 (π 1 (Φ ik ( p )) ) Input: An (n-1)D-EVM corresponding to section S. An (n-1)D-EVM corresponding to couplet hvl. Output: An (n-1)D-EVM. Procedure GetSection(EVM S, EVM hvl) // Returns the projection of the // next section of an nD-OPP // whose previous section is S. return MergeXOR(S, plv) end-of-procedure

}

Algorithm 2. Computing EVM n−1 (π1 (Φik ( p)) ) as EVM n −1 (π 1 ( S ki −1 ( p )) ) ⊗ EVM n −1 (π 1 ( S ki ( p )) ) Input: An (n-1)D-EVM corresponding to section Si. An (n-1)D-EVM corresponding to section Sj. Output: An (n-1)D-EVM. Procedure GetHvl(EVM Si, EVM Sj) // Returns the projection of the // couplet between consecutive // sections Si and Sj. return MergeXOR(Si, Sj) end-of-procedure

Algorithm 3. Computing the sequence of sections from an nD-OPP p represented through the nD-EVM. Input: An nD-EVM p. Procedure EVM_to_SectionSequence(EVM p) EVM hvl // Current couplet. EVM Si, Sj // Previous and next sections about hvl. hvl = InitEVM( ) Si = InitEVM( ) Sj = InitEVM( ) hvl = ReadHvl(p) while(Not(EndEVM(p))) Sj = GetSection(Si, hvl) Process(Si, Sj) Si = Sj hvl = ReadHvl(p) // Read next couplet. end-of-while end-of-procedure

Function MergeXOR performs an XOR between two nD-EVM’s, that is, it keeps all vertices belonging to either EVMn(p) or EVMn(q) and discards any vertex that belongs to both EVMn(p) and EVMn(q). Since the model is sorted, this function consists on a simple merging-like algorithm, and therefore, it runs on linear time (Aguilera,1998). Its complexity is given by O(Card(EVMn(p)) + Card(EVMn(q)) since each vertex from EVMn(p) and EVMn(q) needs to be processed just once. Moreover, according to Theorem 3.3, the resulting set corresponds to the regularized XOR operation between p and q. From the above primitive operations, the Algorithms 1 and 2 may be easily derived. The Algorithm 3 computes the sequence of sections of an nD-OPP p from its nD-EVM using the previous functions (Aguilera,1998). It sequentially reads the projections of the (n-1)D couplets hvl of the polytope p. Then it computes the sequence of sections using function GetSection. Each pair of sections Si and Sj (the previous and next sections about the current hvl) is processed by a generic procedure (called Process), which performs the desired actions upon Si and Sj.

The Regularized Union, Intersection and Difference Operations Theorem 4.1 (Aguilera,1998): A regularized Boolean operation, op*, where op* ∈ {∪*, ∩*, −*, ⊗*} , over two nD-OPP’s p and q, both expressed in the nD-EVM, can be carried out by means of the same op* applied over their own sections, expressed through their Extreme Vertices Models, which are (n-1)D-OPP’s. This result leads into a recursive process for computing the Regularized Boolean operations using the nD-EVM, which descends on the number of dimensions. The base or trivial case of the recursion is the 1D-Boolean operations which can be performed using direct methods.

The Boolean Operations Algorithm for the nD-EVM This section describes the algorithm originally presented in (Aguilera,1998) for performing regularized Boolean operations. Let p and q be two nD-OPP’s represented through the nD-EVM, and let op* be a Boolean operator in {∪*, ∩*, -*, ⊗*}. The algorithm computes the resulting nD-OPP r = p op* q, and it is based on Theorem 4.1. Note that r = p ⊗* q can also be trivially performed using Theorem 3.3. The idea behind Algorithm 4 is the following: • The sequence of sections from p and q, perpendicular to Xi-axis, can be obtained first, based in Theorem 3.2. • Then every section of r is recursively computed as S ki (r ) = Ski ( p) op * Ski (q) .

• Finally, r can be obtained from its sequence of sections, perpendicular to Xi-axis, according to Theorem 3.1. Nevertheless, Algorithm 4 does not work in this sequential form. It actually works in a wholly merged form in which it only needs to store one section for each of the operands p and q, and two consecutive sections for the result r. Algorithm 4. Computing Regularized Boolean Operations on the EVM. Input: The nD-OPP’s p and q expressed in the nD-EVM. The number n of dimensions and the Boolean operation op. Output: The output nD-OPP r, such that r = p op* q, codified through the nD-EVM. Procedure BooleanOperation(EVM p, EVM q, BooleanOperator op, int n) EVM sP, sQ // Current sections of p and q respectively. EVM hvl // I/O couplet. boolean fromP, fromQ // Flags for the source of the couplet hvl. CoordType coord // The common coordinate of couplets. EVM r, sRprev, sRcurr // nD-OPP r and two of its sections. If(n = 1) then // Basic case return BooleanOperation1D(p, q, op) else n = n – 1 sP = InitEVM( ) sQ = InitEVM( ) sRcurr = InitEVM( ) NextObject(p, q, coord, fromP, fromQ) While(Not(EndEVM(p)) and Not(EndEVM(q))) If(fromP = true) then hvl = ReadHvl(p) sP = GetSection(sP, hvl) end-of-if If(fromQ = true) then hvl = ReadHvl(q) sQ = GetSection(sQ, hvl) end-of-if sRprev = sRcurr sRcurr = BooleanOperation(sP,sQ,n,op) // Recursive call hvl = GetHvl(sRprev, sRcurr) SetCoord(hvl, coord) PutHvl(hvl, r) NextObject(p, q, coord, fromP, fromQ) end-of-while while(Not(EndEVM(p))) hvl = ReadHvl(p) PutBool(hvl, r, op) end-of-while while(Not(EndEVM(q))) hvl = ReadHvl(q) PutBool(hvl, r, op) end-of-while return r end-of-else end-of-procedure

We describe some functions present in Algorithm 4 but not defined previously: • Function BooleanOperation1D performs 1D Boolean operations between 1D-OPP’s p and q. • Procedure NextObject considers both input objects p and q and returns the common coord value of the next hvl to process, using function GetCoord. It also returns two flags, fromP and fromQ, which signal from which of the operands (both inclusive) is the next hvl to come. • The main loop of procedure BooleanOperation gets couplets from p and/or q, using function GetSection. These sections are recursively processed to compute the corresponding section of r, sRcurr. Since two consecutive sections, sRprev and sRcurr, are kept, then the projection of the resulting hvl, is obtained by means of function GetHvl and then, it is correctly positioned by procedure SetCoord. When the end of one of the polytopes p or q is reached then the main iteration finishes and the remaining couplets of the other polytope are either appended or not to the resulting polytope depending on the Boolean operation. Procedure PutBool performs this appending process.

Performance of Boolean Operations under the nD-EVM: An Experimental Time Complexity Analysis The temporal efficiency of Algorithm 4 was evaluated from a statistical point of view. We proceed as follows (in (Pérez-Aguila,2006) a more detailed treatment of this analysis is given): • Our testing considered n = 2, 3, 4, 5. • For each n, 16,000 random nD-OPP's were generated according to the following procedures: o Given two hypervoxelizations (see (Pérez-Aguila,2006) for details about this representation scheme for polytopes) representing nD-OPP's g1 and g2 we obtain their respective nD-EVM's namely EVMn(g1) and EVMn(g2). According to Theorem 2.1, if a vertex is surrounded by an odd number of occupied hypervoxels then it is an Extreme Vertex. Thus, a hypervoxelization to nD-EVM conversion consists on collecting every vertex that belongs to and odd number of hypervoxels, and discarding the remaining vertices. o Given the Regularized Boolean Operator op* we perform both g1 op* g2 and EVMn(g1 op* g2). o Let EVMn(r) be the output given by Algorithm 4, i.e., EVMn(r)=EVMn(g1 op* g2). Let r' be the result provided by Boolean operation op* between hypervoxelizations of nD-OPP's g1 and g2. As a mechanism for controlling possible errors in our implementations we obtain EVMn(r') and verify that all the 16,000 generated nD-OPP’s satisfied EVMn(r')=EVMn(r). The time for comparison EVMn(r')=EVMn(r) is not added to the registered execution times. • The considered Boolean operations are Regularized Intersection, Union and XOR. In the case corresponding to XOR operation we have tested the same 8,000 pairs of generated nD-OPP’s with the Algorithm MergeXOR in order to compare its efficiency with Algorithm 4. • The units for the time measures are given in nanoseconds. • The evaluations were performed with a CPU Intel Celeron (900 Mhz) and 256 Mbytes in RAM. • The algorithms were implemented using the Java Programming Language under the Software Development Kit 1.5 provided by Sun Microsystems. • Once the generation of nD-OPP's has finished and the algorithms were evaluated we proceed with a statistical analysis in order to find a trendline of the form t = axb, where x = Card(EVMn(g1)) + Card(EVMn(g2)), that fits as good as possible to our measures in order to provide an estimation of the temporal complexity of the evaluated algorithms for each value of n. The quality of the approximation curve is assured by computing the R2 value known as the coefficient of determination. It is well known that R2 ∈ [0, 1] and it reveals how closely the estimated values for the trendline correspond to our time measures (Burden,2004). According to the literature, our trendlines are most reliable when its R2 is at or near 1 (Wackerly,2001). • Finally and starting from the obtained data we propose an approximation surface for temporal complexity of Algorithm 4 for each considered Boolean operation. Such surface which will be a function of two variables: the number x of Extreme Vertices in the input polytopes and the number n of dimensions.

According to the obtained results we have the following observations: • Performing intersections has a lesser cost respect to unions. This phenomenon was previously identified in (Aguilera,1998) for the 3D case. Although both operations are performed by the same algorithm, the way the polytopes are processed is distinct. As pointed out by (Aguilera,1998), Algorithm 4 has three processing stages labeled as stage A, stage B and stage C (see Figure 1). Only one of the two involved nD-OPP’s is present at stages A and C, with trivial recursive calls at stage A, and no recursive calls at stage C. If the involved Boolean operation is an intersection then the result is empty at those stages, thus almost no work is done at stage A, and no work at all is done at stage C. Any way, stage B will deal with both operands, but the recursive calls at this stage will also have stages A, B and C. Unions, on the other hand, produce Boolean results at all three stages (Aguilera,1998). • Performing Regularized XOR operation is more efficient by using MergeXOR function instead of Algorithm 4. We have commented previously that MergeXOR has a linear complexity execution time because it considers extreme vertices in both input polytopes and discards those vertices present in both polytopes, as established in Theorem 3.3. Moreover, execution time of MergeXOR is not affected by the dimensionality of the input polytopes. In our experiment we had 2D, 3D, 4D and 5D-OPP’s with 0 to approximately 9,000 extreme vertices and although its dimensionality is distinct, its cardinality is the same. • The time complexity of Algorithm 4 increases according to the dimensionality of the input nD-OPP’s. This situation is easy to deduce because the number of recursivity levels depends of the number of dimensions.

Figure 1. Boolean Operations between two 2D-OPP’s a and b. c) The three processing stages (A, B and C) of the Boolean Operations Algorithm (figure taken from (Aguilera,1998)).

It is natural to infer that execution time of Algorithm 4 depends on two variables: the cardinality x of the nD-EVM’s associated to the input polytopes, and the number n of dimensions. Using the measures obtained in the described experiments we computed approximation surfaces, i.e., functions from  2 to  , that provide us an estimation of the execution time to expect given the number of extreme vertices and the number of dimensions. In Table 1 we present approximation surfaces of the form t = axbnc for Intersection and Union operations and their respective coefficients of determination; in the case for XOR operation we present a function of the form t = axbnb + c (The function t = 4506.37 x1.1819n1.4462 was also found for XOR operation, however its coefficient of determination was 0.8357. We decided to propose an alternative form for this specific case in order to provide a more precise estimation). Table 1. Approximation surfaces for estimating execution times for Boolean operations using Algorithm 4. 2 Operation Approximation Surface a b c R 1.1737 1.0862 Intersection t = 4,271.11x n 4,271.11 1.1737 1.0862 0.9234 1.0821 1.0607 Union t = 16,698.63x n 16,698.63 1.0821 1.0607 0.9221 1.4161 1.4161 XOR t = 483.17 x n + 108,263,080 483.1716 1.4161 108,263,080 0.9260

It can be observed in these equations that the surface approximating execution time for Intersection operation preserves the property identified before: Its execution time is lesser that execution time of Union operation and even XOR operation. We can then identify, as shown in Table 1, that the exponents associated to the number of vertices vary between 1 and 1.5. This experimentally identified complexity for our algorithm provides elements to determine the temporal efficiency when we perform some operations between nD-OPP’s represented through the nD-EVM.

Conclusions and Future Work We have described the Extreme Vertices Model in the n-Dimensional Space (nD-EVM). The Extreme Vertices Model allows representing nD-OPP’s by means of a single subset of their vertices: the Extreme Vertices. This work is in fact a very brief description of the capabilities of the model because we have developed simple and robust algorithms, besides the ones presented here, for performing the most usual and demanding tasks on polytopes modeling such as measure operations (computing nD content, and computing (n-1)D content of the boundary of an nD-OPP), boundary extraction, and set membership classification operations (see (Aguilera, 1998) and (Pérez-Aguila,2006) for more details). Moreover, we have described two algorithms for performing Regularized Boolean Operations. One of them, MergeXOR, has a linear execution time while the other, Algorithm 4, has a time complexity which, by experimental analysis, is positioned between x1 and x1.5 (x: number of extreme vertices of the operand polytopes). The approximation surfaces shown in Table 1 have provided us clues about the bounds that should be obtained when a formal complexity analysis is applied to the nD-EVM. As stated in this work, we have considered the time complexity topic from a statistical point of view. Because Algorithm 4 is recursive on the number of dimensions of the input polytopes and in each recursivity level a wide range of situations can be present is that a formal analysis for time complexity should consider these issues. We expect the estimations presented in this work can be useful in suggesting time bounds in order to obtain worst, best and average cases for Algorithm 4. On the other hand, now we mention the development of “real world” practical applications under the context of the nD-EVM which perform an intensive use of the Regularized Boolean Operations algorithms presented here (MergeXOR and Algorithm 4). These practical applications are widely discussed and modeled in detail in (Pérez-Aguila,2006): (1) the representation and manipulation of 2D and 3D color animations; (2) a method for comparing images oriented to the evaluation of volcanoes’ activity; (3) the way the nD-EVM enhances Image Based Reasoning; and finally, (4) an application to collision detection between 3D objects through the nD-EVM.

References Aguilera, A. & Ayala, D. 1997. Orthogonal Polyhedra as Geometric Bounds in Constructive Solid Geometry. 4th ACM Siggraph Symposium on Solid Modeling and Applications, pp. 56-67. Aguilera, A. 1998. Orthogonal Polyhedra: Study and Application. PhD Thesis. Universitat Politècnica de Catalunya. Burden, R. L. & Faires, J. D. 2004. Numerical Analysis, 8th Edition. Brooks Cole. Foley, J. D.; van Dam, A.; Feiner, S. K. & Hughes, J. F. 1995. Computer Graphics: Principles and Practice in C (2nd Edition). Addison-Wesley Professional. Mäntylä, M. 1986. Boolean Operations of 2-Manifolds through Vertex Neighborhood Classification. ACM Transactions on Graphics, Vol. 5, No. 1, pp. 1-29. Pérez-Aguila, R. 2003. The Extreme Vertices Model in the 4D space and its Applications in the Visualization and Analysis of Multidimensional Data Under the Context of a Geographical Information System. MSc Thesis. Universidad de las Américas, Puebla. Pérez-Aguila, R. 2006. Orthogonal Polytopes: Study and Application. PhD Thesis. Universidad de las Américas, Puebla. Putnam, L.K. & Subrahmanyan, P.A. 1986. Boolean Operations on n-Dimensional Objects. IEEE Computer Graphics and Applications, Number 6, Volume 6, pp. 43-51. Requicha, A.A.G. 1977. Mathematical models for rigid solids. Tech. Memo. 28, Production Automation Project, Univ. Rochester, Rochester, N.Y. Spivak, M. 1965. Calculus on Manifolds. HarperCollins Publishers. Takala, T. 1992. A Taxonomy on Geometric and Topological Models. In Computer Graphics and Mathematics, pp. 146-171. Springer-Verlag. Wackerly, D.; Mendenhall, W. & Scheaffer, R. L. 2001. Mathematical Statistics with Applications. Duxbury Press.

Efficient Computation of Regularized Boolean ...

enabled the development of simple and robust algorithms for performing the most usual and ... Some practical applications of the nD-EVM are also commented. .... Definition 2.3: We will call Extreme Vertices of an nD-OPP p to the ending ...

138KB Sizes 2 Downloads 238 Views

Recommend Documents

The Quest for Efficient Boolean Satisfiability Solvers
A DPLL-based SAT solver is a relatively small piece of software. Many of the ...... Efficient SAT Solver," presented at 39th Design Automation Conference, 2001.

A Space-Efficient Indexing Algorithm for Boolean Query Processing
index are 16.4% on DBLP, 26.8% on TREC, and 39.2% on ENRON. We evaluated the query processing time with varying numbers of tokens in a query.

Efficient Computation of 3D Clipped Voronoi Diagram
widely used in various fields, especially in computer graphics and geom- ... reader is referred to [4, 10, 15] for the properties and applications of the Voronoi ..... the experimental results are tested on a laptop with 2.4Ghz processor and 2Gb.

Efficient Distributed Computation of Distance Sketches ...
ment, load balancing, monitoring overlays, and several other problems in ...... covery of consistent availability monitoring overlays for dis- tributed systems.

Efficient Computation of Transfer Function Dominant ... - IEEE Xplore
Jan 12, 2006 - dominant poles of a high-order scalar transfer function. The al- gorithm ... power system dynamics, small-signal stability, sparse eigenanal-.

An Exact, Complete and Efficient Computation of ...
a planar point, representing a curve endpoint or an intersection between two curves (or more), and ... 2See the CGAL project homepage, at http://www.cgal.org/ .

Efficient Computation of Transfer Function Dominant ... - IEEE Xplore
Jan 12, 2006 - and produce good modal equivalents automatically, without any ... modal equivalents, model reduction, poorly-damped oscillations,.

A Space-Efficient Indexing Algorithm for Boolean Query ...
lapping and redundant. In this paper, we propose a novel approach that reduces the size of inverted lists while retaining time-efficiency. Our solution is based ... corresponding inverted lists; each lists contains an sorted array of document ... doc

Numeric Literals Strings Boolean constants Boolean ... - GitHub
iRODS Rule Language Cheat Sheet. iRODS Version 4.0.3. Author: Samuel Lampa, BILS. Numeric Literals. 1 # integer. 1.0 # double. Strings. Concatenation:.