Next Article in Journal
Quantum Brain Networks: A Perspective
Previous Article in Journal
Ternary Neural Networks Based on on/off Memristors: Set-Up and Training
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Fast Study Quadric Interpolation in the Conformal Geometric Algebra Framework

by
Gerardo Martinez-Terán
,
Oswaldo Ureña-Ponce
,
Gerardo Soria-García
,
Susana Ortega-Cisneros
and
Eduardo Bayro-Corrochano
*,†
Department of Electrical Engineering and Computer Science, CINVESTAV, Campus Guadalajara, Av. del Bosque 1145, El Bajío, Zapopan 45019, Mexico
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Electronics 2022, 11(10), 1527; https://doi.org/10.3390/electronics11101527
Submission received: 31 August 2021 / Revised: 19 October 2021 / Accepted: 3 November 2021 / Published: 11 May 2022

Abstract

:
Interpolating trajectories of points and geometric entities is an important problem for kinematics. To describe these trajectories, several algorithms have been proposed using matrices, quaternions, dual-quaternions, and the Study quadric; the last one allows the embedding of motors as 8D vectors into projective space P 7 , where the interpolation of rotations and translations becomes a linear problem. Furthermore, conformal geometric algebra (CGA) is an effective and intuitive framework for representing and manipulating geometric entities in Euclidean spaces, and it allows the use of quaternions and dual-quaternions formulated as Motors. In this paper, a new methodology for accelerating the Study quadric Interpolation based on Conformal Geometric Algebra is presented. This methodology uses General Purpose Graphics Processing Units (GPUs) and it is applied for medical robotics, but it can also be extended to other areas such as aeronautics, robotics, and graphics processing.

1. Introduction

Generating trajectories for 3D objects is a fundamental problem in areas of robotics, image processing, and others. There are few mathematical algorithms for the interpolation of points that use vector calculus, quaternions, dual-quaternions, and linear algebra. Geometric algebra is a powerful mathematical framework for solving problems using basic geometry entities (circles, points, spheres, planes, and lines), and can represent Euclidean geometry, quaternions, and dual-quaternions. For this reason, it can be used for interpolating geometric entities for applications in medical robotics, graphic engineering, robotics, and aeronautics.
In screw theory, Chasles’ theorem states that a general displacement can be represented using a screw motion (cylindrical helix). Screw theory is widely used in mechanics and robotics and linear interpolation is the simple manner for interpolation; however, screw theory allows many other forms of interpolation, such as Bézier curves [1] or three-point quadratic. The pure rotation interpolation reduces exactly to the rotor or quaternionic SO(3) Lie group interpolation. In this paper, we propose the Study quadratic interpolation using the motor algebra for the SE(3) Lie group; a sub-algebra of the conformal geometric algebra.
This work focuses on the reformulation of the quadric Study interpolation method in conformal geometric algebra. The work shows that the speed up of the quadratic interpolation using GPU improves the algorithm’s performance significantly. These results are not surprising, since the replacement of matrices with geometric algebra formulations are known to be superior in numerical stability and performance; also, using GPU hardware is generally faster than CPUs.
The contribution of this work is as follows:
  • Formulation of the quadratic interpolation algorithm using motors of conformal geometric algebra as 8D vectors in the Study manifold;
  • Speeding up the quadratic interpolation algorithm using GPU;
  • Comparison of fast quadratic interpolation GPU versus CPU;
  • The interpolation of the motion of geometric objects in conformal geometric algebra;
  • Application of the interpolation algorithm in kidney surgery.
This paper is organized as follows: Section 2 reports on related work, Section 3 gives a brief introduction to geometric algebra, with special emphasis on conformal geometric algebra. Section 4 describe the rigid motion and similitude group interpolation methods. Section 5 explains the interpolation algorithm using the Study Quadric Manifod. Section 6 describes the speeding up the algorithms using a GPU accelerator. Section 7 shows the experimental results. Section 8 shows an example of interpolation of motion in surgery. Finally, Section 9 presents our conclusions and future work.

2. Related Work

Due to the easy representation of complex problems in robotics and image processing, several works have been proposed to accelerate geometric algebra operations. Most related techniques for accelerating geometric algebra algorithms are based on speeding up basic operations (inner, outer and geometric product, etc.) with FPGA Co-processors [2,3,4,5] and GPU parallelization [6,7].
More complex architectures have been developed for applications on computational vision. In [8], the authors present an algorithm of Clifford convolution and Clifford Fourier transforms for color edge detection, and an alternative algorithm based on rotor edge detection is proposed in [9]. Gerardo Soria-García et al. introduce an FPGA implementation of a Conformal Geometric Algebra Voting Scheme for Geometric Entities Extraction, such as lines and circles on images of edges [10].
A GPU implementation for a conformal geometric algebra interpolation application based on GPU is presented in [11]. The algorithm presented in this work is a modification using motors of the dual-quaternion method to interpolate rotation, translation, and dilation of geometric entities such as points, lines, circles, p a i r o f p o i n t s , planes, and spheres.
Recently, the following authors have produced highly optimized code for GA algorithms: D. Hildenbrand developed the GAALOP code generator for GA algorithms with optimized output on various CPUs and GPUs [6,12]; and Ahmed Eid’ developed the geometric algebra package GMac [13,14,15].
In our work, we focus on the direct implementation of the Study quadric interpolation optimizing the source code for a better execution in the GPU, that is, we reduce the complexity of our source code in order to suit to a computation via the GPU. If a user wants, on top of that, to use code generators like GAALOP or GMac, it would of course reduce the complexity even more.

3. Geometric Algebra

In an n-dimensional real vector space R n , we can introduce an orthonormal basis of vectors { e i } , i = 1 , , n for R n . This leads to a basis for the entire geometric algebra:
1 , { e i } , { e i e j } , { e i e j e k } , , e 1 e 2 e n .
The Geometric Algebra (GA) of the real n-dimensional quadratic vector space ( V , Q ) is denoted as G n . In the case of the notation G p , q , r , ( n = p + q + r ) denotes the GA of ( V , Q ) where p , q , r correspond to the number of basis vectors e i which square in GA to 1, −1 or 0; that is,  e i 2 = 1 , i = 1 , , p , e j 2 = 1 , j = p + 1 , , p + q , and e k 2 = 0 , k = p + q + 1 , , p + q + r , respectively. When a unit vector squares to 0, it is seen as a null vector as in the motor algebra or the point at the origin or at infinity which squares to zero.
In the cases when q = r = 0 , or q = 0 for simplicity, we denote G n , G p , q respectively. If only q = 0 , we denote G p , 0 , r .
Definition 1.
The geometric product of two vectors a and b is written as a b and it is expressed as a sum of its symmetric and antisymmetric parts:
a b = a · b + a b .
G n is a graded linear space:
V = 0 V 1 n ,
where the elements of n are referred to as (homogeneous) multivectors of grad k for k = 0 , 1 , 2 , , n . In the following, for short, elements of 1 V are called vectors. Thus, any M G n can be uniquely decomposed into a sum k < M > k where < M > k k V .
Furthermore, G n is a Z 2 -graded algebra in the following sense:
G n = G n ( 0 ) G n ( 1 ) , G n ( i ) G n ( j ) G n i + j m o d 2 , i , j = 0 , 1 ,
where
G n ( 0 ) = A G n : A = k e v e n < A > k G n ( 1 ) = A G n : A = k o d d < A > k .
Then, G n ( 0 ) (resp. G n ( 1 ) ) is called the even (resp. the odd) part pf G n . Note that, due to Equation (4), G n ( 0 ) is a subalgebra of G n . Later in this paper, the even subalgebra of G n will be denoted by G n + .
The dimension of G n is 2 n . The multivector basis of G n has 2 n bases for scalars, bivectors, trivectors and k-vectors. A k-blade is either the identity element 1 of G n (when k = 0 or, when k> 0), it is defined as the wedge product e i 1 e i 2 e i k ( i 1 < i 2 < < i k ) . A linear combination of k-vectors is called a homogeneous multivector.
Consider two homogeneous multivectors A r and B s G n of grades r and s, respectively. The geometric product of A r and B s can be written as:
A r B s = k e v e n A r B s k w h e n r + s = 0 m o d 2 k o d d A r B s k w h e n r + s = 1 m o d 2
Multivector computing involving inner products is easier if one employs the next equality for the generalized inner product of two blades A r = a 1 a 2 a r , and  B s = b 1 b 2 b s :
A r · B s = a 1 a 2 a r · b 1 · b 2 b 3 b s i f r s a 1 a 2 a r 1 · a r · b 1 b 2 b s i f r < s .
For r i g h t c o n t r a c t i o n , use the following equation:
a 1 a 2 a r · b 1 = i = 1 r 1 r i a 1 a i 1 a i · b 1 a i + 1 a r
and for l e f t c o n t r a c t i o n
a r · b 1 b 2 b s = i = 1 s 1 i 1 b 1 b i 1 a r · b i b i + 1 b s .
From these equations, we can see that the inner product is not commutative for general multivectors.

3.1. Conformal Geometric Algebra

In Conformal Geometric Algebra G 4 , 1 (CGA), the Euclidean vector space R 3 is represented in R 4 , 1 . The space for G 4 , 1 has an orthonormal vector basis given by { e 1 , e 2 , e 2 , e 4 , e 5 } with the properties e i 2 = 1 , i = 1 , 2 , 3 , e 4 2 = 1 , e 5 2 = 1 , e i · e 4 = e i · e 5 = e 4 · e 5 = 0 , i = 1 , 2 , 3 .
The null basis  { e 0 , e } (origin and point at infinity) is defined as:
e 0 = e 5 e 4 2 , e = e 4 + e 5 .
These null vectors satisfy the relations e 0 2 = e 2 = 0 and e · e 0 = 1 .
Let E = e e 0 be the Minkowski plane. The unit Euclidean pseudo-scalar is I e : = e 1 e 2 e 3 , and the conformal pseudoscalar I c = I e E is used for computing the inverse and duals of multivectors. Given a nonsingular k-vector A k G 4 , 1 G 4 , 1 , 0 , the dual and its inverse are, respectively,
A = A I c a n d A 1 = ( 1 ) q A | A | 2 ,
where A stands for the reversion of A and | A | its magnitude.

