MDCELLIPSOIDs is a MATLAB^{®} code to calculate the minimum distance between two ellipsoidal
surfaces in a
nonconformal contact situation.
The implemented methodology is specifically designed for rigid contact detection where the surfaces are in a convexconvex
interaction and do not deform or alter there local geometric properties whenever there is contact. Therefore, in rigid contact,
surfaces may share a common geometric locus, i.e., surfaces may overlap.
Minimum distance calculation is performed by numerically solving a system on nonlinear equations with the
NewtonRaphson method with analytical Jacobians. The system of nonlinear equations corresponds to a set of
necessary, although not sufficient, geometric constraints whose solution consists of the pair of points that have
a common normal direction.
To restrict the solution space to a unique pair of points, different types of constraints are considered:
collinear constraint (vector crossproduct); orthogonal constraint (vector innerproduct); and
locus constraint (point belongs to surface). To guarantee unicity, an additional nonequality condition,
that evaluates the distances of all the candidate solutions, is considered.
All constraints have a welldefined analytical expression that relate the geometric entities envolved in the
common normal concept, i.e., the normal, tangent, binormal and distance vectors which are deducible given only the
implicit surface functional.
Contact detection is performed by simply evaluating the sign of the minimum distance between the surfaces.
The three types of contact detection statuses are: (i) no contact (surfaces appart ⇒ minimum distance greater than zero);
(ii) external contact (contact at a single point ⇒ minimum distance equal to zero);
and (iii) contact (surfaces overlap ⇒ minimum distance lesser than zero).
Householder transformation proved to be useful to deduce the tangential and binormal vectors
given the analytical expression of the normal vector which, by vector calculus, is derived as the gradient of the
implicit function. The
Householder transformation is used to
provide a base of three orthogonal vectors, in which one of them is collinear to the surface normal.
Proximity queries were also implemented to test for coarse (with the traditional
bounding spheres)
and narrow
(with the separate condition) contact detection.
Note that the proximity queries do not calculate the minimum distance between ellipsoids.
Applications The MDCELLIPSOIDs code was originally developed to perform computational simulations for contact analysis of multibody systems. However, the proposed methodology has important applications in many other areas of applied science such as, molecule simulation in computational physics, modeling discontinuous mechanical systems (discrete element method) in geomechanics, humanoid design in biomechanics, virtual reality simulation and computer animation.
Main characteristics of the MDCELLIPSOIDs methodology:

Multibody Dynamics with Contact Forces Flowchart of the MDCELLIPSOIDs integrated with a Multibody Dynamics module. 
References
Credits 
Download MDCELLIPSOIDs, unpack it to a prefered directory and run it in the MATLAB^{®} environment.
The directory is added automatically to your MATLAB path. Type 'mdcdemo' on the command line
window for a quick demonstration. For more details see the corresponding
documentation.
Download MDCELLIPSOIDs [284 KB zip file]!
MDCELLIPSOIDs is licenced under a
Creative Commons AttributionNonCommercialShareAlike 2.0 Generic License.
See the
License and Copyright notice for more information on authors acknowledgment and commercial use.
Directory and file information  The code package is composed by 4 directories or modules, main function, demo file, introductory tutorial, and input data which can either be entered in a excel document or in a MATLAB file (see documentation). The demo file can be promptly runned in the command window once the code is unpacked and MATLAB's current folder is setted to the MDCELLIPSOIDs root directory. 
Zip file content 
MDCELLIPSOIDs/ MDCELLIPSOIDs/Auxiliary Functions Module MDCELLIPSOIDs/Contact Pair Geometric Data Module MDCELLIPSOIDs/NewtonRaphson Method Module MDCELLIPSOIDs/Proximity Queries Module MDCELLIPSOIDs/Visualization Module MINIMUM_DISTANCE_CALCULATION.m mdcdemo.m INPUT_CONTACT_PAIRS_GEOMETRIC_DATA.m INPUT_NEWTON_RAPHSON_INITIALIZATION.m INPUT_VISUALIZATION_DATA.m Examples_quadric_surface_data.xls Users and Developers Manual.pdf 
Auxiliary Functions Module/ Closest_Candidate.m Globalize_Vector.m product_of_matrices.m redimension_quadric_coefficients.m rotation_angle_axis.m Contact Pair Geometric Data Module/ COORDINATE_SYSTEM_POSITIONS.m COORDINATE_SYSTEM_ORIENTATIONS.m SURFACE_DATA.m NewtonRaphson Method Module/ Binormal_Jacobian.m EVALUATION_GEOMETRIC_CONSTRAINTS.m Householder_Matrix.m Householder_Vector.m Implicit_Canonical_Function.m NEWTON_RAPHSON_INITIALIZATION_DATA.m Normal_Function.m RESOLUTION_SYSTEM_NONLINEAR_EQUATIONS.m Tangent_Jacobian.m 
Proximity Queries Module/ Algebraic_Separation_Condition.m Bounding_Spheres.m Separate_Condition.txt Symbolic_Algebraic_Condition.m Visualization Module/ Generic_Quadric_Parametrization.m Quadric_Surface_Mesh_Vertices.m VISUALIZATION_DATA.m VISUALIZATION_MINIMUM_DISTANCE_CALCULATION.m 
Still images  Videos 
Daniel Simões Lopes Biomechatronics Research Group Instituto Superior Técnico  Technical University of Lisbon IDMEC/IST, Av. Rovisco Pais, nº 1 1049001 Lisboa Portugal 
Email: danlopes(at)dem(.)ist(.)utl(.)pt URLs: IST homepage  FENIX homepage  Biomechatronics Research Group 
© 2010 Daniel Simões Lopes