DI-Guy SDK Documentation  13.2
diguyRegion Class Reference

A two-and-a-half-dimensional surface that represents either a navigation mesh or an area that's been painted by hand with the crowd painter. More...

#include <diguyRegion.h>

Public Member Functions

Query Functions
const char * get_name ()
 Returns the name of the region. More...
 
int is_point_in_region (diguySubregionMask subregion_mask, float x, float y, float z)
 Returns 1 if a point is approximately inside the region. More...
 
int get_point_in_region (diguySubregionIndex subregion_index, float *res_x, float *res_y, float *res_z)
 Returns a random x, y, z point in the region specified. More...
 
int get_point_in_region_near_point (diguySubregionIndex subregion_index, float seed_x, float seed_y, float seed_z, float radius, float *res_x, float *res_y, float *res_z)
 Returns a random x, y, z point, near the seed location, in the subregion specified. More...
 
int get_nearest_point_in_region (diguySubregionMask subregion_mask, float seed_x, float seed_y, float seed_z, float *res_x, float *res_y, float *res_z)
 Returns the nearest point in the region near the seed location, in the subregion(s) specified. More...
 
int get_nearest_reachable_point (diguySubregionMask subregion_mask, float seed_x, float seed_y, float seed_z, float *res_x, float *res_y, float *res_z)
 Returns the nearest reachable point to the seed location, inside the subregion(s) specified by the mask. More...
 
int get_num_rows ()
 Returns: the number of rows in the region. More...
 
int get_num_columns ()
 Returns: the number of columns in the region. More...
 
float get_resolution ()
 Returns: the resolution of the region in meters per point. More...
 
float get_random_factor ()
 This function returns a random factor between 0 and 1 computed for this region. More...
 
Editing Functions
int shrink ()
 Shrinks the region's bounds to just the area with tagged data in it. More...
 
int clear_region ()
 Erases all region data and then shrinks the region. More...
 
int clear_subregion (diguySubregionIndex subregion_index)
 Erases all subregion data and then shrinks the region. More...
 
int resample_mesh (float resolution)
 Resamples the mesh and sets the resolution of the mesh to the new resolution. More...
 
int paint (diguySubregionIndex subregion_index, float x, float y, float z, float radius, int force_visual_update=0)
 This function adds to the specified subregion with a spherical brush centered at the specified point and with the specified radius. More...
 
int paint_rectangle (diguySubregionIndex subregion_index, float min_x, float min_y, float min_z, float max_x, float max_y, float max_z, int force_visual_update=0)
 This function adds to the specified subregion with a rectangular brush stretching from the min point to the max point specified. More...
 
int erase (diguySubregionIndex subregion_index, float x, float y, float z, float radius, int force_visual_update=0)
 This function removes from the specified subregion with a spherical brush centered at the specified point and with the specified radius. More...
 
int erase_rectangle (diguySubregionIndex subregion_index, float min_x, float min_y, float min_z, float max_x, float max_y, float max_z, int force_visual_update=0)
 This function removes from the specified subregion with a rectangular brush stretching from min point to the max point specified. More...
 
int generate_navmesh (float min_x, float min_y, float min_z, float max_x, float max_y, float max_z)
 This function attempts to grow the region to encompass the min and max points specified as well as determine the reachability of all of those points at once. More...
 

Private Functions

The functions and variables past this point are for internal use only.

No external access to them is expected or necessary.

bdiNavMeshRegionInterfacem_scripted_object
 A pointer to internal data. More...
 
float m_random_factor
 
class bdiNavMeshRegionInterface
 
class bdiNavMeshRegion
 
bdiNavMeshRegionInterfaceget_scripted_object ()
 
 diguyRegion (bdiNavMeshRegionInterface *scripted_object)
 A private constructor. More...
 
 ~diguyRegion ()
 A private destructor. More...
 

Detailed Description

A two-and-a-half-dimensional surface that represents either a navigation mesh or an area that's been painted by hand with the crowd painter.

Regions can be layered on top of each other. Different colors can be assigned to a region. See DI-Guy user guides for more info.

Constructor & Destructor Documentation

diguyRegion::diguyRegion ( bdiNavMeshRegionInterface scripted_object)
private

A private constructor.

diguyRegion::~diguyRegion ( )
private

A private destructor.

Member Function Documentation

const char* diguyRegion::get_name ( )

Returns the name of the region.

This pointer will never be NULL.

Returns:

name of the region

Callable From:

  • C++
  • Script
int diguyRegion::is_point_in_region ( diguySubregionMask  subregion_mask,
float  x,
float  y,
float  z 
)

Returns 1 if a point is approximately inside the region.

Supports multiple subregions via or'ing masks together.

Use the base mask (DIGUY_SUBREGION_MASK_BASE) to test against the base of the region.

Returns:

1 if the point is in the region, 0 if not

Callable From:

  • C++
  • Script
int diguyRegion::get_point_in_region ( diguySubregionIndex  subregion_index,
float *  res_x,
float *  res_y,
float *  res_z 
)

Returns a random x, y, z point in the region specified.

This function takes a region index (e.g. DIGUY_SUBREGION_BASE).

Parameters
subregion_indexsubregion in which to find the point
res_x,res_y,res_zreturn point

Returns:

0 if a point was successfully generated, -1 on failure

Callable From:

  • C++
  • Script
int diguyRegion::get_point_in_region_near_point ( diguySubregionIndex  subregion_index,
float  seed_x,
float  seed_y,
float  seed_z,
float  radius,
float *  res_x,
float *  res_y,
float *  res_z 
)

Returns a random x, y, z point, near the seed location, in the subregion specified.

