Package geomss.geom

Class Plane

  • All Implemented Interfaces:
    GeomElement<GeomPlane>, Transformable<GeomPlane>, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, javolution.lang.Immutable, javolution.lang.Reusable, javolution.lang.ValueType, javolution.xml.XMLSerializable

    public final class Plane
    extends GeomPlane
    implements javolution.lang.ValueType
    A concrete, immutable, 2D plane in n-dimensional space.

    Modified by: Joseph A. Huwaldt

    Version:
    October 14, 2018
    Author:
    Joseph A. Huwaldt, Date: June 14, 2009
    See Also:
    Serialized Form
    • Method Detail

      • getYZ

        public static Plane getYZ()
        Returns a 3D plane that represents the YZ plane through the origin.
        Returns:
        A 3D plane that represents the YZ plane through the origin.
      • getXZ

        public static Plane getXZ()
        Return a 3D plane that represents the XZ plane through the origin.
        Returns:
        A 3D plane that represents the XZ plane through the origin.
      • getXY

        public static Plane getXY()
        Return a 3D plane that represents the XY plane through the origin.
        Returns:
        A 3D plane that represents the XY plane through the origin.
      • valueOf

        public static Plane valueOf​(double A,
                                    double B,
                                    double C,
                                    Parameter<javax.measure.quantity.Length> D)
        Returns a Plane instance with the specified 3D plane equation values. The plane equation is: A*x + B*y + C*z = D.
        Parameters:
        A - The coefficient on the X axis term.
        B - The coefficient on the Y axis term.
        C - The coefficient on the Z axis term.
        D - The constant term ((normal DOT p0) where p0 is a point in the plane). May not be null.
        Returns:
        the plane having the specified values.
      • valueOf

        public static Plane valueOf​(GeomVector<javax.measure.quantity.Dimensionless> normal,
                                    Parameter<javax.measure.quantity.Length> constant)
        Returns a Plane instance with the specified normal vector and plane equation constant.
        Parameters:
        normal - The unit normal of the plane. May not be null.
        constant - The constant term of the plane equation ((normal DOT p0) where p0 is a point in the plane). May not be null.
        Returns:
        the plane having the specified values.
        Throws:
        DimensionException - if the input normal vector is not at least 3 dimensional.
      • valueOf

        public static Plane valueOf​(GeomVector<javax.measure.quantity.Dimensionless> normal,
                                    GeomPoint p)
        Returns a Plane instance with the specified normal vector and plane equation constant.
        Parameters:
        normal - The unit normal of the plane. May not be null.
        p - A point in the plane (the reference point for the plane). May not be null.
        Returns:
        the plane having the specified values.
        Throws:
        DimensionException - if the input normal vector is not at least 3 dimensional.
      • valueOf

        public static Plane valueOf​(GeomPoint p,
                                    GeomPoint q,
                                    GeomPoint r)
                             throws DimensionException
        Returns a Plane instance that contains the specified 3 independent points.
        Parameters:
        p - A point in the plane (not equal to one of the other two). May not be null.
        q - A point in the plane (not equal to one of the other two). May not be null.
        r - A point in the plane (not equal to one of the other two). May not be null.
        Returns:
        The plane containing the specified points. The plane will match the dimensions of the highest dimension point passed to this method.
        Throws:
        DimensionException - if one of the input points does not have at least 3 physical dimensions.
        java.lang.IllegalArgumentException - if any of the input points are equal to the others.
      • valueOf

        public static Plane valueOf​(GeomTriangle tri)
                             throws DimensionException
        Returns a Plane instance that contains the specified triangle.
        Parameters:
        tri - A triangle that defines the plane. May not be null.
        Returns:
        The plane containing the specified triangle. The plane will match the dimensions of the triangle.
        Throws:
        DimensionException - if the input triangle does not have at least 3 physical dimensions.
        java.lang.IllegalArgumentException - if the triangle is degenerate (has two vertices equal to each other).
      • fitPoints

        public static Plane fitPoints​(java.util.List<? extends GeomPoint> points)
        Return a Plane instance that is fit through the input list of points resulting in the least-squared orthogonal error between the points and the plane.
        Parameters:
        points - The list of points to fit a plane to.
        Returns:
        A plane that represents the least squared error fit to the input points.
      • immutable

        public Plane immutable()
        Return an immutable version of this plane.
        Specified by:
        immutable in class GeomPlane
        Returns:
        An immutable version of this plane.
      • recycle

        public static void recycle​(Plane instance)
        Recycles a Plane instance immediately (on the stack when executing in a StackContext).
        Parameters:
        instance - The instance to be recycled.
      • getPhyDimension

        public int getPhyDimension()
        Returns the number of physical dimensions of the geometry element.
        Specified by:
        getPhyDimension in interface GeomElement<GeomPlane>
        Returns:
        The number of physical dimensions of the geometry element.
      • toDimension

        public Plane toDimension​(int newDim)
        Return the equivalent of this plane converted to the specified number of physical dimensions. If the number of dimensions is greater than this element, then zeros are added to the additional dimensions. If the number of dimensions is less than this element, then the extra dimensions are simply dropped (truncated). If the new dimensions are the same as the dimension of this element, then this element is simply returned.
        Specified by:
        toDimension in interface GeomElement<GeomPlane>
        Specified by:
        toDimension in class GeomPlane
        Parameters:
        newDim - The dimension of the plane to return.
        Returns:
        A copy of this plane converted to the new dimensions.
      • getNormal

        public Vector<javax.measure.quantity.Dimensionless> getNormal()
        Return the normal vector for the plane. The normal vector is a unit vector that is perpendicular to the plane.
        Specified by:
        getNormal in class GeomPlane
        Returns:
        The normal vector for the plane.
      • getConstant

        public Parameter<javax.measure.quantity.Length> getConstant()
        Return the constant term of the plane equation (e.g.: "D" for a 3D plane: A*x + B*y + C*z = D).
        Specified by:
        getConstant in class GeomPlane
        Returns:
        The constant term of the plane equation for this plane.
      • getRefPoint

        public Point getRefPoint()
        Return the reference point for this plane. The reference point is an arbitrary point that is contained in the plane and is used as a reference when drawing the plane.
        Specified by:
        getRefPoint in class GeomPlane
        Returns:
        The reference point for this plane.
      • getUnit

        public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
        Returns the unit in which the geometry in this element are stated.
        Specified by:
        getUnit in interface GeomElement<GeomPlane>
        Returns:
        The unit in which the geometry in this element are stated.
      • to

        public Plane to​(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
        Returns the equivalent to this element but stated in the specified unit.
        Specified by:
        to in interface GeomElement<GeomPlane>
        Parameters:
        unit - the length unit of the element to be returned. May not be null.
        Returns:
        an equivalent to this element but stated in the specified unit.
        Throws:
        javax.measure.converter.ConversionException - if the the input unit is not a length unit.
      • copy

        public Plane copy()
        Returns a copy of this Plane instance allocated by the calling thread (possibly on the stack).
        Specified by:
        copy in interface GeomElement<GeomPlane>
        Specified by:
        copy in interface javolution.lang.ValueType
        Specified by:
        copy in class GeomPlane
        Returns:
        an identical and independent copy of this point.
      • copyToReal

        public Plane copyToReal()
        Return a copy of this object with any transformations or subranges removed (applied).
        Specified by:
        copyToReal in interface GeomElement<GeomPlane>
        Returns:
        A copy of this object with any transformations or subranges removed.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this Plane against the specified object for strict equality (same values and same units).
        Overrides:
        equals in class AbstractGeomElement<GeomPlane>
        Parameters:
        obj - the object to compare with.
        Returns:
        true if this object is identical to that object; false otherwise.