A New Foundation for Computational Geometry and Solid

Download Report

Transcript A New Foundation for Computational Geometry and Solid

A data Type for
Computational Geometry &
Solid Modelling
Abbas Edalat
André Lieutier
Imperial College
Dassault Systemes
Aim
To develop a data type for CG & SM
i. Mathematically sound, realistic
ii. Bridges theory and practice
2
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!
3
The Intersection of two lines
L1
L2
P
With floating point arithmetic, find the point
P of the intersection L1  L2. Then:
min_dist(P, L1) > 0,
min_dist(P, L2) > 0.
4
The Convex Hull Algorithm
A, B & C nearly collinear
A
With floating point we
can get:
B
C
5
The Convex Hull Algorithm
A, B & C nearly collinear
A
With floating point we
can get:
(i) AC, or
B
C
6
The Convex Hull Algorithm
A, B & C nearly collinear
A
With floating point we
can get:
(i) AC, or
(ii) just AB, or
B
C
7
The Convex Hull Algorithm
A, B & C nearly collinear
A
With floating point we
can get:
(i) AC, or
(ii) just AB, or
(iii) just BC, or
B
C
8
The Convex Hull Algorithm
A, B & C nearly collinear
A
With floating point we
can get:
(i) AC, or
(ii) just AB, or
(iii) just BC, or
(iv) none of them.
B
C
The quest for robust algorithms is the most fundamental
unresolved problem in solid modelling and computational
geometry.
9
A Fundamental Problem in Topology and Geometry
• Subset A  X topological space.
Membership predicate A : X  {tt, ff }
 tt
x
 ff
x A
x A
is continuous iff A is both open and closed.
• In particular, for A  Rn, A  , A  Rn
A : Rn  {tt, ff } is not continuous.
• Most engineering is done, however, in Rn.
10
The Discontinuity of the Membership Predicate
• The basic building blocks of classical geometry are
not continuous and hence not computable in Rn.
• Example: The point
xis in the box.
True
x
11
The Discontinuity of the Membership Predicate
• The basic building blocks of classical geometry are
not continuous and hence not computable in Rn.
• Example: The point
xis in the box.
False
x
12
Non-computability of the Membership Predicate
• There is a discontinuity if x
goes through the boundary.
True
False
x
• This predicate is not
computable:
If x is on the boundary, we
cannot in general determine if
it is in or out at any finite
stage of computation.
x
13
Non-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.
14
Intersection of two 3D cubes
15
Intersection of two 3D cubes
16
Intersection of two 3D cubes
17
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.
18
Elements 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.
open
open
tt
• Redefine: A : X {tt, ff}
tt

x   ff


x  IntA
ff
observable
observable
x  IntAc
x  A
with the Scott topology on {tt, ff}.
• A is now a continuous function.

Non-observable
19
Elements 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.
20
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.
21
The 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:
S(X )

f

( f 1{tt}, f 1{ ff })

(O1 , O2 )
O1  O2  
tt

x   ff


x  O1
x  O2
otherwise
SO ( X )
22
Properties 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 O1c.
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.
23
Examples
A
• A = {xR2 ⃒ |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
• B = {xR2 ⃒ |x| ≤ 1}
represented by
({x ⃒ |x| < 1} , {x ⃒ |x| > 1})  Maximal (SR2, ⊑)
is a regular solid object.
24
Boolean operations and predicates
 : SX  SX
(O1 , O2 )  (O2 , O1 )
 : SX  SX  SX
(( A1 , A2 ) , ( B1 , B2 ))  ( A1  B1 , A2  B2 )
 : SX  SX  SX
(( A1 , A2 ) , ( B1 , B2 ))  ( A1  B1 , A2  B2 )
Theorem All these operations and predicates are Scott continuous.
25
Subset Inclusion
• Let Sb X  {( A1, A2 )  SX | A2 compact}{(, )}.
c
 : Sb X  SX  {tt , ff }
tt

(( A1 , A2 ), ( B1 , B2 ))   ff


A2  B1  X
A1  B2  
otherwise.
• Subset inclusion is Scott continuous.
26
General 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.
27
An 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) is a computable partial solid object if there
exists a total recursive function ß such that
(A , B) = ( ∪n π1 ( K ß(n) ) , ∪n π2 ( K ß(n) ) )
28
Computing 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.
29
Computable 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.
30
Quantative 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 semicomputable, but not computable.
• We will enrich the notion of domain-theoretic
computability to include a quantitative measure
of convergence.
31
Hausdorff Computability
• 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
32
Hausdorff 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.
33
Lebesgue 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.
34
Hausdorff and Lebesgue Computable Objects
• 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.
35
Comparison of Various Notions of Computability
Partial solid
in Rn
Distance to
a point
Computable
Boolean
operators
Lebesgue
measure
semicomputable
computable
noncomputable
Hausdorff
computable
computable
noncomputable
noncomputable
Lebesgue
computable
semicomputable
computable
computable
36
The 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 )
37
The Convex Hull Algorithm
38
The Convex Hull Algorithm
39
The Convex Hull Algorithm
40
The Convex Hull map
• 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 TIR2 has vertices T1,T2,T3,T4.
• For x=(T1,T2,…,Tm)(IR2)m, define:
Cm : (IR2)m  SR2
Cm(x)=(Im(x),Em(x)) with
Em(x)=(H4m((Ti1,Ti2,Ti3,Ti4))1im)c
Im(x)=Int({Hm((Tif(i)))1im) | f:NmN4})
where Nk={1,2,…,k}
41
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.
42
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
43
Further 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
44
Hausdorff computability
(1,1)
(0,1)
rn rat ional,rn  r
left comput able.
Qn
1
2
1
2 n1
1
2n
r0 r1
rn 1 rn r
Q   Qn
n0
is Hausdorff
computable.
However:
Q([1,0]  [0, –1])
= [r,1]  {0}  R2
(1,0) is not Hausdorff
computable.
45
Hausdorff and Lebesgue computability
• Lebesgue computable  Hausdorff computable
Let 0 < rn  Q with rn ↗ r, left computable, noncomputable 0 < r < 1.
• Then [r,1]  {0}  R2 is Lebesgue computable but not
Hausdorff computable.
0 r0
rn
r
1
46
Hausdorff and Lebesgue computability
• Hausdorff computable  Lebesgue computable
Complement of a Cantor set with Lebesgue measure
1– r with r =lim rn : left computable, non-computable.
• start with
0
1
• stage 1
s0
• stage 2
s1
2
• At stage n remove 2n open mid-intervals of length sn/2n.
sn  rn  rn1 ,
n
s
m 0
m
 rn
47
Hausdorff Computability
• 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
48
49