public class FloatPoint extends Point2D.Float
Point2D.Double, Point2D.Float
x, y
Constructor and Description |
---|
FloatPoint(float x,
float y)
Creates a point from given coordinates
|
FloatPoint(Point2D point) |
Modifier and Type | Method and Description |
---|---|
FloatPoint |
add(FloatPoint add)
Returns a point with this point's coordinates
added with the given point.
|
FloatPoint |
add(int addX,
int addY)
Returns a point with this point's coordinates
added with the given coordinates.
|
IntPoint |
getIntPoint()
Returns an integer rounded version of this point
|
float |
length()
Returns the length of this point's vector
|
FloatPoint |
multiply(float mult)
Returns a point which is a multiplication of this point
|
FloatPoint |
rotate(double radAngle)
Returns this point's vector rotated according to the radian angle
|
FloatPoint |
subtract(float subX,
float subY)
Returns a point with this point's coordinates
subtracted by the given coordinates.
|
FloatPoint |
subtract(FloatPoint sub)
Returns a point with this point's coordinates
subtracted by the given point.
|
String |
toString()
Returns a string representation of this object
|
FloatPoint |
unitVector()
Returns the unit vector for this point's vector
|
getX, getY, setLocation, setLocation
clone, distance, distance, distance, distanceSq, distanceSq, distanceSq, equals, hashCode, setLocation
public FloatPoint(float x, float y)
x
- coordinatey
- coordinatepublic FloatPoint(Point2D point)
public FloatPoint subtract(float subX, float subY)
subX
- the length to be subtracted from x coordinatesubY
- the length to be subtracted from y coordinatepublic FloatPoint subtract(FloatPoint sub)
sub
- a vector to be subtracted.public FloatPoint add(int addX, int addY)
addX
- length to be added to x coordinateaddY
- length to be added to y coordinatepublic FloatPoint add(FloatPoint add)
add
- a vector to be added.public FloatPoint multiply(float mult)
mult
- the scale to multiply.public IntPoint getIntPoint()
public float length()
public FloatPoint unitVector()
public FloatPoint rotate(double radAngle)
radAngle
- angle in radianspublic String toString()
toString
in class Point2D.Float
Copyright © 2014 Uppsala University and Aalborg University. All Rights Reserved.