A* Pathfinding Project  4.1.2
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
GraphUpdateShape Class Reference

Defines a shape for a Pathfinding.GraphUpdateObject. More...

Detailed Description

Defines a shape for a Pathfinding.GraphUpdateObject.

The shape consists of a number of points which it can either calculate the convex hull of or use as a polygon directly.

A shape is essentially a 2D shape however it can be rotated arbitrarily. When a matrix and a list of points is specified in the constructor the matrix decides what direction is the 'up' direction. When checking if a point is contained in the shape, the point will be projected down on a plane where the 'up' direction is the normal and then it will check if the shape contains the point.

See Also
Pathfinding.GraphUpdateObject.shape

Public Member Functions

 GraphUpdateShape ()
 
 GraphUpdateShape (Vector3[] points, bool convex, Matrix4x4 matrix, float minimumHeight)
 Construct a shape.
 
bool Contains (GraphNode node)
 
bool Contains (Vector3 point)
 
Bounds GetBounds ()
 World space bounding box of this shape.
 

Static Public Member Functions

static Bounds GetBounds (Vector3[] points, Matrix4x4 matrix, float minimumHeight)
 

Public Attributes

float minimumHeight
 

Properties

bool convex [get, set]
 Sets if the convex hull of the points should be calculated.
 
Vector3[] points [get, set]
 Gets or sets the points of the polygon in the shape.
 

Private Member Functions

void CalculateConvexHull ()
 

Static Private Member Functions

static Bounds GetBounds (Vector3[] points, Vector3 right, Vector3 up, Vector3 forward, Vector3 origin, float minimumHeight)
 

Private Attributes

bool _convex
 
Vector3[] _convexPoints
 
Vector3[] _points
 
Vector3 forward = Vector3.forward
 
Vector3 origin
 
Vector3 right = Vector3.right
 
Vector3 up = Vector3.up
 

Constructor & Destructor Documentation

GraphUpdateShape ( Vector3[]  points,
bool  convex,
Matrix4x4  matrix,
float  minimumHeight 
)

Construct a shape.

Parameters
pointsContour of the shape in local space with respect to the matrix (i.e the shape should be in the XZ plane, the Y coordinate will only affect the bounds)
convexIf true, the convex hull of the points will be calculated.
See Also
convex
Parameters
matrixlocal to world space matrix for the points. The matrix determines the up direction of the shape.
minimumHeightIf the points would be in the XZ plane only, the shape would not have a height and then it might not include any points inside it (as testing for inclusion is done in 3D space when updating graphs). This ensures that the shape has at least the minimum height (in the up direction that the matrix specifies).

Member Function Documentation

void CalculateConvexHull ( )
private
bool Contains ( GraphNode  node)
bool Contains ( Vector3  point)
Bounds GetBounds ( )

World space bounding box of this shape.

static Bounds GetBounds ( Vector3[]  points,
Matrix4x4  matrix,
float  minimumHeight 
)
static
static Bounds GetBounds ( Vector3[]  points,
Vector3  right,
Vector3  up,
Vector3  forward,
Vector3  origin,
float  minimumHeight 
)
staticprivate

Member Data Documentation

bool _convex
private
Vector3 [] _convexPoints
private
Vector3 [] _points
private
Vector3 forward = Vector3.forward
private
float minimumHeight
Vector3 origin
private
Vector3 right = Vector3.right
private
Vector3 up = Vector3.up
private

Property Documentation

bool convex
getset

Sets if the convex hull of the points should be calculated.

Convex hulls are faster but non-convex hulls can be used to specify more complicated shapes.

Vector3 [] points
getset

Gets or sets the points of the polygon in the shape.

These points should be specified in clockwise order. Will automatically calculate the convex hull if convex is set to true


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