3.2. Points, Lines, Planes, and Spheres

The representation of a 3D Euclidean point x = [ x, y, z ] T i n R 3 in the geometric algebra G 4 , 1 is given by:
x c = x + 1 2 x 2 e + e 0 .
According to Equation (7), given two conformal points x c and y c , their difference in Euclidean space can be computed as follows:
x y = y c x c · e ,
and, consequently, the following equality:
x c y c + y c z c · e = x c z c · e
is fulfilled as well.
The line is formulated as a form in the Inner Product Null Space (IPNS) as follows:
L = n I E e m = ( n + e m ) ,
where n (bivector) is the orientation and the vector m is the moment of the line.
The plane is formulated as a form in IPNS
π = n I E e d = n e d ;
where the n (bivector) for the plane orientation and d is the distance from origin orthogonal to the plane.
The sphere is formulated as a form in IPNS:
s = p c 1 2 ρ 2 e = p + ( p 2 ρ 2 2 ) e + e 0 .
A point is a sphere with zero radius. Considering the dual equation for the sphere, we can write the constraint for a point lying on a sphere:
x c s = x c ( s · I c ) = 0 .
The sphere can be directly computed by the wedge of four conformal points in the Outer Product Null Space (OPNS):
s = x c 1 x c 2 x c 3 x c 4 .
Replacing any of these points with the point at infinity, we obtain the OPNS plane equation:
π = x c 3 x c 1 x c 2 e = x 3 x 1 x 2 e + ( ( x 3 x 1 ) ( x 2 x 1 ) ) E .
Similar to Equation (20), the OPNS line equation can be formulated as a circle passing through the point at infinity:
l = x c 1 x c 2 e ,
see in Table 1 the summary of the IPNS and OPNS geometric objects.

3.3. Rigid Transformations

In CGA many of the transformations can be formulated in terms of successive reflections between planes.

3.3.1. Reflection

The equation of a point x reflected with respect to a plane π is:
x = π x π 1 .

3.3.2. Translation

The transformation of geometric entity O formulated as two successive reflections w.r.t. the parallel planes π 1 and π 2 is given by:
O = π 2 π 1 T a O π 1 1 π 2 1 T ˜ a , T a = 1 + 1 2 a e = e a 2 e ,
where a = 2 d n , d is the distance of translation, and n is the direction of translation.

3.3.3. Rotation

Similarly, we can formulate a rotation as the product of two reflections between non-parallel planes π 1 and π 2 which cross the origin.
O = π 2 π 1 R θ O π 1 1 π 2 1 R ˜ θ .
The geometric product of the unit normal vectors of these planes n 1 and n 2 yields the equation for the rotor:
R = n 2 n 1 = cos θ θ 2 2 sin θ θ 2 2 n = e θ n θ n 2 2 ,
where the unit bivector n = n 1 n 2 , and the angle θ is twice the angle between π 1 and π 2 .

3.3.4. Screw Motion

The operator for screw motion or motor M is a composition of a translator T and a rotor R, both w.r.t. to an arbitrary axis L. The equation for a motor is as follows:
M = T R = cos θ ^ 2 + L sin θ ^ 2 = cos θ + e d 2 + L sin θ + e d 2 = R + e R = exp θ L ,
where the screw line is L = n + e m ; n and m stand for the orientation and momentum of the screw line and the dual angle θ ^ = θ + e d . Finally, the  motor transformation for any object O G 4 , 1 reads
O = T R O R ˜ T ˜ = M O M ˜ .

4. Rigid Motion and Similitude Group Interpolation

