Bitfighter
021
The Bitfighter Lua Documentation - Robots, Levelgens, and Plugins
|
A simple object representing a coordinate pair.
Member Functions | |
point(x, y) | |
Constructor. | |
Static Member Functions | |
angleTo(p1, p2) | |
Compute the angle between vectors represented in the two passed points. [details] | |
cross(p1, p2) | |
Compute the cross product of two points. [details] | |
distanceTo(p1, p2) | |
Compute the distance between two points. [details] | |
distSquared(p1, p2) | |
Compute the distance squared between two points. [details] | |
dot(p1, p2) | |
Compute the dot product of two points. [details] | |
length(p) | |
Compute the length of the vector contained in the passed point. [details] | |
lengthSquared(p) | |
Compute the square of the length of the vector contained in the passed point. [details] | |
normalize(p) | |
Normalizes the length of a vector represented by a point to have a length of 1. [details] | |
Constants | |
one | |
Constant representing the point (1, 1). [details] | |
zero | |
Constant representing the point (0, 0). [details] | |
A simple object representing a coordinate pair.
Points are used to represent locations and positions in the game. Note that for historical reasons, "point" is lower case. Points can be added and subtracted from one another, as well as multiplied together. Most point methods are static.
Arg types: x: num, y: num | returns point |
Compute the angle between vectors represented in the two passed points.
Computes the angle from the vector passed in p1 and the vector passed in p2 using the atan2 function.
Compute the cross product of two points.
Computes and returns a point representing the cross product of two passed points.
Compute the distance between two points.
Computes the distance between the two passed points.
Compute the distance squared between two points.
Computes the distance squared between the two passed points. This is useful if you are comparing distances to one another, and don't need the actual distance. Not computing the sqrt will make your scripts run more efficiently.
Compute the dot product of two points.
Computes and returns a point representing the dot product of two passed points.
|
static |
Compute the length of the vector contained in the passed point.
Computes the length of the vector contained in the passed point by using the Pythagorean equation; that is, it returns sqrt(p.x^2 + p.y^2).
|
static |
Compute the square of the length of the vector contained in the passed point.
Computes the square of the length of the vector contained in the passed point by using the Pythagorean equation; that is, it returns (p.x^2 + p.y^2). This is useful if you are comparing lengths to one another, and don't need the actual length. Not computing the sqrt will make your scripts run more efficiently.
Normalizes the length of a vector represented by a point to have a length of 1.
If the input vector is (3, 0), the output will be (1, 0).
returns point |
Constant representing the point (1, 1).
Using this constant is marginally more efficient than defining it yourself.
returns point |
Constant representing the point (0, 0).
Using this constant is marginally more efficient than defining it yourself.