eurographics 2 0 1 3
play

Eurographics 2 0 1 3 Projective Geom etry, Duality and Precision of - PowerPoint PPT Presentation

Eurographics 2 0 1 3 Projective Geom etry, Duality and Precision of Com putation in Com puter Graphics, Visualization and Gam es Tutorial Vaclav Skala University of West Bohemia, Plzen, Czech Republic VSB-Technical University, Ostrava, Czech


  1. Eurographics 2 0 1 3 Projective Geom etry, Duality and Precision of Com putation in Com puter Graphics, Visualization and Gam es Tutorial Vaclav Skala University of West Bohemia, Plzen, Czech Republic VSB-Technical University, Ostrava, Czech Republic http://www.VaclavSkala.eu Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 1

  2. Eurographics 2 0 1 3 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 Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 2

  3. Eurographics 2 0 1 3 Ostrava City Ostrava is • an industrial city of coal mining & iron melting • 3 rd largest city Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 3

  4. Eurographics 2 0 1 3 University of W est Bohem ia 1 7 5 3 0 students + 9 8 7 PhD students Com puter Science and Engineering Mathem atics (+ Geomatics) Physics Cybernetics Mechanics (Computational) • Over 5 0 % of income from research and application projects • New research center EU project - investment 64 mil. EUR • 2 nd in the ranking of Czech technical / informatics faculties 2009, 2012 Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 4

  5. Eurographics 2 0 1 3 “Real science” in the XXI century Courtesy of Czech Film, Barrandov Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 5

  6. Eurographics 2 0 1 3 An overview • Precision and robustness • Euclidean space and projective extension • Principle of duality and its applications • Geometric computation in the projective space • Intersection of two planes in E3 with additional constrains • Barycentric coordinates and intersections • Interpolation and intersection algorithms • Implementation aspects and GPU • Conclusion and summary Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 6

  7. Eurographics 2 0 1 3 Num erical system s • 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 in hexadecimal system” Nam e Base Digits E m in E m ax BI NARY B 16 Half 2 10+1 − 14 15 B 32 Single 2 23+1 − 126 127 B 64 Double 2 52+1 − 1022 1023 B 128 Quad 2 112+1 − 16382 16383 DECI MAL D 32 10 7 − 95 96 D 64 10 16 − 383 384 D 128 10 34 − 6143 6144 IEEE 758-2008 standard Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 7

  8. Eurographics 2 0 1 3 Mathem atically perfect algorithm s fail due to instability Main issues • stability, robustness of algorithms • acceptable speed • linear speedup – results depends on HW, CPU …. parameters ! Num erical 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 Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 8

  9. Eu urogr raphic cs 2 0 1 3 Typical e T exam ple es of ins stability • inters section o of 2 lines in E3 • point lies on a a line in E E2 or a p plane in E E3 D = 0 Ax + By + C = 0 or r Ax + By y + Cz + • detec ction if a line inte rsects a polygon, , touches s a vertex x or pass ses throu ugh Typical p T problem m double x x = -1; d double p = ….; d w hile ( x x < +1) w { { if (x == p) Co onsole.O ut.WriteL Line(” ** ** ”) x += p; } } /* if p / p = 0.1 th hen no o output, if p = 0. 25 then expecte ed output t */ E Eurographics 2 2013 Vaclav Sk kala http p://www.Vacla avSkala.eu 2 2013-05-03 9

  10. Eu urogr raphic cs 2 0 1 3 D Delauna y triang gulation & Voron noi diag gram P Point insi de of a c circle give en by thr ree point ts – prob lems with meshin ng points s i n regular r rectang gular grid d. I It can be seen tha at the DT T & VD V i s very se ensitive t to a point t p position c change S ?? ?? ROBU ? USTNESS E Eurographics 2 2013 Vaclav Sk kala http p://www.Vacla avSkala.eu 2 2013-05-03 10

  11. Eurographics 2 0 1 3 Vectors and Points in Geom etry • Vectors – movable, no fixed position • Points – no size, position fixed in the GIVEN coordinate system Coordinate system s : • Cartesian – left / right handed Courtesy of http://mathworld.wolfram.com/ right handed system is used ConfocalEllipsoidalCoordinates.html • Polar • Spherical, Cylindrical • and many others, e.g. Confocal Ellipsoidal Coordinates http://mathworld.wolfram.com/ConfocalEllipsoidalCoordinates.html Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 11

  12. Eurographics 2 0 1 3 Floating point 4 • Not all numbers are represented � � 1 � correctly 1 � 2 � 3 � 5 � 3 � • Logarithmic arithmetic … • Continuous fractions � � �3; 7,15,1,292,1,1,1,2,1,3,1 … � • Interval arithmetic x + y = [a + c, b + d] x = [ a , b ] Num erically NOT valid x - y = [a - d, b - c] y = [ c , d ] identities due to limited x × y = [min(ac, ad, bc, bd), max(ac, ad, bc, bd)] precision x / y = [min(a/c, a/d, b/c, b/d), • ��� � � � ��� � � � 1 • x � � y � � �� � ���� � �� max(a/c, a/d, b/c, b/d)] if y ≠ 0 Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 12

  13. Eurographics 2 0 1 3 Statem ents like if <float> = <float> then …. or if <float> ≠ <float> then …. should not be allow ed in program m ing languages Quadratic equation - m ore reliable results � �,� � �� � √� � � 4�� �� � � �� � � � 0 usually solved as 2� If � � � 4�� then � � � � � � � � � � ⁄ � � � ��� � ��������� � � 4�� �/2 The discriminant should be computed with a twice precision � � � � � � � � � � � � � � � � ⁄ � Vieta’s form ula Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 13

  14. Eurographics 2 0 1 3 at � � 77617 , � � 33096 Function value com putation ���, �� � 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,82739605994682136814116509547981629����, �0,82739605994682136814116509547981629����� Exact solution ���, �� � �2 � � 2� � 54767 66192 Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 14

  15. Eurographics 2 0 1 3 Sum m ation is one of often used com putations. �� � � 10 �� � 0.999990701675415 ��� or �� � � 10 �� � 1.000053524971008 ��� The result should be only one. The correctness in sum m ation is very im portant in pow er series com putations. !!!!ORDER of sum m ation � �� � � 1 � 1 � � 14.392651 � � 14.357357 ���� � ��� Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 15

  16. Eurographics 2 0 1 3 Recursion MOVE (A, C, n); Towers of Hanoi { MOVE (A, B, n-1); MOVE (A, C, 1); MOVE (B, C, n-1) } # MOVE (from, to, number) # Ackermann function ���, �� � � 1 �� � � 0 ��� � 1,1� �� � � 0 ��� � � 0 � � ��� � 1, ���, � � 1�� �� � � 0 ��� � � 0 The value of the function grows very fast as ��4,4� � 2 � ������ � 2 � �������� Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 16

  17. Eurographics 2 0 1 3 �� � � � � � �� � Num erical com putations � Hilbert’s Matrix I nversion ����� � �� � � �� � ��1� ��� �� � � � 1� �� � � � 1 � �� � � � 1 � �� � � � 2 � �� � � 1 � � � � � � � 1,0E+19 1,0E+17 1,0E+15 1,0E+13 1,0E+11 1,0E+09 Error 1,0E+07 1,0E+05 1,0E+03 1,0E+01 1,0E-01 1,0E-03 ε 1,0E-05 1,0E-07 ε p 1,0E-09 ξ 1,0E-11 1,0E-13 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Order of the Hilbert matrix Eurographics 2013 Vaclav Skala http://www.VaclavSkala.eu 2013-05-03 17

Recommend


More recommend