Point.js
From MapbenderWiki
Contents |
List of Methods
class Point
This class implements a point in the plane with euclidean metrics. It also includes several vector functions.
variables
- x: the x-coordinate of the point. private.
- y: the y-coordinate of the point. private.
equals(aVertex)
- returns true if this vertex and aVertex have the same coordinates.
dist(aVertex)
- returns the euclidean distance between this vertex and aVertex.
plus(p)
- returns the sum of this vector and p.
minus(p)
- returns the sum of this vector and -p.
times(c)
- returns this vector scaled by factor c.
dividedBy(c)
- returns this vector scaled by factor 1/c. c may not be 0.
round(numOfDigits)
- sets the precision to 10^-numOfDigits.
toString()
- If p is a point, alert(p) displays its coordinates.
all other functions are private and shall not be used.
