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
.
396 float bmin[3], bmax[3];
399 for (
int i = 1; i < nverts; ++i)
401 rcVmin(bmin, &verts[i*3]);
402 rcVmax(bmax, &verts[i*3]);
407 int minx = (int)((bmin[0]-chf.
bmin[0])/chf.
cs);
408 int miny = (int)((bmin[1]-chf.
bmin[1])/chf.
ch);
409 int minz = (int)((bmin[2]-chf.
bmin[2])/chf.
cs);
410 int maxx = (int)((bmax[0]-chf.
bmin[0])/chf.
cs);
411 int maxy = (int)((bmax[1]-chf.
bmin[1])/chf.
ch);
412 int maxz = (int)((bmax[2]-chf.
bmin[2])/chf.
cs);
414 if (maxx < 0)
return;
415 if (minx >= chf.
width)
return;
416 if (maxz < 0)
return;
417 if (minz >= chf.
height)
return;
419 if (minx < 0) minx = 0;
421 if (minz < 0) minz = 0;
426 for (
int z = minz;
z <= maxz; ++
z)
428 for (
int x = minx;
x <= maxx; ++
x)
436 if ((
int)s.
y >= miny && (int)s.
y <= maxy)
439 p[0] = chf.
bmin[0] + (
x+0.5f)*chf.
cs;
441 p[2] = chf.
bmin[2] + (
z+0.5f)*chf.
cs;
445 chf.
areas[i] = areaId;
int height
The height of the heightfield. (Along the z-axis in cell units.)
Definition: Recast.h:308
#define rcAssert
Definition: RecastAssert.h:30
Represents a span of unobstructed space within a compact heightfield.
Definition: Recast.h:295
rcCompactCell * cells
Array of cells. [Size: width*height].
Definition: Recast.h:319
unsigned short y
The lower extent of the span. (Measured from the heightfield's base.)
Definition: Recast.h:297
rcCompactSpan * spans
Array of spans. [Size: spanCount].
Definition: Recast.h:320
unsigned int index
Index to the first span in the column.
Definition: Recast.h:290
void rcVmin(float *mn, const float *v)
Definition: Recast.h:657
Provides information on the content of a cell column in a compact heightfield.
Definition: Recast.h:288
unsigned int count
Number of spans in the column.
Definition: Recast.h:291
static int pointInPoly(int nvert, const float *verts, const float *p)
Definition: RecastArea.cpp:366
G3D::int16 z
Definition: Vector3int16.h:46
unsigned char * areas
Array containing area id data. [Size: spanCount].
Definition: Recast.h:322
int width
The width of the heightfield. (Along the x-axis in cell units.)
Definition: Recast.h:307
void rcVcopy(float *dest, const float *v)
Definition: Recast.h:677
void startTimer(const rcTimerLabel label)
Definition: Recast.h:131
float cs
The size of each cell. (On the xz-plane.)
Definition: Recast.h:317
float ch
The height of each cell. (The minimum increment along the y-axis.)
Definition: Recast.h:318
static const unsigned char RC_NULL_AREA
Definition: Recast.h:538
G3D::int16 x
Definition: Vector2int16.h:37
void stopTimer(const rcTimerLabel label)
Definition: Recast.h:135
The time to mark a convex polygon area. (See: rcMarkConvexPolyArea)
Definition: Recast.h:71
void rcVmax(float *mx, const float *v)
Definition: Recast.h:667
float bmin[3]
The minimum bounds in world space. [(x, y, z)].
Definition: Recast.h:315