C# Class Project290.Physics.Collision.Shapes.PolygonShape

Represents a simple non-selfintersecting convex polygon. If you want to have concave polygons, you will have to use the BayazitDecomposer or the EarclipDecomposer to decompose the concave polygon into 2 or more convex polygons.
Inheritance: Shape
Mostrar archivo Open project: scastle/Solitude Class Usage Examples

Public Properties

Property Type Description
Normals Vertices
Vertices Vertices

Public Methods

Method Description
Clone ( ) : Shape
ComputeAABB ( AABB &aabb, Transform &transform, int childIndex ) : void

Given a transform, compute the associated axis aligned bounding box for a child shape.

ComputeProperties ( ) : void

Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.

PolygonShape ( Vertices vertices, float density ) : System.Diagnostics

Initializes a new instance of the PolygonShape class.

PolygonShape ( float density ) : System.Diagnostics
RayCast ( RayCastOutput &output, RayCastInput &input, Transform &transform, int childIndex ) : bool

Cast a ray against a child shape.

Set ( Vertices vertices ) : void

Copy vertices. This assumes the vertices define a convex polygon. It is assumed that the exterior is the the right of each edge.

SetAsBox ( float halfWidth, float halfHeight ) : void

Build vertices to represent an axis-aligned box.

SetAsBox ( float halfWidth, float halfHeight, Vector2 center, float angle ) : void

Build vertices to represent an oriented box.

SetAsEdge ( Vector2 start, Vector2 end ) : void

Set this as a single edge.

TestPoint ( Transform &transform, Vector2 &point ) : bool

Test a point for containment in this shape. This only works for convex shapes.

Private Methods

Method Description
PolygonShape ( ) : System.Diagnostics

Method Details

Clone() public method

public Clone ( ) : Shape
return Shape

ComputeAABB() public method

Given a transform, compute the associated axis aligned bounding box for a child shape.
public ComputeAABB ( AABB &aabb, Transform &transform, int childIndex ) : void
aabb AABB The aabb results.
transform Transform The world transform of the shape.
childIndex int The child shape index.
return void

ComputeProperties() public method

Compute the mass properties of this shape using its dimensions and density. The inertia tensor is computed about the local origin, not the centroid.
public ComputeProperties ( ) : void
return void

PolygonShape() public method

Initializes a new instance of the PolygonShape class.
public PolygonShape ( Vertices vertices, float density ) : System.Diagnostics
vertices Vertices The vertices.
density float The density.
return System.Diagnostics

PolygonShape() public method

public PolygonShape ( float density ) : System.Diagnostics
density float
return System.Diagnostics

RayCast() public method

Cast a ray against a child shape.
public RayCast ( RayCastOutput &output, RayCastInput &input, Transform &transform, int childIndex ) : bool
output RayCastOutput The ray-cast results.
input RayCastInput The ray-cast input parameters.
transform Transform The transform to be applied to the shape.
childIndex int The child shape index.
return bool

Set() public method

Copy vertices. This assumes the vertices define a convex polygon. It is assumed that the exterior is the the right of each edge.
public Set ( Vertices vertices ) : void
vertices Vertices The vertices.
return void

SetAsBox() public method

Build vertices to represent an axis-aligned box.
public SetAsBox ( float halfWidth, float halfHeight ) : void
halfWidth float The half-width.
halfHeight float The half-height.
return void

SetAsBox() public method

Build vertices to represent an oriented box.
public SetAsBox ( float halfWidth, float halfHeight, Vector2 center, float angle ) : void
halfWidth float The half-width..
halfHeight float The half-height.
center Microsoft.Xna.Framework.Vector2 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 ( Vector2 start, Vector2 end ) : void
start Microsoft.Xna.Framework.Vector2 The start.
end Microsoft.Xna.Framework.Vector2 The end.
return void

TestPoint() public method

Test a point for containment in this shape. This only works for convex shapes.
public TestPoint ( Transform &transform, Vector2 &point ) : bool
transform Transform The shape world transform.
point Microsoft.Xna.Framework.Vector2 a point in world coordinates.
return bool

Property Details

Normals public_oe property

public Vertices Normals
return Vertices

Vertices public_oe property

public Vertices Vertices
return Vertices