Parameters
subregion_indexsubregion in which to find the point
seed_x,seed_y,seed_zlocation to use as the seed point
radiusradius around the seed point within which the result point should be located
res_x,res_y,res_zreturn point a Returns:

0 if a point was successfully generated, -1 on failure

Callable From:

  • C++
  • Script
int diguyRegion::get_nearest_point_in_region ( diguySubregionMask  subregion_mask,
float  seed_x,
float  seed_y,
float  seed_z,
float *  res_x,
float *  res_y,
float *  res_z 
)

Returns the nearest point in the region near the seed location, in the subregion(s) specified.

Parameters
subregion_masksubregion(s) to search
seed_x,seed_y,seed_zlocation to use as the search seed point
res_x,res_y,res_zreturn point

Returns:

0 if a point was successfully generated, -1 on failure

Callable From:

  • C++
  • Script
int diguyRegion::get_nearest_reachable_point ( diguySubregionMask  subregion_mask,
float  seed_x,
float  seed_y,
float  seed_z,
float *  res_x,
float *  res_y,
float *  res_z 
)

Returns the nearest reachable point to the seed location, inside the subregion(s) specified by the mask.

Determining reachability involves guaranteeing that there is a contiguous section of the base region between the seed point and the resulting point.

Parameters
subregion_maskthe subregion(s) to search
seed_x,seed_y,seed_zthe location to use as the search seed point
res_x,res_y,res_zreturn point

Returns:

0 if a point was successfully found, -1 on failure

Callable From:

  • C++
  • Script
int diguyRegion::get_num_rows ( )

Returns: the number of rows in the region.

Callable From:

  • C++
  • Script
int diguyRegion::get_num_columns ( )

Returns: the number of columns in the region.

Callable From:

  • C++
  • Script
float diguyRegion::get_resolution ( )

Returns: the resolution of the region in meters per point.

Callable From:

  • C++
  • Script
float diguyRegion::get_random_factor ( )

This function returns a random factor between 0 and 1 computed for this region.

This number can be used, for example, to modify colors or depths of region visuals.

The number will remain the same for the lifetime of the region.

Returns:

a random factor between 0 and 1

Callable From:

  • C++
  • Script
int diguyRegion::shrink ( )

Shrinks the region's bounds to just the area with tagged data in it.

Can help conserve memory. Currently always returns 0.

Callable From:

  • C++
  • Script
int diguyRegion::clear_region ( )

Erases all region data and then shrinks the region.

Callable From:

  • C++
  • Script
int diguyRegion::clear_subregion ( diguySubregionIndex  subregion_index)

Erases all subregion data and then shrinks the region.

Callable From:

  • C++
  • Script
int diguyRegion::resample_mesh ( float  resolution)

Resamples the mesh and sets the resolution of the mesh to the new resolution.

Note that the resampled data is currently rough and will probably need to be touched up by hand. The system is currently limited to creating meshes with a resolution of 0.25 meters per point.

Callable From:

  • C++
  • Script
int diguyRegion::paint ( diguySubregionIndex  subregion_index,
float  x,
float  y,
float  z,
float  radius,
int  force_visual_update = 0 
)

This function adds to the specified subregion with a spherical brush centered at the specified point and with the specified radius.

If you are doing a number of edits to the mesh at once, it's preferable to wait until the last one before setting force_visual_update to 1.

Callable From:

  • C++
  • Script
int diguyRegion::paint_rectangle ( diguySubregionIndex  subregion_index,
float  min_x,
float  min_y,
float  min_z,
float  max_x,
float  max_y,
float  max_z,
int  force_visual_update = 0 
)

This function adds to the specified subregion with a rectangular brush stretching from the min point to the max point specified.

If you are doing a number of edits to the mesh at once, it's preferable to wait until the last one before setting force_visual_update to 1.

Callable From:

  • C++
  • Script
int diguyRegion::erase ( diguySubregionIndex  subregion_index,
float  x,
float  y,
float  z,
float  radius,
int  force_visual_update = 0 
)

This function removes from the specified subregion with a spherical brush centered at the specified point and with the specified radius.

If you are doing a number of edits to the mesh at once, it's preferable to wait until the last one before setting force_visual_update to 1.

Returns:

1 if any points were erased, 0 if not

Callable From:

  • C++
  • Script
int diguyRegion::erase_rectangle ( diguySubregionIndex  subregion_index,
float  min_x,
float  min_y,
float  min_z,
float  max_x,
float  max_y,
float  max_z,
int  force_visual_update = 0 
)

This function removes from the specified subregion with a rectangular brush stretching from min point to the max point specified.

If you are doing a number of edits to the mesh at once, it's preferable to wait until the last one before setting force_visual_update to 1.

Returns:

1 if any points were erased, 0 if not

Callable From:

  • C++
  • Script
int diguyRegion::generate_navmesh ( float  min_x,
float  min_y,
float  min_z,
float  max_x,
float  max_y,
float  max_z 
)

This function attempts to grow the region to encompass the min and max points specified as well as determine the reachability of all of those points at once.

**

Note
the navmesh reachability algorithm is not perfect and the results will probably need to be touched up by hand.

Callable From:

  • C++
  • Script
bdiNavMeshRegionInterface* diguyRegion::get_scripted_object ( )
inline

Friends And Related Function Documentation

friend class bdiNavMeshRegionInterface
friend
friend class bdiNavMeshRegion
friend

Member Data Documentation

bdiNavMeshRegionInterface* diguyRegion::m_scripted_object
private

A pointer to internal data.

float diguyRegion::m_random_factor
private

The documentation for this class was generated from the following file: