UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Recast.h File Reference

Go to the source code of this file.

Classes

class  rcContext
 
struct  rcBorderSize
 Specifies the size of borders around the heightfield. More...
 
struct  rcConfig
 
struct  rcSpanData
 
struct  rcSpanCache
 
struct  rcSpan
 
struct  rcSpanPool
 
struct  rcRowExt
 
struct  rcEdgeHit
 
struct  rcTempSpan
 
struct  rcHeightfield
 
struct  rcCompactCell
 Provides information on the content of a cell column in a compact heightfield. More...
 
struct  rcCompactSpan
 Represents a span of unobstructed space within a compact heightfield. More...
 
struct  rcCompactHeightfield
 
struct  rcHeightfieldLayer
 
struct  rcHeightfieldLayerSet
 
struct  rcContour
 Represents a simple, non-overlapping contour in field space. More...
 
struct  rcContourSet
 
struct  rcPolyMesh
 
struct  rcPolyMeshDetail
 

Macros

#define EPIC_ADDITION_USE_NEW_RECAST_RASTERIZER   1
 

Typedefs

typedef unsigned int rcSpanUInt
 

Enumerations

enum  rcLogCategory { RC_LOG_PROGRESS = 1 , RC_LOG_WARNING , RC_LOG_ERROR }
 
enum  rcTimerLabel {
  RC_TIMER_TOTAL , RC_TIMER_TEMP , RC_TIMER_RASTERIZE_TRIANGLES , RC_TIMER_BUILD_COMPACTHEIGHTFIELD ,
  RC_TIMER_BUILD_CONTOURS , RC_TIMER_BUILD_CONTOURS_TRACE , RC_TIMER_BUILD_CONTOURS_SIMPLIFY , RC_TIMER_BUILD_CLUSTERS ,
  RC_TIMER_FILTER_BORDER , RC_TIMER_FILTER_WALKABLE , RC_TIMER_MEDIAN_AREA , RC_TIMER_FILTER_LOW_OBSTACLES ,
  RC_TIMER_BUILD_POLYMESH , RC_TIMER_MERGE_POLYMESH , RC_TIMER_ERODE_AREA , RC_TIMER_MARK_BOX_AREA ,
  RC_TIMER_MARK_CYLINDER_AREA , RC_TIMER_MARK_CONVEXPOLY_AREA , RC_TIMER_BUILD_DISTANCEFIELD , RC_TIMER_BUILD_DISTANCEFIELD_DIST ,
  RC_TIMER_BUILD_DISTANCEFIELD_BLUR , RC_TIMER_BUILD_REGIONS , RC_TIMER_BUILD_REGIONS_WATERSHED , RC_TIMER_BUILD_REGIONS_EXPAND ,
  RC_TIMER_BUILD_REGIONS_FLOOD , RC_TIMER_BUILD_REGIONS_FILTER , RC_TIMER_BUILD_LAYERS , RC_TIMER_BUILD_POLYMESHDETAIL ,
  RC_TIMER_MERGE_POLYMESHDETAIL , RC_MAX_TIMERS
}
 
enum  rcRegionPartitioning { RC_REGION_MONOTONE , RC_REGION_WATERSHED , RC_REGION_CHUNKY }
 
enum  rcBuildContoursFlags { RC_CONTOUR_TESS_WALL_EDGES = 0x01 , RC_CONTOUR_TESS_AREA_EDGES = 0x02 }
 
enum  rcFilterLowAreaFlags { RC_LOW_FILTER_SEED_SPANS = 0x01 , RC_LOW_FILTER_POST_PROCESS = 0x02 }
 
enum  rcRasterizationFlags { RC_PROJECT_TO_BOTTOM = 1 << 0 , RC_RASTERIZE_AS_FILLED_CONVEX = 1 << 1 }
 
enum  rcNeighborSlopeFilterMode { RC_SLOPE_FILTER_RECAST , RC_SLOPE_FILTER_NONE , RC_SLOPE_FILTER_USE_HEIGHT_FROM_WALKABLE_SLOPE }
 

Functions

float rcSin (float x)
 
double rcSin (double x)
 
float rcCos (float x)
 
double rcCos (double x)
 
float rcFloor (float x)
 
double rcFloor (double x)
 
float rcCeil (float x)
 
double rcCeil (double x)
 
float rcAbs (float x)
 
double rcAbs (double x)
 
NAVMESH_API DECLARE_LOG_CATEGORY_EXTERN (LogRecast, Log, All)
 
Allocation Functions

Functions used to allocate and de-allocate Recast objects.

See also
rcAllocSetCustom
NAVMESH_API rcHeightfieldrcAllocHeightfield ()
 
NAVMESH_API void rcFreeHeightField (rcHeightfield *hf)
 
NAVMESH_API rcCompactHeightfieldrcAllocCompactHeightfield ()
 
NAVMESH_API void rcFreeCompactHeightfield (rcCompactHeightfield *chf)
 
NAVMESH_API rcHeightfieldLayerSetrcAllocHeightfieldLayerSet ()
 
NAVMESH_API void rcFreeHeightfieldLayerSet (rcHeightfieldLayerSet *lset)
 
NAVMESH_API rcContourSetrcAllocContourSet ()
 
NAVMESH_API void rcFreeContourSet (rcContourSet *cset)
 
NAVMESH_API rcPolyMeshrcAllocPolyMesh ()
 
NAVMESH_API void rcFreePolyMesh (rcPolyMesh *pmesh)
 
NAVMESH_API rcPolyMeshDetailrcAllocPolyMeshDetail ()
 
NAVMESH_API void rcFreePolyMeshDetail (rcPolyMeshDetail *dmesh)
 
General helper functions
template<class T >
void rcSwap (T &a, T &b)
 
template<class T >
rcMin (T a, T b)
 
rcReal rcMin (rcReal a, rcReal b)
 When used with a mixture of rcReal and other types (in practice floats and doubles mixed here) this overridden function will be preferred by the compiler.
 
template<class T >
rcMax (T a, T b)
 
rcReal rcMax (rcReal a, rcReal b)
 When used with a mixture of rcReal and other types (in practice floats and doubles mixed here) this overridden function will be preferred by the compiler.
 
template<class T >
rcAbs (T a)
 
template<class T >
rcSqr (T a)
 
template<class T >
rcClamp (T v, T mn, T mx)
 
rcReal rcClamp (rcReal v, rcReal mn, rcReal mx)
 When used with a mixture of rcReal and other types (in practice floats and doubles mixed here) this overridden function will be preferred by the compiler.
 
rcReal rcSqrt (rcReal x)
 
Vector helper functions.
void rcVcross (rcReal *dest, const rcReal *v1, const rcReal *v2)
 
rcReal rcVdot (const rcReal *v1, const rcReal *v2)
 
void rcVmad (rcReal *dest, const rcReal *v1, const rcReal *v2, const rcReal s)
 
void rcVadd (rcReal *dest, const rcReal *v1, const rcReal *v2)
 
void rcVsub (rcReal *dest, const rcReal *v1, const rcReal *v2)
 
void rcVmin (rcReal *mn, const rcReal *v)
 
void rcVmax (rcReal *mx, const rcReal *v)
 
void rcVcopy (rcReal *dest, const rcReal *v)
 
rcReal rcVdist (const rcReal *v1, const rcReal *v2)
 
rcReal rcVdistSqr (const rcReal *v1, const rcReal *v2)
 
void rcVnormalize (rcReal *v)
 
NAVMESH_API void rcCalcTriNormals (const rcReal *verts, const int nv, const int *tris, const int nt, rcReal *norms)
 
Heightfield Functions
See also
rcHeightfield
NAVMESH_API void rcCalcBounds (const rcReal *verts, int nv, rcReal *bmin, rcReal *bmax)
 
NAVMESH_API void rcCalcGridSize (const rcReal *bmin, const rcReal *bmax, rcReal cs, int *w, int *h)
 
NAVMESH_API bool rcCreateHeightfield (rcContext *ctx, rcHeightfield &hf, int width, int height, const rcReal *bmin, const rcReal *bmax, rcReal cs, rcReal ch, bool bAllocateTempSpanColumns=false)
 
NAVMESH_API void rcResetHeightfield (rcHeightfield &hf)
 
NAVMESH_API void rcMarkWalkableTriangles (rcContext *ctx, const rcReal walkableSlopeAngle, const rcReal *verts, int nv, const int *tris, int nt, unsigned char *areas)
 
NAVMESH_API void rcMarkWalkableTrianglesCos (rcContext *ctx, const rcReal walkableSlopeCos, const rcReal *verts, int nv, const int *tris, int nt, unsigned char *areas)
 
NAVMESH_API void rcClearUnwalkableTriangles (rcContext *ctx, const rcReal walkableSlopeAngle, const rcReal *verts, int nv, const int *tris, int nt, unsigned char *areas)
 
