Chrono::Engine C++ API
Public Member Functions | Static Public Member Functions | Public Attributes
chrono::geometry::ChTriangle Class Reference

#include <ChCTriangle.h>

Inheritance diagram for chrono::geometry::ChTriangle:
Inheritance graph
[legend]
Collaboration diagram for chrono::geometry::ChTriangle:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ChTriangle (const ChVector<> &mp1, const ChVector<> &mp2, const ChVector<> &mp3)
 ChTriangle (const ChTriangle &source)
ChTriangleoperator= (const ChTriangle &source)
void Copy (const ChTriangle *source)
ChGeometryDuplicate ()
virtual int GetClassType ()
virtual void GetBoundingBox (double &xmin, double &xmax, double &ymin, double &ymax, double &zmin, double &zmax, ChMatrix33<> *Rot=NULL)
virtual ChVector Baricenter ()
virtual void CovarianceMatrix (ChMatrix33<> &C)
virtual int GetManifoldDimension ()
bool IsDegenerated ()
bool Normal (Vector &N)
ChVector GetNormal ()
double PointTriangleDistance (ChVector<> B, double &mu, double &mv, bool &is_into, ChVector<> &Bprojected)
void StreamOUT (ChStreamOutBinary &mstream)
void StreamIN (ChStreamInBinary &mstream)

Static Public Member Functions

static double PointTriangleDistance (ChVector<> B, ChVector<> &A1, ChVector<> &A2, ChVector<> &A3, double &mu, double &mv, bool &is_into, ChVector<> &Bprojected)
static double PointLineDistance (ChVector<> &p, ChVector<> &dA, ChVector<> &dB, double &mu, bool &is_insegment)

Public Attributes

ChVector p1
ChVector p2
ChVector p3

Detailed Description

A triangle. Geometric object for collisions and such.


Member Function Documentation

Vector chrono::geometry::ChTriangle::Baricenter ( ) [virtual]

Compute center of mass It should be overriden by inherited classes

Reimplemented from chrono::geometry::ChGeometry.

void chrono::geometry::ChTriangle::CovarianceMatrix ( ChMatrix33<> &  C) [virtual]

Compute the 3x3 covariance matrix (only the diagonal and upper part) It should be overriden by inherited classes

Reimplemented from chrono::geometry::ChGeometry.

void chrono::geometry::ChTriangle::GetBoundingBox ( double &  xmin,
double &  xmax,
double &  ymin,
double &  ymax,
double &  zmin,
double &  zmax,
ChMatrix33<> *  Rot = NULL 
) [virtual]

Compute bounding box. If a matrix Rot is not null, it should compute bounding box along the rotated directions represented by that transformation matrix Rot. It must be overridden by inherited classes.

Reimplemented from chrono::geometry::ChGeometry.

virtual int chrono::geometry::ChTriangle::GetClassType ( ) [virtual]

Get the class type as unique numerical ID (faster than using ChronoRTTI mechanism). Each inherited class must return an unique ID.

Reimplemented from chrono::geometry::ChGeometry.

double chrono::geometry::ChTriangle::PointLineDistance ( ChVector<> &  p,
ChVector<> &  dA,
ChVector<> &  dB,
double &  mu,
bool &  is_insegment 
) [static]

Calculate distance between a point p and a line identified with segment dA,dB. Returns distance. Also, the mu value reference tells if the nearest projection of point on line falls into segment (for mu 0...1)

Returns:
the distance
Parameters:
ppoint to be measured
dAa point on the line
dBanother point on the line
muparametric coord: if in 0..1 interval, projection is between dA and dB
is_insegmentreturns true if projected point is between dA and dB
static double chrono::geometry::ChTriangle::PointTriangleDistance ( ChVector<>  B,
ChVector<> &  A1,
ChVector<> &  A2,
ChVector<> &  A3,
double &  mu,
double &  mv,
bool &  is_into,
ChVector<> &  Bprojected 
) [static]

Given point B and a generic triangle, computes the distance from the triangle plane, returning also the projection of point on the plane and other infos

Returns:
the signed distance
Parameters:
Bpoint to be measured
A1point of triangle
A2point of triangle
A3point of triangle
mureturns U parametric coord of projection
mvreturns V parametric coord of projection
is_intoreturns true if projection falls on the triangle
Bprojectedreturns the position of the projected point
double chrono::geometry::ChTriangle::PointTriangleDistance ( ChVector<>  B,
double &  mu,
double &  mv,
bool &  is_into,
ChVector<> &  Bprojected 
)

Given point B, computes the distance from this triangle plane, returning also the projection of point on the plane and other infos

Returns:
the signed distance
Parameters:
Bpoint to be measured
mureturns U parametric coord of projection
mvreturns V parametric coord of projection
is_intoreturns true if projection falls on the triangle
Bprojectedreturns the position of the projected point