Class Ray3d

    • Field Detail

      • phi

        public final double phi
        Phi; the angle from the positive X axis direction in radians.
      • theta

        public final double theta
        Theta; the angle from the positive Z axis direction in radians.
    • Constructor Detail

      • Ray3d

        public Ray3d​(double x,
                     double y,
                     double z,
                     double phi,
                     double theta)
              throws DrawRuntimeException
        Construct a new Ray3d.
        Parameters:
        x - double; the x coordinate of the finite end point of the ray
        y - double; the y coordinate of the finite end point of the ray
        z - double; the z coordinate of the finite end point of the ray
        phi - double; the angle from the positive X axis direction in radians.
        theta - double; the angle from the positive Z axis direction in radians
        Throws:
        DrawRuntimeException - when phi is NaN
      • Ray3d

        public Ray3d​(Point3d point,
                     double phi,
                     double theta)
              throws NullPointerException,
                     DrawRuntimeException
        Construct a new Ray3d.
        Parameters:
        point - Point3d; the finite end point of the ray
        phi - double; the angle from the positive X axis direction in radians.
        theta - double; the angle from the positive Z axis direction in radians
        Throws:
        NullPointerException - when point is null
        DrawRuntimeException - when phi is NaN, or theta is NaN
      • Ray3d

        public Ray3d​(double x,
                     double y,
                     double z,
                     double throughX,
                     double throughY,
                     double throughZ)
              throws DrawRuntimeException
        Construct a new Ray3d.
        Parameters:
        x - double; the x coordinate of the finite end point of the ray
        y - double; the y coordinate of the finite end point of the ray
        z - double; the z coordinate of the finite end point of the ray
        throughX - double; the x coordinate of another point on the ray
        throughY - double; the y coordinate of another point on the ray
        throughZ - double; the z coordinate of another point on the ray
        Throws:
        DrawRuntimeException - when throughX == x and throughY == y
      • Ray3d

        public Ray3d​(Point3d point,
                     double throughX,
                     double throughY,
                     double throughZ)
              throws NullPointerException,
                     DrawRuntimeException
        Construct a new Ray3d.
        Parameters:
        point - Point3d; the finite end point of the ray
        throughX - double; the x coordinate of another point on the ray
        throughY - double; the y coordinate of another point on the ray
        throughZ - double; the z coordinate of another point on the ray
        Throws:
        NullPointerException - when point is null
        DrawRuntimeException - when throughX == point.x and throughY == point.y
      • Ray3d

        public Ray3d​(double x,
                     double y,
                     double z,
                     Point3d throughPoint)
              throws NullPointerException,
                     DrawRuntimeException
        Construct a new Ray3d.
        Parameters:
        x - double; the x coordinate of the finite end point of the ray
        y - double; the y coordinate of the finite end point of the ray
        z - double; the z coordinate of the finite end point of the ray
        throughPoint - Point3d; another point on the ray
        Throws:
        NullPointerException - when throughPoint is null
        DrawRuntimeException - when throughPoint is exactly at (x, y)
    • Method Detail

      • getPhi

        public final double getPhi()
        Retrieve the angle from the positive X axis direction in radians.
        Specified by:
        getPhi in interface Ray<Ray3d,​Point3d,​Space3d>
        Returns:
        double; the angle from the positive X axis direction in radians
      • getTheta

        public final double getTheta()
        Retrieve the angle from the positive Z axis direction in radians.
        Returns:
        double; the angle from the positive Z axis direction in radians
      • getEndPoint

        public Point3d getEndPoint()
        Get the finite end point of this Ray.
        Specified by:
        getEndPoint in interface Ray<Ray3d,​Point3d,​Space3d>
        Returns:
        P; the finite end point of this Ray
      • neg

        public Ray3d neg()
        Return a new Point with negated coordinate values.
        Specified by:
        neg in interface Directed<Ray3d>
        Specified by:
        neg in interface Point<Point3d,​Space3d>
        Overrides:
        neg in class Point3d
        Returns:
        Point; a new point with negated coordinate values
      • getLocationExtended

        public Ray3d getLocationExtended​(double position)
                                  throws DrawRuntimeException
        Get the location at a position on the line, with its direction. Position must be a positive, finite value
        Specified by:
        getLocationExtended in interface Ray<Ray3d,​Point3d,​Space3d>
        Parameters:
        position - double; the position on the line for which to calculate the point on the line
        Returns:
        R; a ray with the same direction as this ray
        Throws:
        DrawRuntimeException - when position infinite, or NaN.
      • getBounds

        public Bounds3d getBounds()
        Retrieve the bounding box of the object.
        Specified by:
        getBounds in interface Drawable3d
        Overrides:
        getBounds in class Point3d
        Returns:
        Bounds3d; the bounding box of the object
      • epsilonEquals

        public boolean epsilonEquals​(Ray3d other,
                                     double epsilonCoordinate,
                                     double epsilonRotation)
                              throws NullPointerException,
                                     IllegalArgumentException
        Compare this Directed with another Directed with specified tolerances in the coordinates and the angles.
        Specified by:
        epsilonEquals in interface Directed<Ray3d>
        Parameters:
        other - D; 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