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 Doublecoordinate(ECartesianAxis1D axis)Gets the coordinate of this point on the given axis.Point2DDoublecoordinate(ECartesianAxis1D axis, Double coordinate)Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.Doublecoordinate(ECartesianAxis2D axis)Gets the coordinate of this point on the given axis.Point2DDoublecoordinate(ECartesianAxis2D axis, Double coordinate)Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.Point2DDoublecoordinateByte(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.Point2DDoublecoordinateByte(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.doublecoordinateDouble(ECartesianAxis1D axis)Gets the coordinate of this point on the given axis, as a double.Point2DDoublecoordinateDouble(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.doublecoordinateDouble(ECartesianAxis2D axis)Gets the coordinate of this point on the given axis, as a double.Point2DDoublecoordinateDouble(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.Point2DDoublecoordinateFloat(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.Point2DDoublecoordinateFloat(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.Point2DDoublecoordinateInt(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.Point2DDoublecoordinateInt(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.Point2DDoublecoordinateLong(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.Point2DDoublecoordinateLong(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.Point2DDoublecoordinateShort(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.Point2DDoublecoordinateShort(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.booleanequals(Object o)inthashCode()bytelengthByte()Gets the length of this point as a byte (when interpreted as a vector from the origin).doublelengthDouble()Gets the length of this point as a double (when interpreted as a vector from the origin).floatlengthFloat()Gets the length of this point as a float (when interpreted as a vector from the origin).intlengthInt()Gets the length of this point as an int (when interpreted as a vector from the origin).longlengthLong()Gets the length of this point as a long (when interpreted as a vector from the origin).shortlengthShort()Gets the length of this point as a byte (when interpreted as a vector from the origin).booleannear(Point2DDouble that, double epsilon)Checks whether this point is approximately equal to another point, i.e.Point2DDoublenormalize()Normalizes this point so that itslengthis 1.Point2DDoublerotateDegrees(double degrees)Rotates this point around the origin (0, 0) by the given angle in degrees, in an anti-clockwise direction.Point2DDoublerotateDegreesXY(double angleDegrees)Rotates this point on the xy plane around the origin by the given angle in degrees, in an anti-clockwise direction.Point2DDoublerotateRadians(double radians)Rotates this point around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.Point2DDoublerotateRadiansXY(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.Point2DDoublescale(byte scale)Scales this point by the given ratio.Point2DDoublescale(byte sx, byte sy)Scales this point by the given ratio.Point2DDoublescale(double scale)Scales this point by the given ratio.Point2DDoublescale(double sx, double sy)Scales this point by the given ratio.Point2DDoublescale(float scale)Scales this point by the given ratio.Point2DDoublescale(float sx, float sy)Scales this point by the given ratio.Point2DDoublescale(int scale)Scales this point by the given ratio.Point2DDoublescale(int sx, int sy)Scales this point by the given ratio.Point2DDoublescale(long scale)Scales this point by the given ratio.Point2DDoublescale(long sx, long sy)Scales this point by the given ratio.Point2DDoublescale(short scale)Scales this point by the given ratio.Point2DDoublescale(short sx, short sy)Scales this point by the given ratio.Point2DDoublesubtract(byte dx, byte dy)Subtracts a given amount from the coordinates of this point.Point2DDoublesubtract(double dx, double dy)Subtracts a given amount from the coordinates of this point.Point2DDoublesubtract(float dx, float dy)Subtracts a given amount from the coordinates of this point.Point2DDoublesubtract(int dx, int dy)Subtracts a given amount from the coordinates of this point.Point2DDoublesubtract(long dx, long dy)Subtracts a given amount from the coordinates of this point.Point2DDoublesubtract(short dx, short dy)Subtracts a given amount from the coordinates of this point.Point2DDoublesubtract(Point2DLike<?> delta)Subtracts the given point from this point.StringtoString()Point2DDoubletranslate(byte dx, byte dy)Translates this point by the given delta.Point2DDoubletranslate(double dx, double dy)Translates this point by the given delta.Point2DDoubletranslate(float dx, float dy)Translates this point by the given delta.Point2DDoubletranslate(int dx, int dy)Translates this point by the given delta.Point2DDoubletranslate(long dx, long dy)Translates this point by the given delta.Point2DDoubletranslate(short dx, short dy)Translates this point by the given delta.Point2DDoubletranslate(Point2DLike<?> delta)Translates this point by the given delta.static Point2DDoubleunitDegrees(double degrees)Gets a unit vector pointing in the specified direction in degrees.static Point2DDoubleunitRadians(double radians)Gets a unit vector pointing in the specified direction in radians.static Point2DDoubleunitXNegative()Gets a unit vector pointing in the negative x-direction.static Point2DDoubleunitXPositive()Gets a unit vector pointing in the positive x-direction.static Point2DDoubleunitYNegative()Gets a unit vector pointing in the negative y-direction.static Point2DDoubleunitYPositive()Gets a unit vector pointing in the positive y-direction.Doublex()The x coordinate of this point.Point2DDoublex(Double x)Returns a point with the x coordinate set to the given value, while keeping other coordinates unchanged.Point2DDoublexByte(byte x)Returns a point with the x coordinate set to the given byte value, while keeping other coordinates unchanged.doublexDouble()The x coordinate of this point.Point2DDoublexDouble(double x)Returns a point with the x coordinate set to the given double value, while keeping other coordinates unchanged.Point2DDoublexFloat(float x)Returns a point with the x coordinate set to the given float value, while keeping other coordinates unchanged.Point2DDoublexInt(int x)Returns a point with the x coordinate set to the given int value, while keeping other coordinates unchanged.Point2DDoublexLong(long x)Returns a point with the x coordinate set to the given long value, while keeping other coordinates unchanged.Point2DDoublexShort(short x)Returns a point with the x coordinate set to the given short value, while keeping other coordinates unchanged.Doubley()The y coordinate of this point.Point2DDoubley(Double y)Returns a point with the y coordinate set to the given value, while keeping other coordinates unchanged.Point2DDoubleyByte(byte y)Returns a point with the y coordinate set to the given byte value, while keeping other coordinates unchanged.doubleyDouble()The y coordinate of this point, as a double.Point2DDoubleyDouble(double y)Returns a point with the y coordinate set to the given double value, while keeping other coordinates unchanged.Point2DDoubleyFloat(float y)Returns a point with the y coordinate set to the given float value, while keeping other coordinates unchanged.Point2DDoubleyInt(int y)Returns a point with the y coordinate set to the given int value, while keeping other coordinates unchanged.Point2DDoubleyLong(long y)Returns a point with the y coordinate set to the given long value, while keeping other coordinates unchanged.Point2DDoubleyShort(short y)Returns a point with the y coordinate set to the given short value, while keeping other coordinates unchanged.static Point2DDoublezero()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:Point1DLikeGets the coordinate of this point on the given axis.- Specified by:
coordinatein 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:Point2DLikeGets the coordinate of this point on the given axis.- Specified by:
coordinatein 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:Point1DLikeGets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.- Specified by:
coordinatein interfacePoint1DLike<Double>- Specified by:
coordinatein interfacePoint2D<Double>- Specified by:
coordinatein 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:Point2DLikeGets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.- Specified by:
coordinatein interfacePoint2D<Double>- Specified by:
coordinatein 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:Point1DLikeGets a point with the coordinate on the given axis set to the given byte value, while keeping other coordinates unchanged.- Specified by:
coordinateBytein interfacePoint1DLike<Double>- Specified by:
coordinateBytein interfacePoint2D<Double>- Specified by:
coordinateBytein 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:Point2DLikeGets a point with the coordinate on the given axis set to the given byte value, while keeping other coordinates unchanged.- Specified by:
coordinateBytein interfacePoint2D<Double>- Specified by:
coordinateBytein 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:Point1DLikeGets the coordinate of this point on the given axis, as a double.- Specified by:
coordinateDoublein 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:Point2DLikeGets the coordinate of this point on the given axis, as a double.- Specified by:
coordinateDoublein 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:Point1DLikeGets a point with the coordinate on the given axis set to the given double value, while keeping other coordinates unchanged.- Specified by:
coordinateDoublein interfacePoint1DLike<Double>- Specified by:
coordinateDoublein interfacePoint2D<Double>- Specified by:
coordinateDoublein 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:Point2DLikeGets a point with the coordinate on the given axis set to the given double value, while keeping other coordinates unchanged.- Specified by:
coordinateDoublein interfacePoint2D<Double>- Specified by:
coordinateDoublein 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:Point1DLikeGets a point with the coordinate on the given axis set to the given float value, while keeping other coordinates unchanged.- Specified by:
coordinateFloatin interfacePoint1DLike<Double>- Specified by:
coordinateFloatin interfacePoint2D<Double>- Specified by:
coordinateFloatin 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:Point2DLikeGets a point with the coordinate on the given axis set to the given float value, while keeping other coordinates unchanged.- Specified by:
coordinateFloatin interfacePoint2D<Double>- Specified by:
coordinateFloatin 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:Point1DLikeGets a point with the coordinate on the given axis set to the given int value, while keeping other coordinates unchanged.- Specified by:
coordinateIntin interfacePoint1DLike<Double>- Specified by:
coordinateIntin interfacePoint2D<Double>- Specified by:
coordinateIntin 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:Point2DLikeGets a point with the coordinate on the given axis set to the given int value, while keeping other coordinates unchanged.- Specified by:
coordinateIntin interfacePoint2D<Double>- Specified by:
coordinateIntin 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:Point1DLikeGets a point with the coordinate on the given axis set to the given long value, while keeping other coordinates unchanged.- Specified by:
coordinateLongin interfacePoint1DLike<Double>- Specified by:
coordinateLongin interfacePoint2D<Double>- Specified by:
coordinateLongin 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:Point2DLikeGets a point with the coordinate on the given axis set to the given long value, while keeping other coordinates unchanged.- Specified by:
coordinateLongin interfacePoint2D<Double>- Specified by:
coordinateLongin 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:Point1DLikeGets a point with the coordinate on the given axis set to the given short value, while keeping other coordinates unchanged.- Specified by:
coordinateShortin interfacePoint1DLike<Double>- Specified by:
coordinateShortin interfacePoint2D<Double>- Specified by:
coordinateShortin 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:Point2DLikeGets a point with the coordinate on the given axis set to the given short value, while keeping other coordinates unchanged.- Specified by:
coordinateShortin interfacePoint2D<Double>- Specified by:
coordinateShortin 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:PointGets the length of this point as a byte (when interpreted as a vector from the origin).- Specified by:
lengthBytein interfacePoint- Returns:
- The length of this point as a byte.
-
lengthDouble
public double lengthDouble()
Description copied from interface:PointGets the length of this point as a double (when interpreted as a vector from the origin).- Specified by:
lengthDoublein interfacePoint- Returns:
- The length of this point as a double.
-
lengthFloat
public float lengthFloat()
Description copied from interface:PointGets the length of this point as a float (when interpreted as a vector from the origin).- Specified by:
lengthFloatin interfacePoint- Returns:
- The length of this point as a float.
-
lengthInt
public int lengthInt()
Description copied from interface:PointGets the length of this point as an int (when interpreted as a vector from the origin).
-
lengthLong
public long lengthLong()
Description copied from interface:PointGets the length of this point as a long (when interpreted as a vector from the origin).- Specified by:
lengthLongin interfacePoint- Returns:
- The length of this point as a double.
-
lengthShort
public short lengthShort()
Description copied from interface:PointGets the length of this point as a byte (when interpreted as a vector from the origin).- Specified by:
lengthShortin 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:PointNormalizes this point so that itslengthis 1. When its length is 0, returns this point unchanged.
-
rotateDegrees
public Point2DDouble rotateDegrees(double degrees)
Description copied from interface:Point2DRotates this point around the origin (0, 0) by the given angle in degrees, in an anti-clockwise direction.- Specified by:
rotateDegreesin 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:Point2DLikeRotates this point on the xy plane around the origin by the given angle in degrees, in an anti-clockwise direction.- Specified by:
rotateDegreesXYin interfacePoint2D<Double>- Specified by:
rotateDegreesXYin 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:Point2DRotates this point around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.- Specified by:
rotateRadiansin 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:Point2DLikeRotates this point on the xy plane around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.- Specified by:
rotateRadiansXYin interfacePoint2D<Double>- Specified by:
rotateRadiansXYin 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:PointScales this point by the given ratio.- Specified by:
scalein interfacePoint- Specified by:
scalein interfacePoint1DLike<Double>- Specified by:
scalein interfacePoint2D<Double>- Specified by:
scalein 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:PointScales this point by the given ratio.- Specified by:
scalein interfacePoint- Specified by:
scalein interfacePoint1DLike<Double>- Specified by:
scalein interfacePoint2D<Double>- Specified by:
scalein 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:PointScales this point by the given ratio.- Specified by:
scalein interfacePoint- Specified by:
scalein interfacePoint1DLike<Double>- Specified by:
scalein interfacePoint2D<Double>- Specified by:
scalein 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:PointScales this point by the given ratio.- Specified by:
scalein interfacePoint- Specified by:
scalein interfacePoint1DLike<Double>- Specified by:
scalein interfacePoint2D<Double>- Specified by:
scalein 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:PointScales this point by the given ratio.- Specified by:
scalein interfacePoint- Specified by:
scalein interfacePoint1DLike<Double>- Specified by:
scalein interfacePoint2D<Double>- Specified by:
scalein 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:PointScales this point by the given ratio.- Specified by:
scalein interfacePoint- Specified by:
scalein interfacePoint1DLike<Double>- Specified by:
scalein interfacePoint2D<Double>- Specified by:
scalein 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:Point2DScales this point by the given ratio.
-
scale
public Point2DDouble scale(short sx, short sy)
Description copied from interface:Point2DScales this point by the given ratio.
-
scale
public Point2DDouble scale(int sx, int sy)
Description copied from interface:Point2DScales this point by the given ratio.
-
scale
public Point2DDouble scale(long sx, long sy)
Description copied from interface:Point2DScales this point by the given ratio.
-
scale
public Point2DDouble scale(float sx, float sy)
Description copied from interface:Point2DScales this point by the given ratio.
-
scale
public Point2DDouble scale(double sx, double sy)
Description copied from interface:Point2DScales this point by the given ratio.
-
subtract
public Point2DDouble subtract(byte dx, byte dy)
Description copied from interface:Point2DSubtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(int dx, int dy)
Description copied from interface:Point2DSubtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(short dx, short dy)
Description copied from interface:Point2DSubtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(long dx, long dy)
Description copied from interface:Point2DSubtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(float dx, float dy)
Description copied from interface:Point2DSubtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(double dx, double dy)
Description copied from interface:Point2DSubtracts a given amount from the coordinates of this point.
-
subtract
public Point2DDouble subtract(Point2DLike<?> delta)
Description copied from interface:Point2DSubtracts the given point from this point.
-
translate
public Point2DDouble translate(Point2DLike<?> delta)
Description copied from interface:Point2DTranslates this point by the given delta.
-
translate
public Point2DDouble translate(byte dx, byte dy)
Description copied from interface:Point2DTranslates this point by the given delta.
-
translate
public Point2DDouble translate(short dx, short dy)
Description copied from interface:Point2DTranslates this point by the given delta.
-
translate
public Point2DDouble translate(int dx, int dy)
Description copied from interface:Point2DTranslates this point by the given delta.
-
translate
public Point2DDouble translate(long dx, long dy)
Description copied from interface:Point2DTranslates this point by the given delta.
-
translate
public Point2DDouble translate(float dx, float dy)
Description copied from interface:Point2DTranslates this point by the given delta.
-
translate
public Point2DDouble translate(double dx, double dy)
Description copied from interface:Point2DTranslates this point by the given delta.
-
x
public Point2DDouble x(Double x)
Description copied from interface:Point1DLikeReturns a point with the x coordinate set to the given value, while keeping other coordinates unchanged.- Specified by:
xin interfacePoint1DLike<Double>- Specified by:
xin interfacePoint2D<Double>- Specified by:
xin 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:Point1DLikeThe x coordinate of this point.- Specified by:
xin interfacePoint1DLike<Double>- Returns:
- the x coordinate
-
xByte
public Point2DDouble xByte(byte x)
Description copied from interface:Point1DLikeReturns a point with the x coordinate set to the given byte value, while keeping other coordinates unchanged.- Specified by:
xBytein interfacePoint1DLike<Double>- Specified by:
xBytein interfacePoint2D<Double>- Specified by:
xBytein 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:Point1DLikeReturns a point with the x coordinate set to the given double value, while keeping other coordinates unchanged.- Specified by:
xDoublein interfacePoint1DLike<Double>- Specified by:
xDoublein interfacePoint2D<Double>- Specified by:
xDoublein 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:Point1DLikeThe x coordinate of this point.- Specified by:
xDoublein interfacePoint1DLike<Double>- Returns:
- the x coordinate
-
xFloat
public Point2DDouble xFloat(float x)
Description copied from interface:Point1DLikeReturns a point with the x coordinate set to the given float value, while keeping other coordinates unchanged.- Specified by:
xFloatin interfacePoint1DLike<Double>- Specified by:
xFloatin interfacePoint2D<Double>- Specified by:
xFloatin 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:Point1DLikeReturns a point with the x coordinate set to the given int value, while keeping other coordinates unchanged.- Specified by:
xIntin interfacePoint1DLike<Double>- Specified by:
xIntin interfacePoint2D<Double>- Specified by:
xIntin 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:Point1DLikeReturns a point with the x coordinate set to the given long value, while keeping other coordinates unchanged.- Specified by:
xLongin interfacePoint1DLike<Double>- Specified by:
xLongin interfacePoint2D<Double>- Specified by:
xLongin 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:Point1DLikeReturns a point with the x coordinate set to the given short value, while keeping other coordinates unchanged.- Specified by:
xShortin interfacePoint1DLike<Double>- Specified by:
xShortin interfacePoint2D<Double>- Specified by:
xShortin 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:Point2DLikeReturns a point with the y coordinate set to the given value, while keeping other coordinates unchanged.
-
y
public Double y()
Description copied from interface:Point2DLikeThe y coordinate of this point.- Specified by:
yin interfacePoint2DLike<Double>- Returns:
- the y coordinate
-
yByte
public Point2DDouble yByte(byte y)
Description copied from interface:Point2DLikeReturns 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:Point2DLikeReturns 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:Point2DLikeThe y coordinate of this point, as a double.- Specified by:
yDoublein interfacePoint2DLike<Double>- Returns:
- the y coordinate
-
yFloat
public Point2DDouble yFloat(float y)
Description copied from interface:Point2DLikeReturns 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:Point2DLikeReturns 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:Point2DLikeReturns 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:Point2DLikeReturns 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).
-
-