chrono::collision::ChCollisionUtils Class Reference

Description

Class with some utility functions for collision detection, as static functions.

#include <ChCCollisionUtils.h>

Static Public Member Functions

static bool LineLineIntersect (Vector p1, Vector p2, Vector p3, Vector p4, Vector *pa, Vector *pb, double *mua, double *mub)
 Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4. More...
 
static double PointLineDistance (Vector p, Vector dA, Vector dB, double &mu, int &is_insegment)
 Calculate distance between a point p and a line identified with segment dA,dB. More...
 
static double PointTriangleDistance (Vector B, Vector A1, Vector A2, Vector A3, double &mu, double &mv, int &is_into, Vector &Bprojected)
 Calculate distance of a point from a triangle surface. More...
 

Member Function Documentation

◆ LineLineIntersect()

bool chrono::collision::ChCollisionUtils::LineLineIntersect ( Vector  p1,
Vector  p2,
Vector  p3,
Vector  p4,
Vector pa,
Vector pb,
double *  mua,
double *  mub 
)
static

Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4.

Calculate also the values of mua and mub where Pa = P1 + mua (P2 - P1) Pb = P3 + mub (P4 - P3) Return false if no solution exists.

◆ PointLineDistance()

double chrono::collision::ChCollisionUtils::PointLineDistance ( Vector  p,
Vector  dA,
Vector  dB,
double &  mu,
int &  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)

◆ PointTriangleDistance()

double chrono::collision::ChCollisionUtils::PointTriangleDistance ( Vector  B,
Vector  A1,
Vector  A2,
Vector  A3,
double &  mu,
double &  mv,
int &  is_into,
Vector Bprojected 
)
static

Calculate distance of a point from a triangle surface.

Also computes if projection is inside the triangle. If is_into = true, Bprojected is also computed. Returns distance (positive if 'out' side, out is where points A1 A2 A3 can be read in clockwise fashion)


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/collision/ChCCollisionUtils.h
  • /builds/uwsbel/chrono/src/chrono/collision/ChCCollisionUtils.cpp