2016 ICCSA Cross Product Equations
2016 ICCSA Cross Product Equations
2016 ICCSA Cross Product Equations
net/publication/304702520
CITATIONS READS
6 407
1 author:
Vaclav Skala
University of West Bohemia
310 PUBLICATIONS 2,193 CITATIONS
SEE PROFILE
All content following this page was uploaded by Vaclav Skala on 06 November 2017.
Vaclav Skala1
1
Faculty of Applied Sciences, University of West Bohemia,
Univerzitni 8, CZ 30614 Plzen, Czech Republic
http://www.VaclavSkala.eu
Abstract. Many problems, not only in computer vision and visualization, lead to a system of
linear equations or and fast and robust solution is required. A vast majority of
computational problems in computer vision, visualization and computer graphics are three
dimensional in principle. This paper presents equivalence of the cross–product operation and
solution of a system of linear equations or using projective space representation
and homogeneous coordinates. This leads to a conclusion that division operation for a solution of
a system of linear equations is not required, if projective representation and homogeneous
coordinates are used. An efficient solution on CPU and GPU based architectures is presented with
an application to barycentric coordinates computation as well.
1 Introduction
Many applications, not only in computer vision, require a solution of a homogeneous
system of linear equations or a non-homogeneous system of linear
equations . There are several numerical methods used implemented in standard
numerical libraries. However, the numerical solution actually does not allow further
symbolic manipulation. Even more, solutions of equations and are
considered as different problems and especially is not usually solved quite
correctly as users tend to use some additional condition for unknown (usually setting
or so).
In the following, we show the equivalence of the extended cross-product (outer
product or progressive product) with a solution of both types of linear systems of
equations, i.e. and .
Many problems in computer vision, computer graphics and visualization are -
dimensional. Therefore specific numerical approaches can be applied to speed up the
solution. In the following extended cross-product, also called outer product or
progressive product, is introduced in the “classical” notation using symbol.
(1)
where: , .
(2)
(3)
where: , , , .
It can be shown that there exists a matrix form for the extended cross-product
representation:
(4)
where: . In this case and are sub-determinants with columns of the matrix
defined as:
(5)
(6)
where: , , , ,
.
It can be shown that there exists a matrix form as well:
(7)
(8)
4 Solution of
Solution of non-homogeneous system of equation is used in many
computational tasks.
For simplicity of explanation, let us consider a simple example of intersection
computation of two lines a in given as:
(11)
An intersection point of two those lines is given as a solution of a linear system of
equations: :
(12)
Generally, for the given system of liner equations with unknowns in the
form the solution is given:
(13)
where: is a regular matrix having non-zero determinant, the matrix is the
matrix with replaced column by the vector and is a vector of
unknown values.
In a low dimensional case using general methods for solution of linear equations,
e.g. Gauss-Seidel elimination etc., is computational expensive. Also division operation
is computationally expensive and decreasing precision of a solution.
Usually, a condition if then EXIT is taken for solving “close to
singular cases”. Of course, nobody knows, what a value of is appropriate.
5 Solution of
There is another very simple geometrical problem; determination of a line given by
two points and in . This seems to be a quite simple
problem as we can write:
(14)
i.e. it leads to a solution of homogeneous systems of equations , i.e.:
In this case, we obtain one parametric set of solutions as the Eq.(15) can be multiplied
by any value and the line is the same.
There is a problem – we know that lines and points are dual in the case, so the
question is why the solutions are not dual. However if the projective representation is
used the duality principle will be valid, as follows.
6 Solution and
Let us consider again intersection of two lines a
leading to a solution of non-homogeneous linear system , which is given as:
(16)
If the equations are multiplied by we obtain:
(17)
where: means „projectively equaivalent to“ as and .
Now we can rewrite the equations to the matrix form as :
(18)
(19)
Now, we can see that the formulation is leading in the both cases to the same numerical
problem: to a solution of a homogeneous linear system of equations.
However, a solution of homogeneous linear system of equations is not quite
straightforward as there is a one parametric set of solutions and all of them are
projectively equivalent. It can be seen that the solution of Eq. (18), i.e. intersection of
two lines in , is equivalent to:
(20)
and due to the principle of duality we can write for a line given by two points:
(
21)
In the three dimensional case we can use extended cross-product [12][15][16].
A plane given by three points ,
and is determined in the projective
representation as:
(22)
and the intersection point of three planes points ,
and is determined in the projective
representation as:
(23)
(24)
(25)
if the points are given in the projective space with homogeneous coordinates
, and . It can be easily proved, due to
the multilinearity, we need to solve a linear system :
(26)
Let us define new vectors containing a row of the matrix and vector as:
(27)
The projective barycentric coordinates are given as:
(28)
i.e.
(29)
Using the extended cross product, the projective barycentric coordinates are given as:
(30)
where , , , .
(37)
It can be seen that the formula above is quite difficult to remember and its derivation is
not simple. It should be noted that there is again a severe problem with stability and
robustness if a condition like is used. Also the formula is not convenient
for GPU or SSE applications. There is another equivalent solution based on Plücker
coordinates and duality application, see [12] [16].
Let us explore a solution based on the projective representation explained above.
Given two planes and . Then the directional vector of their intersection is given
as:
(38)
We want to determine the point of the line given as an intersection of those two
planes. Let us consider a plane passing the origin of the coordinate system with the
normal vector equivalent to , Fig.1. This plane is represented as:
(39)
Then the point is simply determined as an intersection of three planes as:
(40)
It can be seen that the proposed algorithm is simple, easy to understand, elegant and
convenient for SEE and GPU applications as it uses vector-vector operations.
Fig.2: The closest point to the given point on an intersection of two planes
(41)
where: , resp. are points on planes , resp. , with a normal vector , resp. .
Coordinates of the closest point on the intersection of two planes to the
point are given as a solution of this system of linear equations. Note that
the point is given in the Euclidean space.
10 Symbolic manipulations
Symbolic manipulations are very important and help to find or simplify computational
formulas, avoid singularities etc. As the extended cross-product is an associative and
anti-commutative as the cross-product in similar rules are valid, i.e. in :
(43)
In the case of the extended cross-product, i.e. in the projective notation we actually
formally have operations in :
(44)
This can be easily proved by applications of rules for operations with determinants.
(55)
3 14 60
6 24 77
13 GPU Code
Many today’s computational systems can use GPU support, which allows fast and
parallel processing. The above presented approach offers significant speed up as the
“standard” cross-product is implemented in hardware as an instruction and the
extended cross-product for 4D can be implemented 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}
In general, it can be seen that a solution of linear systems of equations on GPU for a
small dimension is simple, fast and can be performed in parallel.
14 Conclusion
Projective representation is not widely used for general computation as it is mostly
considered for as applicable to computer graphics and computer vision field only. In
this paper the equivalence of cross-product and solution of linear system of equations
has been presented. The presented approach is especially convenient for -dimensional
and dimensional cases applicable in many engineering and statistical computations,
in which significant speed up can be obtained using SSE instructions or GPU use. Also,
the presented approach enables symbolic manipulation as the solution of a system of
linear equations is transformed to extended cross-product using a matrix form which
enables symbolic manipulations.
Direct application of the presented approach has also been demonstrated on the
barycentric coordinates computation and simple geometric problems.
The presented approach enables avoiding division operations as a denominator is
actually stored in the homogeneous coordinate . It which leads to significant
computational savings, increase of precision and robustness as the division operation is
the longest one and the most decreasing precision of computation.
The presented approach also enables derivation of new and more computationally
efficient formula in other computational fields.
References
1. Coxeter,H.S.M.: Introduction to Geometry, John Wiley, 1961.
2. Doran,Ch., Lasenby,A.: Geometric Algebra for Physicists, Cambridge University Press,
2003
3. Dorst,L., Fontine,D., Mann,S.: Geometric Algebra for Computer Science, Morgan
Kaufmann, 2007
4. Gonzales Calvet,R.: Treatise of Plane Geometry through Geometric Algebra, 2007
5. Hartley,R., Zisserman,A.: MultiView Geometry in Computer Vision, Cambridge
University Press, 2000.
6. Hildenbrand,D.: Foundations of Geometric Algebra Computing, Springer Verlag, , 2012
7. Kanatani,K.: Undestanding geometric Algebra, CRC Press, 2015
8. Krumm,J.: Intersection of Two Planes, Microsoft Research, May 2000
http://research.microsoft.com/apps/pubs/default.aspx?id=68640
9. Johnson,M.: Proof by Duality: or the Discovery of “New” Theorems, Mathematics Today,
December 1996.
10. MacDonald,A.: Linear and Geometric Algebra, Charleston: CreateSpace, 2011
11. 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
12. Skala,V.: Length, Area and Volume Computation in Homogeneous Coordinates,
International Journal of Image and Graphics, Vol.6., No.4, pp.625-639, 2006
13. Skala,V.: Barycentric Coordinates Computation in Homogeneous Coordinates, Computers
& Graphics, Elsevier, ISSN 0097-8493, Vol. 32, No.1, pp.120-127, 2008
14. Skala,V.: Projective Geometry, Duality and Precision of Computation in Computer
Graphics, Visualization and Games, Tutorial Eurographics 2013, Girona, 2013
15. Skala,V.: Projective Geometry and Duality for Graphics, Games and Visualization -
Course SIGGRAPH Asia 2012, Singapore, ISBN 978-1-4503-1757-3, 2012
16. Skala,V.: Intersection Computation in Projective Space using Homogeneous Coordinates,
Int.Journal on Image and Graphics, ISSN 0219-4678, Vol.8, No.4, pp.615-628, 2008
17. Skala,V.: Modified Gaussian Elimination without Division Operations, ICNAAM 2013,
Rhodos, Greece, AIP Conf.Proceedings, No.1558, pp.1936-1939, AIP Publishing, 2013
18. Vince,J.: Geometric Algebra for Computer Science, Springer, 2008
19. Wildberger,N.J.: Divine Proportions: Rational Trigonometry to Universal Geometry, Wild
Egg Pty, 2005
20. Yamaguchi,F. Computer Aided Geometric Design: A totally Four Dimensional Approach,
Springer Verlag, 2002