Recast Navigation
Navigation-mesh Toolset for Games
RecastArea.cpp File Reference
#include "Recast.h"
#include "RecastAlloc.h"
#include "RecastAssert.h"
#include <string.h>

Functions

static void insertSort (unsigned char *data, const int dataLength)
 Sorts the given data in-place using insertion sort. More...
 
static bool pointInPoly (int numVerts, const float *verts, const float *point)
 Checks if a point is contained within a polygon. More...
 
bool rcErodeWalkableArea (rcContext *context, const int erosionRadius, rcCompactHeightfield &compactHeightfield)
 Erodes the walkable area within the heightfield by the specified radius. More...
 
bool rcMedianFilterWalkableArea (rcContext *context, rcCompactHeightfield &compactHeightfield)
 Applies a median filter to walkable area types (based on area id), removing noise. More...
 
void rcMarkBoxArea (rcContext *context, const float *boxMinBounds, const float *boxMaxBounds, unsigned char areaId, rcCompactHeightfield &compactHeightfield)
 Applies an area id to all spans within the specified bounding box. More...
 
void rcMarkConvexPolyArea (rcContext *context, const float *verts, const int numVerts, const float minY, const float maxY, unsigned char areaId, rcCompactHeightfield &compactHeightfield)
 Applies the area id to the all spans within the specified convex polygon. More...
 
static void rcVsafeNormalize (float *v)
 Normalizes the vector if the length is greater than zero. More...
 
int rcOffsetPoly (const float *verts, const int numVerts, const float offset, float *outVerts, const int maxOutVerts)
 Expands a convex polygon along its vertex normals by the given offset amount. More...
 
void rcMarkCylinderArea (rcContext *context, const float *position, const float radius, const float height, unsigned char areaId, rcCompactHeightfield &compactHeightfield)
 Applies the area id to all spans within the specified y-axis-aligned cylinder. More...
 

Variables

static const float EPSILON = 1e-6f
 

Function Documentation

◆ insertSort()

static void insertSort ( unsigned char *  data,
const int  dataLength 
)
static

Sorts the given data in-place using insertion sort.

Parameters
dataThe data to sort
dataLengthThe number of elements in data

◆ pointInPoly()

static bool pointInPoly ( int  numVerts,
const float *  verts,
const float *  point 
)
static

Checks if a point is contained within a polygon.

Parameters
[in]numVertsNumber of vertices in the polygon
[in]vertsThe polygon vertices
[in]pointThe point to check
Returns
true if the point lies within the polygon, false otherwise.

◆ rcVsafeNormalize()

static void rcVsafeNormalize ( float *  v)
static

Normalizes the vector if the length is greater than zero.

If the magnitude is zero, the vector is unchanged.

Parameters
[in,out]vThe vector to normalize. [(x, y, z)]

Variable Documentation

◆ EPSILON

const float EPSILON = 1e-6f
static