This section presents the motor interpolation. We will use this technique when we interpolate geometric objects like points, lines, planes, circles and spheres.
This is a generalization of the well known Spherical Linear Interpolation (SLERP) method [16] Given M i and M f two motors representing the initial and final pose of a rigid body respectively, the Motor Spherical Linear Interpolation function (MSLERP) is defined as follows
M S L E R P ( t ; M i , M f ) = M i ( M i 1 M f ) t ,
with t [ 0 , 1 ] . The underlying kinematic concept of the screw motion was explained in previous sections. A kinematic explanation of this interpolation method was given by [16,17]. Since ( M i 1 M f ) represents the finite screw motion between the initial and final pose of the rigid body, specifically the product:
( M i 1 M f ) t = c o s ( t ( θ 2 + e t 2 ) ) + L s i n ( t ( θ 2 + e t 2 ) ) = c o s ( t ( θ ^ 2 ) ) + L s i n ( t ( θ ^ 2 ) ) ,
defines a screw motion of a dual angle t θ ^ along the screw axis L = n + e m . In this equation, θ and t stand for the rotation angle and the translation bivector, respectively.
The Motor Linear Blending interpolation method (MLB) is defined as follows:
M L B ( t ; M i , M f ) = ( 1 t ) M i + t M f | | ( 1 t ) M i + t M f | | .
This procedure can be extended to the interpolation involving several poses:
M L B ( t ; M 1 , M 2 ) = w 1 ( t ) M 1 + + w n ( t ) M n | | w 1 ( t ) M 1 + + w n ( t ) M n | | .
These weights are assumed to be convex, namely w i 0 and i = 1 n w i = 1 . One can choose weights that are made coincident with the coefficients of the classical Lagrange’s interpolating polynomials
w j ( t ) = k = 1 , k j n t t k t j t k .
Note that Algorithm 1 uses the resulting bivector B (se(3) Lie algebra) to compute the motor (SE(3) Lie group). To interpolate geometric objects O in the conformal geometric algebra framework, represented in IPNS, as points in Equation (12), lines in Equation (15), planes in Equation (16) and spheres in Equation (16), we represent the objects using an IPNS representation and apply the blending interpolated motor M B and for spheres a Dilator D = e l n ρ as well,
x c t = M B t x c t 1 M ˜ B t
L t = M B t L t 1 M ˜ B t
π t = M B t π t 1 M ˜ B t
s t = D t M B t s t 1 M ˜ B t D 1 t .
Algorithm 1 MIB: Motor Iterative Blending.
  • procedure (MIB) ( M 1 , , M n , t )
  •      M B = M L B ( M 1 , , M n , t )
  •      repeat
  •      B = i 1 n w i l o g ( M B 1 M i )
  •      M B = M B e B
  •      until | | B | | h
  •      end procedure

5. Interpolation Algorithm Using the Study Quadric Manifold