NAVMESH_API void rcAddSpan (rcContext *ctx, rcHeightfield &hf, const int x, const int y, const unsigned short smin, const unsigned short smax, const unsigned char area, const int flagMergeThr)
 
NAVMESH_API void rcAddSpans (rcContext *ctx, rcHeightfield &hf, const int flagMergeThr, const rcSpanCache *cachedSpans, const int nspans)
 
NAVMESH_API int rcCountSpans (rcContext *ctx, rcHeightfield &hf)
 
NAVMESH_API void rcCacheSpans (rcContext *ctx, rcHeightfield &hf, rcSpanCache *cachedSpans)
 
NAVMESH_API void rcRasterizeTriangle (rcContext *ctx, const rcReal *v0, const rcReal *v1, const rcReal *v2, const unsigned char area, rcHeightfield &solid, const int flagMergeThr=1, const int rasterizationFlags=0, const int *rasterizationMasks=nullptr)
 
NAVMESH_API void rcRasterizeTriangles (rcContext *ctx, const rcReal *verts, const int nv, const int *tris, const unsigned char *areas, const int nt, rcHeightfield &solid, const int flagMergeThr=1, const int rasterizationFlags=0, const int *rasterizationMasks=nullptr, const rcReal *vertsbmin=nullptr, const rcReal *vertsbmax=nullptr)
 
NAVMESH_API void rcRasterizeTriangles (rcContext *ctx, const rcReal *verts, const int nv, const unsigned short *tris, const unsigned char *areas, const int nt, rcHeightfield &solid, const int flagMergeThr=1, const int rasterizationFlags=0, const int *rasterizationMasks=nullptr, const rcReal *vertsbmin=nullptr, const rcReal *vertsbmax=nullptr)
 
NAVMESH_API void rcRasterizeTriangles (rcContext *ctx, const rcReal *verts, const unsigned char *areas, const int nt, rcHeightfield &solid, const int flagMergeThr=1, const int rasterizationFlags=0, const int *rasterizationMasks=nullptr, const rcReal *vertsbmin=nullptr, const rcReal *vertsbmax=nullptr)
 
NAVMESH_API void rcFilterLowHangingWalkableObstacles (rcContext *ctx, const int walkableClimb, rcHeightfield &solid)
 
NAVMESH_API void rcFilterLedgeSpans (rcContext *ctx, const int walkableHeight, const int walkableClimb, const rcNeighborSlopeFilterMode neighborSlopeFilterMode, const rcReal maxStepFromWalkableSlope, const rcReal ch, const int yStart, const int maxYProcess, rcHeightfield &solid)
 
NAVMESH_API void rcFilterLedgeSpans (rcContext *ctx, const int walkableHeight, const int walkableClimb, const rcNeighborSlopeFilterMode neighborSlopeFilterMode, const rcReal maxStepFromWalkableSlope, const rcReal ch, rcHeightfield &solid)
 
NAVMESH_API void rcFilterWalkableLowHeightSpans (rcContext *ctx, int walkableHeight, rcHeightfield &solid)
 
NAVMESH_API void rcFilterWalkableLowHeightSpansSequences (rcContext *ctx, int walkableHeight, rcHeightfield &solid)
 
NAVMESH_API int rcGetHeightFieldSpanCount (rcContext *ctx, rcHeightfield &hf)
 
Compact Heightfield Functions
NAVMESH_API bool rcBuildCompactHeightfield (rcContext *ctx, const int walkableHeight, const int walkableClimb, rcHeightfield &hf, rcCompactHeightfield &chf)
 
NAVMESH_API bool rcErodeWalkableArea (rcContext *ctx, int radius, rcCompactHeightfield &chf)
 
NAVMESH_API bool rcErodeWalkableAndLowAreas (rcContext *ctx, int radius, unsigned int height, unsigned char areaId, unsigned char filterFlags, rcCompactHeightfield &chf)
 
NAVMESH_API bool rcMedianFilterWalkableArea (rcContext *ctx, rcCompactHeightfield &chf)
 
NAVMESH_API bool rcMarkLowAreas (rcContext *ctx, unsigned int height, unsigned char areaId, rcCompactHeightfield &chf)
 
NAVMESH_API void rcMarkBoxArea (rcContext *ctx, const rcReal *bmin, const rcReal *bmax, unsigned char areaId, rcCompactHeightfield &chf)
 
NAVMESH_API void rcMarkConvexPolyArea (rcContext *ctx, const rcReal *verts, const int nverts, const rcReal hmin, const rcReal hmax, unsigned char areaId, rcCompactHeightfield &chf)
 
NAVMESH_API int rcOffsetPoly (const rcReal *verts, const int nverts, const rcReal offset, rcReal *outVerts, const int maxOutVerts)
 
NAVMESH_API void rcMarkCylinderArea (rcContext *ctx, const rcReal *pos, const rcReal r, const rcReal h, unsigned char areaId, rcCompactHeightfield &chf)
 
NAVMESH_API void rcReplaceBoxArea (rcContext *ctx, const rcReal *bmin, const rcReal *bmax, unsigned char areaId, unsigned char filterAreaId, rcCompactHeightfield &chf)
 
NAVMESH_API void rcReplaceConvexPolyArea (rcContext *ctx, const rcReal *verts, const int nverts, const rcReal hmin, const rcReal hmax, unsigned char areaId, unsigned char filterAreaId, rcCompactHeightfield &chf)
 
NAVMESH_API void rcReplaceCylinderArea (rcContext *ctx, const rcReal *pos, const rcReal r, const rcReal h, unsigned char areaId, unsigned char filterAreaId, rcCompactHeightfield &chf)
 
NAVMESH_API bool rcBuildDistanceField (rcContext *ctx, rcCompactHeightfield &chf)
 
NAVMESH_API bool rcBuildRegions (rcContext *ctx, rcCompactHeightfield &chf, const int borderSize, const int minRegionArea, const int mergeRegionArea)
 
NAVMESH_API bool rcBuildRegionsMonotone (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, const int minRegionArea, const int mergeRegionArea)
 
NAVMESH_API bool rcBuildRegionsChunky (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, const int minRegionArea, const int mergeRegionArea, const int chunkSize)
 
void rcSetCon (rcCompactSpan &s, int dir, int i)
 
int rcGetCon (const rcCompactSpan &s, int dir)
 
int rcGetDirOffsetX (int dir)
 
int rcGetDirOffsetY (int dir)
 
Layer, Contour, Polymesh, and Detail Mesh Functions
NAVMESH_API bool rcBuildHeightfieldLayers (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, const int walkableHeight, rcHeightfieldLayerSet &lset)
 
NAVMESH_API bool rcBuildHeightfieldLayersMonotone (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, const int walkableHeight, rcHeightfieldLayerSet &lset)
 
NAVMESH_API bool rcBuildHeightfieldLayersChunky (rcContext *ctx, rcCompactHeightfield &chf, const rcBorderSize borderSize, const int walkableHeight, const int chunkSize, rcHeightfieldLayerSet &lset)
 
NAVMESH_API bool rcBuildContours (rcContext *ctx, rcCompactHeightfield &chf, const rcReal maxError, const int maxEdgeLen, rcContourSet &cset, const int flags=RC_CONTOUR_TESS_WALL_EDGES)
 
NAVMESH_API bool rcBuildPolyMesh (rcContext *ctx, rcContourSet &cset, const int nvp, rcPolyMesh &mesh)
 
NAVMESH_API bool rcMergePolyMeshes (rcContext *ctx, rcPolyMesh **meshes, const int nmeshes, rcPolyMesh &mesh)
 
NAVMESH_API bool rcBuildPolyMeshDetail (rcContext *ctx, const rcPolyMesh &mesh, const rcCompactHeightfield &chf, const rcReal sampleDist, const rcReal sampleMaxError, rcPolyMeshDetail &dmesh)
 
NAVMESH_API bool rcCopyPolyMesh (rcContext *ctx, const rcPolyMesh &src, rcPolyMesh &dst)
 
NAVMESH_API bool rcMergePolyMeshDetails (rcContext *ctx, rcPolyMeshDetail **meshes, const int nmeshes, rcPolyMeshDetail &mesh)
 

Macro Definition Documentation

◆ EPIC_ADDITION_USE_NEW_RECAST_RASTERIZER

#define EPIC_ADDITION_USE_NEW_RECAST_RASTERIZER   1

Typedef Documentation

◆ rcSpanUInt

Enumeration Type Documentation

◆ rcBuildContoursFlags

Contour build flags.

See also
rcBuildContours
Enumerator
RC_CONTOUR_TESS_WALL_EDGES 

Tessellate solid (impassable) edges during contour simplification.

RC_CONTOUR_TESS_AREA_EDGES 

Tessellate edges between areas during contour simplification.

