Recast Navigation  1.0.35
DetourCommon.cpp File Reference
#include "DetourCommon.h"
#include "DetourMath.h"

Functions

void dtClosestPtPointTriangle (float *closest, const float *p, const float *a, const float *b, const float *c)
 Derives the closest point on a triangle from the specified reference point. More...
 
bool dtIntersectSegmentPoly2D (const float *p0, const float *p1, const float *verts, int nverts, float &tmin, float &tmax, int &segMin, int &segMax)
 
float dtDistancePtSegSqr2D (const float *pt, const float *p, const float *q, float &t)
 
void dtCalcPolyCenter (float *tc, const unsigned short *idx, int nidx, const float *verts)
 Derives the centroid of a convex polygon. More...
 
bool dtClosestHeightPointTriangle (const float *p, const float *a, const float *b, const float *c, float &h)
 Derives the y-axis height of the closest point on the triangle from the specified reference point. More...
 
bool dtPointInPolygon (const float *pt, const float *verts, const int nverts)
 Determines if the specified point is inside the convex polygon on the xz-plane. More...
 
bool dtDistancePtPolyEdgesSqr (const float *pt, const float *verts, const int nverts, float *ed, float *et)
 
static void projectPoly (const float *axis, const float *poly, const int npoly, float &rmin, float &rmax)
 
bool overlapRange (const float amin, const float amax, const float bmin, const float bmax, const float eps)
 
bool dtOverlapPolyPoly2D (const float *polya, const int npolya, const float *polyb, const int npolyb)
 Determines if the two convex polygons overlap on the xz-plane. More...
 
void dtRandomPointInConvexPoly (const float *pts, const int npts, float *areas, const float s, const float t, float *out)
 
float vperpXZ (const float *a, const float *b)
 
bool dtIntersectSegSeg2D (const float *ap, const float *aq, const float *bp, const float *bq, float &s, float &t)
 
bool left (const float *a, const float *b, const float *c)
 
bool cmppt (const float *a, const float *b)
 
int dtConvexhull (const float *pts, int npts, int *out)
 

Function Documentation

bool cmppt ( const float *  a,
const float *  b 
)
inline
void dtCalcPolyCenter ( float *  tc,
const unsigned short *  idx,
int  nidx,
const float *  verts 
)

Derives the centroid of a convex polygon.

Parameters
[out]tcThe centroid of the polgyon. [(x, y, z)]
[in]idxThe polygon indices. [(vertIndex) * nidx]
[in]nidxThe number of indices in the polygon. [Limit: >= 3]
[in]vertsThe polygon vertices. [(x, y, z) * vertCount]
bool dtClosestHeightPointTriangle ( const float *  p,
const float *  a,
const float *  b,
const float *  c,
float &  h 
)

Derives the y-axis height of the closest point on the triangle from the specified reference point.

Parameters
[in]pThe reference point from which to test. [(x, y, z)]
[in]aVertex A of triangle ABC. [(x, y, z)]
[in]bVertex B of triangle ABC. [(x, y, z)]
[in]cVertex C of triangle ABC. [(x, y, z)]
[out]hThe resulting height.
void dtClosestPtPointTriangle ( float *  closest,
const float *  p,
const float *  a,
const float *  b,
const float *  c 
)

Derives the closest point on a triangle from the specified reference point.

Parameters
[out]closestThe closest point on the triangle.
[in]pThe reference point from which to test. [(x, y, z)]
[in]aVertex A of triangle ABC. [(x, y, z)]
[in]bVertex B of triangle ABC. [(x, y, z)]
[in]cVertex C of triangle ABC. [(x, y, z)]
int dtConvexhull ( const float *  pts,
int  npts,
int *  out 
)
bool dtDistancePtPolyEdgesSqr ( const float *  pt,
const float *  verts,
const int  nverts,
float *  ed,
float *  et 
)
float dtDistancePtSegSqr2D ( const float *  pt,
const float *  p,
const float *  q,
float &  t 
)
bool dtIntersectSegmentPoly2D ( const float *  p0,
const float *  p1,
const float *  verts,
int  nverts,
float &  tmin,
float &  tmax,
int &  segMin,
int &  segMax 
)
bool dtIntersectSegSeg2D ( const float *  ap,
const float *  aq,
const float *  bp,
const float *  bq,
float &  s,
float &  t 
)
bool dtOverlapPolyPoly2D ( const float *  polya,
const int  npolya,
const float *  polyb,
const int  npolyb 
)

Determines if the two convex polygons overlap on the xz-plane.

All vertices are projected onto the xz-plane, so the y-values are ignored.

bool dtPointInPolygon ( const float *  pt,
const float *  verts,
const int  nverts 
)

Determines if the specified point is inside the convex polygon on the xz-plane.

All points are projected onto the xz-plane, so the y-values are ignored.

void dtRandomPointInConvexPoly ( const float *  pts,
const int  npts,
float *  areas,
const float  s,
const float  t,
float *  out 
)
bool left ( const float *  a,
const float *  b,
const float *  c 
)
inline
bool overlapRange ( const float  amin,
const float  amax,
const float  bmin,
const float  bmax,
const float  eps 
)
inline
static void projectPoly ( const float *  axis,
const float *  poly,
const int  npoly,
float &  rmin,
float &  rmax 
)
static
float vperpXZ ( const float *  a,
const float *  b 
)
inline