©2010
<<<<<<< HEAD Generated by JsDoc Toolkit 2.4.0 on Mon Mar 21 2011 06:33:40 GMT-0000 (UTC)
======= Generated by JsDoc Toolkit 2.4.0 on Mon Apr 04 2011 02:43:32 GMT-0000 (UTC)
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff HTML template: Codeview

Class Point

<<<<<<< HEAD
Defined in: GameLib.js. =======
Defined in: gamelib.js. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff

Class Summary
Constructor Attributes Constructor Name and Description
 
Point(x, y)
Create a new point with given x and y coordinates.
Field Summary
Field Attributes Field Name and Description
 
x
The x coordinate of this point.
 
y
The y coordinate of this point.
<<<<<<< HEAD ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff <<<<<<< HEAD ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff <<<<<<< HEAD ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff <<<<<<< HEAD ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff <<<<<<< HEAD ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff <<<<<<< HEAD ======= >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Method Summary
Method Attributes Method Name and Description
 
add(other)
Adds a point to this one and returns the new point.
<static>  
Point.add(other)
<static>  
Point.cross(other)
 
cross(other)
Calculate the cross product of this point and another point (Vector).
<static>  
Point.direction(p1, p2)
If you have two dudes, one standing at point p1, and the other standing at point p2, then this method will return the direction that the dude standing at p1 will need to face to look at p2.
<static>  
Point.distance(p1, p2)
 
distance(other)
Computed the Euclidean between this point and another point.
<static>   <<<<<<< HEAD
Point.distance(p1, p2) =======
Point.dot(other) >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
 
dot(other)
Calculate the dot product of this point and another point (Vector).
 
equal(other)
Determine whether this point is equal to another point.
<static>   <<<<<<< HEAD =======
Point.equal(other)
<static>   >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Point.fromAngle(angle)
Construct a point on the unit circle for the given angle.
<static>  
Point.length()
 
Computed the length of this point as though it were a vector from (0,0) to (x,y)
<static>  
Point.magnitude()
 
Calculate the magnitude of this Point (Vector).
 
norm()
The norm of a vector is the unit vector pointing in the same direction.
<static>  
Point.norm()
<static>  
Point.scale(scalar)
 
scale(scalar)
Scale this Point (Vector) by a constant amount.
 
subtract(other)
Subtracts a point to this one and returns the new point.
<static>  
Point.subtract(other)
Class Detail
Point(x, y)
Create a new point with given x and y coordinates. If no arguments are given defaults to (0, 0).
Parameters:
{Number} x Optional
{Number} y Optional
Field Detail
x
The x coordinate of this point.
y
The y coordinate of this point.
Method Detail
{Point} add(other)
Adds a point to this one and returns the new point.
Parameters:
{Point} other
The point to add this point to.
Returns:
A new point, the sum of both.
<<<<<<< HEAD =======
<static> Point.add(other)
Parameters:
other
<static> Point.cross(other)
Parameters:
other
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Number} cross(other)
<<<<<<< HEAD Calculate the cross product of this point and another point (Vector). Usually cross products are thought of as only applying to three dimensional vectors, but z can be treated as zero. The result of this method is interpreted as the magnitude ======= Calculate the cross product of this point and another point (Vector). Usually cross products are thought of as only applying to three dimensional vectors, but z can be treated as zero. The result of this method is interpreted as the magnitude >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff of the vector result of the cross product between [x1, y1, 0] x [x2, y2, 0] perpendicular to the xy plane.
Parameters:
{Point} other
The point to cross with this point.
Returns:
The cross product of this point with the other point as scalar value.
<static> Point.direction(p1, p2)
If you have two dudes, one standing at point p1, and the other standing at point p2, then this method will return the direction that the dude standing at p1 will need to face to look at p2.
Parameters:
{Point} p1
The starting point.
{Point} p2
The ending point.
Returns:
The direction from p1 to p2 in radians.
<<<<<<< HEAD
=======
<static> >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff {Number} <<<<<<< HEAD distance(other)
Computed the Euclidean between this point and another point. ======= Point.distance(p1, p2)
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
<<<<<<< HEAD {Point} other
The point to compute the distance to.
======= {Point} p1
{Point} p2
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns:
<<<<<<< HEAD
The distance between this point and another point.
=======
The Euclidean distance between two points.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
<<<<<<< HEAD
<static> =======
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff {Number} <<<<<<< HEAD Point.distance(p1, p2)
======= distance(other)
Computed the Euclidean between this point and another point. >>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Parameters:
<<<<<<< HEAD {Point} p1
{Point} p2
======= {Point} other
The point to compute the distance to.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
Returns:
<<<<<<< HEAD
The Euclidean distance between two points.
=======
The distance between this point and another point.
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
<<<<<<< HEAD =======
<static> Point.dot(other)
Parameters:
other
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Number} dot(other)
Calculate the dot product of this point and another point (Vector).
Parameters:
{Point} other
The point to dot with this point.
Returns:
The dot product of this point dot other as a scalar value.
{Boolean} equal(other)
Determine whether this point is equal to another point.
Parameters:
{Point} other
The point to check for equality.
Returns:
true if the other point has the same x, y coordinates, false otherwise.
<<<<<<< HEAD =======
<static> Point.equal(other)
Parameters:
other
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
<static> {Point} Point.fromAngle(angle)
Construct a point on the unit circle for the given angle.
Parameters:
{Number} angle
The angle in radians
Returns:
The point on the unit circle.
<<<<<<< HEAD =======
<static> Point.length()
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Number} length()
Computed the length of this point as though it were a vector from (0,0) to (x,y)
Returns:
The length of the vector from the origin to this point.
<<<<<<< HEAD =======
<static> Point.magnitude()
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Number} magnitude()
Calculate the magnitude of this Point (Vector).
Returns:
The magnitude of this point as if it were a vector from (0, 0) -> (x, y).
{Point} norm()
The norm of a vector is the unit vector pointing in the same direction. This method treats the point as though it is a vector from the origin to (x, y).
Returns:
The unit vector pointing in the same direction as this vector.
<<<<<<< HEAD =======
<static> Point.norm()
<static> Point.scale(scalar)
Parameters:
scalar
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff
{Point} scale(scalar)
Scale this Point (Vector) by a constant amount.
Parameters:
{Number} scalar
The amount to scale this point by.
Returns:
A new point, this * scalar.
{Point} subtract(other)
Subtracts a point to this one and returns the new point.
Parameters:
{Point} other
The point to subtract from this point.
Returns:
A new point, this - other.
<<<<<<< HEAD =======
<static> Point.subtract(other)
Parameters:
other
>>>>>>> 3fe863faa00b8e51f1f2f53b6d3e10fbf4b349ff