Upload
doantram
View
218
Download
2
Embed Size (px)
Citation preview
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 1
Robust Computation in Engineering, Geometry and Duality
ICONS 2012 Reunion Island
Courtesy of http://www.google.cz
Václav Skala
University of West Bohemia, Plzen, Czech Republic VSB‐Technical University, Ostrava, Czech Republic
http://www.VaclavSkala.eu
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 2
Plzen (Pilsen) City
Plzen is an old city [first records of Plzen castle 976] city of culture, industry, and brewery.
City, where today’s beer fermentation process was invented that is why today’s beers are called Pilsner ‐ world wide
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 3
Ostrava City
Ostrava is
• an industrial city of coal mining & iron melting
• 3rd largest city
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 4
University of West Bohemia 17530 students + 987 PhD students
Computer Science and Engineering Mathematics (including Geomatics)
Physics Cybernetics Mechanics (Computational)
• Over 50% of income from research and application projects • NTIS project (investment of 27 mil. EUR) • 2nd in the ranking of Czech technical / informatics faculties 2009, 2012
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 5
“Real science” in the XXI century
Courtesy of Czech Film, Barrandov
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 6
History of Mathematics
• Euclid ‐ synthetic geometry 300 BC • Descartes ‐ analytic geometry 1637 • Gauss – complex algebra 1798 • Hamilton – quaternions 1843 • Grassmann – Grasmann Algebra 1844 • Cayley – Matrix Algebra 1854 • Clifford – Clifford algebra 1878 • Gibbs – vector calculus 1881 • Sylvester – determinants 1878 • Ricci – tensor calculus 1890 • Cartan – differential forms 1908 • Dirac, Pauli – spin algebra 1928
Hestenes – Space‐time algebra 1966 Geometry Algebra 1984
Main line
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 7
Robust Computation in Engineering, Geometry and Duality
• Typical engineering and geometrical problems
• Euclidean and projective spaces
• Duality, property of dual transformation
• Algorithm complexity and dual problems
• Robustness & influence to algorithm design
• Typical examples of duality applications
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 8
Numerical systems
• Binary system is used nearly exclusively • Octal & hexadecimal representation is used • If we would be direct descendants of tetrapods – we would have a great advantage – “simple counting”
Name Base Digits E min E max BINARY
B 16 Half 2 10+1 −14 15B 32 Single 2 23+1 −126 127
B 64 Double 2 52+1 −1022 1023 B 128 Quad 2 112+1 −16382 16383
DECIMALD 32 10 7 −95 96D 64 10 16 −383 384D 128
10 34 −6143 6144
IEEE 758‐2008 standard
Figure 1
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 9
Mathematically perfect algorithms fail due to instability
• Main issues
– stability, robustness of algorithms
– acceptable speed
– linear speedup – results depends on HW, CPU …. parameters !
• Numerical stability
– limited precision of float / double
– tests A ? B with floats
• if A = B then ….. else ….. ; if A = 0 then ….. else …. should be forbidden in programming languages
– division operation should be removed or postponed to the last moment if possible ‐ “blue screens”, system resets
Vacla
Typ
Typicdoubwhile if x ##
av Skala htt
pical exa
– inters– point
– detecthrou
cal probble x = ‐1e ( x < +f (x == p += p;
if p =
p://www.Va
amples
section t lies on
Ax + ction if augh
lem 1; doubl1) ) Conso
= 0.1 the
aclavSkala.e
of insta
of 2 linea line inBy + C =a line int
le p = …
le.Out.W
en no ou
eu
bility
es in E3, n E2 or a= 0 ortersects
….;
WriteLin
tput, if
ICON
a plane iAx + By a polyg
e(” ***
f p = 0.2
NS 2012
n E3 y + Cz +gon, touc
”)
5 then e
D = 0 ches a v
expected
vertex or
d outpu
r passes
t
10
Vacla
Dela
Pointpoint
It ca
av Skala htt
unay tri
t inside ts in reg
n be see
p://www.Va
iangulat
of a circgular rec
en that t
aclavSkala.e
tion & V
cle givenctangula
the DT &
eu
Voronoi
n by threr grid.
& VD is v?? ROB
ICON
diagram
ee point
very senBUSTNES
NS 2012
m
s –– pro
nsitive toSS ??
oblems w
o a poin
with me
t positio
shing
on chang
11
ge
Vacla
Vecto
Vecto
PointGIVE
Coor
• Cr
• P• S• a(h
av Skala htt
ors and
ors – mo
ts – no sN coord
rdinate s
Cartesianight hanPolar Sphericand manhttp://m
p://www.Va
Points i
ovable,
size, posdinate sy
systems
n – left /nded sys
l y othersmathwor
aclavSkala.e
in Geom
no fixed
sition fixystem
:
/ right hstem is u
s, e.g. Corld.wolfr
eu
metry
d positio
xed in th
anded used
onfocal ram.com
ICON
on
he
Ellipsoidm/ Confo
NS 2012
dal CoorocalEllip
rdinatespsoidalC
s oordina
ates.htm
12
ml)
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 13
Vectors and Points in Geometry
Vector representation v = ( vx , vy , vz : 0 )
Point representation P = ( Px , Py , Pz : 1 ), resp. ( Px , Py , Pz : Pw ),
Many libraries do not distinguish between points and vectors and treat them in the same manner !! BE CAREFUL !!
v = P1 – P0 = ( Px1 , Py1 , Pz1 : 1 ) ‐ ( Px0 , Py0 , Pz0 : 1 ) = ( Px1 – Px0 , Py1 – Py0 , Pz1 – Pz0 : 0 ) = ( vx , vy , vz : 0 )
!!! Do not make it on CPU/GPU – result ( vx , vy , vz : ε )
It is a point ( vx / ε, vy /ε, vz / ε ) in E3
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 14
Floating point
• Not all numbers are represented correctly
• Logarithmic arithmetic • Continuous fractions • Interval arithmetic
• NOT valid identities
1
x y
4
1 1
3 2
5 3…
x + y = [a + c, b + d] x = [ a , b ]
x ‐ y = [a ‐ d, b ‐ c] y = [ c , d ]
x × y = [min(ac, ad, bc, bd), max(ac, ad, bc, bd)]
x / y = [min(a/c, a/d, b/c, b/d),
max(a/c, a/d, b/c, b/d)] if y ≠ 0
3; 7,15,1,292,1,1,1,2,1,3,1 …
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 15
Statements like
if <float> = <float> then …. or if <float> ≠ <float> then ….
should not be
Quadratic equation
0
If 4 then
4 /2
⁄
to get more reliable results.
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 16
Function value computation at 77617, 33096
, 333.75 11 121 2 5.5 / 2
6.33835 10 single precision
1,1726039400532 double precision
1,1726039400531786318588349045201838 extended precision
The correct result is “somewhere” in the interval of
0,827396059946821368141165095479816292005, 0,827396059946821368141165095479816291986
Exact solution
, 2 25476766192
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 17
Summation is one of often used computations.
10 0.999990701675415
or
10 1.000053524971008
The result should be one. The correctness in summation is very important in power series computations. !!!!ORDER of summation
1 14.357357
114.392651
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 18
Recursion
• Towers o Hanoi
• Ackermann function
The value of the function grows very fast as
4,4 2 2
MOVE (A, C, n); MOVE (A, B, n‐1); MOVE (A, C, 1); MOVE (B, C, n‐1) # MOVE (from, to, number) #
,1 0
1,1 0 01, , 1 0 0
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 19
Numerical computations
Hilbert’s Matrix
1 1 1 1 21
1.0E-131.0E-111.0E-091.0E-071.0E-051.0E-031.0E-011.0E+011.0E+031.0E+051.0E+071.0E+091.0E+111.0E+131.0E+151.0E+171.0E+19
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Err
or
Order of the Hilbert matrix
ε
εp
ξ
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 20
Mathematical “forms” There are several “forms”:
• Implicit , , 0 0 there is no orientation, e.g.
o if 0 is a iso‐curve there is no hint how to find another point of this curve, resp. a line segment approximating the curve => tracing algorithms
o if 0 is a iso‐surface there is no hint how to find another point of this surface => iso‐surface extraction algorithms
• Parametrical – , points of a curve are “ORDERED” according to a parameter
• Explicit , for the given values , resp. , we get function value
Vacla
Impl
• Iso
• Tc
• C
av Skala htt
icit form
s used fooutside, There is aomplexCompiler
p://www.Va
m
or separe.g. a cialways axity of cor optimi
aclavSkala.e
ration –rcle etc.a questiomputatzation is
eu
plane o. on how tions × ps DANGE
ICON
r for det
to compprecisionEROUS i
NS 2012
tection
pute n of comin gener
if a poin
mputatioral
nt is insid
on
de or
21
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 22
Data processing ‐ main field in computer science
Data processing itself can be split to two main areas:
• processing of textual data limited interval of values, unlimited dimensionality
[char as one dimension ‐
Methionylthreonylthreonylglutaminylarginyl...isoleucine 189,819 chars] ‐ no interpolation is defined
• processing of numerical data unlimited interval of values, limited dimensionality – usually 2 or 3
‐ interpolation can be used
Textual Graphical
Dim ∞ 2, 3
Interval 0‐255 (ASCII)
(‐∞, ∞)
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 23
Hash functions
• usually used for textual data processing • prime numbers and modulo operations are used for the hash function
Usual form
3 5 7
multiplication int * float is needed 271
11
10
100
1000
1 2001 4001 6001 8001 10001 12001
Num
ber o
f buc
kets
Bucket length
18
1
10
100
1 201 401 601 801 1001 1201
Num
ber o
f buc
kets
Bucket length
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 24
If the hash function is constructed as
where , , are “irrational” numbers and 2 1 better distribution is
obtained => much faster processing.
173878
1
10
100
1000
10000
100000
1000000
1 10 100 1000
Num
ber o
f clu
ster
s
Cluster length
data set: A4_unterbau1.stl
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 25
Textual processing
The has function is constructed as
„irrational“ 0 1
2 1
Both geometrical and textual hash function design have the same approach coefficients are “irrational” and no division operation is needed.
Some differences for Czech, Hebrew, English, German, Arabic, … languages and “chemical” words.
1
10
100
1000
10000
0 0.2 0.4 0.6 0.8 1
q
English dictionary (start)
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 26
Projective Space
X = [X, Y]T X∈E2
x = [ x, y: w]T x∈P2
Conversion:
X = x / w Y = y / w
& w ≠ 0
If w = 0 then x represents “an ideal point” ‐ a point in infinity, i.e. it is a directional vector.
The Euclidean space E2 is represented as a plane w = 1.
x y
w
w=1x
X Y
(a)
pP2
E2
ρ
a b
c
c=1D(p)
D( )ρ
A B
(b)
D(P )2
D(E ) 2
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 27
Duality
For simplicity, let us consider a line p defined as:
aX + bY + c = 0
We can multiply it by w ≠ 0 and we get:
ax + by + cw = 0 i.e. pTx = 0 p = [ a, b: c]T x = [ x, y: w]T
It is actually a plane in the projective space P2 (point [0, 0: 0]T excluded),
i.e. line p∈E2: p = [a, b: c]T
x y
w
w=1x
X Y
(a)
pP2
E2
ρ
a b
c
c=1D(p)
D( )ρ
A B
(b)
D(P )2
D(E ) 2
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 28
From the mathematical notation pTx = 0
we cannot distinguish whether p is a line and x is a point or vice versa in the case of P2. It means that a point and a line are dual in the case of P2, and a point and a plane are dual in the case of P3.
The principle of duality in P2 states that:
Any theorem remains true when we interchange the words “point” and “line”, “lie on” and “pass through”, “join” and “intersection”, “collinear” and “concurrent” and so on.
Once the theorem has been established, the dual theorem is obtained as described above.
This helps a lot to solve some geometrical problems.
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 29
Definition 1
The cross product of the two vectors x1 = [x1,y1:w1]T and x2 = [x2,y2:w2]
T is defined as:
1 2 1 1 1
2 2 2
× det x y wx y w
⎡ ⎤⎢ ⎥= ⎢ ⎥⎢ ⎥⎣ ⎦
i j kx x
where: i = [1,0,0]T, j = [0,1,0]T, k = [0,0,1]T
Please, note that homogeneous coordinates are used.
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 30
Theorem 1
Let two points x1 and x2 be given in the projective space. Then the coefficients of the p line, which is defined by those two points, are determined as the cross product of their homogeneous coordinates
p = x1× x2
Proof 1
Let the line p∈E2 be defined in homogeneous coordinates as
ax + by + cw = 0
We are actually looking for a solution to the following equations:
1 0T =p x and 2 0T =p x where: p = [a,b,c]T
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 31
It means that any point x that lies on the p line must satisfy both the
equation above and the equation 0T =p x in other words the p vector is
defined as
1 1 1
2 2 2
det x y wx y w
⎡ ⎤⎢ ⎥= ⎢ ⎥⎢ ⎥⎣ ⎦
i j kp
We can write ( )1 2× 0T =x x x
i.e.
1 1 1
2 2 2
det 0x y wx y wx y w
⎡ ⎤⎢ ⎥ =⎢ ⎥⎢ ⎥⎣ ⎦
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 32
Evaluating the determinant
0
we get the line coefficients of the line p as:
⎥⎦
⎤⎢⎣
⎡=
22
11detwywy
a
⎥⎦
⎤⎢⎣
⎡−=
22
11detwxwx
b
⎥⎦
⎤⎢⎣
⎡=
22
11detyxyx
c
Note: for w = 1 we get the standard cross product formula and the cross product defines the p line, i.e. p = x1 × x2
where: p = [a,b:c]T
• An intersection of two lines => A x = b • A line given by two points => A x = 0
Cross product is equivalent to a solution of a linear system of
equations !
No division operation !
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 33
Computation in Projective Space
• Cross product definition
• A plane ρ is determined as a cross product of three given points
Due to the duality
• An intersection point x of three planes is determined as a cross product of three given planes
Computation of generalized cross product is equivalent to a solution of a linear system of equations => no division operation!
1 1 1 11 2 3
2 2 2 2
3 3 3 3
× ×x y z wx y z wx y z w
⎡ ⎤⎢ ⎥⎢ ⎥=⎢ ⎥⎢ ⎥⎣ ⎦
i j k l
x x x
1 1 1 11 2 3
2 2 2 2
3 3 3 3
× ×a b c da b c da b c d
⎡ ⎤⎢ ⎥⎢ ⎥=⎢ ⎥⎢ ⎥⎣ ⎦
i j k l
ρ ρ ρ
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 34
Computation in Projective Space
E2 E3
Dual problem
In graphical applications position of points are changed by an interaction, i.e. . The question is how coefficients of a line, resp. a plane are changed without need to recompute them from the definition.
It can be proved that , resp.
As the computation is made in the projective space we can write
, resp.
THIS IS SIGNIFICANT SIMPLIFICATION OF COMPUTATIONS
Vacla
Com
Trans
av Skala htt
putatio
sformat
p://www.Va
n in Pro
tion abo
aclavSkala.e
ojective S
ut a gen
eu
Space
neral axi
ICON
s
NS 2012
35
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 36
Computation in Projective Space
Transformation about a general axis
1
1 where:
Instead of usually used transformations:
That is generally complex, unstable as a user has to select which axis is to be used for a rotation
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 37
Computation in Projective Space
Interpolation
• It means that we can interpolate using homogeneous coordinates without a need of “normalization” to Ek !!
• Homogeneous coordinate w ≥ 0 In many algorithms, we need “monotonous” parameterization, only
( )
( )
0 1 0
0 1 0
0 1 0 0 1 0
0 1 0 0 1 0
Linear parametrization( ) ( ) ,
Non-linear (monotonous) parametrization( ) ( ) ,( ) ( ) ( ) ( )( ) ( ) ( ) ( )
t t t
t t tx t x x x t y t y y y tz t z z z t w t w w w t
= + − ∈ −∞ ∞
= + − ∈ −∞ ∞
= + − = + −
= + − = + −
X X X X
x x x x
0.00
1.00
2.00
3.00
4.00
5.00
6.00
7.00
0.0 0.2 0.4 0.6 0.8 1.0 1.2
1.50
1.70
1.90
2.10
2.30
2.50
2.70
2.90
3.10
0.00 1.00 2.00 3.00 4.00 5.00 6.00 7.00
Y
Vacla
Com
av Skala htt
putatio
p://www.Va
n in Pro
aclavSkala.e
ojective S
eu
Space
ICONNS 2012
Courtesy of W
Wikipedia
38
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 39
Computation in Projective Space
Spherical interpolation
, ,sin 1 Ω
sin Ωsin Ω
sin Ω
Instability occurs if Ω .
Mathematically formula is correct,
in practice the code generally incorrect! [ ]
, , sin 1 Ω sin Ωsin Ω
sin 1 Ω sin Ω : sin Ω
Homogeneous coordinate
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 40
Computation in Projective Space
Intersection line – plane
An intersection of a plane with a line in E2 / E3 can be computed efficiently
Comparison operations must be modified !!!
Cyrus‐Beck line clipping algorithm 10‐25% faster
( )
[ ]
0 1 0
1 0
0
0
min
min min
( ) ( ) ,
0 0
, , ,
: 0 :
TEST.....
* * ..... condition 0w
T
T
T
T
T Tw
w w
w
t t t
ax by cz d
a b c d
t
t t
τ τ
τ τ τ
τ τ τ τ τ
= + − ∈ −∞ ∞
= + + + =
= = −
= −
= − =
= ≤ = −⎡ ⎤⎣ ⎦
>> ≥
x x x x
a x
a S X X
a xa sa x a s
t if then t t
if thenif then
Vacla
Line proce xA , x The inpubegin1 p2 fo
3 4 if5 i:6 xA7 Dend
av Skala htt
Clippingedure CLxB – in hEXIT endut: xA , xBn p := xA x xor k:=0 to
if pTxkf c = [000= TAB1[cxA := p x eDRAW (xACLIP_L;
p://www.Va
g LIP_L; Skhomogends the pr
B ; xA=[xA
xB; ax+bo N‐1 do
k ≥ 0 then00]T or c c]; j:= TAei ; xB := p
A; xB )
aclavSkala.e
kala – Voneous coorocedure,yA,1]
T p
by+c = 0o xk=[xk,
n ck:=1 e= [1111]B2[c]; p x ej ; ei – i‐th
eu
l.21, No.ordinatee p = [a,b,c]
yk,1]
T
else ck:=0]T then EX
h edge
ICON
11, pp.90s
]T
0; XIT;
NS 2012
05‐914
41
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 42
Computation in Projective Space ‐ Barycentric coordinates
Let us consider a triangle with vertices X1, X2, X3,
A position of any point X∈E2 can be expressed as
Linear system must be solved
If points xi are given as [xi, yi, zi: wi ]T and wi ≠ 1then xi must be “normalized”
1 1 2 2 3 3
1 1 2 2 3 3
1 2 3
additional condition1 0 1
i = 1,...,3
i
ii
a X a X a X Xa Y a Y a Y Y
a a a aP
aP
+ + =
+ + =
+ + = ≤ ≤
=
P1
x1
x
x3
P3
x2
P2
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 43
Computation in Projective Space
Rewriting
11 2 3
21 2 3
3
41 1 1 1
bX X X X
bY Y Y Y
bb
⎡ ⎤⎡ ⎤ ⎢ ⎥⎢ ⎥ ⎢ ⎥ =⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥⎣ ⎦
⎣ ⎦
0
Solution of the linear system of equations (LSE) is equivalent to generalized cross product
1 1 2 2 3 3 4
1 1 2 2 3 3 4
1 2 3 4
4 4
00
01,...,3 0i i
b X b X b X b Xb Y b Y b Y b Yb b b bb a b i b
+ + + =
+ + + =
+ + + =
= − = ≠
[ ]
1 2 3 4
1 2 3
1 2 3
× ×
, , ,
, , ,
, , ,
1,1,1,1
T
T
T
T
b b b b
X X X X
Y Y Y Y
=
= ⎡ ⎤⎣ ⎦
= ⎡ ⎤⎣ ⎦
= ⎡ ⎤⎣ ⎦
=
b ξ η w
b
ξ
η
w
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 44
Computation in Projective Space
if wi ≠ 1
=> entities: projective scalar, projective vector
( Skala,V.: Barycentric coordinates computation in homogeneous coordinates, Computers&Graphics, 2008)
11 2 3
21 2 3
31 2 3
4
bx x x x
by y y y
bw w w w
b
⎡ ⎤⎡ ⎤ ⎢ ⎥⎢ ⎥ ⎢ ⎥ =⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥⎣ ⎦
⎣ ⎦
0
1 2 3 4
1 2 3
1 2 3
1 2 3
× ×
, , ,
, , ,
, , ,
, , ,
T
T
T
T
b b b b
x x x x
y y y y
w w w w
=
= ⎡ ⎤⎣ ⎦
= ⎡ ⎤⎣ ⎦
= ⎡ ⎤⎣ ⎦
= ⎡ ⎤⎣ ⎦
b ξ η w
b
ξ
η
w
1 2 3
2 3 1
3 1 2
0 ( : ) 10 ( : ) 10 ( : ) 1
b w w wb w w wb w w w
≤ − ≤
≤ − ≤
≤ − ≤
Vacla
Com
Line Inter
• Pc
• P
av Skala htt
putatio
in E3 asrsectionPlücker’s omplicat
Projective
p://www.Va
n in Pro
s Two Pl coordinated comp
e comput
aclavSkala.e
ojective S
ane
ates – putation
tation
eu
Space
ICONNS 2012 45
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 46
Computation in Projective Space
Standard formula
The formula is quite “horrible” one and for students not acceptable as it is too complex and they do not see from the formula comes from.
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 47
Computation in Projective Space
, , : , , :
normal vectors are
, , , ,
directional vector of a line of two planes and is given as
“starting” point ???
A plane passing the origin with a normal vector , , , : 0
The point is defined as
How simple formula supporting matrix‐vector architectures like GPU and parallel processing
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 48
Computation in Projective Space
Advantages
• “infinity” is well represented • No division operation is needed • Many mathematical formula are simpler • One code sequence solve primary and dual problems • Supports matrix – vector operations in hardware – like GPU etc.
Disadvantages
• Careful handling with formula as the projective space • Exponents of the homogeneous vector can overflow – it should be normalized not supported by the current hardware – P_Lib use on GPU (C# and C++)
Vacla
Com
• Go
• Ne
• P
av Skala htt
putatio
GPU (Graoperation
Native ariexponent
Programm
p://www.Va
n in Pro
phical Prn – espec
ithmetic t “norma
mable HW
aclavSkala.e
ojective S
rocessingcially for
operatiolization”
W – para
eu
Space
g Unit) ‐o[x,y,z,w]
ons with
llel proce
ICON
optimized
homoge
essing
NS 2012
d for mat
neous co
trix‐vecto
oordinate
or, vecto
es – with
or‐vector
hout
49
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 50
Computation in Projective Space
4D cross product can be implemented in Cg/HLSL on GPU (not optimal implementation) as:
float4 cross_4D(float4 x1, float4 x2, float4 x3) float4 a; a.x=dot(x1.yzw, cross(x2.yzw, x3.yzw)); a.y=‐dot(x1.xzw, cross(x2.xzw, x3.xzw)); a.z=dot(x1.xyw, cross(x2.xyw, x3.xyw)); a.w=‐dot(x1.xyz, cross(x2.xyz, x3.xyz)); return a;
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 57
Acknowledgment Questions
Thanks belong to colleagues at UWB & VSB universities for discussions and help, to many authors of published related papers, I haven’t refer properly (a list would be too long*). Research supported by the MSMT CR, projects No. LA10035, ME10060
Contact: Vaclav Skala http://www.VaclavSkala.eu University of West Bohemia, Plzen & VSB‐Technical University, Ostrava Czech Republic *) Please, find related reference in: • Skala,V.: Geometry, Duality and Robust Computation in Engineering, submitted for publication, 2012
• Skala,V.: Interpolation and Intersection Algorithms and GPU, ICONS2012, VisGra 2012 workshop, accepted for publications, 2012
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 58
Main References [1] van Verth,J.M., Bishop,L.M.: Essential Mathematics for Games and Interactive
Applications, Morgan Kaufmann 2005 [2] Skala,V.: GPU Computation in Projective Space Using Homogeneous Coordinates ,
Game Programming GEMS 6 (Ed.Dickheiser,M.), pp.137‐147, Charles River Media, 2006 [3] Skala,V.: A new approach to line and line segment clipping in homogeneous
coordinates, The Visual Computer, Vol.21, No.11, pp.905‐914, Springer Verlag, 2005 [4] Skala,V.: Barycentric coordinates computation in homogeneous coordinates, submitted
for publication, 2007 [5] Skala,V.: Length, Area and Volume Computation in Homogeneous Coordinates,
International Journal of Image and Graphics, Vol.6., No.4, pp.625‐639, 2006 [6] Yamaguchi,F.: Computer Aided Design – A totally Four‐Dimensional Approach, Springer
Verlag 2002 [7] Fernando,R., Kilgard,M.J.: The Cg Tutorial, Addison Wesley, 2003 [8] Skala,V., Kaiser,J., Ondracka,V.: Library for Computation in the Projective Space,
Aplimat 2007 conf., 2007 [9] Uhlir,K., Skala,V.: Radial Basis Functions, EUSIPCO 2005
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 59
RESOURCES FOR ROBUST COMPUTATION Numerical nonrobustness causes all kinds of failures. But can you produce an example with an infinite loop? This and other forms of manifestation are discussed in Anatomy of Algorithmic Failures. It is intended to provide classroom examples. Source code available. Robust Geometric Algorithms and their Implementation, Guest Editorial Forward from a Special Issue of Computational Geometry: Theory and Applications (CGTA 33:1, 2006). Resource Page for ``Survey/Tutorial on Exact Geometric Computing'' Lectures at Workshop on Geometric Computing, University of Hong Kong, June 27‐‐29, 2001.
General Forums on Nonrobustness Issues ‐‐ DIMACS Workshop on Implementation of Geometric Algorithms Dec 4‐6, 2002 ‐‐ SIAM Minisymposium: Robust Geometric Computation (2001) ‐‐ MSRI Workshop on Foundations of CAD (1999) ‐‐ SIAM Workshop on Integration of CAD and CFD (1999) ‐‐ Emerging Challenges in Computational Topology Report (1999) ‐‐Computational Geometry Task Force Report (1996) ‐‐ SIGGRAPH'98 Panel on Robust Geometry. Position Statements from panelists. ‐‐ACM Strategic Directions Report (1996) ‐‐Tom Peters's presentation on Non‐robustness Issues in CAGD [here is a local copy] This work is part of the NSF/DARPA CARGO Program (2001‐4) in which non‐robustness and topological consistency issues are addressed.
Non‐robustness in the News ‐‐ Patriot Missile Defense Saga, from US General Accounting Office (local copy) ‐‐ Ariane 5 Saga, from European Space Agency ‐‐ Software Bugs Cost US economy $59.5 billion/year. The report focused on the financial sector, and the automotive and aircraft manufacturing industries. In the latter 2 industries, the cost is estimated at $1.8 billion/year. Report was prepared by Research Triangle Institute for NIST. ‐‐ Disasters attributable to numerical errors, from Doug Arnold (including the North Sea oil rig collapse)
Projects and Groups ‐‐K. Mehlhorn at Max‐Planck Institute of Computer Science is involved in various robustness projects (LEDA, CGAL, EXACUS). ‐‐PRISME Project at INRIA, Sophia‐Antipolia, directed by J.‐D. Boissonnat. ‐‐ Superrobust Computation Project of K. Sugihara at Tokyo University ‐‐ Arenaire Project of J.‐M. Muller. ‐‐ iRRAM Project of N. Mueller is a C++ package for error‐free real arithmetic based on the concept of a real RAM. ‐‐ Professor Cuyt's Group on Computer Arithmetic and Numerical Techniques. ‐‐ Evaluation of Special Functions from Dan Lozier at NIST: includes a function evaluator service.
RETRIEVED from http://www.cs.nyu.edu/csweb/Research/Groups/ http://www.cs.nyu.edu/csweb/Research/Groups/
Vaclav Skala http://www.VaclavSkala.eu ICONS 2012 60
Software ‐‐ GMP Home. New in GMP 3.1 (FFT Based Multiplication!) ‐‐MPFR homepage The MPFR library is a C library for multiprecision floating‐point computations with exact rounding. It is based on the GMP multiprecision library and will replace the MPF class starting with version 3.1 of GMP. Here are some timings . ‐‐ Intel's Open source for Numerics ‐‐ Arithmetic Explorer
Robust Meshing and Triangulation ‐‐ GNU Triangulated Surface (GTS) Library: Open Source free software for 3D surfaces triangular meshes. Version 0.4.0 (Jan 2001). FEATURES: based on the GTK+ GUI Toolkit, 2D dynamic constrained Delaunay triangulation, robust predicates of Shewchuk, Boolean set operations, multiresolution models, dynamic view‐independent LOD, some view‐dependent LOD, Kd‐trees, collision detection. [ Bibliography | Reference Manual | ]
Computing transcendental functions. ‐‐ The Table Maker's Dilemma ‐‐ Elementary Functions, Algorithms and Implementation, book by Jean‐Michel Muller from Birkhauser, Boston (1997).
Organizations and Web Resources ‐‐ CCA Net (Computability and Complexity in Analysis) ‐‐ Interval Computation ‐‐ Real Algebraic and Analytic Geometry (RAAG) ‐‐ Foundations of Computational Mathematics
Software Resources Source Forge: free Open Source developer services (CVS, mailists, forums, site hosting, etc). Thousands of projects in every field.
Conferences ‐‐ IEEE Symposium on Computer Arithmetic. Call for Papers for 15th Symposium on Computer Arithmetic (Nov 1, 2000). ‐‐ 4th Conference on Real Numbers and Computers ‐‐ 4th Workshop on Computability and Complexity in Analysis Sep 17‐20, 2000, Swansea, Wales.
Bibliography Collection ‐‐ Constructivity, Computability and Complexity in Analysis, a collection of over 500 entries. ‐‐ Numerical techniques from Rational Approximation Theory and Computer Arithmetic, a collection of over 2500 entries.
RETRIEVED from http://www.cs.nyu.edu/csweb/Research/Groups/ http://www.cs.nyu.edu/csweb/Research/Groups/