NAME

Box2D::b2PolygonShape - A convex polygon.

SYNOPSIS

my $rect = Box2D::b2PolygonShape->new();
$rect->SetAsBox( $hx, $hy );

DESCRIPTION

A convex polygon. It is assumed that the interior of the polygon is to the left of each edge.

METHODS

new()

Default constructor.

Returns a Box2D::b2PolygonShape

GetVertex( $index )

Get a vertex by index.

Parameters:

  • int32 $index

Returns a Box2D::b2Vec2

GetVertexCount()

Get the vertex count.

Returns a int32

Set( @vertices )

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

Parameters:

  • array @vertices

SetAsBox( $hx, $hy )

SetAsBox( $hx, $hy, $center, $angle )

Build vertices to represent an oriented box.

Parameters:

  • float32 $hx - the half-width.

  • float32 $hy - the half-height.

  • Box2D::b2Vec2 $center (optional) - the center of the box in local coordinates.

  • float32 $angle (optional) - the rotation of the box in local coordinates.

SetAsEdge( $v1, $v2 )

Set this as a single edge.

Parameters:

  • Box2D::b2Vec2 $v1

  • Box2D::b2Vec2 $v2

SEE ALSO

BUGS

See "BUGS" in Box2D

AUTHORS

See "AUTHORS" in Box2D

COPYRIGHT & LICENSE

See "COPYRIGHT & LICENSE" in Box2D