◆ rcFilterLowAreaFlags

Enumerator
RC_LOW_FILTER_SEED_SPANS 

initial seeding on spans

RC_LOW_FILTER_POST_PROCESS 

additional filtering at the end

◆ rcLogCategory

Recast log categories.

See also
rcContext
Enumerator
RC_LOG_PROGRESS 

A progress log entry.

RC_LOG_WARNING 

A warning log entry.

RC_LOG_ERROR 

An error log entry.

◆ rcNeighborSlopeFilterMode

Enumerator
RC_SLOPE_FILTER_RECAST 
RC_SLOPE_FILTER_NONE 
RC_SLOPE_FILTER_USE_HEIGHT_FROM_WALKABLE_SLOPE 

◆ rcRasterizationFlags

Enumerator
RC_PROJECT_TO_BOTTOM 

Will create spans from the triangle surface to the bottom of the heightfield.

RC_RASTERIZE_AS_FILLED_CONVEX 

Will rasterize all the triangles of a list into a single span for each (x,z) and then add all those spans in the heightfield //UE.

◆ rcRegionPartitioning

Region partitioning methods

See also
rcConfig
Enumerator
RC_REGION_MONOTONE 

monotone partitioning

RC_REGION_WATERSHED 

watershed partitioning

RC_REGION_CHUNKY 

monotone partitioning on small chunks

◆ rcTimerLabel

Recast performance timer categories.

See also
rcContext
Enumerator
RC_TIMER_TOTAL 

The user defined total time of the build.

RC_TIMER_TEMP 

A user defined build time.

RC_TIMER_RASTERIZE_TRIANGLES 

The time to rasterize the triangles. (See: rcRasterizeTriangle)

RC_TIMER_BUILD_COMPACTHEIGHTFIELD 

The time to build the compact heightfield. (See: rcBuildCompactHeightfield)

RC_TIMER_BUILD_CONTOURS 

The total time to build the contours. (See: rcBuildContours)

RC_TIMER_BUILD_CONTOURS_TRACE 

The time to trace the boundaries of the contours. (See: rcBuildContours)

RC_TIMER_BUILD_CONTOURS_SIMPLIFY 

The time to simplify the contours. (See: rcBuildContours)

RC_TIMER_BUILD_CLUSTERS 

The time to link clusters from contours. (See: rcBuildClusters)

RC_TIMER_FILTER_BORDER 

The time to filter ledge spans. (See: rcFilterLedgeSpans)

RC_TIMER_FILTER_WALKABLE 

The time to filter low height spans. (See: rcFilterWalkableLowHeightSpans)

RC_TIMER_MEDIAN_AREA 

The time to apply the median filter. (See: rcMedianFilterWalkableArea)

RC_TIMER_FILTER_LOW_OBSTACLES 

The time to filter low obstacles. (See: rcFilterLowHangingWalkableObstacles)

RC_TIMER_BUILD_POLYMESH 

The time to build the polygon mesh. (See: rcBuildPolyMesh)

RC_TIMER_MERGE_POLYMESH 

The time to merge polygon meshes. (See: rcMergePolyMeshes)

RC_TIMER_ERODE_AREA 

The time to erode the walkable area. (See: rcErodeWalkableArea)

RC_TIMER_MARK_BOX_AREA 

The time to mark a box area. (See: rcMarkBoxArea)

RC_TIMER_MARK_CYLINDER_AREA 

The time to mark a cylinder area. (See: rcMarkCylinderArea)

RC_TIMER_MARK_CONVEXPOLY_AREA 

The time to mark a convex polygon area. (See: rcMarkConvexPolyArea)

RC_TIMER_BUILD_DISTANCEFIELD 

The total time to build the distance field. (See: rcBuildDistanceField)

RC_TIMER_BUILD_DISTANCEFIELD_DIST 

The time to build the distances of the distance field. (See: rcBuildDistanceField)

RC_TIMER_BUILD_DISTANCEFIELD_BLUR 

The time to blur the distance field. (See: rcBuildDistanceField)

RC_TIMER_BUILD_REGIONS 

The total time to build the regions. (See: rcBuildRegions, rcBuildRegionsMonotone)

RC_TIMER_BUILD_REGIONS_WATERSHED 

The total time to apply the watershed algorithm. (See: rcBuildRegions)

RC_TIMER_BUILD_REGIONS_EXPAND 

The time to expand regions while applying the watershed algorithm. (See: rcBuildRegions)

RC_TIMER_BUILD_REGIONS_FLOOD 

The time to flood regions while applying the watershed algorithm. (See: rcBuildRegions)

RC_TIMER_BUILD_REGIONS_FILTER 

The time to filter out small regions. (See: rcBuildRegions, rcBuildRegionsMonotone)

RC_TIMER_BUILD_LAYERS 

The time to build heightfield layers. (See: rcBuildHeightfieldLayers)

RC_TIMER_BUILD_POLYMESHDETAIL 

The time to build the polygon mesh detail. (See: rcBuildPolyMeshDetail)

RC_TIMER_MERGE_POLYMESHDETAIL 

The time to merge polygon mesh details. (See: rcMergePolyMeshDetails)

RC_MAX_TIMERS 

The maximum number of timers. (Used for iterating timers.)

Function Documentation

◆ DECLARE_LOG_CATEGORY_EXTERN()

NAVMESH_API DECLARE_LOG_CATEGORY_EXTERN ( LogRecast  ,
Log  ,
All   
)

◆ rcAbs() [1/3]

double rcAbs ( double  x)
inline

◆ rcAbs() [2/3]

float rcAbs ( float  x)
inline

◆ rcAbs() [3/3]

template<class T >
T rcAbs ( a)
inline

Returns the absolute value.

Parameters
[in]aThe value.
Returns
The absolute value of the specified value.

◆ rcAddSpan()

NAVMESH_API void rcAddSpan ( rcContext ctx,
rcHeightfield hf,
const int  x,
const int  y,
const unsigned short  smin,
const unsigned short  smax,
const unsigned char  area,
const int  flagMergeThr 
)

Adds a span to the specified heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in,out]hfAn initialized heightfield.
[in]xThe width index where the span is to be added. [Limits: 0 <= value < rcHeightfield::width]
[in]yThe height index where the span is to be added. [Limits: 0 <= value < rcHeightfield::height]
[in]sminThe minimum height of the span. [Limit: < smax] [Units: vx]
[in]smaxThe maximum height of the span. [Limit: <= RC_SPAN_MAX_HEIGHT] [Units: vx]
[in]areaThe area id of the span. [Limit: <= RC_WALKABLE_AREA)
[in]flagMergeThrThe merge theshold. [Limit: >= 0] [Units: vx]

◆ rcAddSpans()

NAVMESH_API void rcAddSpans ( rcContext ctx,
rcHeightfield hf,
const int  flagMergeThr,
const rcSpanCache cachedSpans,
const int  nspans 
)

◆ rcAllocCompactHeightfield()

NAVMESH_API rcCompactHeightfield * rcAllocCompactHeightfield ( )

Allocates a compact heightfield object using the Recast allocator.

Returns
A compact heightfield that is ready for initialization, or null on failure.
See also
rcBuildCompactHeightfield, rcFreeCompactHeightfield

◆ rcAllocContourSet()

NAVMESH_API rcContourSet * rcAllocContourSet ( )

Allocates a contour set object using the Recast allocator.

Returns
A contour set that is ready for initialization, or null on failure.
See also
rcBuildContours, rcFreeContourSet

◆ rcAllocHeightfield()

NAVMESH_API rcHeightfield * rcAllocHeightfield ( )

Allocates a heightfield object using the Recast allocator.

Returns
A heightfield that is ready for initialization, or null on failure.
See also
rcCreateHeightfield, rcFreeHeightField

◆ rcAllocHeightfieldLayerSet()

NAVMESH_API rcHeightfieldLayerSet * rcAllocHeightfieldLayerSet ( )

Allocates a heightfield layer set using the Recast allocator.

Returns
A heightfield layer set that is ready for initialization, or null on failure.
See also
rcBuildHeightfieldLayers, rcFreeHeightfieldLayerSet

◆ rcAllocPolyMesh()

NAVMESH_API rcPolyMesh * rcAllocPolyMesh ( )

Allocates a polygon mesh object using the Recast allocator.

Returns
A polygon mesh that is ready for initialization, or null on failure.
See also
rcBuildPolyMesh, rcFreePolyMesh

◆ rcAllocPolyMeshDetail()

NAVMESH_API rcPolyMeshDetail * rcAllocPolyMeshDetail ( )

Allocates a detail mesh object using the Recast allocator.

Returns
A detail mesh that is ready for initialization, or null on failure.
See also
rcBuildPolyMeshDetail, rcFreePolyMeshDetail

◆ rcBuildCompactHeightfield()

