The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Box2D::b2Vec2 - A 2D column vector.

SYNOPSIS

  my $v = Box2D::b2Vec2->new( $x, $y );

DESCRIPTION

A 2D column vector.

METHODS

new()

Default constructor does nothing.

Returns a Box2D::b2Vec2

new( $x, $y )

Construct using coordinates.

Parameters:

  • float32 $x

  • float32 $y

IsValid()

Does this vector contain finite coordinates?

Returns a bool

Length()

Get the length of this vector (the norm).

Returns a float32

LengthSquared()

Get the length squared. For performance, use this instead of b2Vec2::Length (if possible).

Returns a float32

Normalize()

Convert this vector into a unit vector. Returns the length.

Returns a float32

Set( $x, $y )

Set this vector to some specified coordinates.

Parameters:

  • float32 $x

  • float32 $y

SetZero()

Set this vector to all zeros.

x()

x( $x )

Parameters:

  • float32 $x (optional)

Returns a float32

y()

y( $y )

Parameters:

  • float32 $y (optional)

Returns a float32

SEE ALSO

BUGS

See "BUGS" in Box2D

AUTHORS

See "AUTHORS" in Box2D

COPYRIGHT & LICENSE

See "COPYRIGHT & LICENSE" in Box2D