Interface Point
- All Superinterfaces:
Serializable
- All Known Subinterfaces:
Point1D<Numerical>, Point1DLike<Numerical>, Point2D<Numerical>, Point2DLike<Numerical>
- All Known Implementing Classes:
Point2DDouble
An n-dimensional point with coordinates of type
Number. 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 TypeMethodDescriptionintThe dimension of the point, which is the number of coordinates it has.byteGets the length of this point as a byte (when interpreted as a vector from the origin).doubleGets the length of this point as a double (when interpreted as a vector from the origin).floatGets the length of this point as a float (when interpreted as a vector from the origin).intGets the length of this point as an int (when interpreted as a vector from the origin).longGets the length of this point as a long (when interpreted as a vector from the origin).shortGets the length of this point as a byte (when interpreted as a vector from the origin).Normalizes this point so that itslengthis 1.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.
-
Method Details
-
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
-
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
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
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
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
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
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.
-