NAVMESH_API bool rcBuildCompactHeightfield ( rcContext ctx,
const int  walkableHeight,
const int  walkableClimb,
rcHeightfield hf,
rcCompactHeightfield chf 
)

Builds a compact heightfield representing open space, from a heightfield representing solid space.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableHeightMinimum floor to 'ceiling' height that will still allow the floor area to be considered walkable. [Limit: >= 3] [Units: vx]
[in]walkableClimbMaximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]
[in]hfThe heightfield to be compacted.
[out]chfThe resulting compact heightfield. (Must be pre-allocated.)
Returns
True if the operation completed successfully.

This is just the beginning of the process of fully building a compact heightfield. Various filters may be applied applied, then the distance field and regions built. E.g: rcBuildDistanceField and rcBuildRegions

See the rcConfig documentation for more information on the configuration parameters.

See also
rcAllocCompactHeightfield, rcHeightfield, rcCompactHeightfield, rcConfig

◆ rcBuildContours()

NAVMESH_API bool rcBuildContours ( rcContext ctx,
rcCompactHeightfield chf,
const rcReal  maxError,
const int  maxEdgeLen,
rcContourSet cset,
const int  buildFlags 
)

Builds a contour set from the region outlines in the provided compact heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]chfA fully built compact heightfield.
[in]maxErrorThe maximum distance a simplfied contour's border edges should deviate the original raw contour. [Limit: >=0] [Units: wu]
[in]maxEdgeLenThe maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]
[out]csetThe resulting contour set. (Must be pre-allocated.)
[in]buildFlagsThe build flags. (See: rcBuildContoursFlags)
Returns
True if the operation completed successfully.

The raw contours will match the region outlines exactly. The maxError and maxEdgeLen parameters control how closely the simplified contours will match the raw contours.

Simplified contours are generated such that the vertices for portals between areas match up. (They are considered mandatory vertices.)

Setting maxEdgeLength to zero will disable the edge length feature.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcAllocContourSet, rcCompactHeightfield, rcContourSet, rcConfig

◆ rcBuildDistanceField()

NAVMESH_API bool rcBuildDistanceField ( rcContext ctx,
rcCompactHeightfield chf 
)

Builds the distance field for the specified compact heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in,out]chfA populated compact heightfield.
Returns
True if the operation completed successfully.

This is usually the second to the last step in creating a fully built compact heightfield. This step is required before regions are built using rcBuildRegions or rcBuildRegionsMonotone.

After this step, the distance data is available via the rcCompactHeightfield::maxDistance and rcCompactHeightfield::dist fields.

See also
rcCompactHeightfield, rcBuildRegions, rcBuildRegionsMonotone

◆ rcBuildHeightfieldLayers()

NAVMESH_API bool rcBuildHeightfieldLayers ( rcContext ctx,
rcCompactHeightfield chf,
const rcBorderSize  borderSize,
const int  walkableHeight,
rcHeightfieldLayerSet lset 
)

Builds a layer set from the specified compact heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]chfA fully built compact heightfield.
[in]borderSizeThe size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
[in]walkableHeightMinimum floor to 'ceiling' height that will still allow the floor area to be considered walkable. [Limit: >= 3] [Units: vx]
[out]lsetThe resulting layer set. (Must be pre-allocated.)
Returns
True if the operation completed successfully.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcAllocHeightfieldLayerSet, rcCompactHeightfield, rcHeightfieldLayerSet, rcConfig

◆ rcBuildHeightfieldLayersChunky()

NAVMESH_API bool rcBuildHeightfieldLayersChunky ( rcContext ctx,
rcCompactHeightfield chf,
const rcBorderSize  borderSize,
const int  walkableHeight,
const int  chunkSize,
rcHeightfieldLayerSet lset 
)

Builds a layer set from the specified compact heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]chfA fully built compact heightfield.
[in]borderSizeThe size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
[in]walkableHeightMinimum floor to 'ceiling' height that will still allow the floor area to be considered walkable. [Limit: >= 3] [Units: vx]
[in]chunkSizeSize of chunk of subregion [Units: vx]
[out]lsetThe resulting layer set. (Must be pre-allocated.)
Returns
True if the operation completed successfully.

◆ rcBuildHeightfieldLayersMonotone()

NAVMESH_API bool rcBuildHeightfieldLayersMonotone ( rcContext ctx,
rcCompactHeightfield chf,
const rcBorderSize  borderSize,
const int  walkableHeight,
rcHeightfieldLayerSet lset 
)

Builds a layer set from the specified compact heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]chfA fully built compact heightfield.
[in]borderSizeThe size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
[in]walkableHeightMinimum floor to 'ceiling' height that will still allow the floor area to be considered walkable. [Limit: >= 3] [Units: vx]
[out]lsetThe resulting layer set. (Must be pre-allocated.)
Returns
True if the operation completed successfully.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcAllocHeightfieldLayerSet, rcCompactHeightfield, rcHeightfieldLayerSet, rcConfig

◆ rcBuildPolyMesh()

NAVMESH_API bool rcBuildPolyMesh ( rcContext ctx,
rcContourSet cset,
const int  nvp,
rcPolyMesh mesh 
)

Builds a polygon mesh from the provided contours.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]csetA fully built contour set.
[in]nvpThe maximum number of vertices allowed for polygons generated during the contour to polygon conversion process. [Limit: >= 3]
[out]meshThe resulting polygon mesh. (Must be re-allocated.)
Returns
True if the operation completed successfully.
Note
If the mesh data is to be used to construct a Detour navigation mesh, then the upper limit must be retricted to <= DT_VERTS_PER_POLYGON.
See also
rcAllocPolyMesh, rcContourSet, rcPolyMesh, rcConfig

◆ rcBuildPolyMeshDetail()

NAVMESH_API bool rcBuildPolyMeshDetail ( rcContext ctx,
const rcPolyMesh mesh,
const rcCompactHeightfield chf,
const rcReal  sampleDist,
const rcReal  sampleMaxError,
rcPolyMeshDetail dmesh 
)

Builds a detail mesh from the provided polygon mesh.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]meshA fully built polygon mesh.
[in]chfThe compact heightfield used to build the polygon mesh.
[in]sampleDistSets the distance to use when samping the heightfield. [Limit: >=0] [Units: wu]
[in]sampleMaxErrorThe maximum distance the detail mesh surface should deviate from heightfield data. [Limit: >=0] [Units: wu]
[out]dmeshThe resulting detail mesh. (Must be pre-allocated.)
Returns
True if the operation completed successfully.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcAllocPolyMeshDetail, rcPolyMesh, rcCompactHeightfield, rcPolyMeshDetail, rcConfig

◆ rcBuildRegions()

NAVMESH_API bool rcBuildRegions ( rcContext ctx,
rcCompactHeightfield chf,
const int  borderSize,
const int  minRegionArea,
const int  mergeRegionArea 
)

Builds region data for the heightfield using watershed partitioning.

Parameters
[in,out]ctxThe build context to use during the operation.
[in,out]chfA populated compact heightfield.
[in]borderSizeThe size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
[in]minRegionAreaThe minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx].
[in]mergeRegionAreaAny regions with a span count smaller than this value will, if possible, be merged with larger regions. [Limit: >=0] [Units: vx]
Returns
True if the operation completed successfully.

◆ rcBuildRegionsChunky()

NAVMESH_API bool rcBuildRegionsChunky ( rcContext ctx,
rcCompactHeightfield chf,
const rcBorderSize  borderSize,
const int  minRegionArea,
const int  mergeRegionArea,
const int  chunkSize 
)

Builds region data for the heightfield using simple monotone partitioning.

Parameters
[in,out]ctxThe build context to use during the operation.
[in,out]chfA populated compact heightfield.
[in]borderSizeThe size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
[in]minRegionAreaThe minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx].
[in]mergeRegionAreaAny regions with a span count smaller than this value will, if possible, be merged with larger regions. [Limit: >=0] [Units: vx]
[in]chunkSizeSize of subregion [Units: vx]
Returns
True if the operation completed successfully.

◆ rcBuildRegionsMonotone()

NAVMESH_API bool rcBuildRegionsMonotone ( rcContext ctx,
rcCompactHeightfield chf,
const rcBorderSize  borderSize,
const int  minRegionArea,
const int  mergeRegionArea 
)

Builds region data for the heightfield using simple monotone partitioning.

Parameters
[in,out]ctxThe build context to use during the operation.
[in,out]chfA populated compact heightfield.
[in]borderSizeThe size of the non-navigable border around the heightfield. [Limit: >=0] [Units: vx]
[in]minRegionAreaThe minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx].
[in]mergeRegionAreaAny regions with a span count smaller than this value will, if possible, be merged with larger regions. [Limit: >=0] [Units: vx]
Returns
True if the operation completed successfully.

Non-null regions will consist of connected, non-overlapping walkable spans that form a single contour. Contours will form simple polygons.

