Package de.xima.fc.common.geometry
Class Point2DDouble
- java.lang.Object
-
- de.xima.fc.common.geometry.Point2DDouble
-
- All Implemented Interfaces:
Point
,Point1DLike<Double>
,Point2D<Double>
,Point2DLike<Double>
,Serializable
public final class Point2DDouble extends Object implements Point2D<Double>
A 2D point with double precision coordinates. Some operations are dependent on the coordinate system's handedness, in which case a left-handed coordinate system is assumed. This is common in computer graphics, where the x-axis points to the right and the y-axis points down.This class is immutable and thread-safe.
- Since:
- 8.4.0
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Point2DDouble(double x, double y)
Creates a new point with the given coordinates.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Double
coordinate(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis.Point2DDouble
coordinate(ECartesianAxis1D axis, Double coordinate)
Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.Double
coordinate(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis.Point2DDouble
coordinate(ECartesianAxis2D axis, Double coordinate)
Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.Point2DDouble
coordinateByte(ECartesianAxis1D axis, byte coordinate)
Gets a point with the coordinate on the given axis set to the given byte value, while keeping other coordinates unchanged.Point2DDouble
coordinateByte(ECartesianAxis2D axis, byte coordinate)
Gets a point with the coordinate on the given axis set to the given byte value, while keeping other coordinates unchanged.double
coordinateDouble(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis, as a double.Point2DDouble
coordinateDouble(ECartesianAxis1D axis, double coordinate)
Gets a point with the coordinate on the given axis set to the given double value, while keeping other coordinates unchanged.double
coordinateDouble(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis, as a double.Point2DDouble
coordinateDouble(ECartesianAxis2D axis, double coordinate)
Gets a point with the coordinate on the given axis set to the given double value, while keeping other coordinates unchanged.Point2DDouble
coordinateFloat(ECartesianAxis1D axis, float coordinate)
Gets a point with the coordinate on the given axis set to the given float value, while keeping other coordinates unchanged.Point2DDouble
coordinateFloat(ECartesianAxis2D axis, float coordinate)
Gets a point with the coordinate on the given axis set to the given float value, while keeping other coordinates unchanged.Point2DDouble
coordinateInt(ECartesianAxis1D axis, int coordinate)
Gets a point with the coordinate on the given axis set to the given int value, while keeping other coordinates unchanged.Point2DDouble
coordinateInt(ECartesianAxis2D axis, int coordinate)
Gets a point with the coordinate on the given axis set to the given int value, while keeping other coordinates unchanged.Point2DDouble
coordinateLong(ECartesianAxis1D axis, long coordinate)
Gets a point with the coordinate on the given axis set to the given long value, while keeping other coordinates unchanged.Point2DDouble
coordinateLong(ECartesianAxis2D axis, long coordinate)
Gets a point with the coordinate on the given axis set to the given long value, while keeping other coordinates unchanged.Point2DDouble
coordinateShort(ECartesianAxis1D axis, short coordinate)
Gets a point with the coordinate on the given axis set to the given short value, while keeping other coordinates unchanged.Point2DDouble
coordinateShort(ECartesianAxis2D axis, short coordinate)
Gets a point with the coordinate on the given axis set to the given short value, while keeping other coordinates unchanged.Predicate<Point2DDouble>
epsilonBall(double epsilon)
Creates a predicate that returns for all points within the ε-ball centered at this point.boolean
equals(Object o)
int
hashCode()
byte
lengthByte()
Gets the length of this point as a byte (when interpreted as a vector from the origin).double
lengthDouble()
Gets the length of this point as a double (when interpreted as a vector from the origin).float
lengthFloat()
Gets the length of this point as a float (when interpreted as a vector from the origin).int
lengthInt()
Gets the length of this point as an int (when interpreted as a vector from the origin).long
lengthLong()
Gets the length of this point as a long (when interpreted as a vector from the origin).short
lengthShort()
Gets the length of this point as a byte (when interpreted as a vector from the origin).boolean
near(Point2DDouble that, double epsilon)
Checks whether this point is approximately equal to another point, i.e.Point2DDouble
normalize()
Normalizes this point so that itslength
is 1.Point2DDouble
rotateDegrees(double degrees)
Rotates this point around the origin (0, 0) by the given angle in degrees, in an anti-clockwise direction.Point2DDouble
rotateDegreesXY(double angleDegrees)
Rotates this point on the xy plane around the origin by the given angle in degrees, in an anti-clockwise direction.Point2DDouble
rotateRadians(double radians)
Rotates this point around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.Point2DDouble
rotateRadiansXY(double angleRadians)
Rotates this point on the xy plane around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.Point2DDouble
scale(byte scale)
Scales this point by the given ratio.Point2DDouble
scale(byte sx, byte sy)
Scales this point by the given ratio.Point2DDouble
scale(double scale)
Scales this point by the given ratio.Point2DDouble
scale(double sx, double sy)
Scales this point by the given ratio.Point2DDouble
scale(float scale)
Scales this point by the given ratio.Point2DDouble
scale(float sx, float sy)
Scales this point by the given ratio.Point2DDouble
scale(int scale)
Scales this point by the given ratio.Point2DDouble
scale(int sx, int sy)
Scales this point by the given ratio.Point2DDouble
scale(long scale)
Scales this point by the given ratio.Point2DDouble
scale(long sx, long sy)
Scales this point by the given ratio.Point2DDouble
scale(short scale)
Scales this point by the given ratio.Point2DDouble
scale(short sx, short sy)
Scales this point by the given ratio.Point2DDouble
subtract(byte dx, byte dy)
Subtracts a given amount from the coordinates of this point.Point2DDouble
subtract(double dx, double dy)
Subtracts a given amount from the coordinates of this point.Point2DDouble
subtract(float dx, float dy)
Subtracts a given amount from the coordinates of this point.Point2DDouble
subtract(int dx, int dy)
Subtracts a given amount from the coordinates of this point.Point2DDouble
subtract(long dx, long dy)
Subtracts a given amount from the coordinates of this point.Point2DDouble
subtract(short dx, short dy)
Subtracts a given amount from the coordinates of this point.Point2DDouble
subtract(Point2DLike<?> delta)
Subtracts the given point from this point.String
toString()
Point2DDouble
translate(byte dx, byte dy)
Translates this point by the given delta.Point2DDouble
translate(double dx, double dy)
Translates this point by the given delta.Point2DDouble
translate(float dx, float dy)
Translates this point by the given delta.Point2DDouble
translate(int dx, int dy)
Translates this point by the given delta.Point2DDouble
translate(long dx, long dy)
Translates this point by the given delta.Point2DDouble
translate(short dx, short dy)
Translates this point by the given delta.Point2DDouble
translate(Point2DLike<?> delta)
Translates this point by the given delta.static Point2DDouble
unitDegrees(double degrees)
Gets a unit vector pointing in the specified direction in degrees.static Point2DDouble
unitRadians(double radians)
Gets a unit vector pointing in the specified direction in radians.static Point2DDouble
unitXNegative()
Gets a unit vector pointing in the negative x-direction.static Point2DDouble
unitXPositive()
Gets a unit vector pointing in the positive x-direction.static Point2DDouble
unitYNegative()
Gets a unit vector pointing in the negative y-direction.static Point2DDouble
unitYPositive()
Gets a unit vector pointing in the positive y-direction.Double
x()
The x coordinate of this point.Point2DDouble
x(Double x)
Returns a point with the x coordinate set to the given value, while keeping other coordinates unchanged.Point2DDouble
xByte(byte x)
Returns a point with the x coordinate set to the given byte value, while keeping other coordinates unchanged.double
xDouble()
The x coordinate of this point.Point2DDouble
xDouble(double x)
Returns a point with the x coordinate set to the given double value, while keeping other coordinates unchanged.Point2DDouble
xFloat(float x)
Returns a point with the x coordinate set to the given float value, while keeping other coordinates unchanged.Point2DDouble
xInt(int x)
Returns a point with the x coordinate set to the given int value, while keeping other coordinates unchanged.Point2DDouble
xLong(long x)
Returns a point with the x coordinate set to the given long value, while keeping other coordinates unchanged.Point2DDouble
xShort(short x)
Returns a point with the x coordinate set to the given short value, while keeping other coordinates unchanged.Double
y()
The y coordinate of this point.Point2DDouble
y(Double y)
Returns a point with the y coordinate set to the given value, while keeping other coordinates unchanged.Point2DDouble
yByte(byte y)
Returns a point with the y coordinate set to the given byte value, while keeping other coordinates unchanged.double
yDouble()
The y coordinate of this point, as a double.Point2DDouble
yDouble(double y)
Returns a point with the y coordinate set to the given double value, while keeping other coordinates unchanged.Point2DDouble
yFloat(float y)
Returns a point with the y coordinate set to the given float value, while keeping other coordinates unchanged.Point2DDouble
yInt(int y)
Returns a point with the y coordinate set to the given int value, while keeping other coordinates unchanged.Point2DDouble
yLong(long y)
Returns a point with the y coordinate set to the given long value, while keeping other coordinates unchanged.Point2DDouble
yShort(short y)
Returns a point with the y coordinate set to the given short value, while keeping other coordinates unchanged.static Point2DDouble
zero()
Gets a point at the origin (0, 0).-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.xima.fc.common.geometry.Point1DLike
coordinateByte, coordinateFloat, coordinateInt, coordinateLong, coordinateShort, xByte, xFloat, xInt, xLong, xShort
-
Methods inherited from interface de.xima.fc.common.geometry.Point2D
dimensions
-
Methods inherited from interface de.xima.fc.common.geometry.Point2DLike
coordinateByte, coordinateFloat, coordinateInt, coordinateLong, coordinateShort, yByte, yFloat, yInt, yLong, yShort
-
-
-
-
Method Detail
-
coordinate
public Double coordinate(ECartesianAxis1D axis)
Description copied from interface:Point1DLike
Gets the coordinate of this point on the given axis.- Specified by:
coordinate
in interfacePoint1DLike<Double>
- Parameters:
axis
- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinate
public Double coordinate(ECartesianAxis2D axis)
Description copied from interface:Point2DLike
Gets the coordinate of this point on the given axis.- Specified by:
coordinate
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinate
public Point2DDouble coordinate(ECartesianAxis1D axis, Double coordinate)
Description copied from interface:Point1DLike
Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.- Specified by:
coordinate
in interfacePoint1DLike<Double>
- Specified by:
coordinate
in interfacePoint2D<Double>
- Specified by:
coordinate
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinate
public Point2DDouble coordinate(ECartesianAxis2D axis, Double coordinate)
Description copied from interface:Point2DLike
Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.- Specified by:
coordinate
in interfacePoint2D<Double>
- Specified by:
coordinate
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateByte
public Point2DDouble coordinateByte(ECartesianAxis1D axis, byte coordinate)
Description copied from interface:Point1DLike
Gets a point with the coordinate on the given axis set to the given byte value, while keeping other coordinates unchanged.- Specified by:
coordinateByte
in interfacePoint1DLike<Double>
- Specified by:
coordinateByte
in interfacePoint2D<Double>
- Specified by:
coordinateByte
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a byte.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateByte
public Point2DDouble coordinateByte(ECartesianAxis2D axis, byte coordinate)
Description copied from interface:Point2DLike
Gets a point with the coordinate on the given axis set to the given byte value, while keeping other coordinates unchanged.- Specified by:
coordinateByte
in interfacePoint2D<Double>
- Specified by:
coordinateByte
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a byte.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateDouble
public double coordinateDouble(ECartesianAxis1D axis)
Description copied from interface:Point1DLike
Gets the coordinate of this point on the given axis, as a double.- Specified by:
coordinateDouble
in interfacePoint1DLike<Double>
- Parameters:
axis
- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateDouble
public double coordinateDouble(ECartesianAxis2D axis)
Description copied from interface:Point2DLike
Gets the coordinate of this point on the given axis, as a double.- Specified by:
coordinateDouble
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateDouble
public Point2DDouble coordinateDouble(ECartesianAxis1D axis, double coordinate)
Description copied from interface:Point1DLike
Gets a point with the coordinate on the given axis set to the given double value, while keeping other coordinates unchanged.- Specified by:
coordinateDouble
in interfacePoint1DLike<Double>
- Specified by:
coordinateDouble
in interfacePoint2D<Double>
- Specified by:
coordinateDouble
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a double.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateDouble
public Point2DDouble coordinateDouble(ECartesianAxis2D axis, double coordinate)
Description copied from interface:Point2DLike
Gets a point with the coordinate on the given axis set to the given double value, while keeping other coordinates unchanged.- Specified by:
coordinateDouble
in interfacePoint2D<Double>
- Specified by:
coordinateDouble
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a double.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateFloat
public Point2DDouble coordinateFloat(ECartesianAxis1D axis, float coordinate)
Description copied from interface:Point1DLike
Gets a point with the coordinate on the given axis set to the given float value, while keeping other coordinates unchanged.- Specified by:
coordinateFloat
in interfacePoint1DLike<Double>
- Specified by:
coordinateFloat
in interfacePoint2D<Double>
- Specified by:
coordinateFloat
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a float.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateFloat
public Point2DDouble coordinateFloat(ECartesianAxis2D axis, float coordinate)
Description copied from interface:Point2DLike
Gets a point with the coordinate on the given axis set to the given float value, while keeping other coordinates unchanged.- Specified by:
coordinateFloat
in interfacePoint2D<Double>
- Specified by:
coordinateFloat
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a float.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateInt
public Point2DDouble coordinateInt(ECartesianAxis1D axis, int coordinate)
Description copied from interface:Point1DLike
Gets a point with the coordinate on the given axis set to the given int value, while keeping other coordinates unchanged.- Specified by:
coordinateInt
in interfacePoint1DLike<Double>
- Specified by:
coordinateInt
in interfacePoint2D<Double>
- Specified by:
coordinateInt
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as an int.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateInt
public Point2DDouble coordinateInt(ECartesianAxis2D axis, int coordinate)
Description copied from interface:Point2DLike
Gets a point with the coordinate on the given axis set to the given int value, while keeping other coordinates unchanged.- Specified by:
coordinateInt
in interfacePoint2D<Double>
- Specified by:
coordinateInt
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as an int.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateLong
public Point2DDouble coordinateLong(ECartesianAxis1D axis, long coordinate)
Description copied from interface:Point1DLike
Gets a point with the coordinate on the given axis set to the given long value, while keeping other coordinates unchanged.- Specified by:
coordinateLong
in interfacePoint1DLike<Double>
- Specified by:
coordinateLong
in interfacePoint2D<Double>
- Specified by:
coordinateLong
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a long.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateLong
public Point2DDouble coordinateLong(ECartesianAxis2D axis, long coordinate)
Description copied from interface:Point2DLike
Gets a point with the coordinate on the given axis set to the given long value, while keeping other coordinates unchanged.- Specified by:
coordinateLong
in interfacePoint2D<Double>
- Specified by:
coordinateLong
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a long.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateShort
public Point2DDouble coordinateShort(ECartesianAxis1D axis, short coordinate)
Description copied from interface:Point1DLike
Gets a point with the coordinate on the given axis set to the given short value, while keeping other coordinates unchanged.- Specified by:
coordinateShort
in interfacePoint1DLike<Double>
- Specified by:
coordinateShort
in interfacePoint2D<Double>
- Specified by:
coordinateShort
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a short.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
coordinateShort
public Point2DDouble coordinateShort(ECartesianAxis2D axis, short coordinate)
Description copied from interface:Point2DLike
Gets a point with the coordinate on the given axis set to the given short value, while keeping other coordinates unchanged.- Specified by:
coordinateShort
in interfacePoint2D<Double>
- Specified by:
coordinateShort
in interfacePoint2DLike<Double>
- Parameters:
axis
- The axis for which to adjust the coordinate.coordinate
- The new coordinate value for the specified axis as a short.- Returns:
- A point with the specified coordinate and all other coordinates unchanged.
-
epsilonBall
public Predicate<Point2DDouble> epsilonBall(double epsilon)
Creates a predicate that returns for all points within the ε-ball centered at this point. I.e. all points whose distance to this point is less than or equal to the given ε value.- Parameters:
epsilon
- The maximum distance for the points to be considered equal- Returns:
- A predicate that returns true for all points within the epsilon-sphere centered at this point.
-
lengthByte
public byte lengthByte()
Description copied from interface:Point
Gets the length of this point as a byte (when interpreted as a vector from the origin).- Specified by:
lengthByte
in interfacePoint
- Returns:
- The length of this point as a byte.
-
lengthDouble
public double lengthDouble()
Description copied from interface:Point
Gets the length of this point as a double (when interpreted as a vector from the origin).- Specified by:
lengthDouble
in interfacePoint
- Returns:
- The length of this point as a double.
-
lengthFloat
public float lengthFloat()
Description copied from interface:Point
Gets the length of this point as a float (when interpreted as a vector from the origin).- Specified by:
lengthFloat
in interfacePoint
- Returns:
- The length of this point as a float.
-
lengthInt
public int lengthInt()
Description copied from interface:Point
Gets the length of this point as an int (when interpreted as a vector from the origin).
-
lengthLong
public long lengthLong()
Description copied from interface:Point
Gets the length of this point as a long (when interpreted as a vector from the origin).- Specified by:
lengthLong
in interfacePoint
- Returns:
- The length of this point as a double.
-
lengthShort
public short lengthShort()
Description copied from interface:Point
Gets the length of this point as a byte (when interpreted as a vector from the origin).- Specified by:
lengthShort
in interfacePoint
- Returns:
- The length of this point as a short.
-
near
public boolean near(Point2DDouble that, double epsilon)
Checks whether this point is approximately equal to another point, i.e. whether the distance between the two points is less than or equal to the given epsilon value.This is not an equivalence relation and must not be used where the semantics of
Object.equals(Object)
are expected.- Parameters:
that
- The point to compare withepsilon
- The maximum distance for the points to be considered equal- Returns:
- true if the points are approximately equal, false otherwise
-
normalize
public Point2DDouble normalize()
Description copied from interface:Point
Normalizes this point so that itslength
is 1. When its length is 0, returns this point unchanged.
-
rotateDegrees
public Point2DDouble rotateDegrees(double degrees)
Description copied from interface:Point2D
Rotates this point around the origin (0, 0) by the given angle in degrees, in an anti-clockwise direction.- Specified by:
rotateDegrees
in interfacePoint2D<Double>
- Parameters:
degrees
- The angle in angleDegrees to rotate the point.- Returns:
- A new point that is the result of the rotation.
-
rotateDegreesXY
public Point2DDouble rotateDegreesXY(double angleDegrees)
Description copied from interface:Point2DLike
Rotates this point on the xy plane around the origin by the given angle in degrees, in an anti-clockwise direction.- Specified by:
rotateDegreesXY
in interfacePoint2D<Double>
- Specified by:
rotateDegreesXY
in interfacePoint2DLike<Double>
- Parameters:
angleDegrees
- The angle in angleDegrees to rotate the point.- Returns:
- A new point that is the result of the rotation.
-
rotateRadians
public Point2DDouble rotateRadians(double radians)
Description copied from interface:Point2D
Rotates this point around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.- Specified by:
rotateRadians
in interfacePoint2D<Double>
- Parameters:
radians
- The angle in radians to rotate the point.- Returns:
- A new point that is the result of the rotation.
-
rotateRadiansXY
public Point2DDouble rotateRadiansXY(double angleRadians)
Description copied from interface:Point2DLike
Rotates this point on the xy plane around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.- Specified by:
rotateRadiansXY
in interfacePoint2D<Double>
- Specified by:
rotateRadiansXY
in interfacePoint2DLike<Double>
- Parameters:
angleRadians
- The angle in radians to rotate the point.- Returns:
- A new point that is the result of the rotation.
-
scale
public Point2DDouble scale(byte scale)
Description copied from interface:Point
Scales this point by the given ratio.- Specified by:
scale
in interfacePoint
- Specified by:
scale
in interfacePoint1DLike<Double>
- Specified by:
scale
in interfacePoint2D<Double>
- Specified by:
scale
in interfacePoint2DLike<Double>
- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
public Point2DDouble scale(short scale)
Description copied from interface:Point
Scales this point by the given ratio.- Specified by:
scale
in interfacePoint
- Specified by:
scale
in interfacePoint1DLike<Double>
- Specified by:
scale
in interfacePoint2D<Double>
- Specified by:
scale
in interfacePoint2DLike<Double>
- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
public Point2DDouble scale(int scale)
Description copied from interface:Point
Scales this point by the given ratio.- Specified by:
scale
in interfacePoint
- Specified by:
scale
in interfacePoint1DLike<Double>
- Specified by:
scale
in interfacePoint2D<Double>
- Specified by:
scale
in interfacePoint2DLike<Double>
- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
public Point2DDouble scale(long scale)
Description copied from interface:Point
Scales this point by the given ratio.- Specified by:
scale
in interfacePoint
- Specified by:
scale
in interfacePoint1DLike<Double>
- Specified by:
scale
in interfacePoint2D<Double>
- Specified by:
scale
in interfacePoint2DLike<Double>
- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
public Point2DDouble scale(float scale)
Description copied from interface:Point
Scales this point by the given ratio.- Specified by:
scale
in interfacePoint
- Specified by:
scale
in interfacePoint1DLike<Double>
- Specified by:
scale
in interfacePoint2D<Double>
- Specified by:
scale
in interfacePoint2DLike<Double>
- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
public Point2DDouble scale(double scale)
Description copied from interface:Point
Scales this point by the given ratio.- Specified by:
scale
in interfacePoint
- Specified by:
scale
in interfacePoint1DLike<Double>
- Specified by:
scale
in interfacePoint2D<Double>
- Specified by:
scale
in interfacePoint2DLike<Double>
- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
public Point2DDouble scale(byte sx, byte sy)
Description copied from interface:Point2D
Scales this point by the given ratio.
-
scale
public Point2DDouble scale(short sx, short sy)
Description copied from interface:Point2D
Scales this point by the given ratio.
-
scale
public Point2DDouble scale(int sx, int sy)
Description copied from interface:Point2D
Scales this point by the given ratio.
-
scale
public Point2DDouble scale(long sx, long sy)
Description copied from interface:Point2D
Scales this point by the given ratio.
-
scale
public Point2DDouble scale(float sx, float sy)
Description copied from interface:Point2D
Scales this point by the given ratio.
-
scale
public Point2DDouble scale(double sx, double sy)
Description copied from interface:Point2D
Scales this point by the given ratio.
-
subtract
public Point2DDouble subtract(byte dx, byte dy)
Description copied from interface:Point2D
Subtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(int dx, int dy)
Description copied from interface:Point2D
Subtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(short dx, short dy)
Description copied from interface:Point2D
Subtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(long dx, long dy)
Description copied from interface:Point2D
Subtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(float dx, float dy)
Description copied from interface:Point2D
Subtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(double dx, double dy)
Description copied from interface:Point2D
Subtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(Point2DLike<?> delta)
Description copied from interface:Point2D
Subtracts the given point from this point.
-
translate
public Point2DDouble translate(Point2DLike<?> delta)
Description copied from interface:Point2D
Translates this point by the given delta.
-
translate
public Point2DDouble translate(byte dx, byte dy)
Description copied from interface:Point2D
Translates this point by the given delta.
-
translate
public Point2DDouble translate(short dx, short dy)
Description copied from interface:Point2D
Translates this point by the given delta.
-
translate
public Point2DDouble translate(int dx, int dy)
Description copied from interface:Point2D
Translates this point by the given delta.
-
translate
public Point2DDouble translate(long dx, long dy)
Description copied from interface:Point2D
Translates this point by the given delta.
-
translate
public Point2DDouble translate(float dx, float dy)
Description copied from interface:Point2D
Translates this point by the given delta.
-
translate
public Point2DDouble translate(double dx, double dy)
Description copied from interface:Point2D
Translates this point by the given delta.
-
x
public Point2DDouble x(Double x)
Description copied from interface:Point1DLike
Returns a point with the x coordinate set to the given value, while keeping other coordinates unchanged.- Specified by:
x
in interfacePoint1DLike<Double>
- Specified by:
x
in interfacePoint2D<Double>
- Specified by:
x
in interfacePoint2DLike<Double>
- Parameters:
x
- The new x coordinate value- Returns:
- A point with the specified x coordinate.
-
x
public Double x()
Description copied from interface:Point1DLike
The x coordinate of this point.- Specified by:
x
in interfacePoint1DLike<Double>
- Returns:
- the x coordinate
-
xByte
public Point2DDouble xByte(byte x)
Description copied from interface:Point1DLike
Returns a point with the x coordinate set to the given byte value, while keeping other coordinates unchanged.- Specified by:
xByte
in interfacePoint1DLike<Double>
- Specified by:
xByte
in interfacePoint2D<Double>
- Specified by:
xByte
in interfacePoint2DLike<Double>
- Parameters:
x
- The new x coordinate value as a byte- Returns:
- A point with the specified x coordinate.
-
xDouble
public Point2DDouble xDouble(double x)
Description copied from interface:Point1DLike
Returns a point with the x coordinate set to the given double value, while keeping other coordinates unchanged.- Specified by:
xDouble
in interfacePoint1DLike<Double>
- Specified by:
xDouble
in interfacePoint2D<Double>
- Specified by:
xDouble
in interfacePoint2DLike<Double>
- Parameters:
x
- The new x coordinate value as a double- Returns:
- A point with the specified x coordinate.
-
xDouble
public double xDouble()
Description copied from interface:Point1DLike
The x coordinate of this point.- Specified by:
xDouble
in interfacePoint1DLike<Double>
- Returns:
- the x coordinate
-
xFloat
public Point2DDouble xFloat(float x)
Description copied from interface:Point1DLike
Returns a point with the x coordinate set to the given float value, while keeping other coordinates unchanged.- Specified by:
xFloat
in interfacePoint1DLike<Double>
- Specified by:
xFloat
in interfacePoint2D<Double>
- Specified by:
xFloat
in interfacePoint2DLike<Double>
- Parameters:
x
- The new x coordinate value as a float- Returns:
- A point with the specified x coordinate.
-
xInt
public Point2DDouble xInt(int x)
Description copied from interface:Point1DLike
Returns a point with the x coordinate set to the given int value, while keeping other coordinates unchanged.- Specified by:
xInt
in interfacePoint1DLike<Double>
- Specified by:
xInt
in interfacePoint2D<Double>
- Specified by:
xInt
in interfacePoint2DLike<Double>
- Parameters:
x
- The new x coordinate value as an int- Returns:
- A point with the specified x coordinate.
-
xLong
public Point2DDouble xLong(long x)
Description copied from interface:Point1DLike
Returns a point with the x coordinate set to the given long value, while keeping other coordinates unchanged.- Specified by:
xLong
in interfacePoint1DLike<Double>
- Specified by:
xLong
in interfacePoint2D<Double>
- Specified by:
xLong
in interfacePoint2DLike<Double>
- Parameters:
x
- The new x coordinate value as a long- Returns:
- A point with the specified x coordinate.
-
xShort
public Point2DDouble xShort(short x)
Description copied from interface:Point1DLike
Returns a point with the x coordinate set to the given short value, while keeping other coordinates unchanged.- Specified by:
xShort
in interfacePoint1DLike<Double>
- Specified by:
xShort
in interfacePoint2D<Double>
- Specified by:
xShort
in interfacePoint2DLike<Double>
- Parameters:
x
- The new x coordinate value as a short- Returns:
- A point with the specified x coordinate.
-
y
public Point2DDouble y(Double y)
Description copied from interface:Point2DLike
Returns a point with the y coordinate set to the given value, while keeping other coordinates unchanged.
-
y
public Double y()
Description copied from interface:Point2DLike
The y coordinate of this point.- Specified by:
y
in interfacePoint2DLike<Double>
- Returns:
- the y coordinate
-
yByte
public Point2DDouble yByte(byte y)
Description copied from interface:Point2DLike
Returns a point with the y coordinate set to the given byte value, while keeping other coordinates unchanged.
-
yDouble
public Point2DDouble yDouble(double y)
Description copied from interface:Point2DLike
Returns a point with the y coordinate set to the given double value, while keeping other coordinates unchanged.
-
yDouble
public double yDouble()
Description copied from interface:Point2DLike
The y coordinate of this point, as a double.- Specified by:
yDouble
in interfacePoint2DLike<Double>
- Returns:
- the y coordinate
-
yFloat
public Point2DDouble yFloat(float y)
Description copied from interface:Point2DLike
Returns a point with the y coordinate set to the given float value, while keeping other coordinates unchanged.
-
yInt
public Point2DDouble yInt(int y)
Description copied from interface:Point2DLike
Returns a point with the y coordinate set to the given int value, while keeping other coordinates unchanged.
-
yLong
public Point2DDouble yLong(long y)
Description copied from interface:Point2DLike
Returns a point with the y coordinate set to the given long value, while keeping other coordinates unchanged.
-
yShort
public Point2DDouble yShort(short y)
Description copied from interface:Point2DLike
Returns a point with the y coordinate set to the given short value, while keeping other coordinates unchanged.
-
unitDegrees
public static Point2DDouble unitDegrees(double degrees)
Gets a unit vector pointing in the specified direction in degrees. 0 is east, 90 is north, 180 is west, and 270 is south.- Parameters:
degrees
- The angle in degrees.- Returns:
- A unit vector pointing in the specified direction.
-
unitRadians
public static Point2DDouble unitRadians(double radians)
Gets a unit vector pointing in the specified direction in radians. 0 is east, π/2 is north, π is west, and 3π/2 is south.- Parameters:
radians
- The angle in radians.- Returns:
- A unit vector pointing in the specified direction.
-
unitXNegative
public static Point2DDouble unitXNegative()
Gets a unit vector pointing in the negative x-direction.- Returns:
- A unit vector pointing in the negative x-direction.
-
unitXPositive
public static Point2DDouble unitXPositive()
Gets a unit vector pointing in the positive x-direction.- Returns:
- A unit vector pointing in the positive x-direction.
-
unitYNegative
public static Point2DDouble unitYNegative()
Gets a unit vector pointing in the negative y-direction.- Returns:
- A unit vector pointing in the negative y-direction.
-
unitYPositive
public static Point2DDouble unitYPositive()
Gets a unit vector pointing in the positive y-direction.- Returns:
- A unit vector pointing in the positive y-direction.
-
zero
public static Point2DDouble zero()
Gets a point at the origin (0, 0).- Returns:
- A point at the origin (0, 0).
-
-