According Gfrerrer [18], one can formulate an interpolation algorithm using the Study’s kinematics mapping.This maps Euclidean rigid transformations into homogeneous points which in turn belong to the Study quadric M 6 (projective space P 7 )
G = S E ( 3 ) P 7 α X = x 0 , , x 7 ,
where S E ( 3 ) is the special Lie group for 3D Euclidean rigid transformations, α represents any Euclidean rigid transformation and the vector X containing homogeneous coordinates X M 6 . Note that the motor algebra G 3 , 0 , 1 + is a sub-algebra of the 3D conformal geometric algebra G 4 , 1 , thus the interpolation uses motors, depending upon which algebra is used one can use I for motors of G 3 , 0 , 1 + or e for motors of G 4 , 1 which both square to zero and are acting similarly to the isotropic operator of the dual quaternions, which use ϵ , which squares to zero as well.
Given the set X M 6 containing three homogeneous points X 1 , X 2 , X 3 M 6 , that is, these points lie on a manifold M 6 , which is embedded in the projective space P 7 ( R 4 ). The interpolation curve is generated by interpolating the given homogeneous points X 0 , , X N P 7 which satisfy the set X computed as follows
X = f 0 ( t ) X 1 T Q X 2 X 0 + f 1 ( t ) X 0 T Q X 2 X 1 + f 2 ( t ) X 0 T Q X 1 X 2 .
This equation represents a discretization of the curve X ( t ) into N points. i.e., intermediate points are computed.
The interpolation polynomials f 0 ( t ) , f 1 ( t ) , and  f 2 ( t ) are formulated as follows
f 0 = ( t 0 t 1 ) ( t 0 t 2 ) ( t t 1 ) ( t t 2 ) f 1 = ( t 1 t 0 ) ( t 1 t 2 ) ( t t 0 ) ( t t 2 ) f 2 = ( t 2 t 0 ) ( t 2 t 1 ) ( t t 0 ) ( t t 1 ) ,
where t, t 0 , t 1 , and  t 2 are interpolation values between 0 and 1. t represents the segment of curve where the point is calculated, t 0 , t 1 and t 2 are values that represent the section of curve where interpolated and control points meet. The algorithm checks the number of elements in X, if there is only one point, this is returned as the solution, otherwise, X is used to get intermediate control points via Equation (38) and saved in M. For N control points, we obtain N 2 interpolation points.
The Study-quadric bilinear form is given by the following matrix Q ,
Q = 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 2 1 2 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 1 2 0 0 0 0
If one wishes to interpolate more points, the above-explained interpolation equation can be extended and adapted as De Casteljau’s algorithm [19]. This is shown in Algorithm 2.
This algorithm calculates a homogeneous point for the given set X that contains the control points ( X 1 , , X N ) and the interpolation values ( t , t 0 , t 1 , t 2 ) and the Study quadric bilinear matrix Q . Here t , t 0 , t 1 , t 2 are interpolation variables. t is the position interval variable and allows us to determine the position within the curve of the interpolation point, the value t goes from 0 to 1. To calculate all the points of the curve, all the values of t are traversed. ( t 0 , t 1 , t 2 ) are values that indicate at which point the interpolation points, in the functions that came in the Klawiter library [19], the values t 0 = 0 , t 1 = 0.5 , t 2 = 1 , are proposed so that the interpolated points correspond to the initial control point, the mid-control point and the endpoint, respectively. These are fixed for each curve, only t is what can change when calculating a point within a specific curve. In the algorithm, the triple of the set of points will be selected as follows: X ( t k ) = X k , X ( t k + 1 ) = X k + 1 , X ( t k + 2 ) = X k + 2 for k = 0 , 1 , , n 2 .
The algorithm checks the number of elements in X . If there is only one point, this is returned as the solution. Otherwise, X is used to obtain intermediate control points via Equation (38) and saved in M . M is used to call the algorithm recursively until we get only one interpolation point and return it. Figure 1 shows the algorithm interpolation for five control points. See that, in each interpolation step, for N control points, we get N 2 interpolation points and N 1 repeats are required. Since in the last step, Equation (38) required three points, an odd number of control points is needed.    \
Electronics 11 01527 i001
Figure 1. Interpolation of five control points with Algorithm 2.
Figure 1. Interpolation of five control points with Algorithm 2.
Electronics 11 01527 g001
Where X is the set of control homogeneous points ( X 1 , · , X N ) that describe the discrete curve trajectory, Q is the quadric matrix, t 0 , t 1 , and  t 2 are global constant values, in this case, 0, 0.5 and 1 respectively. As is seen in the algorithm, it is required that the array X has an odd number of homogeneous points to get an interpolation curve. Note that the solution is in fact a rational motion utilizing an interpolating spline which in turn involves rational sub-spline motions, see [1].
In general, the Study quadric interpolation algorithm uses homogeneous points represented by dual-quaternions or by homogenous matrices. As we know, motors are isomorphic to dual-quaternions and a motor can be represented as a homogeneous point as well. This motor represented as a vector M = { M 0 , , M 7 } R 8 lies on the Study Manifold (see Table 2). In this regard, we propose a modified interpolation algorithm. For that, the  homogeneous points are replaced by motors and matrix operations are substituted with GA operations.
Since the matrix multiplications in (38) with the form X a T Q X b , the result of which is a constant value expressed as:
X a T Q X b = x a 0 x b 7 + x a 1 x b 6 + x a 2 x b 5 + x a 3 x b 4 + x a 5 x b 3 + x a 6 x b 2 + x a 7 x b 0 2 .
Changing the homogeneous points with their respective motor representations in CGA and analyzing the motor multiplication, is shown that the coefficient of the blade e 123 ( α 3 ) from the motor multiplication M 1 M 2 ˜ is the double value of (41). This coefficient ( α 3 ) can be extracted from any motor using the partial derivative:
α 3 M = M e 123 ,
or via the inner product with the I e and e 0 :
α 3 M = I e · M · e 0 .
Using GA,  Equation (38) is reformulated for a motor based interpolation algorithm. It uses three control motors as follows:
M = f 0 ( t ) α 3 M 1 M 2 ˜ M 0 + f 1 ( t ) α 3 M 0 M 2 ˜ M 1 + f 2 ( t ) α 3 M 0 M 1 ˜ M 2 2 .
In the same manner as in Algorithm 2, for more control points, Equation (44) can be rewritten using the De Casteljau’s algorithm as described in Algorithm 3. This algorithm calculates one motor for the set M of control motors ( m 1 , , m N ) and the interpolation constants (t, t 0 , t 1 , t 2 ). Similar to Algorithm 2, the interpolation function is called recursively with the calculated motors from the last step as an input until we get only one motor. Since the last step needs three motors to calculate the last one, M must contain an odd number of motors.
Electronics 11 01527 i002

6. Speeding up the Algorithms Using a GPU Accelerator

To implement the motor interpolation, we translated the Algorithm 3 into an equivalent-iterative version given by Algorithm 4; for more detail technical aspects see [20].
Electronics 11 01527 i003
The GPU and CPU have different architectures. The CPU has a few sets of cores for sequential applications. In contrast, the GPU has many cores for highly parallel computing. Figure 2 compares the CPU and GPU architectures. Note that GPU cores run asynchronously using threads. Each core is limited to 32, 64, 128, 256, or 512 threads. If a parallel GPU implementation is launched, a certain number of cores are required. These are figured out as a direct function of the selected threads per block. In the case of the motor interpolation, each thread launches a copy of the algorithm.
All GPU operations run explicitly or implicitly on a stream, where multiple streams are launched and the transference data and kernel launch can be overlapped as shown in Figure 3; for more detail technical aspects see [20].
For the case of the parallel calculation of multiple curves, the multi-streaming implementation is used and each curve is computed in an independent stream.

