Package de.xima.fc.common.geometry
Interface Point1DLike<Numerical extends Number>
-
- Type Parameters:
Numerical
- The type of the coordinates, which must be a subclass ofNumber
.
- All Superinterfaces:
Point
,Serializable
- All Known Subinterfaces:
Point1D<Numerical>
,Point2D<Numerical>
,Point2DLike<Numerical>
- All Known Implementing Classes:
Point2DDouble
public interface Point1DLike<Numerical extends Number> extends Point
A 2-dimensional point with coordinates of typeNumber
. 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 Numerical
coordinate(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis.Point1DLike<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.default byte
coordinateByte(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis, as a byte.Point1DLike<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 double
coordinateDouble(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis, as a double.Point1DLike<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 float
coordinateFloat(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis, as a float.Point1DLike<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 int
coordinateInt(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis, as an integer.Point1DLike<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 long
coordinateLong(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis, as a long.Point1DLike<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 short
coordinateShort(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis, as a short.Point1DLike<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.Point1DLike<Numerical>
normalize()
Normalizes this point so that itslength
is 1.Point1DLike<Numerical>
scale(byte scale)
Scales this point by the given ratio.Point1DLike<Numerical>
scale(double scale)
Scales this point by the given ratio.Point1DLike<Numerical>
scale(float scale)
Scales this point by the given ratio.Point1DLike<Numerical>
scale(int scale)
Scales this point by the given ratio.Point1DLike<Numerical>
scale(long scale)
Scales this point by the given ratio.Point1DLike<Numerical>
scale(short scale)
Scales this point by the given ratio.Numerical
x()
The x coordinate of this point.Point1DLike<Numerical>
x(Numerical x)
Returns a point with the x coordinate set to the given value, while keeping other coordinates unchanged.default byte
xByte()
The x coordinate of this point, as a byte.Point1DLike<Numerical>
xByte(byte x)
Returns a point with the x coordinate set to the given byte value, while keeping other coordinates unchanged.default double
xDouble()
The x coordinate of this point.Point1DLike<Numerical>
xDouble(double x)
Returns a point with the x coordinate set to the given double value, while keeping other coordinates unchanged.default float
xFloat()
The x coordinate of this point, as a float.Point1DLike<Numerical>
xFloat(float x)
Returns a point with the x coordinate set to the given float value, while keeping other coordinates unchanged.default int
xInt()
The x coordinate of this point, as an int.Point1DLike<Numerical>
xInt(int x)
Returns a point with the x coordinate set to the given int value, while keeping other coordinates unchanged.default long
xLong()
The x coordinate of this point, as a long.Point1DLike<Numerical>
xLong(long x)
Returns a point with the x coordinate set to the given long value, while keeping other coordinates unchanged.default short
xShort()
The x coordinate of this point, as a short.Point1DLike<Numerical>
xShort(short x)
Returns a point with the x 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
-
-
-
-
Method Detail
-
coordinate
Numerical coordinate(ECartesianAxis1D 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
Point1DLike<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.- 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(ECartesianAxis1D 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
Point1DLike<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.- 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(ECartesianAxis1D 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
Point1DLike<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.- 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(ECartesianAxis1D 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
Point1DLike<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.- 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(ECartesianAxis1D 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
Point1DLike<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.- 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(ECartesianAxis1D 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
Point1DLike<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.- 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(ECartesianAxis1D axis)
Gets the coordinate of this point on the given axis, as a short.- Parameters:
axis
- The axis for which to get the coordinate.- Returns:
- The coordinate of this point on the given axis.
-
coordinateShort
Point1DLike<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.- 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
Point1DLike<Numerical> normalize()
Description copied from interface:Point
Normalizes this point so that itslength
is 1. When its length is 0, returns this point unchanged.
-
scale
Point1DLike<Numerical> scale(int scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point1DLike<Numerical> scale(long scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point1DLike<Numerical> scale(float scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point1DLike<Numerical> scale(double scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point1DLike<Numerical> scale(byte scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
scale
Point1DLike<Numerical> scale(short scale)
Description copied from interface:Point
Scales this point by the given ratio.
-
x
Numerical x()
The x coordinate of this point.- Returns:
- the x coordinate
-
x
Point1DLike<Numerical> x(Numerical x)
Returns a point with the x coordinate set to the given value, while keeping other coordinates unchanged.- Parameters:
x
- The new x coordinate value- Returns:
- A point with the specified x coordinate.
-
xByte
default byte xByte()
The x coordinate of this point, as a byte.- Returns:
- the x coordinate
-
xByte
Point1DLike<Numerical> xByte(byte x)
Returns a point with the x coordinate set to the given byte value, while keeping other coordinates unchanged.- Parameters:
x
- The new x coordinate value as a byte- Returns:
- A point with the specified x coordinate.
-
xDouble
default double xDouble()
The x coordinate of this point.- Returns:
- the x coordinate
-
xDouble
Point1DLike<Numerical> xDouble(double x)
Returns a point with the x coordinate set to the given double value, while keeping other coordinates unchanged.- Parameters:
x
- The new x coordinate value as a double- Returns:
- A point with the specified x coordinate.
-
xFloat
default float xFloat()
The x coordinate of this point, as a float.- Returns:
- the x coordinate
-
xFloat
Point1DLike<Numerical> xFloat(float x)
Returns a point with the x coordinate set to the given float value, while keeping other coordinates unchanged.- Parameters:
x
- The new x coordinate value as a float- Returns:
- A point with the specified x coordinate.
-
xInt
default int xInt()
The x coordinate of this point, as an int.- Returns:
- the x coordinate
-
xInt
Point1DLike<Numerical> xInt(int x)
Returns a point with the x coordinate set to the given int value, while keeping other coordinates unchanged.- Parameters:
x
- The new x coordinate value as an int- Returns:
- A point with the specified x coordinate.
-
xLong
default long xLong()
The x coordinate of this point, as a long.- Returns:
- the x coordinate
-
xLong
Point1DLike<Numerical> xLong(long x)
Returns a point with the x coordinate set to the given long value, while keeping other coordinates unchanged.- Parameters:
x
- The new x coordinate value as a long- Returns:
- A point with the specified x coordinate.
-
xShort
default short xShort()
The x coordinate of this point, as a short.- Returns:
- the x coordinate
-
xShort
Point1DLike<Numerical> xShort(short x)
Returns a point with the x coordinate set to the given short value, while keeping other coordinates unchanged.- Parameters:
x
- The new x coordinate value as a short- Returns:
- A point with the specified x coordinate.
-
-