Class OrientedPoint3d

    • Constructor Detail

      • OrientedPoint3d

        public OrientedPoint3d​(double x,
                               double y,
                               double z)
                        throws IllegalArgumentException
        Create an immutable directed point with x, y, and z coordinates, stored with double precision, and direction 0,0,0.
        Parameters:
        x - double; the x coordinate
        y - double; the y coordinate
        z - double; the z coordinate
        Throws:
        IllegalArgumentException - when x, y, or z is NaN
      • OrientedPoint3d

        public OrientedPoint3d​(double x,
                               double y,
                               double z,
                               double dirX,
                               double dirY,
                               double dirZ)
                        throws IllegalArgumentException
        Create an immutable directed point with x, y, and z coordinates, stored with double precision and direction.
        Parameters:
        x - double; the x coordinate
        y - double; the y coordinate
        z - double; the z coordinate
        dirX - double; the direction as rotation around the x-axis with the point as the center
        dirY - double; the direction as rotation around the y-axis with the point as the center
        dirZ - double; the direction as rotation around the z-axis with the point as the center
        Throws:
        IllegalArgumentException - when x, y, z, dirX, dirY, or dirZ is NaN
      • OrientedPoint3d

        public OrientedPoint3d​(double[] xyz)
                        throws NullPointerException,
                               IllegalArgumentException
        Create an immutable directed point with x, y, and z coordinates, stored with double precision, and direction 0,0,0.
        Parameters:
        xyz - double[]; the x, y and z coordinates
        Throws:
        NullPointerException - when xyx is null
        IllegalArgumentException - when the length of the xyx array is not 3, or contains a NaN value, or dirX, dirY, or dirZ is NaN
      • OrientedPoint3d

        public OrientedPoint3d​(double[] xyz,
                               double dirX,
                               double dirY,
                               double dirZ)
                        throws NullPointerException,
                               IllegalArgumentException
        Create an immutable directed point with x, y, and z coordinates, stored with double precision, and direction 0,0,0.
        Parameters:
        xyz - double[]; the x, y and z coordinates
        dirX - double; the direction as rotation around the x-axis with the point as the center
        dirY - double; the direction as rotation around the y-axis with the point as the center
        dirZ - double; the direction as rotation around the z-axis with the point as the center
        Throws:
        NullPointerException - when xyx is null
        IllegalArgumentException - when the length of the xyx array is not 3, or contains a NaN value, or dirX, dirY, or dirZ is NaN
      • OrientedPoint3d

        public OrientedPoint3d​(Point3d point,
                               double dirX,
                               double dirY,
                               double dirZ)
                        throws IllegalArgumentException
        Create an immutable directed point from another point, stored with double precision and specified direction.
        Parameters:
        point - Point3d; the point from which this OrientedPoint3d will be instantiated
        dirX - double; the direction as rotation around the x-axis with the point as the center
        dirY - double; the direction as rotation around the y-axis with the point as the center
        dirZ - double; the direction as rotation around the z-axis with the point as the center
        Throws:
        IllegalArgumentException - when dirX, dirY, or dirZ is NaN
      • OrientedPoint3d

        public OrientedPoint3d​(double x,
                               double y,
                               double z,
                               double[] direction)
                        throws NullPointerException,
                               IllegalArgumentException
        Create an immutable point with x, y, and z coordinates, stored with double precision, and direction.
        Parameters:
        x - double; the x coordinate
        y - double; the y coordinate
        z - double; the z coordinate
        direction - double[]; the direction as rotations around the x,y,z-axes with the point as the center
        Throws:
        NullPointerException - when rotation is null
        IllegalArgumentException - when the length of the direction array is not 3
      • OrientedPoint3d

        public OrientedPoint3d​(double[] xyz,
                               double[] direction)
                        throws NullPointerException,
                               IllegalArgumentException
        Create an immutable point with x, y, and z coordinates, stored with double precision, and direction.
        Parameters:
        xyz - double[]; the x, y and z coordinates
        direction - double[]; the rotation around the x,y,z-axis with the point as the center
        Throws:
        NullPointerException - when xyx or direction is null
        IllegalArgumentException - when the length of the xyx array or the length of the direction array is not 3
    • Method Detail

      • translate

        public OrientedPoint3d translate​(double dx,
                                         double dy)
                                  throws IllegalArgumentException
        Return a new Point with a translation by the provided dx and dy.
        Overrides:
        translate in class Point3d
        Parameters:
        dx - double; the horizontal translation
        dy - double; the vertical translation
        Returns:
        Point3D; a new point with the translated coordinates
        Throws:
        IllegalArgumentException - when dx, or dy is NaN
      • translate

        public OrientedPoint3d translate​(double dx,
                                         double dy,
                                         double dz)
                                  throws IllegalArgumentException
        Return a new Point3d with a translation by the provided dx, dy and dz.
        Overrides:
        translate in class Point3d
        Parameters:
        dx - double; the x translation
        dy - double; the y translation
        dz - double; the z translation
        Returns:
        Point3d; a new point with the translated coordinates
        Throws:
        IllegalArgumentException - when dx, dy, or dz is NaN
      • abs

        public OrientedPoint3d abs()
        Return a new Point with absolute coordinate values.
        Specified by:
        abs in interface Point<Point3d,​Space3d>
        Overrides:
        abs in class Point3d
        Returns:
        Point; a new point with absolute coordinate values
      • interpolate

        public OrientedPoint3d interpolate​(OrientedPoint3d otherPoint,
                                           double fraction)
                                    throws NullPointerException,
                                           IllegalArgumentException
        Interpolate towards another Point with a fraction. It is allowed for fraction to be less than zero or larger than 1. In that case the interpolation turns into an extrapolation. DirX, dirY and dirZ are interpolated using the interpolateShortest method.
        Parameters:
        otherPoint - OrientedPoint3d; the other point
        fraction - double; the factor for interpolation towards the other point. When <code>fraction</code> is between 0 and 1, it is an interpolation, otherwise an extrapolation. If fraction is 0; this Point is returned; if fraction is 1, the other point is returned
        Returns:
        OrientedPoint3d; a new OrientedPoint3d at the requested fraction
        Throws:
        NullPointerException - when otherPoint is null
        IllegalArgumentException - when fraction is NaN
      • rotate

        public OrientedPoint3d rotate​(double rotateZ)
                               throws IllegalArgumentException
        Return a new OrientedPoint with an in-place rotation around the z-axis by the provided delta. The resulting rotation will be normalized between -π and π.
        Parameters:
        rotateZ - double; the rotation around the z-axis
        Returns:
        OrientedPoint3d; a new point with the same coordinates, dirX and dirY and modified dirZ
        Throws:
        IllegalArgumentException - when rotateZ is NaN
      • rotate

        public OrientedPoint3d rotate​(double rotateX,
                                      double rotateY,
                                      double rotateZ)
                               throws IllegalArgumentException
        Return a new OrientedPoint3d point with an in-place rotation by the provided rotateX, rotateY, and rotateZ. The resulting rotations will be normalized between -π and π.
        Parameters:
        rotateX - double; the rotation around the x-axis
        rotateY - double; the rotation around the y-axis
        rotateZ - double; the rotation around the z-axis
        Returns:
        OrientedPoint3d; a new point with the same coordinates and applied rotations
        Throws:
        IllegalArgumentException - when any of the rotations is NaN
      • getDirX

        public double getDirX()
        Return the rotation around the x-axis in radians.
        Specified by:
        getDirX in interface Oriented3d<OrientedPoint3d>
        Returns:
        double; the rotation around the x-axis in radians
      • getDirY

        public double getDirY()
        Return the rotation around the y-axis in radians.
        Specified by:
        getDirY in interface Oriented3d<OrientedPoint3d>
        Returns:
        double; the rotation around the y-axis in radians
      • getDirZ

        public double getDirZ()
        Return the rotation around the z-axis in radians.
        Specified by:
        getDirZ in interface Oriented<OrientedPoint3d>
        Returns:
        double; the rotation around the z-axis in radians
      • toString

        public String toString​(int fractionDigits)
        Return a string representation of the point with a certain number of fraction digits for the coordinates.
        Specified by:
        toString in interface Point<Point3d,​Space3d>
        Overrides:
        toString in class Point3d
        Parameters:
        fractionDigits - int; the number of fraction digits. Should be 0 or a positive number
        Returns:
        String; a formatted string with a certain number of fraction digits for the coordinates
      • epsilonEquals

        public boolean epsilonEquals​(OrientedPoint3d other,
                                     double epsilonCoordinate,
                                     double epsilonRotation)
                              throws NullPointerException,
                                     IllegalArgumentException
        Compare this Oriented with another Oriented with specified tolerances in the coordinates and the angles.
        Specified by:
        epsilonEquals in interface Oriented<OrientedPoint3d>
        Parameters:
        other - O; the point to compare with
        epsilonCoordinate - double; the upper bound of difference for one of the coordinates; use Double.POSITIVE_INFINITY if you do not want to check the coordinates
        epsilonRotation - double; the upper bound of difference for the direction(s); use Double.POSITIVE_INFINITY if you do not want to check the angles
        Returns:
        boolean; true if x, y, and z are less than epsilonCoordinate apart, and rotX, rotY and rotZ are less than epsilonRotation apart, otherwise false
        Throws:
        NullPointerException - when point is null
        IllegalArgumentException - epsilonCoordinate or epsilonRotation is NaN or negative