7. Experiments

7.1. Interpolation of the Motion of Geometric Entities

The interpolation motors can be used to calculate the new position of geometric entities O i G 4 , 1 as follows:
O i = M i O i M i ˜ ,
where O i can be, at instant i, any geometric entity of point, line, plane, circle, sphere or point pairs expressed in conformal geometric algebra [21]. Figure 4 shows the interpolation of these geometric objects under the action of a motor M i .

7.2. Speeding up the Algorithms Using a GPU Accelerator

The Study’s quadric and the motor interpolation are compared to analyze which of the algorithms has the best speed performance. The results are presented in Figure 5. We see that the motor interpolation version is faster than the Study quadric interpolation, namely for 20,000 points, it is 28× times faster.
Figure 5 shows that the motor interpolation algorithm selected for sequential and parallel implementation utilizes the same hardware parameters.
The sequential implementation was programmed using C++ language and CUDA C++ for the parallel approach using 32 threads per block in the kernel. The interpolated motors were computed using single and double-precision floating-point representation. All the measures consider only the algorithm execution, but data transference, file writing, and reading are excluded. The results are shown in Figure 6; for a discussion in more detail, see [20].
It was confirmed that the GPU has the best time performance for calculating the interpolation algorithm. When the time execution in CPU increases linearly, the time in GPU for 500 or fewer points remains almost constant. For the case of 20,000 motors, the GPU implementation runs 79× and 60× times faster than the CPU for single and double floating-point respectively. The different multi-streaming implementations were analyzed; 16 different interpolation curves were calculated using the concurrent approach for host-to-device and device-to-host asynchronous memory copy with 4 configurations (1, 2, 4, and 8 streams) with 32 threads per block. The measure times include data transference. Figure 7 depicts that the use of multi-streaming reduces the execution time considerably, i.e., for 20,000 points, 8 streams version is 2.7×, 1.9× and 1.6× times faster than 1, 2 and 4 streams respectively.

8. Interpolation of Surgery Motion

Since this work focuses on the reformulation of the quadric Study interpolation method in conformal geometric algebra and the speed up of the quadratic interpolation using GPU. In this section, we present just an application of the quadratic Study interpolation algorithm. We do not intend to analyze the impact of the quadratic Study interpolation in robotics; this is a goal of our future article.
This Study’s quadric-based motor interpolation was used to interpolate trajectories in medical robotics for kidney surgery, see Figure 8. The robot manipulator has to follow a path for sutureingaround a certain region on the kidney phantom. We design to tasks: follow an UltraSound (US)-probe trajectory and the interpolation of a given 3D points sequence. One provides the point coordinates and their desired orientations; these are interpolated by the motor algorithm (see Figure 8b–d). Afterwards, we check the precision error using inverse kinematics. The inverse kinematics was also formulated in conformal geometric algebra; the algorithm was reported in [21].

9. Conclusions

The interpolation of the trajectory of points and geometric entities is an important problem for kinematics. To describe these trajectories, several algorithms have been proposed using matrices, quaternions, dual-quaternions and the Study quadric. We show that Conformal geometric algebra is an effective and intuitive framework for representing and manipulating the motors as 8D vectors in projective space P 7 , where the interpolation of rotations and translations becomes a linear problem. This methodology uses general purpose GPUs and it is applied for medical robotics. In the future, we will pursue implementing the interpolation algorithm using multiple GPUs and reducing the data dependency. We will also build an OpenCL library of the algorithms using Python.

Author Contributions

