Package de.xima.fc.common.geometry
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
public interface Point2DLike<Numerical extends Number> extends Point1DLike<Numerical>
A point with coordinates of typeNumber
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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Point2DLike<Numerical>
coordinate(ECartesianAxis1D axis, Numerical coordinate)
Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.Numerical
coordinate(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis.Point2DLike<Numerical>
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.Point2DLike<Numerical>
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 byte
coordinateByte(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis, as a byte.Point2DLike<Numerical>
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.Point2DLike<Numerical>
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 double
coordinateDouble(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis, as a double.Point2DLike<Numerical>
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.Point2DLike<Numerical>
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 float
coordinateFloat(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis, as a float.Point2DLike<Numerical>
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.Point2DLike<Numerical>
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 int
coordinateInt(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis, as an integer.Point2DLike<Numerical>
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.Point2DLike<Numerical>
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 long
coordinateLong(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis, as a long.Point2DLike<Numerical>
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.Point2DLike<Numerical>
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 short
coordinateShort(ECartesianAxis2D axis)
Gets the coordinate of this point on the given axis, as an integer.Point2DLike<Numerical>
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.Point2DLike<Numerical>
normalize()
Normalizes this point so that itslength
is 1.Point2DLike<Numerical>
rotateDegreesXY(double angleDegrees)
Rotates this point on the xy plane around the origin by the given angle in degrees, in an anti-clockwise direction.Point2DLike<Numerical>
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.Point2DLike<Numerical>
scale(byte scale)
Scales this point by the given ratio.Point2DLike<Numerical>
scale(double scale)
Scales this point by the given ratio.Point2DLike<Numerical>
scale(float scale)
Scales this point by the given ratio.Point2DLike<Numerical>
scale(int scale)
Scales this point by the given ratio.Point2DLike<Numerical>
scale(long scale)
Scales this point by the given ratio.Point2DLike<Numerical>
scale(short scale)
Scales this point by the given ratio.Point2DLike<Numerical>
x(Numerical x)
Returns a point with the x coordinate set to the given value, while keeping other coordinates unchanged.Point2DLike<Numerical>
xByte(byte x)
Returns a point with the x coordinate set to the given byte value, while keeping other coordinates unchanged.Point2DLike<Numerical>
xDouble(double x)
Returns a point with the x coordinate set to the given double value, while keeping other coordinates unchanged.Point2DLike<Numerical>
xFloat(float x)
Returns a point with the x coordinate set to the given float value, while keeping other coordinates unchanged.Point2DLike<Numerical>
xInt(int x)
Returns a point with the x coordinate set to the given int value, while keeping other coordinates unchanged.Point2DLike<Numerical>
xLong(long x)
Returns a point with the x coordinate set to the given long value, while keeping other coordinates unchanged.Point2DLike<Numerical>
xShort(short x)
Returns a point with the x coordinate set to the given short value, while keeping other coordinates unchanged.Numerical
y()
The y coordinate of this point.Point2DLike<Numerical>
y(Numerical y)
Returns a point with the y coordinate set to the given value, while keeping other coordinates unchanged.default byte
yByte()
The y coordinate of this point, as a byte.Point2DLike<Numerical>
yByte(byte yByte)
Returns a point with the y coordinate set to the given byte value, while keeping other coordinates unchanged.default double
yDouble()
The y coordinate of this point, as a double.Point2DLike<Numerical>
yDouble(double yDouble)
Returns a point with the y coordinate set to the given double value, while keeping other coordinates unchanged.default float
yFloat()
The y coordinate of this point, as a float.Point2DLike<Numerical>
yFloat(float yFloat)
Returns a point with the y coordinate set to the given float value, while keeping other coordinates unchanged.default int
yInt()
The y coordinate of this point, as an int.Point2DLike<Numerical>
yInt(int yInt)
Returns a point with the y coordinate set to the given int value, while keeping other coordinates unchanged.default long
yLong()
The y coordinate of this point, as a long.Point2DLike<Numerical>
yLong(long yLong)
Returns a point with the y coordinate set to the given long value, while keeping other coordinates unchanged.default short
yShort()
The y coordinate of this point, as a short.Point2DLike<Numerical>
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 de.xima.fc.common.geometry.Point
dimensions, lengthByte, lengthDouble, lengthFloat, lengthInt, lengthLong, lengthShort
-
Methods inherited from interface de.xima.fc.common.geometry.Point1DLike
coordinate, coordinateByte, coordinateDouble, coordinateFloat, coordinateInt, coordinateLong, coordinateShort, x, xByte, xDouble, xFloat, xInt, xLong, xShort
-
-
-
-
Method Detail
-
coordinate
Numerical coordinate(ECartesianAxis2D axis)
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
Point2DLike<Numerical> coordinate(ECartesianAxis1D axis, Numerical 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<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
Point2DLike<Numerical> 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.- 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
default byte coordinateByte(ECartesianAxis2D axis)
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
Point2DLike<Numerical> 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<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
Point2DLike<Numerical> 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.- 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
default double coordinateDouble(ECartesianAxis2D axis)
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
Point2DLike<Numerical> 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<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
Point2DLike<Numerical> 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.- 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
default float coordinateFloat(ECartesianAxis2D axis)
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
Point2DLike<Numerical> 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<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
Point2DLike<Numerical> 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.- 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
default int coordinateInt(ECartesianAxis2D axis)
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
Point2DLike<Numerical> 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<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
Point2DLike<Numerical> 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.- 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
default long coordinateLong(ECartesianAxis2D axis)
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
Point2DLike<Numerical> 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<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
Point2DLike<Numerical> 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.- 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
default short coordinateShort(ECartesianAxis2D axis)
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
Point2DLike<Numerical> 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<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
Point2DLike<Numerical> 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.- 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:Point
Normalizes this point so that itslength
is 1. When its length is 0, returns this point unchanged.
-
rotateDegreesXY
Point2DLike<Numerical> rotateDegreesXY(double angleDegrees)
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
Point2DLike<Numerical> 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.- Parameters:
angleRadians
- The angle in radians to rotate the point.- Returns:
- A new point that is the result of the rotation.
-
scale
Point2DLike<Numerical> scale(int scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point2DLike<Numerical> scale(long scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point2DLike<Numerical> scale(float scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point2DLike<Numerical> scale(double scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point2DLike<Numerical> scale(byte scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point2DLike<Numerical> scale(short scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
x
Point2DLike<Numerical> x(Numerical 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<Numerical extends Number>
- Parameters:
x
- The new x coordinate value- Returns:
- A point with the specified x coordinate.
-
xByte
Point2DLike<Numerical> 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<Numerical extends Number>
- Parameters:
x
- The new x coordinate value as a byte- Returns:
- A point with the specified x coordinate.
-
xDouble
Point2DLike<Numerical> 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<Numerical extends Number>
- Parameters:
x
- The new x coordinate value as a double- Returns:
- A point with the specified x coordinate.
-
xFloat
Point2DLike<Numerical> 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<Numerical extends Number>
- Parameters:
x
- The new x coordinate value as a float- Returns:
- A point with the specified x coordinate.
-
xInt
Point2DLike<Numerical> 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<Numerical extends Number>
- Parameters:
x
- The new x coordinate value as an int- Returns:
- A point with the specified x coordinate.
-
xLong
Point2DLike<Numerical> 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<Numerical extends Number>
- Parameters:
x
- The new x coordinate value as a long- Returns:
- A point with the specified x coordinate.
-
xShort
Point2DLike<Numerical> 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<Numerical extends Number>
- Parameters:
x
- The new x coordinate value as a short- Returns:
- A point with the specified x coordinate.
-
y
Numerical y()
The y coordinate of this point.- Returns:
- the y coordinate
-
y
Point2DLike<Numerical> y(Numerical 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
Point2DLike<Numerical> yByte(byte 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
Point2DLike<Numerical> yDouble(double 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
Point2DLike<Numerical> yFloat(float 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
Point2DLike<Numerical> yInt(int 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
Point2DLike<Numerical> yLong(long 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
Point2DLike<Numerical> yShort(short 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.
-
-