lejos.geom
Class Point
java.lang.Object
java.awt.geom.Point2D
java.awt.geom.Point2D.Float
lejos.geom.Point
- All Implemented Interfaces:
- Cloneable
- Direct Known Subclasses:
- WayPoint
public class Point
- extends Point2D.Float
Point with float co-ordinates for use in navigation.
- Author:
- Lawrie Griffiths
Constructor Summary |
Point(float radians)
|
Point(float x,
float y)
|
Method Summary |
Point |
add(Point other)
|
Point |
addWith(Point other)
|
float |
angle()
|
float |
angleTo(Point p)
Returns the direction angle from this point to the Point p |
Point |
clone()
Create a copy of this object, using a shallow copy. |
Point |
copyTo(Point p)
|
float |
dotProduct(Point other)
|
Point |
getNormalized()
|
Point |
leftOrth()
|
float |
length()
|
Point |
makeLeftOrth()
|
Point |
makeRightOrth()
|
void |
moveTo(Point other)
|
Point |
multiply(float length)
|
Point |
multiplyBy(float length)
|
Point |
normalize()
|
Point |
pointAt(float distance,
float angle)
Returns a new point at the specified distance in the direction angle from
this point. |
Point |
project(Point origin,
Point xDir)
|
Point |
projectWith(Point xDir)
|
Point |
projectWith(Point xDir,
Point origin)
|
Point |
reverse()
|
Point |
rightOrth()
|
Point |
subtract(float length)
|
Point |
subtract(Point other)
|
Point |
subtractWith(Point other)
|
void |
translate(float dx,
float dy)
Translates this point, at location (x, y), by dx along the x axis and
dy along the y axis so that it now represents the point (x + dx, y + dy). |
Point |
unproject(Point origin,
Point xDir)
|
Point |
unProjectWith(Point xDir)
|
Point |
unProjectWith(Point xDir,
Point origin)
|
Point
public Point(float x,
float y)
Point
public Point(float radians)
angleTo
public float angleTo(Point p)
- Returns the direction angle from this point to the Point p
- Parameters:
p
- the Point to determine the angle to
- Returns:
- the angle
translate
public void translate(float dx,
float dy)
- Translates this point, at location (x, y), by dx along the x axis and
dy along the y axis so that it now represents the point (x + dx, y + dy).
- Parameters:
dx
- dy
-
copyTo
public Point copyTo(Point p)
clone
public Point clone()
- Description copied from class:
Object
- Create a copy of this object, using a shallow copy.
- Overrides:
clone
in class Point2D
- Returns:
- The new copy of the Object
add
public Point add(Point other)
moveTo
public void moveTo(Point other)
subtract
public Point subtract(Point other)
subtract
public Point subtract(float length)
multiply
public Point multiply(float length)
getNormalized
public Point getNormalized()
reverse
public Point reverse()
unproject
public Point unproject(Point origin,
Point xDir)
project
public Point project(Point origin,
Point xDir)
angle
public float angle()
leftOrth
public Point leftOrth()
rightOrth
public Point rightOrth()
addWith
public Point addWith(Point other)
subtractWith
public Point subtractWith(Point other)
multiplyBy
public Point multiplyBy(float length)
length
public float length()
normalize
public Point normalize()
makeLeftOrth
public Point makeLeftOrth()
makeRightOrth
public Point makeRightOrth()
projectWith
public Point projectWith(Point xDir)
projectWith
public Point projectWith(Point xDir,
Point origin)
unProjectWith
public Point unProjectWith(Point xDir)
dotProduct
public float dotProduct(Point other)
unProjectWith
public Point unProjectWith(Point xDir,
Point origin)
pointAt
public Point pointAt(float distance,
float angle)
- Returns a new point at the specified distance in the direction angle from
this point.
- Parameters:
distance
- the distance to the new pointangle
- the angle to the new point
- Returns:
- the new point