Professional Documents
Culture Documents
4 - A Mathematical Framework For Contact Detection Between Quadric and Superquadric Surface PDF
4 - A Mathematical Framework For Contact Detection Between Quadric and Superquadric Surface PDF
net/publication/226803750
CITATIONS READS
63 527
4 authors:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Jorge A.C. Ambrósio on 21 May 2014.
1 INTRODUCTION
Contact is an omnipresent phenomenon in any mechanical system. Physically, it can be
defined as the tendency of two bodies on sharing a common locus in space in which reactive
forces are generated to oppose body intersection and energy is dissipated, usually, in the form
of heat.
To accurately design and simulate a mechanism, that is either interacting with the
surrounding environment or devising relative joint motion among the articulated bodies that
compose it, contact forces must be utterly considered [1]. Within multibody dynamics, contact
analysis is a computational methodology used to describe the behaviour of a constrained
mechanical system induced by reactive forces that are produced during body collision.
Contact analysis focuses on the resolution of three fundamental issues: (i) minimum distance
calculation between surfaces; (ii) contact detection; and (iii) establishment of a force model
that depends on material properties and (pseudo-)penetration depth. Such analysis requires a
representative geometric description of the bodies boundaries.
Given a non-conformal (or convex) surface representation of the colliding bodies, together
with their position and spatial orientation, the resolution of the minimum distance calculation
problem is purely geometric. The unknown variables of such problem are the spatial
coordinates of the candidate contacting pair of points. Usually, contact between two surfaces
is established by the resolution of a set of non-linear equations that expresses collinear and
orthogonal constraints between vectors defining the contacting surfaces, namely, the normal,
tangent, binormal and distance vectors [1-3]. Another type of equation that is important for
the geometric accuracy of contact analysis is hereafter called as the locus condition or
isosurface condition (isoline condition, in two-dimensional space). The solution of this type of
equations are the points that satisfy a geometric property. As an example, the locus condition
of a sphere is the location of all the points equally distanced from a point, i.e., the center point.
The intersection of rigid bodies geometries, although physically impossible, can be
considered as a motif for the mathematical concept of contact: two surfaces (or lines) are in
contact when their intersection is not a null set of points. Contact detection consists on
determining if the referred bodies are in physical contact, thus, three contact status are
possible: (i) no contact; (ii) external contact or contact at a sigle point; and (iii) contact with
pseudo-penetration. From a mechanical point of view, whenever contact occurs it is said that
the rigid bodies overlap or present pseudo-penetration. Here, contact detection relies on
evaluating the minimum distance between surfaces, i.e., contact is detected when the
minimum distance is lesser or equal to zero and positive when surfaces are apart. By
convention, negative distances imply surface overlap.
The magnitude of the contact reaction forces, which depends on the minimum distance,
can be calculated only when pseudo-penetration occurs. Within the equations of motion,
contact forces are seen as external forces that act upon interacting or interlinked bodies.
Different formalisms can be used to describe the continuous contact forces, including penalty
and linear complementary contact formulations. A common model for the continuous contact
forces was proposed by Lankarani and Nikravesh, which is based on the Hertzian non-linear
elastic contact [4]. Hunt and Crossley proposed a more general and continuous contact force
model that also accounts for energy disspation [5]. Although other formalisms, such as the
linear complementary problem, can be used to evaluate the contact forces, taking advantage of
the proposed geometric description of contact presented here, such methodologies are not
considered in this work.
For non-conformal contact analysis, the surface associated to the rigid body must be
described with a mathematically well-defined and C2 continuous geometric representation, so
2
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
that analytical expressions of the distance vector and the normal, tangential and binormal
surface vectors can be deduced. The surface representation can be either implicit or explicit
(parametric). This being, the mathematical framework presented hereafter relies on vector
calculus, algebraic and differential geometry. One of the main requirements to model the
geometry of a three-dimensional object, in this case the outer surface of a rigid body, is the
usage of a mathematical description that provides high geometric representativity. Quadric or
superquadric surfaces are geometric entities that provide such a description for a variety of
shapes, both natural and manmade objects.
For mechanical systems presenting freeform shapes, superquadrics surfaces can be fitted to
a set of points that belong to the generalized surface by solving the following optimization
problem: minimizing the distances between the points within the neighbourhood of the
contact site and the approximate surface. This strategy is suitable to handle contact problems
in which the contacting surfaces either have geometries close to a superquadratic surface or
the contact points do not depart from a small neigborhood of the surface.
Contact analysis has many important applications in other areas of applied sciences such as,
molecule simulation in computational physics [6], modeling discontinuous mechanical
systems (discrete element method) in geomechanics [7], humanoid design in biomechanics [8],
virtual reality simualtion and computer animation. From such a variety of applications,
several methods have been developed for distance computation and contact detection based
on quadric and superquadric surfaces.
Based on an interior point algorithm, Chakraborty et al. [9] formulated the distance
computation for convex bodies as an optimization problem to minimize the euclidean distance
subjected to the condition that candidate points lie on the surfaces. Such method presents
global convergence properties that are robust even in the absence of any initial information
about the closest points. The method is also quite accurate since the determined points belong
to the surface. Its main drawback is a lesser computational efficiency compared to other
methods [7,8].
For discrete element modeling, Lin and Ng [7] applied contact detection algorithms for
ellipsoids based on the common normal vector concept, which states that two points are the
candidate contact pair of points if the normal directions at these points are parallel to the
intersecting line. A set of non-linear equations obtained from equaling both normal vectors
and from equaling the normal vector to the distance vector, is solved numerically. Two
additional conditions of the points lying on the ellipsoids are also considered. This method
was tested only for ellipsoids and does not regard other vector relationships that are
fundamental for numerical robustness and accuracy.
For biomechanical applications, Kwak et al. [8] developed multibody models of
diarthrodial joints, such as the knee. The models include articular contact of freeform surfaces
with a parametric representation. Contact detection is also founded on the common normal
vector concept. Here, it is pointed out that the computational efficiency of their contact model
is enhanced by the use of analytical Jacobians.
Wang et al. [10] presented an algebraic condition for real-time continuous collision
detection for ellipsoids moving under rigid body transformations. The algebraic condition is a
quartic polynomial equation, also named as separation condition or characteristic equation,
that relates the geometric parameters of shape, spatial orientation, and position of two
ellipsoids. Depending on the sign of all four roots it is possible to determine the contact status.
The resolution of the characteristic equation is strightfoward, leading to a simple and yet
efficient algorithm for contact detection of ellipsoidal bodies that computes the exact time
interval of the collision [11].
3
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
In this paper, a general non-conformal contact detection methodology for rigid bodies,
described by quadric and superquadric surfaces, is presented. The proposed contact detection
methodology establishes a set of geometric conditions that, once fulfilled, render the pair of
points of possible contact. The resulting methodology consists in a set of non-linear equations
that is solved numerically with the Newton-Raphson method for which the Jacobian matrices
are calculated analytically, without resorting to optimization algorithms. This way, contact
detection comes naturally from the minimum distance calculation. The theoretical
formulations of the geometric description and the computational implementation aspects of
contact detection are described in the following sections.
where M is the global mass matrix, q is the acceleration vector, Φq is the Jacobian matrix of
the kinematic constraints, λ is the vector of Lagrangian multipliers, γ is the right-hand side
vector of the acceleration equation and g is the external force vector. Contact forces are,
therefore, included in the g vector that contains all the external forces applied to the system.
The relative position and orientation of the bodies are obtained by integrating in time the
equations of motion given by Eq. 1. Spatial data, such as translational coordinates and euler
angles, varies with time and are contained within vector q, the vector of generalized
coordinates.
Contact mechanics relies on the geometric constraint that expresses the common normal
principle (although Lin and Ng [7] have referred it as a ‘concept’ it should be understood as a
geometric principle). Restriction to body movement by such a constraint is imposed by the
application of a pair of forces that appear when surfaces overlap, and not by the conditioning
of a DOF within the mechanical system.
For every time step, contact detection is evaluated by determining the minimum Euclidean
distance between the surfaces or, to test if the bodies are apart, by evaluating proximity
queries [9]. When two moving surfaces overlap, a pair of opposite contact normal forces
appear, each one applied on the contact points of the intervining bodies and with the direction
of the minimum distance vector. The reaction force magnitude is proportional to the pseudo-
penetration. Although the contact detection methodology regards bodies as being rigid, the
pseudo-penetration is an estimate of the deformation that results from the overlap of the
surfaces. This way, not only is it possible to predict the contact forces but also to estimate the
contact areas and contact stresses.
In Fig. 1, a generalized multibody model [1] of a contact pair is presented. Each rigid body
is defined with at least three points and can contain more than one contact surface. The
coordinate systems employed to describe the motion and configuration of a contact pair are:
the global coordinate system XYZ; the coordinate systems ξkηkζk of rigid bodies k ∈ {α,β}; and
the local coordinate systems xmymzm of surfaces m ∈ {i,j}. Position vectors and transformation
matrices, obtained from the multibody dynamics calculations, are represented, respectively,
by r and A where the subscripts indicate the corresponding coordinate systems, e.g., AOβ
represents the coordinate transformation from the local coordinate system of body β to the
global coordinate system. Position vectors in the local reference system of the contacting
surface are represented by s. Each body has a fixed coordinate system that must not be
4
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
confused with the local coordinate systems of the surfaces that compose it. Note that, contact
calculation is performed using the outward surface normals and that all vectorial relationships,
that define the geometric constraints, are referenced to the global coordinate system.
Figure 1: Multibody model of a contact pair and vector entities envolved in contact analysis.
'i ( xi , yi , zi ) = 0,
(2)
' j ( x j , y j , z j ) = 0,
and
p i = p i ( s, u ) ,
(3)
p j = p j ( w, v ) ,
where Fi and Fj are implicit scalar functions that define the locus of points belonging to
surfaces i and j, respectively; pi and pj are the parametric position vectors of the referred
5
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
surfaces; (x,y,z) the cartesian coordinates of a point belonging to the surface; and (s,u) and
(w,v) parametric coordinates. The distance vector that connects the two contact points
candidates located on the surfaces, dPQ, is defined as the difference of the global vector
positions of points P and Q, given by rOP and rOQ. Thus, one has,
where rOP and rOQ are unknown quantities. The normal vector at each point is derived by
partial differentiation of the surface equation in order to the spatial coordinates. If the implicit
surface representation is considered (Eq. 2), the normal vector is the surface gradient. A plane
that contains the tangent vectors can then be deduced since a plane can be defined by a point
and a normal vector. In the case of parametric surfaces (Eq. 3), differentiation of the surface
expression gives the tangential vectors along each spatial parameter. Therefore, surface
normals are calculated by the cross product of the tangent vectors.
Contact detection is formulated by a set of geometric constraints, including the
aforementioned common normal principle, which is written as a vector ΦG = ΦG (q G ) that
depends on the vector of the unknown points,
qG = ⎡ rOP ⎤ . (5)
⎢r ⎥
⎣ OQ ⎦
For convinience of the methodology, vector qG can also be expressed in local coordinates of
the intervining surfaces, as it will be described in the next section. In general, three types of
non-linear algebraic equations define a geometric constraint:
It should be noticed that the latter type of constraint is only introduced for contact detection
regarding implicit surfaces.
As it was mentioned before, contact between surfaces is enunciated as the problematic of
encountering the location of the pair of points in which the distance vector, dPQ, is aligned to
the surface normals niP and njQ, and has a minimum value. This can be written as two cross
product equations relating vectors dPQ, niP, and njQ. Equivalently, the collinearity condition
can be expressed as an orthogonal constraint involving vector dPQ, surface tangent vectors tiP
and tjQ, and binormal vectors biP and bjQ. Eq. 6 presents the equivalency of both constraints,
⎧ d PQ ⋅ t iP = 0
d PQ × niP = 0 ⇔ ⎨
⎩d PQ ⋅ biP = 0
. (6)
⎧ d PQ ⋅ t jQ = 0
d PQ × n jQ = 0 ⇔ ⎨
⎩d PQ ⋅ b jQ = 0
In 3-D space, whether one considers the collinear or orthogonal constraint definition, Eq. 6
always renders a system of four non-linear independent equations. According to the
orthogonal constraint, Eq. 6 can be solved for the 4 unknown surface parameters (s,u,w,v) in
6
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
the case of parametric surfaces, or when the surface representation follows an implicit
definition, 2 additional locus contraints given by Eq. 2, one for each rigid body, must be
added to the set of orthogonal constraints. In this case, one has 4+2 equations for the 6
cartesian coordinates (xi, yi, zi) and (xj, yj, zj) of the candidate contact points. Redunt
constraints must be avoided so that all the equations are linearly independent.
The vector of geometric constraints ΦG is built with C2 continuous functions and the dot
and cross product operators do not introduce any discontinuity for an arbitrary point in the
domain, therefore, ΦG is a twice-differentiable vector function. The vector equation that
contains non-redundant geometric constraints,
ΦG (qG ) = 0, (7)
can then be solved using the Newton-Raphson iterative procedure which, theoretically,
converges quadratically near the solution. Since ΦG has, at least, a C2 mathematical
expression, one can exploit the numerical behaviour with analytical Jacobians.
The distance vector magnitude, d, is calculated as the signed Euclidean distance of vector
dPQ, thus, ‘negative distances’ are considered. At a given time instant, the signed magnitude d
indicates one of the three possible contact situtations (Table 1): (i) no contact; (ii) contact at a
single point or external contact (rOP = rOQ) and (iii) contact with pseudo-penetration.
Minimum distance
Contact type d = sign ( niP ⋅ d PQ ) d PQ 2
No contact d>0
External contact d=0
Contact with pseudo-penetration d<0
7
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
where
T
qG = ⎡⎣ xi , yi , zi , x j , y j , z j ⎤⎦ . (8)
The last two geometric constraints in Eq. 7 are the implicit surface equations given in the
canonical form. i.e., the surface principal axis are aligned with the local coordinate axis and
the surface centroid is coincident with the local origin. All vectors in Eq. 7 are defined in
global coordinates except for the vector of unknown cartesian coordinates, qG. In fact, all
surface vectors in Eq. 7 depend on qG and on the position and orientation of the reference
systems. This being, the surface vectors can be expressed in local surface coordinates as (see
Fig. 1):
d PQ = rOQ − rOP =
= rOβ + A Oβ rβ j + A Oβ A β j s jQ − ( rOα + A Oα rα i + A Oα Aα i siP ) ,
n OP = A Oα Aα i niP , (9)
t OQ = A Oβ A β j ( n jQ × v jQ ) = A Oβ A β j n jQ v jQ ,
( )
b OQ = A Oβ A β j n jQ × ( n jQ × v jQ ) = A Oβ A β j n jQn jQ v jQ ,
where niP, njQ, and vjQ depend the position vectors of points P and Q in local surface
coordinates, siP and sjQ; the tilde sign (~) above the vectors is the skew-symmetric matrix
associated with the corresponding vector; and vjQ is an auxiliary vector applied to the
calculation of the tangent and binormal vectors to the surface, that is calculated in such a way
that is not collinear to the normal vector. In fact, any vector that respects the following two
conditions,
v = n ⇒ v = 0 ∧ n = 0, (10)
v n
⋅ ≠ 1, (11)
v n
is a valid auxiliary vector. The first condition (Eq. 10) implies that both vectors are equal if
and only if they are the zero vector. As for the second condition (Eq. 11), it implies that the
vectors must not be collinear.
The Newton-Raphson method relies on the Taylor series expansion of ΦG. This demands
the calculation of the geometric contraints Jacobians. Each row of the Jacobian matrix is the
first partial derivate of ΦG in order to qG. Hence,
∂
ΦGqG ( qG ) = ΦG ( qG ) ⇔ ΦGqG ( qG ) = ⎡ tTOQ ( n OP ) G + nTOP ( t OQ ) ⎤ (12)
∂q G
⎢ q
⎥
qG
⎢b OQ ( n OP ) G
T
+ nTOP ( b OQ ) G ⎥
⎢ q q
⎥
⎢ t OQ ( d PQ ) G
T
+ d PQ ( t OQ ) G ⎥
T
⎢ q q
⎥
⎢b OQ ( d PQ ) G
T
+ d PQ ( b OQ ) G ⎥
T
⎢ q q
⎥
⎢ T
n iP 01×3 ⎥
⎢ 01×3 T
n jQ ⎥
⎣ ⎦
where
8
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
(d )
PQ qG = A Oβ A β j ( s jQ ) G − A Oα Aα i ( siP )qG ,
q
(t )
OQ qG = A Oβ A β j ( n jQ × v jQ ) =
qG (13)
= A Oβ A β j ⎡n jQ ( v jQ ) G + v jQ ( n jQ ) G ⎤ ,
⎣ q q ⎦
(b )
OQ qG (
= A Oβ A β j n jQ × ( n jQ × v jQ ) ) qG
=
= A Oβ A β j ⎡n jQn jQ ( v jQ ) G − n jQ v jQ ( n jQ ) G −
⎣ q q
− ( n jQ v jQ − v jQn jQ )( n jQ ) G ⎤ ,
q ⎦
The equations presented in this section are generic to any implicit surface that is C2
continuous. Once equations Eq. 7 and Eq. 12 are implemented, extending the methodology to
other surfaces simply requires the deduction of the analytical expressions for niP, njQ, and vjQ
( niP )qG , ( n jQ ) G , and ( v jQ ) G which is usually a straightfoward process.
q q
9
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
with
a11a1 = a22 a2 = a33 a3 = 0, (16)
where {a11, a22, a33} are shape coefficients and {a1, a2, a3} are unit or zero valued coefficients
that define the quadric surface family type (Table 2). Dimension parameters along the x, y,
and z directions are given by the following formulas:
1 1 1
a= , b= , c= . (17)
a11 a22 a33
x = ⎡ x ⎤ , and A = ⎡ a11 0 0 1
2 a1 ⎤ . (18)
⎢ y⎥ ⎢ 0 a22 0 1
a2 ⎥⎥
⎢ ⎥ ⎢ 2
⎢z⎥ ⎢ 0 0 a33 2 a3
1 ⎥
⎢ ⎥ ⎢1 ⎥
⎣1 ⎦ ⎣ 2 a1
1
2 a2 1
2 a3 −1 ⎦
The separation condition heavily depends on the matricial form expressed in the above
equation [10,11].
Due to the radial symmetry of the surface, an angle-center parametrization can deduced by
expressing the quadric surface in spherical coordinates as:
10
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
where c = cos(.), s = sin(.), rquad is the radial coordinate, φ and θ are the azimuth and zenith
angular coordinates. If rquad = 1 for all the angular domain, we obtain the unit sphere. Note
that Eq. 19 is a parametric equation that is valid for all quadric surface family members listed
in Table 2. This is extremely important in terms of computational implementation of the
visualization of the contact surfaces since only one expression represents all surface members.
Given the implicit representation of the surface in the canonical form (Eq. 15), the normal
vector of a quadric surface is the gradient vector of the scalar function F. For surfaces i and j,
the normal vectors are given by:
The auxiliary vector is defined as the signed permutation of the normal vector coordinates,
T
v jQ = ⎡⎣ − n j , z n j , x n j , y ⎤⎦ , (23)
where nj,x, nj,y, and nj,z are the normal vector coordinates in the local surface reference system.
Note that, any other signed permutation that respects the conditions in Eq. 10 and Eq. 11 is a
valid auxiliary. Attention must be made for the possibility of geometric singularities. For
example, Eq. 23 presents a geometric singularity for n = τ[1 -1 1]T, with τ ∈ \ . The Jacobian
matrix of vjQ is given by:
(v )
jQ qG = 2 ⎡0 0 0 0 0 − a j ,33 ⎤ . (24)
⎢ ⎥
⎢0 0 0 a j ,11 0 0 ⎥
⎢0 0 0 0 a 0 ⎥⎦
⎣ j ,22
In order to increase the efficiency of the contact detection algorithm, proximity queries are
usually considered [9]. They consist on simple tests to averiguate if the surfaces are apart for a
given instant of time. When dealing with closed surface quadrics, such as spheres and
ellipsoids, the most commonly used proximity query is the bounding sphere test. Such
technique allows rapid tests for collision detection but are not quite precise, and are often
evaluated to determine if a more detailed testing is required. A bounding sphere, as the name
suggests, is a 3-D sphere that contains all the points of the quadric surface and share the same
centroid. Basically, the test consists on evaluating the inequality between the sum of the semi-
major axis of the quadric surfaces and the distance between their centroids. If the distance is
lesser or equal to the sum of the semi-major axis then a more detailed testing must be
11
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
conducted. An elegant and efficient algorithm for detecting contact between two ellipsoids
was presented by Choi et al. [11]. This algorithm is based on the separation condition of two
ellipsoids, which is a necessary and sufficient condition that states that the characteristic
equation has positive roots if and only if the ellipsoids do not have common interior points
[10].
where {a11, a22, a33} are shape coefficients, and γ1 and γ2 are the expoents. Depending on the
signal value of shape coefficients, one can define the family type of the superquadric (Table
3). If γ 1 = γ 2 with γ 1 , γ 2 ∈ {1, 2} then Eq. 25 falls in to a quadric implicit function. Barr [12]
introduced a spherical product operator through which a surface is created given two
parametric curves that lay upon two orthogonal planes. In fact, it is merely a generalization of
the spherical to rectangular coordinate transformation. Basically, γ1 and γ2 are the expoents
the orthogonal curves that lay on yOz and xOy, respectively. The formulas for the dimension
parameters along the x, y, and z directions are given by:
1 1 1
⎛ 1 ⎞ γ2 ⎛ 1 ⎞γ2 ⎛ 1 ⎞ γ1
a = ⎜⎜ ⎟⎟ , b = ⎜⎜ ⎟⎟ , c = ⎜⎜ ⎟⎟ . (26)
⎝ a11 ⎠ ⎝ a22 ⎠ ⎝ a33 ⎠
The angle-center parametrization is deduced in the same way as for the quadric surfaces.
This being, the parametric superquadric representation ssuper is given by:
12
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
where rsuper is the radial coordinate, φ and θ are the azimuth and zenith angular coordinates.
Note that Eq. 27 is a parametric equation that is valid for all the mentioned superquadric
family members in Table 3.
Barr’s [12] implicit definition of the superquadric surface is composed by a function raised
to γ 1 γ 2 . By twice differentiating Eq. 25, the expoent γ 1 γ 2 − 2 appears in the resulting
expressions. As a consequence, only values of γ 1 ≥ 2γ 2 are permissible, so that non-negative
expoentes are preserved. This deeply hampers the desired geometric representativity and
excludes the particular case of the quadric surfaces. For contact analysis with implicit surfaces,
the superquadric definition proposed by Barr is quite limited, although it is entirely applicable
when considering the parametric version of the geometric constraints. Therefore, an
alternative quadric surface generalization is considered:
where {a11, a22, a33} are shape coefficients, and γ1, γ2, and γ3 are real non-negative expoents.
In any computational implementation involving polynomials with rational expoents, one
must be aware of the numerical evaluation of superquadric equations [16]. The correct order
of evaluation of these exponential terms is ( x 2 ) , with γ = 2/ε, to assure that the result is not
1ε
a complex number when x < 0. In order to prevent divisions by zero, the expoent must be
greater or equal to zero. The values of γ1, γ2, and γ3 are normally bounded between 2 and
infinity so that only convex shapes, with no geometric singularities, are modeled.
The normal vector to a superquadric surface is also given by the gradient vector and the
Jacobian matrices are obtained in the same fashion:
(30)
⎡ 2 ε −1 ⎤
1
⎡ 2 ε −1 ⎤
1
niP = ∇Fi ( xi , yi , zi ) = ⎢ ai ,11γ i ,1 xi ( xi ) i ,1 ⎥ , n jQ = ∇Fj ( x j , y j , z j ) = ⎢ a j ,11γ j ,1 x j ( x j ) j ,1 ⎥ ,
⎢ 1 ⎥ ⎢ 1 ⎥
⎢ a γ y ( y 2 ) ε i ,2 −1 ⎥ ⎢ a γ y ( y 2 ) ε j ,2 −1 ⎥
⎢ i ,22 i ,2 i i ⎥ ⎢ j ,22 j ,2 j j ⎥
⎢ 1 ⎥ ⎢ 1 ⎥
⎢⎣ ai ,33γ i ,3 zi ( zi ) ε i ,3 ⎥⎦ ⎢⎣ a j ,33γ j ,3 z j ( z j ) ε j ,3 ⎥⎦
2 −1 2 −1
(31)
⎡ 1
⎤
= ⎢ ai ,11γ i ,1 ( γ i ,1 − 1) ( xi 2 ) ε i ,1
−1
( niP )q G 0 0 0 0 0⎥ ,
⎢ 1 ⎥
⎢ 0 ai ,22γ i ,2 ( γ i ,2 − 1) ( yi ) i ,2
2 ε −1
0 0 0 0⎥
⎢ ⎥
⎢ 1 ⎥
ai ,33γ i ,3 ( γ i ,3 − 1) ( zi 2 ) ε i ,3 0 0 0 ⎥⎦
−1
⎢⎣ 0 0
⎡ 1
⎤
(n ) = ⎢0 0 0 a j ,11γ j ,1 ( γ j ,1 − 1) ( x j 2 ) ε j ,1
−1
jQ qG 0 0 ⎥.
⎢ 1 ⎥
⎢0 0 0 0 a j ,22γ j ,2 ( γ j ,2 − 1) ( y j ) j ,2
2 ε −1
0 ⎥
⎢ ⎥
⎢ 1 ⎥
a j ,33γ j ,3 ( γ j ,3 − 1) ( z j 2 ) ε j ,3 ⎥⎦
−1
⎢⎣0 0 0 0 0
13
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
FN = K δ n + λδ nδ (33)
14
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
2λ
e = 1− δ0 (34)
3K
The force expressed by Eq. 33, when drawn versus penetration, results in a hysteresis loop
as shown in Fig. 2. The area of the hysteresis loop is equal to the energy loss due to the
internal damping of the material. The hysteresis damping function assumes that the loss in
energy during impact is due to the material damping of t he colliding bodies, which dissipates
energy in the form of heat.
The occurrence of surface overlap is the basis to evaluate the local deformation of the
contacting bodies. Then, a constitutive contact law, such as the continuous contact force
model proposed by Hunt and Crossley or by Lankarani and Nikravesh can be applied to
evaluate the contact force developed in the direction perpendicular to the plane of collision.
Within the contact region, the surface deformation and resulting contact stresses are
approximated by a function of the proximity (i.e., the overlap) of the originally undeformed
surfaces.
15
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
location of the pair of contact points together with the contact forces. The algorithm consists
on the following steps:
(i) Establish the time interval [t0, tend] for the analysis;
(ii) At time step t0, establish the initial conditions for the position vector,
q 0 = q(t0 ), velocity vector, q 0 = q (t0 ) , and contact candidate pair of points qG0 = qG (t0 );
(iii) Evaluate the proximity queries; if the surfaces are sufficiently close then go to (iv),
otherwise go to (vii);
(iv) Run the Newton-Raphson method with analytical Jacobians to obtain the vector of the
contact points qG;
(v) Compute the signed distance magnitude d and check for contact; if there is contact,
evaluate contact forces; if not go to step (vii);
(vi) Add the contact forces to the vector of applied forces g;
(vii) Solve the equations of motion deduced from the multibody dynamics formulation in
order to obtain the body positions and orientations for the new time step t + Δt ;
(viii) Update the system time variable t and use the vector qG obtained in (iii) as the initial
guess for the Newton-Raphson method;
(ix) Go to step (iii) and proceed with the whole process for the new time step;
(x) Exit the main algorithm’s loop when the final time step is reached.
Note that the contact detection algorithm is ran n times for each time step, where n is the
number of rigid contact pairs within the multibody system. Fig. 3 shows the flowchart of the
contact methodology. The numerical implementation of this methodology leads to an efficient
algorithm since the information of the previous time step is used as an initial guess to find the
solution of the non-linear equations and, therefore, only a few iterations are required to obtain
the solution.
7 RESULTS
The results here presented refer to the distance computation between a contact pair
represented as ellipsoidal (quadric) surfaces as depicted in Fig. 4(A). No proximity queries or
16
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
multibody dynamics calculations are undertaken in order to evaluate the distance computation
efficiency during the analysis. The contact analysis is performed for a time interval of 200
timesteps with a tolerance of 10-6 for the Newton-Raphson accuracy. Both surfaces are
initially aligned with the global coordinate system axes, and the centroids of surface i and j
are positioned at the origin and at [0 4 0]T, respectively. The prescribed motion induced upon
surface i and j are a 360º rotation along the X axis and along the vector [1 1 1]T, respectively,
as represented in Fig. 4(B). The initial approximation, qG(t0), consisted on the half distance
between the centroids. For the remaning timesteps, the Newton-Raphson approximations are
the resulting vector from the previous timestep, qG(t). The analysis evaluation took 0.9960
seconds, corresponding to a total of 987 Newton-Raphson iterations required for the 200
timesteps, without diverging. Approximately 5 iterations per timestep are necessary to solve
the non-linear system of equations (Eq. 7). Fig. 5(A) and Fig. 5(B) show the influence of the
initial approximation of the Newton-Raphson method in which the initial points for t = 0 did
not lie on the surfaces. Both plots show that the residual error follows, approximately, a
quadratic convergence. When the approximation is closer to the solution, a supra-quadratic
convergence is noticed. A test was performed for distance computation between a contact
pair of superquadrics which failed when the coordinates were close to zero. However, for a
contact pair made up by a quadric and a superquadric the method did not fail and presented a
computational behaviour close to the quadric case here presented.
A B
t=0 t = 20 t = 35
t = 50 t = 68 t = 100
Figure 4: (A) Initial configuration of the surface pair. (B) 3D graphics of the contact region and its vinicity in six
different timesteps. (blue surface – i, red surface – j; red vectors – normals, grey vector – auxiliary, blue vector –
tangent, green vector – binormal)
2 0
10 10
A G
Φ1 B G
Φ1
0
10 G G
Φ2 -2
10 Φ2
G G
-2
10 Φ3 Φ3
G G
Φ4 -4
10 Φ4
log10(abs(Φ G))
log10(abs(Φ G))
-4
10 G G
Φ5 Φ5
G G
-6
10 Φ6 -6
10 Φ6
-8
10 -8
10
-10
10
-10
-12
10
10
-14 -12
10 10
1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 1 1.5 2 2.5 3 3.5 4
Iteration Index Iteration Index
Figure 5: (A) Semi-log plot of vector ΦG at t = 0. (B) Semi-log plot of vector ΦG at t = 50.
17
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
8 DISCUSSION
The proposed contact methodology relies on a simple geometric principle and on locus
contraints that are quite intuitive. Consequently, the methodology is easily formulated
according to vector calculus and algebraic and differential geometry.
From a mathematical point of view, quadrics detain a better behaviour than superquadrics
since special treatment is not required for continuity singularities and the issues associated
with rational expoents do not take place (divisions by zero and the appearance of complex
numbers for negative domain values). On the other hand, superquadrics possess a higher
geometric representativity since the varying expoents control the overall curvature of the
surface, contrary to quadrics that have a constant power. Notice that the contact formultion
proposed here is limited to convex surfaces. In fact, if one or both of the surfaces are concave,
multiple solutions can be obtained for the geometric constraint vector. In order to apply the
contact detection metholodoly to concave surfaces, a set of superquadrics can be arranjed to
fit the non-convex surface. Quadrics and superquadrics have a small number of geometric
parameters and approximate a wide class of convex objects.
The auxiliary vector chosen for quadric surfaces provides constant Jacobian matrices and a
geometric singularity. For superquadrics it is necessary to guarantee that the normal vector
and auxiliary vector Jacobians are not ill-conditioned, i.e., with not too many zeros, so that
ΦGqG does not become a singular matrix when a pair of local coordinates are close to zero. As
an alternative, instead of considering the implicit surface definition, the parametric
representation provides normal vector, tangent and, binormal information available
continuosly over the surface, even across edges that are very square.
Contact calculations contribute quite significantly to the computational cost of multibody
dynamics analysis. The evaluation of functions describing the superquadrics involves the
computation of trigonometric and exponential functions, and is thus expensive. Proximity
queries help attenuate the computational burden but for superquadric surfaces an efficient test,
such as the separation condition for ellipsoids, is not yet available. The usage of analytical
Jacobians, besides guaranteeing the geometric accuracy of the result, also contributes to the
computational efficiency, since no matrix estimate is required for each iteration.
All in all, the computational efficieny and robustness are the major advantages of the
present model is that it converges rapidly, allowing simulations to be performed interactively.
Though the computational time is dependent on the initial guess (a limitation inherited from
the Newton-Raphson algorithm) 200 timesteps were completed in less than 1.5 seconds.
9 CONCLUSIONS
In this work, an accurate, efficient, and easily implementable algorithm for minimum
distance computation between quadric and superquadric surfaces is presented. This contact
algorithm does not resort on optimization methods or convex polyhedra geometries, making
use of analytical expressions for the surface vectors and associated Jacobian matrices. A
mathematical artifice was introduced to compute tangent and binormal vectors for implicit
surfaces given the normal vector to a surface. The methodology provides a uniform
framework for distance computation between objects described as arbitrary convex implicit
surfaces but geometric singularities still persist. The speed at which distance computation is
performed enables real-time dynamic simulations.
The proposed contact methodology explores the implicit representation of superquadrics
which relies on algebraic expressions with rational expoents, contrary to the parametric
counterpart which involves trigonometric functions raised to rational expoents, i.e.,
18
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
ACKNOWLEDGMENTS
The authors would like to acknowledge the support given by the Fundação para a Ciência
e a Tecnologia (FCT), through projects ProPaFe (PTDC/EMEPME/67687/2006) and
DACHOR (MIT-Pt/BS-HHMS/0042/2008). The first author would like to thank FCT for the
PhD grant SFRH/BD/47750/2008.
REFERENCES
[1] P. Nikravesh, Computer-aided analysis of mechanical systems. Prentice-Hall,
Englewood Cliffs, New Jersey, 1988.
[2] R. Schwertassek, T. Klisch, Two Modelling Problems in Multibody Simulation:
Flexible Bodies and Contact of Bodies, Proceedings of the NATO Advanced Study
Institute on Computational Methods in Mechanisms, Invited Lectures, 1, 283-312,
Varna, Bulgaria, 1997.
[3] J. Pombo, J. Ambrósio, M. Silva, A new wheel-rail contact model for railway dynamics,
Vehicle System Dynamics, 45:2,165-189, 2007.
[4] H. Lankarani and P. Nikravesh, Continuous Contact Force Models for Impact Analysis
in Multibody Systems, Nonlinear Dynamics, 5, 193-207, 1994.
[5] K. Hunt, F. Crossley, Coefficient of Restitution Interpreted as Damping in Vibroimpact,
ASME Jornal of Applied Mechanics, 42, pp. 440–445, 1975.
[6] A. Donev, S. Torquato, F.H. Stillinger, Neighbor List Collision-Driven Molecular
Dynamics Simulation for Nonspherical Hard Particles II: Applications to Ellipses and
Ellipsoids, J. Computational Pysics, 202, pp. 765–793, 2005.
[7] X. Lin and T.-T. Ng, Contact Detection Algorithms for Three-Dimnsional Ellipsoids in
Discrete Element Modelling, International Journal for Numerical and Analytical
Methods in Geomechanics, 19, 653-659, 1995.
19
Daniel S. Lopes, Miguel T. Silva and Jorge A. Ambrósio
20