Interface Point2DLike<Numerical extends Number>
- Type Parameters:
Numerical- The type of the coordinates, which must be a subclass ofNumber.
- All Superinterfaces:
Point, Point1DLike<Numerical>, Serializable
- All Known Subinterfaces:
Point2D<Numerical>
- All Known Implementing Classes:
Point2DDouble
A point with coordinates of type
Number that has a dimension of at least 2. Some operations may be 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.- Since:
- 8.4.0
-
Method Summary
Modifier and TypeMethodDescriptioncoordinate(ECartesianAxis1D axis, Numerical coordinate) Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.coordinate(ECartesianAxis2D axis) Gets the coordinate of this point on the given axis.coordinate(ECartesianAxis2D axis, Numerical coordinate) Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.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.default byteGets the coordinate of this point on the given axis, as a byte.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.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.default doubleGets the coordinate of this point on the given axis, as a double.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.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.default floatGets the coordinate of this point on the given axis, as a float.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.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.default intGets the coordinate of this point on the given axis, as an integer.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.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.default longGets the coordinate of this point on the given axis, as a long.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.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.default shortGets the coordinate of this point on the given axis, as an integer.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.Normalizes this point so that itslengthis 1.rotateDegreesXY(double angleDegrees) Rotates this point on the xy plane around the origin by the given angle in degrees, in an anti-clockwise direction.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.scale(byte scale) Scales this point by the given ratio.scale(double scale) Scales this point by the given ratio.scale(float scale) Scales this point by the given ratio.scale(int scale) Scales this point by the given ratio.scale(long scale) Scales this point by the given ratio.scale(short scale) Scales this point by the given ratio.Returns a point with the x coordinate set to the given value, while keeping other coordinates unchanged.xByte(byte x) Returns a point with the x coordinate set to the given byte value, while keeping other coordinates unchanged.xDouble(double x) Returns a point with the x coordinate set to the given double value, while keeping other coordinates unchanged.xFloat(float x) Returns a point with the x coordinate set to the given float value, while keeping other coordinates unchanged.xInt(int x) Returns a point with the x coordinate set to the given int value, while keeping other coordinates unchanged.xLong(long x) Returns a point with the x coordinate set to the given long value, while keeping other coordinates unchanged.xShort(short x) Returns a point with the x coordinate set to the given short value, while keeping other coordinates unchanged.y()The y coordinate of this point.Returns a point with the y coordinate set to the given value, while keeping other coordinates unchanged.default byteyByte()The y coordinate of this point, as a byte.yByte(byte yByte) Returns a point with the y coordinate set to the given byte value, while keeping other coordinates unchanged.default doubleyDouble()The y coordinate of this point, as a double.yDouble(double yDouble) Returns a point with the y coordinate set to the given double value, while keeping other coordinates unchanged.default floatyFloat()The y coordinate of this point, as a float.yFloat(float yFloat) Returns a point with the y coordinate set to the given float value, while keeping other coordinates unchanged.default intyInt()The y coordinate of this point, as an int.yInt(int yInt) Returns a point with the y coordinate set to the given int value, while keeping other coordinates unchanged.default longyLong()The y coordinate of this point, as a long.yLong(long yLong) Returns a point with the y coordinate set to the given long value, while keeping other coordinates unchanged.default shortyShort()The y coordinate of this point, as a short.yShort(short yShort) Returns a point with the y coordinate set to the given short value, while keeping other coordinates unchanged.Methods inherited from interface Point
dimensions, lengthByte, lengthDouble, lengthFloat, lengthInt, lengthLong, lengthShortMethods inherited from interface Point1DLike
coordinate, coordinateByte, coordinateDouble, coordinateFloat, coordinateInt, coordinateLong, coordinateShort, x, xByte, xDouble, xFloat, xInt, xLong, xShort
-
Method Details
-
coordinate
Gets the coordinate of this point on the given axis.- Parameters:
axis- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
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<Numerical extends Number>- 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
Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.- 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
Gets the coordinate of this point on the given axis, as a byte.- Parameters:
axis- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateByte
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<Numerical extends Number>- 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
Gets a point with the coordinate on the given axis set to the given byte value, while keeping other coordinates unchanged.- 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
Gets the coordinate of this point on the given axis, as a double.- Parameters:
axis- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateDouble
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<Numerical extends Number>- 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
Gets a point with the coordinate on the given axis set to the given double value, while keeping other coordinates unchanged.- 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
Gets the coordinate of this point on the given axis, as a float.- Parameters:
axis- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateFloat
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<Numerical extends Number>- 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
Gets a point with the coordinate on the given axis set to the given float value, while keeping other coordinates unchanged.- 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
Gets the coordinate of this point on the given axis, as an integer.- Parameters:
axis- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateInt
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<Numerical extends Number>- 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
Gets a point with the coordinate on the given axis set to the given int value, while keeping other coordinates unchanged.- 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
Gets the coordinate of this point on the given axis, as a long.- Parameters:
axis- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateLong
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<Numerical extends Number>- 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
Gets a point with the coordinate on the given axis set to the given long value, while keeping other coordinates unchanged.- 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
Gets the coordinate of this point on the given axis, as an integer.- Parameters:
axis- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateShort
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<Numerical extends Number>- 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
Gets a point with the coordinate on the given axis set to the given short value, while keeping other coordinates unchanged.- 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.
-
normalize
Point2DLike<Numerical> normalize()Description copied from interface:PointNormalizes this point so that itslengthis 1. When its length is 0, returns this point unchanged. -
rotateDegreesXY
Rotates this point on the xy plane around the origin by the given angle in degrees, in an anti-clockwise direction.- Parameters:
angleDegrees- The angle in angleDegrees to rotate the point.- Returns:
- A new point that is the result of the rotation.
-
rotateRadiansXY
Rotates this point on the xy plane around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.- Parameters:
angleRadians- The angle in radians to rotate the point.- Returns:
- A new point that is the result of the rotation.
-
scale
Description copied from interface:PointScales this point by the given ratio. -
scale
Description copied from interface:PointScales this point by the given ratio. -
scale
Description copied from interface:PointScales this point by the given ratio. -
scale
Description copied from interface:PointScales this point by the given ratio. -
scale
Description copied from interface:PointScales this point by the given ratio. -
scale
Description copied from interface:PointScales this point by the given ratio. -
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<Numerical extends Number>- Parameters:
x- The new x coordinate value- Returns:
- A point with the specified x coordinate.
-
xByte
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<Numerical extends Number>- Parameters:
x- The new x coordinate value as a byte- Returns:
- A point with the specified x coordinate.
-
xDouble
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<Numerical extends Number>- Parameters:
x- The new x coordinate value as a double- Returns:
- A point with the specified x coordinate.
-
xFloat
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<Numerical extends Number>- Parameters:
x- The new x coordinate value as a float- Returns:
- A point with the specified x coordinate.
-
xInt
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<Numerical extends Number>- Parameters:
x- The new x coordinate value as an int- Returns:
- A point with the specified x coordinate.
-
xLong
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<Numerical extends Number>- Parameters:
x- The new x coordinate value as a long- Returns:
- A point with the specified x coordinate.
-
xShort
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<Numerical extends Number>- Parameters:
x- The new x coordinate value as a short- Returns:
- A point with the specified x coordinate.
-
y
-
y
Returns a point with the y coordinate set to the given value, while keeping other coordinates unchanged.- Parameters:
y- The new y coordinate value- Returns:
- A point with the specified y coordinate.
-
yByte
default byte yByte()The y coordinate of this point, as a byte.- Returns:
- the y coordinate
-
yByte
Returns a point with the y coordinate set to the given byte value, while keeping other coordinates unchanged.- Parameters:
yByte- The new y coordinate value as a byte- Returns:
- A point with the specified y coordinate.
-
yDouble
default double yDouble()The y coordinate of this point, as a double.- Returns:
- the y coordinate
-
yDouble
Returns a point with the y coordinate set to the given double value, while keeping other coordinates unchanged.- Parameters:
yDouble- The new y coordinate value as a double- Returns:
- A point with the specified y coordinate.
-
yFloat
default float yFloat()The y coordinate of this point, as a float.- Returns:
- the y coordinate
-
yFloat
Returns a point with the y coordinate set to the given float value, while keeping other coordinates unchanged.- Parameters:
yFloat- The new y coordinate value as a float- Returns:
- A point with the specified y coordinate.
-
yInt
default int yInt()The y coordinate of this point, as an int.- Returns:
- the y coordinate
-
yInt
Returns a point with the y coordinate set to the given int value, while keeping other coordinates unchanged.- Parameters:
yInt- The new y coordinate value as an int- Returns:
- A point with the specified y coordinate.
-
yLong
default long yLong()The y coordinate of this point, as a long.- Returns:
- the y coordinate
-
yLong
Returns a point with the y coordinate set to the given long value, while keeping other coordinates unchanged.- Parameters:
yLong- The new y coordinate value as a long- Returns:
- A point with the specified y coordinate.
-
yShort
default short yShort()The y coordinate of this point, as a short.- Returns:
- the y coordinate
-
yShort
Returns a point with the y coordinate set to the given short value, while keeping other coordinates unchanged.- Parameters:
yShort- The new y coordinate value as a short- Returns:
- A point with the specified y coordinate.
-