sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube Class Reference

#include <DistanceGridCollisionModel.h>

Collaboration diagram for sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube:

Collaboration graph
[legend]

Data Structures

struct  Point

Public Types

enum  {
  C000 = 0+0+0, C100 = 1+0+0, C010 = 0+2+0, C110 = 1+2+0,
  C001 = 0+0+4, C101 = 1+0+4, C011 = 0+2+4, C111 = 1+2+4
}
enum  {
  FX0 = 0+0, FX1 = 0+1, FY0 = 2+0, FY1 = 2+1,
  FZ0 = 4+0, FZ1 = 4+1
}
typedef Vec< 4, GSReal > Plane
 plane equation as defined by Plane.(x y z 1) = 0

Public Member Functions

 DeformedCube ()
void updateDeform ()
 Update the deformation precomputed values.
void updatePoints ()
 Update the deformedPoints position if not done yet (i.e. if pointsUpdated==false).
void updateFaces ()
 Update the face planes if not done yet (i.e.
DistanceGrid::Coord baryCoords (const GCoord &c) const
 Compute the barycentric coordinates of a point from its initial position.
GCoord initpos (const GCoord &b) const
 Compute the initial position of a point from its barycentric coordinates.
GCoord deform (const GCoord &b) const
 Compute the deformed position of a point from its barycentric coordinates.
GCoord deformDir (const GCoord &b, const GCoord &dir) const
 deform a direction relative to a point in barycentric coordinates
Mat< 3, 3, double > Jdeform (const GCoord &b) const
 Get the local jacobian matrix of the deformation.
GCoord undeform0 (const GCoord &p) const
 Compute an initial estimate to the barycentric coordinate of a point given its deformed position.
GCoord undeformDir (const GCoord &b, const GCoord &dir) const
 Undeform a direction relative to a point in barycentric coordinates.
Plane computePlane (int c00, int c10, int c01, int c11)
 Compute a plane equation given 4 corners.

Static Public Member Functions

static GSReal interp (GSReal coef, GSReal a, GSReal b)

Data Fields

DistanceGrid * grid
int elem
 Index of the corresponding element in the topology.
vector< Point > points
 barycentric coordinates of included points
GCoord initP0
GCoord initDP
GCoord invDP
 Initial corners position.
GCoord corners [8]
 Current corners position.
Plane faces [6]
 planes corresponding to the six faces (FX0,FX1,FY0,FY1,FZ0,FZ1)
GCoord center
 current center;
GSReal radius
 radius of enclosing sphere
vector< GCoord > deformedPoints
 deformed points
bool pointsUpdated
 true the deformedPoints vector has been updated with the latest positions
bool facesUpdated
 true the faces plane vector has been updated with the latest positions
Precomputed deformation factors
We have : deform(b) = C000(1-b[0])(1-b[1])(1-b[2]) + C100(b[0])(1-b[1])(1-b[2]) + C010(1-b[0])(b[1])(1-b[2]) + C110(b[0])(b[1])(1-b[2]) + C001(1-b[0])(1-b[1])( b[2]) + C101(b[0])(1-b[1])( b[2]) + C011(1-b[0])(b[1])( b[2]) + C111(b[0])(b[1])( b[2]) = C000 + Dx b[0] + Dy b[1] + Dz b[2] + Dxy b[0]b[1] + Dxz b[0]b[2] + dyz b[1]b[2] + dxyz b[0]b[1]b[2]

GCoord Dx
 Dx = -C000+C100.
GCoord Dy
 Dy = -C000+C010.
GCoord Dz
 Dx = -C000+C001.
GCoord Dxy
 Dxy = C000-C100-C010+C110 = C110-C010-Dx.
GCoord Dxz
 Dxz = C000-C100-C001+C101 = C101-C001-Dx.
GCoord Dyz
 Dyz = C000-C010-C001+C011 = C011-C001-Dy.
GCoord Dxyz
 Dxyz = - C000 + C100 + C010 - C110 + C001 - C101 - C011 + C111 = C001 - C101 - C011 + C111 - Dxy.

Detailed Description

Definition at line 601 of file DistanceGridCollisionModel.h.


Member Typedef Documentation

plane equation as defined by Plane.(x y z 1) = 0

Definition at line 623 of file DistanceGridCollisionModel.h.


Member Enumeration Documentation

anonymous enum

Enumerator:
C000 
C100 
C010 
C110 
C001 
C101 
C011 
C111 

Definition at line 615 of file DistanceGridCollisionModel.h.

anonymous enum

Enumerator:
FX0 
FX1 
FY0 
FY1 
FZ0 
FZ1 

Definition at line 625 of file DistanceGridCollisionModel.h.


Constructor & Destructor Documentation

sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::DeformedCube (  )  [inline]

Definition at line 605 of file DistanceGridCollisionModel.h.


Member Function Documentation

DistanceGrid::Coord sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::baryCoords ( const GCoord &  c  )  const [inline]

Compute the barycentric coordinates of a point from its initial position.

Definition at line 656 of file DistanceGridCollisionModel.h.

References initP0, and invDP.

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection().

FFDDistanceGridCollisionModel::DeformedCube::Plane sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::computePlane ( int  c00,
int  c10,
int  c01,
int  c11 
)

Compute a plane equation given 4 corners.

Definition at line 590 of file DistanceGridCollisionModel.cpp.

References corners, and cross().

Referenced by updateFaces().

GCoord sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::deform ( const GCoord &  b  )  const [inline]

Compute the deformed position of a point from its barycentric coordinates.

Definition at line 670 of file DistanceGridCollisionModel.h.

References C000, corners, Dx, Dxy, Dxyz, Dxz, Dy, Dyz, and Dz.

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection(), and updatePoints().

GCoord sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::deformDir ( const GCoord &  b,
const GCoord &  dir 
) const [inline]

deform a direction relative to a point in barycentric coordinates

Definition at line 681 of file DistanceGridCollisionModel.h.

References Dx, Dxy, Dxyz, Dxz, Dy, Dyz, and Dz.

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection().

GCoord sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::initpos ( const GCoord &  b  )  const [inline]

Compute the initial position of a point from its barycentric coordinates.

Definition at line 663 of file DistanceGridCollisionModel.h.

References initDP, and initP0.

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection().

static GSReal sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::interp ( GSReal  coef,
GSReal  a,
GSReal  b 
) [inline, static]

Definition at line 675 of file DistanceGridCollisionModel.h.

Mat<3,3,double> sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::Jdeform ( const GCoord &  b  )  const [inline]

Get the local jacobian matrix of the deformation.

Definition at line 694 of file DistanceGridCollisionModel.h.

References Dx, Dxy, Dxyz, Dxz, Dy, Dyz, and Dz.

Referenced by undeformDir().

GCoord sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::undeform0 ( const GCoord &  p  )  const [inline]

Compute an initial estimate to the barycentric coordinate of a point given its deformed position.

Definition at line 710 of file DistanceGridCollisionModel.h.

References faces.

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection().

GCoord sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::undeformDir ( const GCoord &  b,
const GCoord &  dir 
) const [inline]

Undeform a direction relative to a point in barycentric coordinates.

Definition at line 722 of file DistanceGridCollisionModel.h.

References sofa::defaulttype::Mat< L, C, real >::invert(), and Jdeform().

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection().

void sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::updateDeform (  ) 

Update the deformation precomputed values.

Definition at line 553 of file DistanceGridCollisionModel.cpp.

References C000, C001, C010, C011, C100, C101, C110, C111, corners, Dx, Dxy, Dxyz, Dxz, Dy, Dyz, and Dz.

Referenced by sofa::component::collision::FFDDistanceGridCollisionModel::updateGrid().

void sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::updateFaces (  ) 

Update the face planes if not done yet (i.e.

Update the face planes position if not done yet (i.e. if facesUpdated==false).

if facesUpdated==false)

Definition at line 579 of file DistanceGridCollisionModel.cpp.

References C000, C001, C010, C011, C100, C101, C110, C111, computePlane(), faces, facesUpdated, FX0, FX1, FY0, FY1, FZ0, and FZ1.

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection().

void sofa::component::collision::FFDDistanceGridCollisionModel::DeformedCube::updatePoints (  ) 

Update the deformedPoints position if not done yet (i.e. if pointsUpdated==false).

Definition at line 565 of file DistanceGridCollisionModel.cpp.

References deform(), deformedPoints, points, and pointsUpdated.

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection().


Field Documentation

Dx = -C000+C100.

Definition at line 637 of file DistanceGridCollisionModel.h.

Referenced by deform(), deformDir(), Jdeform(), and updateDeform().

Dxy = C000-C100-C010+C110 = C110-C010-Dx.

Definition at line 640 of file DistanceGridCollisionModel.h.

Referenced by deform(), deformDir(), Jdeform(), and updateDeform().

Dxyz = - C000 + C100 + C010 - C110 + C001 - C101 - C011 + C111 = C001 - C101 - C011 + C111 - Dxy.

Definition at line 643 of file DistanceGridCollisionModel.h.

Referenced by deform(), deformDir(), Jdeform(), and updateDeform().

Dxz = C000-C100-C001+C101 = C101-C001-Dx.

Definition at line 641 of file DistanceGridCollisionModel.h.

Referenced by deform(), deformDir(), Jdeform(), and updateDeform().

Dy = -C000+C010.

Definition at line 638 of file DistanceGridCollisionModel.h.

Referenced by deform(), deformDir(), Jdeform(), and updateDeform().

Dyz = C000-C010-C001+C011 = C011-C001-Dy.

Definition at line 642 of file DistanceGridCollisionModel.h.

Referenced by deform(), deformDir(), Jdeform(), and updateDeform().

Dx = -C000+C001.

Definition at line 639 of file DistanceGridCollisionModel.h.

Referenced by deform(), deformDir(), Jdeform(), and updateDeform().

Index of the corresponding element in the topology.

Definition at line 606 of file DistanceGridCollisionModel.h.

Referenced by sofa::component::collision::FFDDistanceGridCollisionModel::updateGrid().

planes corresponding to the six faces (FX0,FX1,FY0,FY1,FZ0,FZ1)

Definition at line 624 of file DistanceGridCollisionModel.h.

Referenced by undeform0(), and updateFaces().

true the faces plane vector has been updated with the latest positions

Definition at line 653 of file DistanceGridCollisionModel.h.

Referenced by sofa::component::collision::FFDDistanceGridCollisionModel::draw(), updateFaces(), and sofa::component::collision::FFDDistanceGridCollisionModel::updateGrid().

Definition at line 604 of file DistanceGridCollisionModel.h.

Definition at line 613 of file DistanceGridCollisionModel.h.

Referenced by initpos().

Definition at line 613 of file DistanceGridCollisionModel.h.

Referenced by baryCoords(), and initpos().

Initial corners position.

Definition at line 613 of file DistanceGridCollisionModel.h.

Referenced by baryCoords(), and sofa::component::collision::DiscreteIntersection::computeIntersection().

barycentric coordinates of included points

Definition at line 612 of file DistanceGridCollisionModel.h.

Referenced by sofa::component::collision::DiscreteIntersection::computeIntersection(), and updatePoints().

true the deformedPoints vector has been updated with the latest positions

Definition at line 651 of file DistanceGridCollisionModel.h.

Referenced by sofa::component::collision::FFDDistanceGridCollisionModel::draw(), sofa::component::collision::FFDDistanceGridCollisionModel::updateGrid(), and updatePoints().


The documentation for this class was generated from the following files:

Generated on Sun Nov 23 04:17:28 2008 for Sofa by  doxygen 1.5.7.1