If multiple regions form an area that is smaller than minRegionArea, then all spans will be re-assigned to the zero (null) region.

Partitioning can result in smaller than necessary regions. mergeRegionArea helps reduce unecessarily small regions.

See the rcConfig documentation for more information on the configuration parameters.

The region data will be available via the rcCompactHeightfield::maxRegions and rcCompactSpan::reg fields.

Warning
The distance field must be created using rcBuildDistanceField before attempting to build regions.
See also
rcCompactHeightfield, rcCompactSpan, rcBuildDistanceField, rcBuildRegionsMonotone, rcConfig

◆ rcCacheSpans()

NAVMESH_API void rcCacheSpans ( rcContext ctx,
rcHeightfield hf,
rcSpanCache cachedSpans 
)

◆ rcCalcBounds()

NAVMESH_API void rcCalcBounds ( const rcReal verts,
int  nv,
rcReal bmin,
rcReal bmax 
)

Calculates the bounding box of an array of vertices.

Parameters
[in]vertsAn array of vertices. [(x, y, z) * nv]
[in]nvThe number of vertices in the verts array.
[out]bminThe minimum bounds of the AABB. [(x, y, z)] [Units: wu]
[out]bmaxThe maximum bounds of the AABB. [(x, y, z)] [Units: wu]

◆ rcCalcGridSize()

NAVMESH_API void rcCalcGridSize ( const rcReal bmin,
const rcReal bmax,
rcReal  cs,
int *  w,
int *  h 
)

Calculates the grid size based on the bounding box and grid cell size.

Parameters
[in]bminThe minimum bounds of the AABB. [(x, y, z)] [Units: wu]
[in]bmaxThe maximum bounds of the AABB. [(x, y, z)] [Units: wu]
[in]csThe xz-plane cell size. [Limit: > 0] [Units: wu]
[out]wThe width along the x-axis. [Limit: >= 0] [Units: vx]
[out]hThe height along the z-axis. [Limit: >= 0] [Units: vx]

◆ rcCalcTriNormals()

NAVMESH_API void rcCalcTriNormals ( const rcReal verts,
const int  nv,
const int *  tris,
const int  nt,
rcReal norms 
)

Calculates the normals of each triangles in an array

Parameters
[in]vertsAn array of vertices. [(x, y, z) * nv]
[in]nvThe number of vertices in the verts array.
[in]trisThe triangle vertex indices. [(vertA, vertB, vertC) * nt]
[in]ntThe number of triangles.
[out]normsThe normal vector of each triangle. [(x, y, z) * nt]

◆ rcCeil() [1/2]

double rcCeil ( double  x)
inline

◆ rcCeil() [2/2]

float rcCeil ( float  x)
inline

◆ rcClamp() [1/2]

rcReal rcClamp ( rcReal  v,
rcReal  mn,
rcReal  mx 
)
inline

When used with a mixture of rcReal and other types (in practice floats and doubles mixed here) this overridden function will be preferred by the compiler.

◆ rcClamp() [2/2]

template<class T >
T rcClamp ( v,
mn,
mx 
)
inline

Clamps the value to the specified range.

Parameters
[in]vThe value to clamp.
[in]mnThe minimum permitted return value.
[in]mxThe maximum permitted return value.
Returns
The value, clamped to the specified range.

◆ rcClearUnwalkableTriangles()

NAVMESH_API void rcClearUnwalkableTriangles ( rcContext ctx,
const rcReal  walkableSlopeAngle,
const rcReal verts,
int  nv,
const int *  tris,
int  nt,
unsigned char areas 
)

Sets the area id of all triangles with a slope greater than or equal to the specified value to RC_NULL_AREA.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableSlopeAngleThe maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]
[in]vertsThe vertices. [(x, y, z) * nv]
[in]nvThe number of vertices.
[in]trisThe triangle vertex indices. [(vertA, vertB, vertC) * nt]
[in]ntThe number of triangles.
[out]areasThe triangle area ids. [Length: >= nt]

Only sets the aread id's for the unwalkable triangles. Does not alter the area id's for walkable triangles.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles

◆ rcCopyPolyMesh()

NAVMESH_API bool rcCopyPolyMesh ( rcContext ctx,
const rcPolyMesh src,
rcPolyMesh dst 
)

Copies the poly mesh data from src to dst.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]srcThe source mesh to copy from.
[out]dstThe resulting detail mesh. (Must be pre-allocated, must be empty mesh.)
Returns
True if the operation completed successfully.

◆ rcCos() [1/2]

double rcCos ( double  x)
inline

◆ rcCos() [2/2]

float rcCos ( float  x)
inline

◆ rcCountSpans()

NAVMESH_API int rcCountSpans ( rcContext ctx,
rcHeightfield hf 
)

◆ rcCreateHeightfield()

NAVMESH_API bool rcCreateHeightfield ( rcContext ctx,
rcHeightfield hf,
int  width,
int  height,
const rcReal bmin,
const rcReal bmax,
rcReal  cs,
rcReal  ch,
bool  bAllocateTempSpanColumns 
)

Initializes a new heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in,out]hfThe allocated heightfield to initialize.
[in]widthThe width of the field along the x-axis. [Limit: >= 0] [Units: vx]
[in]heightThe height of the field along the z-axis. [Limit: >= 0] [Units: vx]
[in]bminThe minimum bounds of the field's AABB. [(x, y, z)] [Units: wu]
[in]bmaxThe maximum bounds of the field's AABB. [(x, y, z)] [Units: wu]
[in]csThe xz-plane cell size to use for the field. [Limit: > 0] [Units: wu]
[in]chThe y-axis cell size to use for field. [Limit: > 0] [Units: wu]
[in]bAllocateTempSpanColumnsIndicate if we need to allocate the heightfield's tempSpanColumns.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcAllocHeightfield, rcHeightfield

◆ rcErodeWalkableAndLowAreas()

NAVMESH_API bool rcErodeWalkableAndLowAreas ( rcContext ctx,
int  radius,
unsigned int  height,
unsigned char  areaId,
unsigned char  filterFlags,
rcCompactHeightfield chf 
)

Erodes the walkable area within the heightfield by the specified radius. Additionally, it will mark all spans that are too low (rcMarkLowAreas)

Parameters
[in,out]ctxThe build context to use during the operation.
[in]radiusThe radius of erosion. [Limits: 0 < value < 255] [Units: vx]
[in]heightHeight threshold [Units: vx]
[in]areaIdThe area id to apply [Limit: <= @RC_WALKABLE_AREA]
[in]filterFlagsSee: rcFilterLowAreaFlags
[in,out]chfThe populated compact heightfield to erode.
Returns
True if the operation completed successfully.

Basically, any spans that are closer to a boundary or obstruction than the specified radius are marked as unwalkable.

This method is usually called immediately after the heightfield has been built.

See also
rcCompactHeightfield, rcBuildCompactHeightfield, rcConfig::walkableRadius

◆ rcErodeWalkableArea()

NAVMESH_API bool rcErodeWalkableArea ( rcContext ctx,
int  radius,
rcCompactHeightfield chf 
)

Erodes the walkable area within the heightfield by the specified radius.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]radiusThe radius of erosion. [Limits: 0 < value < 255] [Units: vx]
[in,out]chfThe populated compact heightfield to erode.
Returns
True if the operation completed successfully.

Basically, any spans that are closer to a boundary or obstruction than the specified radius are marked as unwalkable.

This method is usually called immediately after the heightfield has been built.

See also
rcCompactHeightfield, rcBuildCompactHeightfield, rcConfig::walkableRadius

◆ rcFilterLedgeSpans() [1/2]

NAVMESH_API void rcFilterLedgeSpans ( rcContext ctx,
const int  walkableHeight,
const int  walkableClimb,
const rcNeighborSlopeFilterMode  neighborSlopeFilterMode,
const rcReal  maxStepFromWalkableSlope,
const rcReal  ch,
const int  yStart,
const int  maxYProcess,
rcHeightfield solid 
)

Marks spans that are ledges as not-walkable, by a number of y coords at a time.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableHeightMinimum floor to 'ceiling' height that will still allow the floor area to be considered walkable. [Limit: >= 3] [Units: vx]
[in]walkableClimbMaximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]
[in]neighborSlopeFilterModeChange the way neighbors slope filtering is done. //UE
[in]maxStepFromWalkableSlopeMaximum step height in relation to cs and the walkable angle. [Limit: >= 0] [Units: wu] //UE
[in]chCell height. [Limit: >= 0] [Units: wu] //UE
[in,out]solidA fully built heightfield. (All spans have been added.)
[in]yStarty coord to start at
[in]maxYProcessMax y coords to process (yStart + maxYProcess can be more than solid.height and will be capped to solid.height)
See also
rcHeightfield, rcConfig