Conceptualization, E.B.-C., G.M.-T.; methodology, E.B.-C., G.M.-T., S.O.-C.; software, O.U.-P.; validation, G.M.-T., O.U.-P. and G.S.-G.; writing—review and editing, G.M.-T. and E.B.-C.; funding acquisition, E.B.-C. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by Mexican CONACYT Project A1-S-10412.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Prautzsch, H.; Boehm, W.; Paluszny, M. Bézier and B-Spline Techniques; Springer Science & Business Media: Berlin, Germany, 2013. [Google Scholar]
  2. Franchini, S.; Gentile, A.; Sorbello, F.; Vassallo, G.; Vitabile, S. An FPGA implementation of a quadruple-based multiplier for 4D Clifford algebra. In Proceedings of the IEEE 11th EUROMICRO Conference on Digital System Design: Architectures, Methods and Tools 2008 (DSD’08), Parma, Italy, 3–5 September 2008; pp. 743–751. [Google Scholar]
  3. Franchini, S.; Gentile, A.; Sorbello, F.; Vassallo, G.; Vitabile, S. A New Embedded Coprocessor for Clifford Algebra Based Software Intensive Systems. In Proceedings of the IEEE 2011 International Conference on Complex, Intelligent, and Software Intensive Systems (CISIS), Seoul, Korea, 30 June–2 July 2011; pp. 335–342. [Google Scholar]
  4. Franchini, S.; Gentile, A.; Sorbello, F.; Vassallo, G.; Vitabile, S. Design and implementation of an embedded coprocessor with native support for 5D, quadruple-based Clifford algebra. IEEE Trans. Comput. 2013, 62, 2366–2381. [Google Scholar] [CrossRef]
  5. Franchini, S.; Gentile, A.; Sorbello, F.; Vassallo, G.; Vitabile, S. ConformalALU: A conformal geometric algebra coprocessor for medical image processing. IEEE Trans. Comput. 2015, 64, 955–970. [Google Scholar] [CrossRef]
  6. Lange, H.; Stock, F.; Koch, A.; Hildenbrand, D. Acceleration and energy efficiency of a geometric algebra computation using reconfigurable computers and GPUs. In Proceedings of the IEEE FCCM’09 17th IEEE Symposium on Field Programmable Custom Computing Machines, Napa, CA, USA, 5–7 April 2009; pp. 255–258. [Google Scholar]
  7. Franchini, S.; Gentile, A.; Vassallo, G.; Vitabile, S. Accelerating Clifford Algebra Operations Using GPUs and an OpenCL Code Generator. In Proceedings of the IEEE 2015 Euromicro Conference on Digital System Design, Madeira, Portugal, 26–28 August 2015; pp. 57–64. [Google Scholar]
  8. Franchini, S.; Gentile, A.; Vassallo, G.; Sorbello, F.; Vitabile, S. A specialized architecture for color image edge detection based on Clifford algebra. In Proceedings of the IEEE Complex, Intelligent, 2013 Seventh International Conference Complex, Intelligent, and Software Intensive Systems (CISIS), Taichung, Taiwan, 3–5 July 2013; pp. 128–135. [Google Scholar]
  9. Mishra, B.; Wilson, P. Color edge detection hardware based on geometric algebra. In Proceedings of the 3rd European Conference on Visual Media Production (CVMP 2006) Part of the 2nd Multimedia Conference 2006, IET, London, UK, 29–30 November 2006; pp. 115–121. [Google Scholar]
  10. Soria-García, G.; Altamirano-Gómez, G.; Ortega-Cisneros, S.; Bayro-Corrochano, E. Conformal Geometric Algebra Voting Scheme implemented in reconfigurable devices for geometric entities extraction. In Proceedings of the IEEE Transactions on Industrial Electronics, Atlanta, GA, USA, 15–17 October 2007; pp. 8747–8755. [Google Scholar]
  11. Papaefthymiou, M.; Hildenbrand, D.; Papagiannakis, G. An inclusive Conformal Geometric Algebra GPU animation interpolation and deformation algorithm. Vis. Comput. 2016, 32, 751–759. [Google Scholar] [CrossRef]
  12. Accelerator for GA Computing. Available online: http://www.gaalop.de/D.Hildebrand (accessed on 5 August 2021).
  13. Eid, A. (Ed.) Code Generation for Geometric Algebra: Combining Geometric, Algebraic, and Software Abstractions for Scientific Computations; Noor Publishing: Chisinau, Moldova, 2016. [Google Scholar]
  14. Eid, A. Geometric Algebra Packet GMac. Available online: https://github.com/ga-explorer/GMac (accessed on 10 September 2021).
  15. Eid, A.H. An Extended Implementation Framework for Geometric Algebra Operations on Systems of Coordinate Frames of Arbitrary Signature. Adv. Appl. Clifford Algebr. 2018, 28, 16. [Google Scholar] [CrossRef]
  16. Etzel, K.R.; McCarthy, J.M. Spatial motion interpolation in an image space of so(4). In Proceedings of the 1996 ASME Design Engineering Technical Conference and Computers in Engineering Conference, Irvine, CA, USA, 18–22 August 1996. [Google Scholar]
  17. Kavan, L.; Collins, S.; Zara, J.; O’Sullivan, C. Geometric Skinning with Approximate Dual Quaternion Blending; Technical Report TCD-CS-2006-46; The University of Dublin, Trinity College: Dublin, Ireland, 2006. [Google Scholar]
  18. Gfrerrer, A. Study’s Kinematic Mapping—A Tool for Motion Design. In Advances in Robot Kinematics; Springer: Heidelberg, Germany, 2010; pp. 7–16. [Google Scholar]
  19. Klawitter, D. Documentation-Kinematic Toolbox; Internal Report; Technische Universität Dresden: Dresden, Germany, 2010. [Google Scholar]
  20. Bayro-Corrochano, E. (Ed.) Geometric Algebra Applicationsa Vol.II: Robot Modelling and Control; Springer: Heidelberg, Germany, 2020. [Google Scholar]
  21. Bayro-Corrochano, E. Geometric Computing for Wavelets Transforms, Robot Vision, Learning, Control and Action; Springer: Heidelberg, Germany, 2010. [Google Scholar]
