C# Class Box2D.Collision.Shapes.PolygonShape

A convex polygon shape. Polygons have a maximum number of vertices equal to _maxPolygonVertices. In most cases you should not need many vertices for a convex polygon.
Inheritance: Shape
Show file Open project: gerich-home/box2dnet Class Usage Examples

Public Methods

Method Description
CentroidToOut ( Transform xf, Vec2 result ) : Vec2

Get the centroid and apply the supplied transform.

Clone ( ) : Shape
ComputeAABB ( AABB aabb, Transform xf, int childIndex ) : void
ComputeCentroidToOut ( Vec2 vs, int count, Vec2 result ) : void
ComputeMass ( MassData massData, float density ) : void
GetCentroid ( Transform xf ) : Vec2

Get the centroid and apply the supplied transform.

GetVertex ( int index ) : Vec2

Get a vertex by index.

PolygonShape ( ) : System
Raycast ( RayCastOutput output, RayCastInput input, Transform xf, int childIndex ) : bool
Set ( Vec2 vertices, int count ) : void

Create a convex hull from the given array of points. The count must be in the range [3, Settings.maxPolygonVertices].

Set ( Vec2 verts, int num, Vec2Array vecPool, IntArray intPool ) : void

Create a convex hull from the given array of points. The count must be in the range [3, Settings.maxPolygonVertices]. This method takes an arraypool for pooling

SetAsBox ( float hx, float hy ) : void

Build vertices to represent an axis-aligned box.

SetAsBox ( float hx, float hy, Vec2 center, float angle ) : void

Build vertices to represent an oriented box.

SetAsEdge ( Vec2 v1, Vec2 v2 ) : void

Set this as a single edge.

TestPoint ( Transform xf, Vec2 p ) : bool
Validate ( ) : bool

Validate convexity. This is a very time consuming operation.

Method Details

CentroidToOut() public method

Get the centroid and apply the supplied transform.
public CentroidToOut ( Transform xf, Vec2 result ) : Vec2
xf Box2D.Common.Transform
result Box2D.Common.Vec2
return Box2D.Common.Vec2

Clone() public method

public Clone ( ) : Shape
return Shape

ComputeAABB() public method

public ComputeAABB ( AABB aabb, Transform xf, int childIndex ) : void
aabb AABB
xf Box2D.Common.Transform
childIndex int
return void

ComputeCentroidToOut() public method

public ComputeCentroidToOut ( Vec2 vs, int count, Vec2 result ) : void
vs Box2D.Common.Vec2
count int
result Box2D.Common.Vec2
return void

ComputeMass() public method

public ComputeMass ( MassData massData, float density ) : void
massData MassData
density float
return void

GetCentroid() public method

Get the centroid and apply the supplied transform.
public GetCentroid ( Transform xf ) : Vec2
xf Box2D.Common.Transform
return Box2D.Common.Vec2

GetVertex() public method

Get a vertex by index.
public GetVertex ( int index ) : Vec2
index int
return Box2D.Common.Vec2

PolygonShape() public method

public PolygonShape ( ) : System
return System

Raycast() public method

public Raycast ( RayCastOutput output, RayCastInput input, Transform xf, int childIndex ) : bool
output RayCastOutput
input RayCastInput
xf Box2D.Common.Transform
childIndex int
return bool

Set() public method

Create a convex hull from the given array of points. The count must be in the range [3, Settings.maxPolygonVertices].
public Set ( Vec2 vertices, int count ) : void
vertices Box2D.Common.Vec2
count int
return void

Set() public method

Create a convex hull from the given array of points. The count must be in the range [3, Settings.maxPolygonVertices]. This method takes an arraypool for pooling
public Set ( Vec2 verts, int num, Vec2Array vecPool, IntArray intPool ) : void
verts Box2D.Common.Vec2
num int
vecPool Box2D.Pooling.Arrays.Vec2Array
intPool Box2D.Pooling.Arrays.IntArray
return void

SetAsBox() public method

Build vertices to represent an axis-aligned box.
public SetAsBox ( float hx, float hy ) : void
hx float the half-width.
hy float the half-height.
return void

SetAsBox() public method

Build vertices to represent an oriented box.
public SetAsBox ( float hx, float hy, Vec2 center, float angle ) : void
hx float the half-width.
hy float the half-height.
center Box2D.Common.Vec2 the center of the box in local coordinates.
angle float the rotation of the box in local coordinates.
return void

SetAsEdge() public method

Set this as a single edge.
public SetAsEdge ( Vec2 v1, Vec2 v2 ) : void
v1 Box2D.Common.Vec2
v2 Box2D.Common.Vec2
return void

TestPoint() public method

public TestPoint ( Transform xf, Vec2 p ) : bool
xf Box2D.Common.Transform
p Box2D.Common.Vec2
return bool

Validate() public method

Validate convexity. This is a very time consuming operation.
public Validate ( ) : bool
return bool