◆ rcFilterLedgeSpans() [2/2]

NAVMESH_API void rcFilterLedgeSpans ( rcContext ctx,
const int  walkableHeight,
const int  walkableClimb,
const rcNeighborSlopeFilterMode  neighborSlopeFilterMode,
const rcReal  maxStepFromWalkableSlope,
const rcReal  ch,
rcHeightfield solid 
)

Marks spans that are ledges as not-walkable.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableHeightMinimum floor to 'ceiling' height that will still allow the floor area to be considered walkable. [Limit: >= 3] [Units: vx]
[in]walkableClimbMaximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]
[in]neighborSlopeFilterModeChange the way neighbors slope filtering is done. //UE
[in]maxStepFromWalkableSlopeMaximum step height in relation to cs and the walkable angle. [Limit: >= 0] [Units: wu] //UE
[in]chCell height. [Limit: >= 0] [Units: wu] //UE
[in,out]solidA fully built heightfield. (All spans have been added.)

A ledge is a span with one or more neighbors whose maximum is further away than walkableClimb from the current span's maximum. This method removes the impact of the overestimation of conservative voxelization so the resulting mesh will not have regions hanging in the air over ledges.

A span is a ledge if: rcAbs(currentSpan.smax - neighborSpan.smax) > walkableClimb

See also
rcHeightfield, rcConfig

◆ rcFilterLowHangingWalkableObstacles()

NAVMESH_API void rcFilterLowHangingWalkableObstacles ( rcContext ctx,
const int  walkableClimb,
rcHeightfield solid 
)

Marks non-walkable spans as walkable if their maximum is within walkableClimp of a walkable neighbor.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableClimbMaximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]
[in,out]solidA fully built heightfield. (All spans have been added.)

Allows the formation of walkable regions that will flow over low lying objects such as curbs, and up structures such as stairways.

Two neighboring spans are walkable if: rcAbs(currentSpan.smax - neighborSpan.smax) < waklableClimb

Warning
Will override the effect of rcFilterLedgeSpans. So if both filters are used, call rcFilterLedgeSpans after calling this filter.
See also
rcHeightfield, rcConfig

◆ rcFilterWalkableLowHeightSpans()

NAVMESH_API void rcFilterWalkableLowHeightSpans ( rcContext ctx,
int  walkableHeight,
rcHeightfield solid 
)

Marks walkable spans as not walkable if the clearance above the span is less than the specified height.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableHeightMinimum floor to 'ceiling' height that will still allow the floor area to be considered walkable. [Limit: >= 3] [Units: vx]
[in,out]solidA fully built heightfield. (All spans have been added.)

For this filter, the clearance above the span is the distance from the span's maximum to the next higher span's minimum. (Same grid column.)

See also
rcHeightfield, rcConfig

◆ rcFilterWalkableLowHeightSpansSequences()

NAVMESH_API void rcFilterWalkableLowHeightSpansSequences ( rcContext ctx,
int  walkableHeight,
rcHeightfield solid 
)

◆ rcFloor() [1/2]

double rcFloor ( double  x)
inline

◆ rcFloor() [2/2]

float rcFloor ( float  x)
inline

◆ rcFreeCompactHeightfield()

NAVMESH_API void rcFreeCompactHeightfield ( rcCompactHeightfield chf)

Frees the specified compact heightfield object using the Recast allocator.

Parameters
[in]chfA compact heightfield allocated using rcAllocCompactHeightfield
See also
rcAllocCompactHeightfield

◆ rcFreeContourSet()

NAVMESH_API void rcFreeContourSet ( rcContourSet cset)

Frees the specified contour set using the Recast allocator.

Parameters
[in]csetA contour set allocated using rcAllocContourSet
See also
rcAllocContourSet

◆ rcFreeHeightField()

NAVMESH_API void rcFreeHeightField ( rcHeightfield hf)

Frees the specified heightfield object using the Recast allocator.

Parameters
[in]hfA heightfield allocated using rcAllocHeightfield
See also
rcAllocHeightfield

◆ rcFreeHeightfieldLayerSet()

NAVMESH_API void rcFreeHeightfieldLayerSet ( rcHeightfieldLayerSet lset)

Frees the specified heightfield layer set using the Recast allocator.

Parameters
[in]lsetA heightfield layer set allocated using rcAllocHeightfieldLayerSet
See also
rcAllocHeightfieldLayerSet

◆ rcFreePolyMesh()

NAVMESH_API void rcFreePolyMesh ( rcPolyMesh pmesh)

Frees the specified polygon mesh using the Recast allocator.

Parameters
[in]pmeshA polygon mesh allocated using rcAllocPolyMesh
See also
rcAllocPolyMesh

◆ rcFreePolyMeshDetail()

NAVMESH_API void rcFreePolyMeshDetail ( rcPolyMeshDetail dmesh)

Frees the specified detail mesh using the Recast allocator.

Parameters
[in]dmeshA detail mesh allocated using rcAllocPolyMeshDetail
See also
rcAllocPolyMeshDetail

◆ rcGetCon()

int rcGetCon ( const rcCompactSpan s,
int  dir 
)
inline

Gets neighbor connection data for the specified direction.

Parameters
[in]sThe span to check.
[in]dirThe direction to check. [Limits: 0 <= value < 4]
Returns
The neighbor connection data for the specified direction, or RC_NOT_CONNECTED if there is no connection.

◆ rcGetDirOffsetX()

int rcGetDirOffsetX ( int  dir)
inline

Gets the standard width (x-axis) offset for the specified direction.

Parameters
[in]dirThe direction. [Limits: 0 <= value < 4]
Returns
The width offset to apply to the current cell position to move in the direction.

◆ rcGetDirOffsetY()

int rcGetDirOffsetY ( int  dir)
inline

Gets the standard height (z-axis) offset for the specified direction.

Parameters
[in]dirThe direction. [Limits: 0 <= value < 4]
Returns
The height offset to apply to the current cell position to move in the direction.

◆ rcGetHeightFieldSpanCount()

NAVMESH_API int rcGetHeightFieldSpanCount ( rcContext ctx,
rcHeightfield hf 
)

Returns the number of spans contained in the specified heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]hfAn initialized heightfield.
Returns
The number of spans in the heightfield.

◆ rcMarkBoxArea()

NAVMESH_API void rcMarkBoxArea ( rcContext ctx,
const rcReal bmin,
const rcReal bmax,
unsigned char  areaId,
rcCompactHeightfield chf 
)

Applies an area id to all spans within the specified bounding box. (AABB)

Parameters
[in,out]ctxThe build context to use during the operation.
[in]bminThe minimum of the bounding box. [(x, y, z)]
[in]bmaxThe maximum of the bounding box. [(x, y, z)]
[in]areaIdThe area id to apply. [Limit: <= RC_WALKABLE_AREA]
[in,out]chfA populated compact heightfield.

The value of spacial parameters are in world units.

See also
rcCompactHeightfield, rcMedianFilterWalkableArea

◆ rcMarkConvexPolyArea()

NAVMESH_API void rcMarkConvexPolyArea ( rcContext ctx,
const rcReal verts,
const int  nverts,
const rcReal  hmin,
const rcReal  hmax,
unsigned char  areaId,
rcCompactHeightfield chf 
)

Applies the area id to the all spans within the specified convex polygon.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]vertsThe vertices of the polygon [Fomr: (x, y, z) * nverts]
[in]nvertsThe number of vertices in the polygon.
[in]hminThe height of the base of the polygon.
[in]hmaxThe height of the top of the polygon.
[in]areaIdThe area id to apply. [Limit: <= RC_WALKABLE_AREA]
[in,out]chfA populated compact heightfield.

The value of spacial parameters are in world units.

The y-values of the polygon vertices are ignored. So the polygon is effectively projected onto the xz-plane at hmin, then extruded to hmax.

See also
rcCompactHeightfield, rcMedianFilterWalkableArea

◆ rcMarkCylinderArea()

NAVMESH_API void rcMarkCylinderArea ( rcContext ctx,
const rcReal pos,
const rcReal  r,
const rcReal  h,
unsigned char  areaId,
rcCompactHeightfield chf 
)

Applies the area id to all spans within the specified cylinder.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]posThe center of the base of the cylinder. [Form: (x, y, z)]
[in]rThe radius of the cylinder.
[in]hThe height of the cylinder.
[in]areaIdThe area id to apply. [Limit: <= RC_WALKABLE_AREA]
[in,out]chfA populated compact heightfield.

The value of spacial parameters are in world units.

See also
rcCompactHeightfield, rcMedianFilterWalkableArea

◆ rcMarkLowAreas()

NAVMESH_API bool rcMarkLowAreas ( rcContext ctx,
unsigned int  height,
unsigned char  areaId,
rcCompactHeightfield chf 
)

Marks all spans that have insufficient free space above

