Math

Math Module

The Math Module contains helpful math functions, and the Vector and Vector3 classes.

The Math Module can be accessed with MDog.Math.method().

Math Methods

Vector

A Vector is a 2D point or direction with an x and a y. Make one with new MDog.Math.Vector(x, y).

Methods that change a vector change it in place, and return the same vector so they can be chained, like velocity.add(gravity).constrain(5). Use clone() first to keep the original.

The x and y can also be read and set directly.

Constructor

Vector Methods

Vector3

A Vector3 is a 3D point or direction with an x, y, and z. It's mostly used by the ThreeDee Module. Make one with new MDog.Math.Vector3(x, y, z).

Just like Vector, methods change the vector in place and return it so they can be chained.

Constructor

Vector3 Methods