Recast Navigation
Navigation-mesh Toolset for Games
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)
 

Function Documentation

◆ dtCalcPolyCenter()

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]

◆ dtClosestHeightPointTriangle()

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.

◆ dtClosestPtPointTriangle()

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)]

◆ dtDistancePtPolyEdgesSqr()

bool dtDistancePtPolyEdgesSqr ( const float *  pt,
const float *  verts,
const int  nverts,
float *  ed,
float *  et 
)

◆ dtDistancePtSegSqr2D()

float dtDistancePtSegSqr2D ( const float *  pt,
const float *  p,
const float *  q,
float &  t 
)

◆ dtIntersectSegmentPoly2D()

bool dtIntersectSegmentPoly2D ( const float *  p0,
const float *  p1,
const float *  verts,
int  nverts,
float &  tmin,
float &  tmax,
int &  segMin,
int &  segMax 
)

◆ dtIntersectSegSeg2D()

bool dtIntersectSegSeg2D ( const float *  ap,
const float *  aq,
const float *  bp,
const float *  bq,
float &  s,
float &  t 
)

◆ dtOverlapPolyPoly2D()

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.

◆ dtPointInPolygon()

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.

◆ dtRandomPointInConvexPoly()

void dtRandomPointInConvexPoly ( const float *  pts,
const int  npts,
float *  areas,
const float  s,
const float  t,
float *  out 
)

◆ overlapRange()

bool overlapRange ( const float  amin,
const float  amax,
const float  bmin,
const float  bmax,
const float  eps 
)
inline

◆ projectPoly()

static void projectPoly ( const float *  axis,
const float *  poly,
const int  npoly,
float &  rmin,
float &  rmax 
)
static

◆ vperpXZ()

float vperpXZ ( const float *  a,
const float *  b 
)
inline