A data Type for A data Type for Computational Geometry & Computational Geometry & Solid Modelling Solid Modelling Abbas Edalat André Lieutier Imperial College Dassault Systemes
A data Type for A data Type for Computational Geometry &Computational Geometry &
Solid Modelling Solid Modelling
Abbas Edalat André LieutierImperial College Dassault Systemes
2
AimAim
i. Mathematically sound, realistic
ii. Bridges theory and practice
To develop a data type for CG & SM
3
Why do we need a data type for solids?Why do we need a data type for solids?
Answer: To develop robust algorithms!
Lack of a proper data type and use of real RAM in which comparison of real numbers is decidable give unreliable programs in practice!
4
The Intersection of two linesThe Intersection of two lines
With floating point arithmetic, find the point P of the intersection L1 L2. Then: min_dist(P, L1) > 0, min_dist(P, L2) > 0.
1L
2LP
5
The Convex Hull AlgorithmThe Convex Hull Algorithm
A, B & C nearly collinear A
B
C
With floating point we can get:
6
A, B & C nearly collinear
The Convex Hull AlgorithmThe Convex Hull Algorithm
A
B
C
With floating point we can get:
(i) AC, or
7
A, B & C nearly collinear
The Convex Hull AlgorithmThe Convex Hull Algorithm
A
B
C
With floating point we can get:
(i) AC, or(ii) just AB, or
8
A, B & C nearly collinear
The Convex Hull AlgorithmThe Convex Hull Algorithm
A
B
C
With floating point we can get:
(i) AC, or(ii) just AB, or(iii) just BC, or
9
A, B & C nearly collinear
With floating point we can get:
(i) AC, or(ii) just AB, or(iii) just BC, or(iv) none of them.
The quest for robust algorithms is the most fundamental unresolved problem in solid modelling and computational geometry.
The Convex Hull AlgorithmThe Convex Hull Algorithm
A
B
C
10
• Subset A X topological space.
Membership predicate A : X {tt, ff }
is continuous iff A is both open and closed.
Axff
Axttx
A Fundamental Problem in Topology and GeometryA Fundamental Problem in Topology and Geometry
• In particular, for A Rn, A , A Rn
A : Rn {tt, ff } is not continuous.
• Most engineering is done, however, in Rn.
11
• The basic building blocks of classical geometry are not continuous and hence not computable in Rn.
The Discontinuity of the Membership PredicateThe Discontinuity of the Membership Predicate
True
x
• Example: The point is in the box.x
12
x
False
• The basic building blocks of classical geometry are not continuous and hence not computable in Rn.
The Discontinuity of the Membership PredicateThe Discontinuity of the Membership Predicate
• Example: The point is in the box.x
13
• There is a discontinuity if x goes through the boundary. x
Non-computability of the Membership PredicateNon-computability of the Membership Predicate
• This predicate is not computable:
x If x is on the boundary, we cannot in general determine if it is in or out at any finite stage of computation.
FalseTrue
14
Non-computable Operations in Classical CG & SMNon-computable Operations in Classical CG & SM
• A: Rn {tt, ff} not continuous means it is not computable, even for simple objects like A=[0,1]n.
• x A is not decidable even for simple objects: for A = [0,) R, we just have the undecidability of x 0.
• The Boolean operations such as is not continuous, hence noncomputable, wrt any natural notion of topology on subsets. For example: : C(Rn) C(Rn) C(Rn), where C(Rn) is compact subsets with the Hausdorff metric.
15
Intersection of two 3D cubesIntersection of two 3D cubes
16
Intersection of two 3D cubesIntersection of two 3D cubes
17
Intersection of two 3D cubesIntersection of two 3D cubes
18
This is Really Ironical!This is Really Ironical!
• Topology and geometry have been developed to study continuous functions and transformations on spaces.
• The membership predicate and the binary operations for and are the fundamental building blocks of topology and geometry.
• Yet, these fundamental functions are not continuous in classical topology and geometry.
19
Elements of a Computable Topology/GeometryElements of a Computable Topology/Geometry
• A : X {tt, ff} fails to be continuous on A, the boundary of A.
• For any open or closed set A, the predicate x A is non-observable, like x = 0.
• Redefine: A : X {tt, ff}
with the Scott topology on {tt, ff}.
Ax
IntAxff
IntAxtt
x c
tt ff
open
open
observable observable
Non-observable
A is now a continuous function.
20
Elements of a Computable Topology/GeometryElements of a Computable Topology/Geometry
• Note that A=B iff int A=int B & int Ac=int Bc,
i.e. sets with the same interior and exterior have the same membership predicate.
• We now change our view: In analogy with classical set theory where every set is completely determined by its membership predicate, we define a (partial) solid object to be given by any continuous map f : X { tt, ff }
• Then:f –1{tt} is open; it’s called the interior of the object. f –1{ff} is open; it’s called the exterior of the object.
21
Partial Solid Objects Partial Solid Objects
• We have now introduced partial solid objects, since X \ (f –1{tt} f –1{ff}) may have non-empty interior.
• We partially order the continuous functions:f, g : X {tt, ff } f ⊑ g x X . f(x) ⊑ g(x)
• f ⊑ g f –1{tt} g –1{tt} & f –1{ff} g –1{ff}Therefore, f ⊑ g means g has more information about an idealized real solid object.
22
The Solid Domain of XThe Solid Domain of X
• The solid domain S (X) of X is the partial order (X {tt, ff }, ⊑ )
• S(X) is isomorphic to the poset SO(X) of pairs of disjoint
open sets (O1,O2) ordered componentwise by inclusion:
21
212
1
11
),(
otherwise
}){},{(
)( )(
OO
OOOxff
Oxtt
x
fffttff
XSXS O
23
Properties of the Solid DomainProperties of the Solid Domain
• Theorem For a (second countable) locally compact Hausdorff space X (e.g. Rn), S(X) is (–) continuous.
and (U1, U2) << (V1, V2) iff U1 V1 & U2 V2
• Theorem If X is Hausdorff, then: (O1, O2) Maximal (S X, ⊑) iff
O1= int O2c & O2= int O1
c.
This is a regular solid object: O1=int O1 & O2=int O2
• Definition (O1, O2) , O1 ≠ ∅ ≠ O2 , is a classical object if O1 ∪ O2 = X.
24
ExamplesExamples
• A = {xR2 |x| ≤ 1} ⃒� [1, 2]represented in the model by(int A, int Ac) = ( {x | ⃒� x| < 1}, R2 \ A )is a classical (but non-regular) solid object.
• B = {xR2 |x| ≤ 1} ⃒�represented by({x | ⃒� x| < 1} , {x | ⃒� x| > 1}) Maximal (SR2, ⊑)is a regular solid object.
A
B
25
Boolean operations and predicatesBoolean operations and predicates
Theorem All these operations and predicates are Scott continuous.
),()),( , ),((
:
22112121 BABABBAA
SXSXSX
),(),(
:
1221 OOOO
SXSX
),()),( , ),((
:
22112121 BABABBAA
SXSXSX
26
Subset InclusionSubset Inclusion
otherwise.
)),(),,((
},{:
21
12
2121 BAff
XBAtt
BBAA
ffttSXXSb
• Subset inclusion is Scott continuous.
.)},{( compact} |),{( 221 cb ASXAAXS• Let
27
General Minkowski operatorGeneral Minkowski operator
• For smoothing out sharp corners of objects.
• SbRn = { (A, B) SRn | Bc is bounded} {( , )}.∪ ∅ ∅
All real solids are represented in SbRn.
• Define: __ : SRn SbRn SRn
((A,B) , (C,D)) (↦ A ⊕ C , (Bc ⊕ Dc)c) where A ⊕ C = { a+c | a A, c C }
• Theorem __ is Scott continuous.
28
• (A, B) is a computable partial solid object if there exists a total recursive function ß such that
An effectively given solid domainAn effectively given solid domain
• SX can be given effective structure for any locally compact second countable Hausdorff space, e.g. Rn, Sn, Tn, [0,1]n.
• Consider X=Rn. The set of pairs of disjoint open rational polyhedra of the form K = (L1 , L2), gives a basis for SX.
• Let Kn= (π1 ( K n ) , π2 ( K n) ) be an enumeration of basis.
(A , B) = ( ∪n π1 ( K ß(n) ) , ∪n π2 ( K ß(n) ) )
29
Computing a Solid ObjectComputing a Solid Object
• In this model, a solid object is represented by its interior and exterior.
• The interior and the exterior
are approximated by two
nested sequence of rational polyhedra.
30
Computable Operations on the Solid DomainComputable Operations on the Solid Domain
• F: (SX)n SX or F: (SX)n { tt, ff }
is computable if it takes computable sequences of partial solid objects to computable sequences.
• Theorem All the basic Boolean operations and predicates are computable wrt any effective enumeration of either the partial rational polyhedra or the partial dyadic voxel sets.
31
Quantative Measure of ConvergenceQuantative Measure of Convergence
• In our present model for computable solids, there is no quantitative measure for the convergence of the basis elements to a computable solid.
• Example: The minimum distance from say a rational point to a computable solid is semi-computable, but not computable.
• We will enrich the notion of domain-theoretic computability to include a quantitative measure of convergence.
32
• We strengthen the notion of a computable solid by using the Hausdorff distance d between compact sets in Rn.
• d(C,D) = min{ r | C Dr & D Cr } where Dr = { x | y D. |x-y| r }
• (A , B) S [–k, k]n is Hausdorff computable
iff there exists an effective chain Kß(n) of basis elements with ß a total recursive function such that:
(A , B) = ( ∪n π1 ( K ß(n) ) , ∪n π2 ( K ß(n) ) )
with
d (π1 ( K ß(n) ) , A ) < 1/2n , d (π2 ( K ß(n) ) , B) < 1/2n
Hausdorff ComputabilityHausdorff Computability
33
Hausdorff computabilityHausdorff computability
• Two solid objects which have a small Hausdorff distance from each other are visually close.
• The Hausdorff distance gives a natural quantitative measure for approximation of solid objects.
• However, the intersection or union of two Hausdorff computable solid objects may fail to be Hausdorff computable.
• Examples of such failure are nontrivial to construct.
34
Lebesgue ComputabilityLebesgue Computability
(A , B) S [–k, k]n is Lebesgue computable iff
there exists an effective chain K ß(n) of basis elements
with ß a total recursive functions such that:
(A , B) = ( ∪n π1 ( K ß(n) ) , ∪n π2 ( K ß(n) ) )
µ(A) - µ(π1 ( K ß(n) ) ) < 1/2 n and
µ(B) - µ(π2 ( K ß(n) ) ) < 1/2 n .
The definition can be extended to SRn.
Theorem Boolean operations are Lebesgue computable.
35
• Hausdorff computable Lebesgue computable
• Lebesgue computable Hausdorff computable
• Theorem: A regular solid object is computable iff it is Hausdorff computable.
• However: A computable regular solid object may not be Lebesgue computable.
Hausdorff and Lebesgue Computable ObjectsHausdorff and Lebesgue Computable Objects
36
Comparison of Various Notions of ComputabilityComparison of Various Notions of Computability
Partial solid
in Rn
Distance to a point
Boolean operators
Lebesgue measure
Computablesemi-
computablecomputable
non-computable
Hausdorff computable
computablenon-
computablenon-
computable
Lebesgue computable
semi-computable
computable computable
37
The data typeThe data type
• We use pairs of disjoint dyadic open polyhedra with either the Hausdorff or the Lebesgue measure for approximating the idealized solid object.
((A , B) , 1/2 m )
38
The Convex Hull AlgorithmThe Convex Hull Algorithm
39
The Convex Hull AlgorithmThe Convex Hull Algorithm
40
The Convex Hull AlgorithmThe Convex Hull Algorithm
41
• Let Hm: (R2)m C(R2) be the classical convex Hull map, with C(R2) the set of compact subsets of R2.
• Let (IR2,) be the domain of rectangles in R2.• Each rectangle TIR2 has vertices T1,T2,T3,T4.
Im(x)=Int({Hm((Tif(i)))1im) | f:NmN4})
where Nk={1,2,…,k}
The Convex Hull mapThe Convex Hull map
• For x=(T1,T2,…,Tm)(IR2)m, define:
Cm : (IR2)m SR2
Cm(x)=(Im(x),Em(x)) with
Em(x)=(H4m((Ti1,Ti
2,Ti3,Ti
4))1im)c
42
The Convex Hull is Computable!The Convex Hull is Computable!
• Theorem: The map Cm : (IR2)m SR2
is Hausdorff and Lebesgue computable.
• Complexity:
1. Em(x) is O(m log m).
2. Im(x) is O(m3) but there is a good approximation in O(m log m), the complexity of the classical convex hull algorithm.
43
Conclusion Conclusion
Our model satisfies: A well-defined notion of computability Reflects the observable properties of real solids Is closed under basic operations Captures regular and non-regular sets Supports a methodology for designing robust
algorithms
44
Further WorkFurther Work
Work to be done:• Implementation with exact real arithmetic with interval input as in CAD
• Theoretical work Lebesgue computability of for regular solids Boundary representation Differential properties of curves/surfaces Solids of manifolds
45
Hausdorff computabilityHausdorff computability
)1,0( )1,1(
)0,1(
nQ
0r 1r 1nr nr r
21
121n
n21
0
.computableleft
rational,
nn
nn
rrr
However:
Q([1,0] [0, –1])= [r,1] {0} R2
is not Hausdorff computable.
is Hausdorff computable.
46
Hausdorff and Lebesgue computabilityHausdorff and Lebesgue computability
• Lebesgue computable Hausdorff computable
Let 0 < rn Q with rn ↗ r, left computable, non-computable 0 < r < 1.
• Then [r,1] {0} R2 is Lebesgue computable but not Hausdorff computable.
10r nr r0
47
Hausdorff and Lebesgue computabilityHausdorff and Lebesgue computability
• Hausdorff computable Lebesgue computableComplement of a Cantor set with Lebesgue measure
1– r with r =lim rn : left computable, non-computable.
• start with
• stage 1
• stage 2
• At stage n remove 2n open mid-intervals of length sn/2n.
nmnnn rsrrs
n
0m1 ,
0 1
s0
21s
48
• We strengthen the notion of a computable solid by using the Hausdorff distance d between compact sets as a quantitative measure of convergence.
• (A , B) S [–k, k]n is Hausdorff computable
iff there exists an effective chain Kß(n) of basis elements with ß a total recursive function such that:
(A , B) = ( ∪n π1 ( K ß(n) ) , ∪n π2 ( K ß(n) ) )
with
d (π1 ( K ß(n) ) , A ) < 1/2 n , d (π2 ( K ß(n) ) , B) < 1/2
n
d (π1 ( K ß(n) ) c, Ac) < 1/2 n , d (π2 ( K ß(n) ) c , Bc) < 1/2
n
Hausdorff ComputabilityHausdorff Computability
49