Class Intersection


  • public final class Intersection
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Intersection​(Vec4 intersectionPoint, boolean isTangent)
      Constructs an Intersection from an intersection point and tangency indicator.
      Intersection​(Vec4 intersectionPoint, double intersectionLength, boolean isTangent)
      Constructs an Intersection from an intersection point and tangency indicator.
      Intersection​(Vec4 intersectionPoint, Position intersectionPosition, boolean isTangent, java.lang.Object object)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.Double getIntersectionLength()
      The parametric length along the intersection geometry.
      Vec4 getIntersectionPoint()
      Returns the intersection point.
      Position getIntersectionPosition()
      Returns the intersection position if one has been set.
      java.lang.Object getObject()
      Returns the object associated with the intersection.
      int hashCode()  
      boolean isTangent()
      Indicates whether the intersection is tangent to the object intersected.
      void setIntersectionPoint​(Vec4 intersectionPoint)
      Specifies the intersection point.
      void setIntersectionPosition​(Position intersectionPosition)
      Specifies the intersection position, which should be a position computed from the intersection point.
      void setObject​(java.lang.Object object)
      Specifies the object to associate with the intersection.
      void setTangent​(boolean tangent)
      Specifies whether the intersection is tangent to the object intersected.
      static java.util.Queue<Intersection> sort​(Vec4 refPoint, java.util.List<Intersection> listA, java.util.List<Intersection> listB)
      Merges two lists of intersections into a single list sorted by intersection distance from a specified reference point.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • intersectionPoint

        protected Vec4 intersectionPoint
      • intersectionLength

        protected java.lang.Double intersectionLength
      • intersectionPosition

        protected Position intersectionPosition
      • isTangent

        protected boolean isTangent
      • object

        protected java.lang.Object object
    • Constructor Detail

      • Intersection

        public Intersection​(Vec4 intersectionPoint,
                            boolean isTangent)
        Constructs an Intersection from an intersection point and tangency indicator.
        Parameters:
        intersectionPoint - the intersection point.
        isTangent - true if the intersection is tangent to the object intersected, otherwise false.
        Throws:
        java.lang.IllegalArgumentException - if intersectionPoint is null
      • Intersection

        public Intersection​(Vec4 intersectionPoint,
                            double intersectionLength,
                            boolean isTangent)
        Constructs an Intersection from an intersection point and tangency indicator.
        Parameters:
        intersectionPoint - the intersection point
        intersectionLength - the parametric length along the intersection geometry. If the geometry was a line, then this value will be the parametric value of the intersection point along the line.
        isTangent - true if the intersection is tangent to the object intersected, otherwise false.
        Throws:
        java.lang.IllegalArgumentException - if intersectionPoint is null
      • Intersection

        public Intersection​(Vec4 intersectionPoint,
                            Position intersectionPosition,
                            boolean isTangent,
                            java.lang.Object object)
    • Method Detail

      • getIntersectionPosition

        public Position getIntersectionPosition()
        Returns the intersection position if one has been set.
        Returns:
        the intersection position, or null if the position has not been set.
      • setIntersectionPosition

        public void setIntersectionPosition​(Position intersectionPosition)
        Specifies the intersection position, which should be a position computed from the intersection point.
        Parameters:
        intersectionPosition - the intersection position. May be null.
      • getObject

        public java.lang.Object getObject()
        Returns the object associated with the intersection.
        Returns:
        the object associated with the intersection, or null if no object is associated.
      • setObject

        public void setObject​(java.lang.Object object)
        Specifies the object to associate with the intersection.
        Parameters:
        object - the object to associate with the intersection. May be null.
      • getIntersectionPoint

        public Vec4 getIntersectionPoint()
        Returns the intersection point.
        Returns:
        the intersection point.
      • setIntersectionPoint

        public void setIntersectionPoint​(Vec4 intersectionPoint)
        Specifies the intersection point.
        Parameters:
        intersectionPoint - the intersection point. May be null, but typically should not be.
      • isTangent

        public boolean isTangent()
        Indicates whether the intersection is tangent to the object intersected.
        Returns:
        true if the intersection is tangent, otherwise false.
      • setTangent

        public void setTangent​(boolean tangent)
        Specifies whether the intersection is tangent to the object intersected.
        Parameters:
        tangent - true if the intersection is tangent, otherwise false.
      • getIntersectionLength

        public java.lang.Double getIntersectionLength()
        The parametric length along the intersection geometry. If the geometry involved a line, this value is the parametric distance at which the intersection occurred along the line.
        Returns:
        the intersection length, or null if the length was not calculated.
      • sort

        public static java.util.Queue<Intersection> sort​(Vec4 refPoint,
                                                         java.util.List<Intersection> listA,
                                                         java.util.List<Intersection> listB)
        Merges two lists of intersections into a single list sorted by intersection distance from a specified reference point.
        Parameters:
        refPoint - the reference point.
        listA - the first list of intersections.
        listB - the second list of intersections.
        Returns:
        the merged list of intersections, sorted by increasing distance from the reference point.
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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