Class Triangle


  • public class Triangle
    extends ConvexObject
    Author:
    Calixte DENIZET
    • Field Detail

      • segments

        protected java.util.List<Segment> segments
    • Method Detail

      • isBehind

        public int isBehind​(ConvexObject o)
        Description copied from class: ConvexObject
        Check if o is behind this. Take care: the algorithms used are for convex objects (typically tri-tri, seg-seg or tri-seg)
        Overrides:
        isBehind in class ConvexObject
        Returns:
        true if o is behind this
      • isIn2D

        public boolean isIn2D()
      • addSegment

        public boolean addSegment​(Segment s)
      • pointOnVertices

        public boolean pointOnVertices​(Vector3d p)
      • removeSegment

        public void removeSegment​(Segment s)
      • replaceSegment

        public void replaceSegment​(Segment s,
                                   java.util.List<Segment> segs)
      • breakObject

        public java.util.List<ConvexObject> breakObject​(ConvexObject o)
        Description copied from class: ConvexObject
        Abstract method Break this ConvexObject against the ConvexObject o
        Specified by:
        breakObject in class ConvexObject
        Parameters:
        o - a ConvexObject
        Returns:
        a list of ConvexObject.
      • draw

        public void draw​(java.awt.Graphics2D g2d)
        Description copied from class: AbstractDrawable3DObject
        Draw this object on a Graphics2D object
        Specified by:
        draw in class AbstractDrawable3DObject
        Parameters:
        g2d - the Graphics2d object where to draw
      • breakObject

        public java.util.List<ConvexObject> breakObject​(Vector4d v)
        Description copied from class: ConvexObject
        Abstract method Break this ConvexObject against a plane
        Specified by:
        breakObject in class ConvexObject
        Parameters:
        v - plane definition
        Returns:
        a list of ConvexObject.
      • isPointInside

        protected boolean isPointInside​(Vector3d v)
      • isPointInside

        protected boolean isPointInside​(Vector3d v,
                                        boolean checkCoplanarity)
      • isCoplanar

        protected boolean isCoplanar​(Segment s)
      • isCoplanar

        protected boolean isCoplanar​(Triangle t)
      • isSegmentAcross

        protected boolean isSegmentAcross​(Segment s)
      • isSegmentInside

        protected boolean isSegmentInside​(Segment s)
      • isSegmentIntersects

        protected boolean isSegmentIntersects​(Segment s)
      • getSegmentIntersection

        protected double getSegmentIntersection​(Segment s)
      • breakTriangleOnLine

        protected static java.util.List<ConvexObject> breakTriangleOnLine​(Triangle t,
                                                                          Vector3d p,
                                                                          Vector3d n)
        Break a triangle according to its intersection with a line containing p in the plane of the triangle and orthogonal to n The triangle and the line are supposed to be coplanar.
        Parameters:
        t - the triangle to break
        p - a point of the line
        n - a vector
        Returns:
        a list of triangles
      • breakIntersectingTriangles

        protected static java.util.List<ConvexObject> breakIntersectingTriangles​(Triangle t1,
                                                                                 Triangle t2)
        Get the broken triangles in following the intersection of the planes containing t1 and t2. The planes containing t1 and t2 are supposed to be secant.
        Parameters:
        t1 - the first triangle
        t2 - the second triangle
        Returns:
        an array of length 2 containing the resulting triangles for t1 and t2.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object