Parameters
[in,out]ctxThe build context to use during the operation.
[in,out]chfA populated compact heightfield.
[in]heightHeight threshold [Units: vx]
[in]areaIdThe area id to apply [Limit: <= @RC_WALKABLE_AREA]
Returns
True if the operation completed successfully.

◆ rcMarkWalkableTriangles()

NAVMESH_API void rcMarkWalkableTriangles ( rcContext ctx,
const rcReal  walkableSlopeAngle,
const rcReal verts,
int  nv,
const int *  tris,
int  nt,
unsigned char areas 
)

Sets the area id of all triangles with a slope below the specified value to RC_WALKABLE_AREA.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableSlopeAngleThe maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]
[in]vertsThe vertices. [(x, y, z) * nv]
[in]nvThe number of vertices.
[in]trisThe triangle vertex indices. [(vertA, vertB, vertC) * nt]
[in]ntThe number of triangles.
[out]areasThe triangle area ids. [Length: >= nt]

Only sets the aread id's for the walkable triangles. Does not alter the area id's for unwalkable triangles.

See the rcConfig documentation for more information on the configuration parameters.

See also
rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles

◆ rcMarkWalkableTrianglesCos()

NAVMESH_API void rcMarkWalkableTrianglesCos ( rcContext ctx,
const rcReal  walkableSlopeCos,
const rcReal verts,
int  nv,
const int *  tris,
int  nt,
unsigned char areas 
)

Sets the area id of all triangles with a slope below the specified value to RC_WALKABLE_AREA.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]walkableSlopeCosThe cosine of maximum slope that is considered walkable. [Limits: 0 <= value < 1]
[in]vertsThe vertices. [(x, y, z) * nv]
[in]nvThe number of vertices.
[in]trisThe triangle vertex indices. [(vertA, vertB, vertC) * nt]
[in]ntThe number of triangles.
[out]areasThe triangle area ids. [Length: >= nt]

◆ rcMax() [1/2]

rcReal rcMax ( rcReal  a,
rcReal  b 
)
inline

When used with a mixture of rcReal and other types (in practice floats and doubles mixed here) this overridden function will be preferred by the compiler.

◆ rcMax() [2/2]

template<class T >
T rcMax ( a,
b 
)
inline

Returns the maximum of two values.

Parameters
[in]aValue A
[in]bValue B
Returns
The maximum of the two values.

◆ rcMedianFilterWalkableArea()

NAVMESH_API bool rcMedianFilterWalkableArea ( rcContext ctx,
rcCompactHeightfield chf 
)

Applies a median filter to walkable area types (based on area id), removing noise.

Parameters
[in,out]ctxThe build context to use during the operation.
[in,out]chfA populated compact heightfield.
Returns
True if the operation completed successfully.

This filter is usually applied after applying area id's using functions such as rcMarkBoxArea, rcMarkConvexPolyArea, and rcMarkCylinderArea.

See also
rcCompactHeightfield

◆ rcMergePolyMeshDetails()

NAVMESH_API bool rcMergePolyMeshDetails ( rcContext ctx,
rcPolyMeshDetail **  meshes,
const int  nmeshes,
rcPolyMeshDetail mesh 
)

Merges multiple detail meshes into a single detail mesh.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]meshesAn array of detail meshes to merge. [Size: nmeshes]
[in]nmeshesThe number of detail meshes in the meshes array.
[out]meshThe resulting detail mesh. (Must be pre-allocated.)
Returns
True if the operation completed successfully.
See also
rcAllocPolyMeshDetail, rcPolyMeshDetail

◆ rcMergePolyMeshes()

NAVMESH_API bool rcMergePolyMeshes ( rcContext ctx,
rcPolyMesh **  meshes,
const int  nmeshes,
rcPolyMesh mesh 
)

Merges multiple polygon meshes into a single mesh.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]meshesAn array of polygon meshes to merge. [Size: nmeshes]
[in]nmeshesThe number of polygon meshes in the meshes array.
[in]meshThe resulting polygon mesh. (Must be pre-allocated.)
Returns
True if the operation completed successfully.
See also
rcAllocPolyMesh, rcPolyMesh

◆ rcMin() [1/2]

rcReal rcMin ( rcReal  a,
rcReal  b 
)
inline

When used with a mixture of rcReal and other types (in practice floats and doubles mixed here) this overridden function will be preferred by the compiler.

◆ rcMin() [2/2]

template<class T >
T rcMin ( a,
b 
)
inline

Returns the minimum of two values.

Parameters
[in]aValue A
[in]bValue B
Returns
The minimum of the two values.

◆ rcOffsetPoly()

NAVMESH_API int rcOffsetPoly ( const rcReal verts,
const int  nverts,
const rcReal  offset,
rcReal outVerts,
const int  maxOutVerts 
)

Helper function to offset voncex polygons for rcMarkConvexPolyArea.

Parameters
[in]vertsThe vertices of the polygon [Form: (x, y, z) * nverts]
[in]nvertsThe number of vertices in the polygon.
[out]outVertsThe offset vertices (should hold up to 2 * nverts) [Form: (x, y, z) * return value]
[in]maxOutVertsThe max number of vertices that can be stored to outVerts.
Returns
Number of vertices in the offset polygon or 0 if too few vertices in outVerts.

◆ rcRasterizeTriangle()

NAVMESH_API void rcRasterizeTriangle ( rcContext ctx,
const rcReal v0,
const rcReal v1,
const rcReal v2,
const unsigned char  area,
rcHeightfield solid,
const int  flagMergeThr,
const int  rasterizationFlags,
const int *  rasterizationMasks 
)

Rasterizes a triangle into the specified heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]v0Triangle vertex 0 [(x, y, z)]
[in]v1Triangle vertex 1 [(x, y, z)]
[in]v2Triangle vertex 2 [(x, y, z)]
[in]areaThe area id of the triangle. [Limit: <= RC_WALKABLE_AREA]
[in,out]solidAn initialized heightfield.
[in]flagMergeThrThe distance where the walkable flag is favored over the non-walkable flag. [Limit: >= 0] [Units: vx]
[in]rtzFlagsFlags to change the rasterization behavior //UE
[in]rtzMasksMask for the rasterization flags [Size: hf.w*hf.h] //UE

No spans will be added if the triangle does not overlap the heightfield grid.

See also
rcHeightfield

◆ rcRasterizeTriangles() [1/3]

NAVMESH_API void rcRasterizeTriangles ( rcContext ctx,
const rcReal verts,
const int  nv,
const int *  tris,
const unsigned char areas,
const int  nt,
rcHeightfield solid,
const int  flagMergeThr,
const int  rasterizationFlags,
const int *  rasterizationMasks,
const rcReal vertsbmin,
const rcReal vertsbmax 
)

Rasterizes an indexed triangle mesh into the specified heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]vertsThe vertices. [(x, y, z) * nv]
[in]nvThe number of vertices.
[in]trisThe triangle indices. [(vertA, vertB, vertC) * nt]
[in]areasThe area id's of the triangles. [Limit: <= RC_WALKABLE_AREA] [Size: nt]
[in]ntThe number of triangles.
[in,out]solidAn initialized heightfield.
[in]flagMergeThrThe distance where the walkable flag is favored over the non-walkable flag. [Limit: >= 0] [Units: vx]
[in]rtzFlagsFlags to change the rasterization behavior //UE
[in]rtzMasksMask for the rasterization flags [Size: hf.w*hf.h] //UE
[in]vertsbminMin location of the bounding box of verts [(x, y, z)] //UE
[in]vertsbmaxMax location of the bounding box of verts [(x, y, z)] //UE

Spans will only be added for triangles that overlap the heightfield grid.

See also
rcHeightfield

◆ rcRasterizeTriangles() [2/3]

NAVMESH_API void rcRasterizeTriangles ( rcContext ctx,
const rcReal verts,
const int  nv,
const unsigned short tris,
const unsigned char areas,
const int  nt,
rcHeightfield solid,
const int  flagMergeThr,
const int  rasterizationFlags,
const int *  rasterizationMasks,
const rcReal vertsbmin,
const rcReal vertsbmax 
)

Rasterizes an indexed triangle mesh into the specified heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]vertsThe vertices. [(x, y, z) * nv]
[in]nvThe number of vertices.
[in]trisThe triangle indices. [(vertA, vertB, vertC) * nt]
[in]areasThe area id's of the triangles. [Limit: <= RC_WALKABLE_AREA] [Size: nt]
[in]ntThe number of triangles.
[in,out]solidAn initialized heightfield.
[in]flagMergeThrThe distance where the walkable flag is favored over the non-walkable flag. [Limit: >= 0] [Units: vx]
[in]rtzFlagsFlags to change the rasterization behavior //UE
[in]rtzMasksMask for the rasterization flags [Size: hf.w*hf.h] //UE
[in]vertsbminMin location of the bounding box of verts [(x, y, z)] //UE
[in]vertsbmaxMax location of the bounding box of verts [(x, y, z)] //UE

Spans will only be added for triangles that overlap the heightfield grid.

See also
rcHeightfield

◆ rcRasterizeTriangles() [3/3]

NAVMESH_API void rcRasterizeTriangles ( rcContext ctx,
const rcReal verts,
const unsigned char areas,
const int  nt,
rcHeightfield solid,
const int  flagMergeThr,
const int  rasterizationFlags,
const int *  rasterizationMasks,
const rcReal vertsbmin,
const rcReal vertsbmax 
)

Rasterizes triangles into the specified heightfield.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]vertsThe triangle vertices. [(ax, ay, az, bx, by, bz, cx, by, cx) * nt]
[in]areasThe area id's of the triangles. [Limit: <= RC_WALKABLE_AREA] [Size: nt]
[in]ntThe number of triangles.
[in,out]solidAn initialized heightfield.
[in]flagMergeThrThe distance where the walkable flag is favored over the non-walkable flag. [Limit: >= 0] [Units: vx]
[in]rtzFlagsFlags to change the rasterization behavior //UE
[in]rtzMasksMask for the rasterization flags [Size: hf.w*hf.h] //UE
[in]vertsbminMin location of the bounding box of verts [(x, y, z)] //UE
[in]vertsbmaxMax location of the bounding box of verts [(x, y, z)] //UE

Spans will only be added for triangles that overlap the heightfield grid.

See also
rcHeightfield

◆ rcReplaceBoxArea()

NAVMESH_API void rcReplaceBoxArea ( rcContext ctx,
const rcReal bmin,
const rcReal bmax,
unsigned char  areaId,
unsigned char  filterAreaId,
rcCompactHeightfield chf 
)

Replaces an area id in spans with matching filter area within the specified bounding box. (AABB)

Parameters
[in,out]ctxThe build context to use during the operation.
[in]bminThe minimum of the bounding box. [(x, y, z)]
[in]bmaxThe maximum of the bounding box. [(x, y, z)]
[in]areaIdThe area id to apply. [Limit: <= RC_WALKABLE_AREA]
[in,out]chfA populated compact heightfield.

The value of spacial parameters are in world units.

See also
rcCompactHeightfield, rcMedianFilterWalkableArea

◆ rcReplaceConvexPolyArea()

NAVMESH_API void rcReplaceConvexPolyArea ( rcContext ctx,
const rcReal verts,
const int  nverts,
const rcReal  hmin,
const rcReal  hmax,
unsigned char  areaId,
unsigned char  filterAreaId,
rcCompactHeightfield chf 
)

Replaces an area id in spans with matching filter area within the specified convex polygon.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]vertsThe vertices of the polygon [Fomr: (x, y, z) * nverts]
[in]nvertsThe number of vertices in the polygon.
[in]hminThe height of the base of the polygon.
[in]hmaxThe height of the top of the polygon.
[in]areaIdThe area id to apply. [Limit: <= RC_WALKABLE_AREA]
[in,out]chfA populated compact heightfield.

The value of spacial parameters are in world units.

The y-values of the polygon vertices are ignored. So the polygon is effectively projected onto the xz-plane at hmin, then extruded to hmax.

See also
rcCompactHeightfield, rcMedianFilterWalkableArea

◆ rcReplaceCylinderArea()

NAVMESH_API void rcReplaceCylinderArea ( rcContext ctx,
const rcReal pos,
const rcReal  r,
const rcReal  h,
unsigned char  areaId,
unsigned char  filterAreaId,
rcCompactHeightfield chf 
)

Replaces an area id in spans with matching filter area within the specified cylinder.

Parameters
[in,out]ctxThe build context to use during the operation.
[in]posThe center of the base of the cylinder. [Form: (x, y, z)]
[in]rThe radius of the cylinder.
[in]hThe height of the cylinder.
[in]areaIdThe area id to apply. [Limit: <= RC_WALKABLE_AREA]
[in,out]chfA populated compact heightfield.

The value of spacial parameters are in world units.

See also
rcCompactHeightfield, rcMedianFilterWalkableArea

◆ rcResetHeightfield()

NAVMESH_API void rcResetHeightfield ( rcHeightfield hf)

Resets all spans of heightfield.

Parameters
[in,out]hfThe heightfield to reset.
[in]bminThe minimum bounds of the field's AABB. [(x, y, z)] [Units: wu]
[in]bmaxThe maximum bounds of the field's AABB. [(x, y, z)] [Units: wu]
[in,out]hfThe heightfield toreset.

◆ rcSetCon()

void rcSetCon ( rcCompactSpan s,
int  dir,
int  i 
)
inline

Sets the neighbor connection data for the specified direction.

Parameters
[in]sThe span to update.
[in]dirThe direction to set. [Limits: 0 <= value < 4]
[in]iThe index of the neighbor span.

◆ rcSin() [1/2]

double rcSin ( double  x)
inline

◆ rcSin() [2/2]

float rcSin ( float  x)
inline

◆ rcSqr()

template<class T >
T rcSqr ( a)
inline

Returns the square of the value.

Parameters
[in]aThe value.
Returns
The square of the value.

◆ rcSqrt()

rcReal rcSqrt ( rcReal  x)

Returns the square root of the value.

Parameters
[in]xThe value.
Returns
The square root of the vlaue.

◆ rcSwap()

template<class T >
void rcSwap ( T &  a,
T &  b 
)
inline

Swaps the values of the two parameters.

Parameters
[in,out]aValue A
[in,out]bValue B

◆ rcVadd()

void rcVadd ( rcReal dest,
const rcReal v1,
const rcReal v2 
)
inline

Performs a vector addition. (v1 + v2)

Parameters
[out]destThe result vector. [(x, y, z)]
[in]v1The base vector. [(x, y, z)]
[in]v2The vector to add to v1. [(x, y, z)]

◆ rcVcopy()

void rcVcopy ( rcReal dest,
const rcReal v 
)
inline

Performs a vector copy.

Parameters
[out]destThe result. [(x, y, z)]
[in]vThe vector to copy. [(x, y, z)]

◆ rcVcross()

void rcVcross ( rcReal dest,
const rcReal v1,
const rcReal v2 
)
inline

Derives the cross product of two vectors. (v1 x v2)

Parameters
[out]destThe cross product. [(x, y, z)]
[in]v1A Vector [(x, y, z)]
[in]v2A vector [(x, y, z)]

◆ rcVdist()

rcReal rcVdist ( const rcReal v1,
const rcReal v2 
)
inline

Returns the distance between two points.

Parameters
[in]v1A point. [(x, y, z)]
[in]v2A point. [(x, y, z)]
Returns
The distance between the two points.

◆ rcVdistSqr()

rcReal rcVdistSqr ( const rcReal v1,
const rcReal v2 
)
inline

Returns the square of the distance between two points.

Parameters
[in]v1A point. [(x, y, z)]
[in]v2A point. [(x, y, z)]
Returns
The square of the distance between the two points.

◆ rcVdot()

rcReal rcVdot ( const rcReal v1,
const rcReal v2 
)
inline

Derives the dot product of two vectors. (v1 . v2)

Parameters
[in]v1A Vector [(x, y, z)]
[in]v2A vector [(x, y, z)]
Returns
The dot product.

◆ rcVmad()

void rcVmad ( rcReal dest,
const rcReal v1,
const rcReal v2,
const rcReal  s 
)
inline

Performs a scaled vector addition. (v1 + (v2 * s))

Parameters
[out]destThe result vector. [(x, y, z)]
[in]v1The base vector. [(x, y, z)]
[in]v2The vector to scale and add to v1. [(x, y, z)]
[in]sThe amount to scale v2 by before adding to v1.

◆ rcVmax()

void rcVmax ( rcReal mx,
const rcReal v 
)
inline

Selects the maximum value of each element from the specified vectors.

Parameters
[in,out]mxA vector. (Will be updated with the result.) [(x, y, z)]
[in]vA vector. [(x, y, z)]

◆ rcVmin()

void rcVmin ( rcReal mn,
const rcReal v 
)
inline

Selects the minimum value of each element from the specified vectors.

Parameters
[in,out]mnA vector. (Will be updated with the result.) [(x, y, z)]
[in]vA vector. [(x, y, z)]

◆ rcVnormalize()

void rcVnormalize ( rcReal v)
inline

Normalizes the vector.

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

◆ rcVsub()

void rcVsub ( rcReal dest,
const rcReal v1,
const rcReal v2 
)
inline

Performs a vector subtraction. (v1 - v2)

Parameters
[out]destThe result vector. [(x, y, z)]
[in]v1The base vector. [(x, y, z)]
[in]v2The vector to subtract from v1. [(x, y, z)]