Package de.xima.fc.common.geometry
Interface Point
-
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
Point1D<Numerical>
,Point1DLike<Numerical>
,Point2D<Numerical>
,Point2DLike<Numerical>
- All Known Implementing Classes:
Point2DDouble
public interface Point extends Serializable
An n-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 Modifier and Type Method Description int
dimensions()
The dimension of the point, which is the number of coordinates it has.byte
lengthByte()
Gets the length of this point as a byte (when interpreted as a vector from the origin).double
lengthDouble()
Gets the length of this point as a double (when interpreted as a vector from the origin).float
lengthFloat()
Gets the length of this point as a float (when interpreted as a vector from the origin).int
lengthInt()
Gets the length of this point as an int (when interpreted as a vector from the origin).long
lengthLong()
Gets the length of this point as a long (when interpreted as a vector from the origin).short
lengthShort()
Gets the length of this point as a byte (when interpreted as a vector from the origin).Point
normalize()
Normalizes this point so that itslength
is 1.Point
scale(byte scale)
Scales this point by the given ratio.Point
scale(double scale)
Scales this point by the given ratio.Point
scale(float scale)
Scales this point by the given ratio.Point
scale(int scale)
Scales this point by the given ratio.Point
scale(long scale)
Scales this point by the given ratio.Point
scale(short scale)
Scales this point by the given ratio.
-
-
-
Method Detail
-
dimensions
int dimensions()
The dimension of the point, which is the number of coordinates it has.- Returns:
- The dimensionality of the point.
-
lengthByte
byte lengthByte()
Gets the length of this point as a byte (when interpreted as a vector from the origin).- Returns:
- The length of this point as a byte.
-
lengthDouble
double lengthDouble()
Gets the length of this point as a double (when interpreted as a vector from the origin).- Returns:
- The length of this point as a double.
-
lengthFloat
float lengthFloat()
Gets the length of this point as a float (when interpreted as a vector from the origin).- Returns:
- The length of this point as a float.
-
lengthInt
int lengthInt()
Gets the length of this point as an int (when interpreted as a vector from the origin).- Returns:
- The length of this point as an int.
-
lengthLong
long lengthLong()
Gets the length of this point as a long (when interpreted as a vector from the origin).- Returns:
- The length of this point as a double.
-
lengthShort
short lengthShort()
Gets the length of this point as a byte (when interpreted as a vector from the origin).- Returns:
- The length of this point as a short.
-
normalize
Point normalize()
Normalizes this point so that itslength
is 1. When its length is 0, returns this point unchanged.- Returns:
- The normalized point with length 1, or this point unchanged if its length is 0.
-
scale
Point scale(byte scale)
Scales this point by the given ratio.- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
Point scale(int scale)
Scales this point by the given ratio.- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
Point scale(long scale)
Scales this point by the given ratio.- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
Point scale(float scale)
Scales this point by the given ratio.- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
Point scale(double scale)
Scales this point by the given ratio.- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
scale
Point scale(short scale)
Scales this point by the given ratio.- Parameters:
scale
- The ratio in all directions to scale by.- Returns:
- A new point that is the result of the scaling.
-
-