Figure 2. Architecture comparison of (a) CPU and (b) GPU.
Figure 2. Architecture comparison of (a) CPU and (b) GPU.
Electronics 11 01527 g002
Figure 3. Different streams used for a concurrent implementation (a) 1-stream, (b) concurrent approach for a device-to-host asynchronous memory copy, (c) concurrent approach for host-to-device asynchronous memory copy, (d) concurrent approach for host-to-device and device-to-host asynchronous memory copy.
Figure 3. Different streams used for a concurrent implementation (a) 1-stream, (b) concurrent approach for a device-to-host asynchronous memory copy, (c) concurrent approach for host-to-device asynchronous memory copy, (d) concurrent approach for host-to-device and device-to-host asynchronous memory copy.
Electronics 11 01527 g003
Figure 4. Interpolation of geometric entities O i G 4 , 1 : (a) points, (b) lines, (c) planes, (d) spheres, (e) point pairs, and (f) circles using the CGA motor interpolation curve (g).
Figure 4. Interpolation of geometric entities O i G 4 , 1 : (a) points, (b) lines, (c) planes, (d) spheres, (e) point pairs, and (f) circles using the CGA motor interpolation curve (g).
Electronics 11 01527 g004
Figure 5. Comparison of Study’s quadric and Motor interpolation speed-up.
Figure 5. Comparison of Study’s quadric and Motor interpolation speed-up.
Electronics 11 01527 g005
Figure 6. CPU and GPU speed-up analysis.
Figure 6. CPU and GPU speed-up analysis.
Electronics 11 01527 g006
Figure 7. Comparison of the Multi-Stream speed-up.
Figure 7. Comparison of the Multi-Stream speed-up.
Electronics 11 01527 g007
Figure 8. (a) robot; views: (b) X-Y, (c) X-Z, (d) Y-Z.
Figure 8. (a) robot; views: (b) X-Y, (c) X-Z, (d) Y-Z.
Electronics 11 01527 g008
Table 1. Geometric entities in conformal geometric algebra. The IPNS and OPNS stand for Inner Product Null Space and Outer Product Null Space respectively.
Table 1. Geometric entities in conformal geometric algebra. The IPNS and OPNS stand for Inner Product Null Space and Outer Product Null Space respectively.
EntityIPNSOPNS
Point x c = x + x 2 2 e + e 0 x = S 1 S 2 S 3 S 4
Sphere S = c + c e 2 ρ 2 2 e + e 0 s = x c 1 x c 2 x c 3 x c 4
Plane π = n e d
n = x 1 x 2 x 1 x 3
d = x 1 x 2 x 3 I e
π = e x c 1 x c 2 x c 3
Line L = π 1 π 2
L = n I e e m I e
n = x 1 x 2
m = x 1 x 2
l = e x c 1 x c 2
Circle Z = S 1 S 2
Z = π S
z = x c 1 x c 2 x c 3
Table 2. Study quadric homogeneous point represented in dual-quaternion and its equivalences as a motor in G 3 , 0 , 1 + and as a motor in G 4 , 1 .
Table 2. Study quadric homogeneous point represented in dual-quaternion and its equivalences as a motor in G 3 , 0 , 1 + and as a motor in G 4 , 1 .
Homogeneous PointDual-Quaternion G 3 , 0 , 1 + G 4 , 1
x 0 α 0 α 0 α 0
x 1 α 1 i α 1 e 12 α 1 e 12
x 2 α 2 j α 2 e 31 α 2 e 31
x 3 α 3 k α 3 e 23 α 3 e 23
x 4 α 4 ϵ α 4 e 1234 α 4 e 123
x 5 α 5 ϵ i α 5 e 43 α 5 e 3
x 6 α 6 ϵ j α 6 e 42 α 6 e 2
x 7 α 7 ϵ k α 7 e 41 α 7 e 1
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Martinez-Terán, G.; Ureña-Ponce, O.; Soria-García, G.; Ortega-Cisneros, S.; Bayro-Corrochano, E. Fast Study Quadric Interpolation in the Conformal Geometric Algebra Framework. Electronics 2022, 11, 1527. https://doi.org/10.3390/electronics11101527

AMA Style

Martinez-Terán G, Ureña-Ponce O, Soria-García G, Ortega-Cisneros S, Bayro-Corrochano E. Fast Study Quadric Interpolation in the Conformal Geometric Algebra Framework. Electronics. 2022; 11(10):1527. https://doi.org/10.3390/electronics11101527

Chicago/Turabian Style

Martinez-Terán, Gerardo, Oswaldo Ureña-Ponce, Gerardo Soria-García, Susana Ortega-Cisneros, and Eduardo Bayro-Corrochano. 2022. "Fast Study Quadric Interpolation in the Conformal Geometric Algebra Framework" Electronics 11, no. 10: 1527. https://doi.org/10.3390/electronics11101527

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop