Interface Point2D<Numerical extends Number>

  • Type Parameters:
    Numerical - The type of the coordinates, which must be a subclass of Number.
    All Superinterfaces:
    Point, Point1DLike<Numerical>, Point2DLike<Numerical>, Serializable
    All Known Implementing Classes:
    Point2DDouble

    public interface Point2D<Numerical extends Number>
    extends Point2DLike<Numerical>
    A 2-dimensional point with coordinates of type Number. Some operations are 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 Detail

      • coordinate

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        coordinate in interface Point2DLike<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

        Point2D<Numerical> coordinate​(ECartesianAxis2D axis,
                                      Numerical coordinate)
        Description copied from interface: Point2DLike
        Gets a point with the coordinate on the given axis set to the given value, while keeping other coordinates unchanged.
        Specified by:
        coordinate in interface Point2DLike<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.
      • coordinateByte

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        coordinateByte in interface Point2DLike<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

        Point2D<Numerical> coordinateByte​(ECartesianAxis2D axis,
                                          byte coordinate)
        Description copied from interface: Point2DLike
        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 interface Point2DLike<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.
      • coordinateDouble

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        coordinateDouble in interface Point2DLike<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

        Point2D<Numerical> coordinateDouble​(ECartesianAxis2D axis,
                                            double coordinate)
        Description copied from interface: Point2DLike
        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 interface Point2DLike<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.
      • coordinateFloat

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        coordinateFloat in interface Point2DLike<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

        Point2D<Numerical> coordinateFloat​(ECartesianAxis2D axis,
                                           float coordinate)
        Description copied from interface: Point2DLike
        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 interface Point2DLike<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.
      • coordinateInt

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        coordinateInt in interface Point2DLike<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

        Point2D<Numerical> coordinateInt​(ECartesianAxis2D axis,
                                         int coordinate)
        Description copied from interface: Point2DLike
        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 interface Point2DLike<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.
      • coordinateLong

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        coordinateLong in interface Point2DLike<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

        Point2D<Numerical> coordinateLong​(ECartesianAxis2D axis,
                                          long coordinate)
        Description copied from interface: Point2DLike
        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 interface Point2DLike<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.
      • coordinateShort

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        coordinateShort in interface Point2DLike<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

        Point2D<Numerical> coordinateShort​(ECartesianAxis2D axis,
                                           short coordinate)
        Description copied from interface: Point2DLike
        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 interface Point2DLike<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.
      • dimensions

        default int dimensions()
        Description copied from interface: Point
        The dimension of the point, which is the number of coordinates it has.
        Specified by:
        dimensions in interface Point
        Returns:
        The dimensionality of the point.
      • rotateDegrees

        Point2D<Numerical> rotateDegrees​(double angleDegrees)
        Rotates this point around the origin (0, 0) 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.
      • rotateDegreesXY

        Point2D<Numerical> rotateDegreesXY​(double angleDegrees)
        Description copied from interface: Point2DLike
        Rotates this point on the xy plane around the origin by the given angle in degrees, in an anti-clockwise direction.
        Specified by:
        rotateDegreesXY in interface Point2DLike<Numerical extends Number>
        Parameters:
        angleDegrees - The angle in angleDegrees to rotate the point.
        Returns:
        A new point that is the result of the rotation.
      • rotateRadians

        Point2D<Numerical> rotateRadians​(double angleRadians)
        Rotates this point 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.
      • rotateRadiansXY

        Point2D<Numerical> rotateRadiansXY​(double angleRadians)
        Description copied from interface: Point2DLike
        Rotates this point on the xy plane around the origin (0, 0) by the given angle in radians, in an anti-clockwise direction.
        Specified by:
        rotateRadiansXY in interface Point2DLike<Numerical extends Number>
        Parameters:
        angleRadians - The angle in radians to rotate the point.
        Returns:
        A new point that is the result of the rotation.
      • scale

        Point2D<Numerical> scale​(byte sx,
                                 byte sy)
        Scales this point by the given ratio.
        Parameters:
        sx - The ratio in x-direction to scale by.
        sy - The ratio in y-direction to scale by.
        Returns:
        A new point that is the result of the scaling.
      • scale

        Point2D<Numerical> scale​(short sx,
                                 short sy)
        Scales this point by the given ratio.
        Parameters:
        sx - The ratio in x-direction to scale by.
        sy - The ratio in y-direction to scale by.
        Returns:
        A new point that is the result of the scaling.
      • scale

        Point2D<Numerical> scale​(int sx,
                                 int sy)
        Scales this point by the given ratio.
        Parameters:
        sx - The ratio in x-direction to scale by.
        sy - The ratio in y-direction to scale by.
        Returns:
        A new point that is the result of the scaling.
      • scale

        Point2D<Numerical> scale​(long sx,
                                 long sy)
        Scales this point by the given ratio.
        Parameters:
        sx - The ratio in x-direction to scale by.
        sy - The ratio in y-direction to scale by.
        Returns:
        A new point that is the result of the scaling.
      • scale

        Point2D<Numerical> scale​(float sx,
                                 float sy)
        Scales this point by the given ratio.
        Parameters:
        sx - The ratio in x-direction to scale by.
        sy - The ratio in y-direction to scale by.
        Returns:
        A new point that is the result of the scaling.
      • scale

        Point2D<Numerical> scale​(double sx,
                                 double sy)
        Scales this point by the given ratio.
        Parameters:
        sx - The ratio in x-direction to scale by.
        sy - The ratio in y-direction to scale by.
        Returns:
        A new point that is the result of the scaling.
      • subtract

        Point2D<Numerical> subtract​(byte dx,
                                    byte dy)
        Subtracts a given amount from the coordinates of this point.
        Parameters:
        dx - The delta in x-direction to subtract.
        dy - The delta in y-direction to subtract.
        Returns:
        A new point that is the result of the subtraction.
      • subtract

        Point2D<Numerical> subtract​(int dx,
                                    int dy)
        Subtracts a given amount from the coordinates of this point.
        Parameters:
        dx - The delta in x-direction to subtract.
        dy - The delta in y-direction to subtract.
        Returns:
        A new point that is the result of the subtraction.
      • subtract

        Point2D<Numerical> subtract​(short dx,
                                    short dy)
        Subtracts a given amount from the coordinates of this point.
        Parameters:
        dx - The delta in x-direction to subtract.
        dy - The delta in y-direction to subtract.
        Returns:
        A new point that is the result of the subtraction.
      • subtract

        Point2D<Numerical> subtract​(long dx,
                                    long dy)
        Subtracts a given amount from the coordinates of this point.
        Parameters:
        dx - The delta in x-direction to subtract.
        dy - The delta in y-direction to subtract.
        Returns:
        A new point that is the result of the subtraction.
      • subtract

        Point2D<Numerical> subtract​(float dx,
                                    float dy)
        Subtracts a given amount from the coordinates of this point.
        Parameters:
        dx - The delta in x-direction to subtract.
        dy - The delta in y-direction to subtract.
        Returns:
        A new point that is the result of the subtraction.
      • subtract

        Point2D<Numerical> subtract​(double dx,
                                    double dy)
        Subtracts a given amount from the coordinates of this point.
        Parameters:
        dx - The delta in x-direction to subtract.
        dy - The delta in y-direction to subtract.
        Returns:
        A new point that is the result of the subtraction.
      • subtract

        Point2D<Numerical> subtract​(Point2DLike<?> delta)
        Subtracts the given point from this point.
        Parameters:
        delta - The point to subtract.
        Returns:
        A new point that is the result of the subtraction.
      • translate

        Point2D<Numerical> translate​(byte dx,
                                     byte dy)
        Translates this point by the given delta.
        Parameters:
        dx - The delta in x-direction to translate by.
        dy - The delta in y-direction to translate by.
        Returns:
        A new point that is the result of the translation.
      • translate

        Point2D<Numerical> translate​(int dx,
                                     int dy)
        Translates this point by the given delta.
        Parameters:
        dx - The delta in x-direction to translate by.
        dy - The delta in y-direction to translate by.
        Returns:
        A new point that is the result of the translation.
      • translate

        Point2D<Numerical> translate​(short dx,
                                     short dy)
        Translates this point by the given delta.
        Parameters:
        dx - The delta in x-direction to translate by.
        dy - The delta in y-direction to translate by.
        Returns:
        A new point that is the result of the translation.
      • translate

        Point2D<Numerical> translate​(long dx,
                                     long dy)
        Translates this point by the given delta.
        Parameters:
        dx - The delta in x-direction to translate by.
        dy - The delta in y-direction to translate by.
        Returns:
        A new point that is the result of the translation.
      • translate

        Point2D<Numerical> translate​(float dx,
                                     float dy)
        Translates this point by the given delta.
        Parameters:
        dx - The delta in x-direction to translate by.
        dy - The delta in y-direction to translate by.
        Returns:
        A new point that is the result of the translation.
      • translate

        Point2D<Numerical> translate​(double dx,
                                     double dy)
        Translates this point by the given delta.
        Parameters:
        dx - The delta in x-direction to translate by.
        dy - The delta in y-direction to translate by.
        Returns:
        A new point that is the result of the translation.
      • translate

        Point2D<Numerical> translate​(Point2DLike<?> delta)
        Translates this point by the given delta.
        Parameters:
        delta - The delta to translate by.
        Returns:
        A new point that is the result of the translation.
      • xByte

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        xByte in interface Point2DLike<Numerical extends Number>
        Parameters:
        x - The new x coordinate value as a byte
        Returns:
        A point with the specified x coordinate.
      • xDouble

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        xDouble in interface Point2DLike<Numerical extends Number>
        Parameters:
        x - The new x coordinate value as a double
        Returns:
        A point with the specified x coordinate.
      • xFloat

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        xFloat in interface Point2DLike<Numerical extends Number>
        Parameters:
        x - The new x coordinate value as a float
        Returns:
        A point with the specified x coordinate.
      • xInt

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        xInt in interface Point2DLike<Numerical extends Number>
        Parameters:
        x - The new x coordinate value as an int
        Returns:
        A point with the specified x coordinate.
      • xLong

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        xLong in interface Point2DLike<Numerical extends Number>
        Parameters:
        x - The new x coordinate value as a long
        Returns:
        A point with the specified x coordinate.
      • xShort

        Point2D<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 interface Point1DLike<Numerical extends Number>
        Specified by:
        xShort in interface Point2DLike<Numerical extends Number>
        Parameters:
        x - The new x coordinate value as a short
        Returns:
        A point with the specified x coordinate.
      • y

        Point2D<Numerical> y​(Numerical y)
        Description copied from interface: Point2DLike
        Returns a point with the y coordinate set to the given value, while keeping other coordinates unchanged.
        Specified by:
        y in interface Point2DLike<Numerical extends Number>
        Parameters:
        y - The new y coordinate value
        Returns:
        A point with the specified y coordinate.
      • yByte

        Point2D<Numerical> yByte​(byte y)
        Description copied from interface: Point2DLike
        Returns a point with the y coordinate set to the given byte value, while keeping other coordinates unchanged.
        Specified by:
        yByte in interface Point2DLike<Numerical extends Number>
        Parameters:
        y - The new y coordinate value as a byte
        Returns:
        A point with the specified y coordinate.
      • yDouble

        Point2D<Numerical> yDouble​(double y)
        Description copied from interface: Point2DLike
        Returns a point with the y coordinate set to the given double value, while keeping other coordinates unchanged.
        Specified by:
        yDouble in interface Point2DLike<Numerical extends Number>
        Parameters:
        y - The new y coordinate value as a double
        Returns:
        A point with the specified y coordinate.
      • yFloat

        Point2D<Numerical> yFloat​(float y)
        Description copied from interface: Point2DLike
        Returns a point with the y coordinate set to the given float value, while keeping other coordinates unchanged.
        Specified by:
        yFloat in interface Point2DLike<Numerical extends Number>
        Parameters:
        y - The new y coordinate value as a float
        Returns:
        A point with the specified y coordinate.
      • yInt

        Point2D<Numerical> yInt​(int y)
        Description copied from interface: Point2DLike
        Returns a point with the y coordinate set to the given int value, while keeping other coordinates unchanged.
        Specified by:
        yInt in interface Point2DLike<Numerical extends Number>
        Parameters:
        y - The new y coordinate value as an int
        Returns:
        A point with the specified y coordinate.
      • yLong

        Point2D<Numerical> yLong​(long y)
        Description copied from interface: Point2DLike
        Returns a point with the y coordinate set to the given long value, while keeping other coordinates unchanged.
        Specified by:
        yLong in interface Point2DLike<Numerical extends Number>
        Parameters:
        y - The new y coordinate value as a long
        Returns:
        A point with the specified y coordinate.
      • yShort

        Point2D<Numerical> yShort​(short y)
        Description copied from interface: Point2DLike
        Returns a point with the y coordinate set to the given short value, while keeping other coordinates unchanged.
        Specified by:
        yShort in interface Point2DLike<Numerical extends Number>
        Parameters:
        y - The new y coordinate value as a short
        Returns:
        A point with the specified y coordinate.