Package geomss.geom

Class TriangleTrans

    • Method Detail

      • newInstance

        public static TriangleTrans newInstance​(GeomTriangle child,
                                                GTransform transform)
        Returns a 3D TriangleTrans instance holding the specified GeomTriangle and GTransform.
        Parameters:
        child - The GeomTriangle that is the child of this transform element (may not be null).
        transform - The transform held by this transform element (may not be null).
        Returns:
        the transform element having the specified values.
      • setTransform

        public void setTransform​(GTransform transform)
        Sets the transformation represented by this transformation element.
        Specified by:
        setTransform in interface GeomTransform<GeomTriangle>
        Parameters:
        transform - The transform to set this transform element to (may not be null).
      • getP1

        public GeomPoint getP1()
        Return the first vertex in this triangle.
        Specified by:
        getP1 in class GeomTriangle
        Returns:
        The first vertex in this triangle.
      • getP2

        public GeomPoint getP2()
        Return the second vertex in this triangle.
        Specified by:
        getP2 in class GeomTriangle
        Returns:
        The second vertex in this triangle.
      • getP3

        public GeomPoint getP3()
        Return the third and last vertex in this triangle.
        Specified by:
        getP3 in class GeomTriangle
        Returns:
        The third and last vertex in this triangle.
      • getNormal

        public VectorTrans<javax.measure.quantity.Dimensionless> getNormal()
        Return the surface unit normal vector for this triangle. If the triangle is degenerate (zero area), then the normal vector will have zero length.
        Specified by:
        getNormal in class GeomTriangle
        Returns:
        The surface normal vector for this triangle.
      • getArea

        public Parameter<javax.measure.quantity.Area> getArea()
        Return the surface area of one side of this triangle. The returned area is always positive, but can be zero.
        Specified by:
        getArea in class GeomTriangle
        Returns:
        The surface area of one side of this triangle.
      • reverse

        public TriangleTrans reverse()
        Return a new triangle that is identical to this one, but with the order of the points (and the surface normal direction) reversed.
        Specified by:
        reverse in class GeomTriangle
        Returns:
        A new Triangle that is identical to this one, but with the order of the points reversed.
      • getBoundsMin

        public Point getBoundsMin()
        Return the coordinate point representing the minimum bounding box corner of this geometry element (e.g.: min X, min Y, min Z).
        Specified by:
        getBoundsMin in interface GeomElement<GeomTriangle>
        Returns:
        The minimum bounding box coordinate for this geometry element.
        Throws:
        java.lang.IndexOutOfBoundsException - if this list contains no elements.
      • getBoundsMax

        public Point getBoundsMax()
        Return the coordinate point representing the maximum bounding box corner (e.g.: max X, max Y, max Z).
        Specified by:
        getBoundsMax in interface GeomElement<GeomTriangle>
        Returns:
        The maximum bounding box coordinate for this geometry element.
        Throws:
        java.lang.IndexOutOfBoundsException - if this list contains no elements.
      • getUnit

        public javax.measure.unit.Unit<javax.measure.quantity.Length> getUnit()
        Returns the unit in which this triangle is stated.
        Specified by:
        getUnit in interface GeomElement<GeomTriangle>
        Overrides:
        getUnit in class GeomTriangle
        Returns:
        The unit in which this GeomTriangle is stated.
      • to

        public TriangleTrans to​(javax.measure.unit.Unit<javax.measure.quantity.Length> unit)
                         throws javax.measure.converter.ConversionException
        Returns the equivalent to this element but stated in the specified unit.
        Specified by:
        to in interface GeomElement<GeomTriangle>
        Specified by:
        to in interface PointGeometry<GeomTriangle>
        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.
      • toDimension

        public TriangleTrans toDimension​(int newDim)
        Return a copy of this Triangle 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<GeomTriangle>
        Parameters:
        newDim - The dimension of the Triangle to return.
        Returns:
        This Triangle converted to the new dimensions.
        Throws:
        java.lang.IllegalArgumentException - if the new dimension is anything other than 3.
      • copy

        public TriangleTrans copy()
        Returns a copy of this TriangleTrans instance allocated by the calling thread (possibly on the stack).
        Specified by:
        copy in interface GeomElement<GeomTriangle>
        Returns:
        an identical and independent copy of this point.
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this TriangleTrans against the specified object for strict equality.
        Overrides:
        equals in class AbstractGeomElement<GeomTriangle>
        Parameters:
        obj - the object to compare with.
        Returns:
        true if this transform is identical to that transform; false otherwise.
      • recycle

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