Documentation of 'georegression.metric.Intersection2D_F32' Java class
Intersection2D_F32
georegression.metric

Class Intersection2D_F32



  • public class Intersection2D_F32
    extends java.lang.Object
    Functions relating to finding the points at which two shapes intersect with each other.
    • Constructor Detail

      • Intersection2D_F32

        public Intersection2D_F32()
    • Method Detail

      • containConvex

        public static boolean containConvex(Polygon2D_F32 polygon,
                                            Point2D_F32 pt)

        Checks to see if the point is contained inside the convex polygon. If the point is an the polygon's perimeter it is considered to NOT be inside.

        Clockwise or counter-clockwise order of the polygon does not matter.

        Parameters:
        polygon - Convex polygon. Not modified.
        pt - Point. Not modified.
        Returns:
        True if the point is contained inside the polygon.
      • containConcave

        public static boolean containConcave(Polygon2D_F32 polygon,
                                             Point2D_F32 pt)
        Checks to see if the point is contained inside the concave polygon. NOTE: Points which lie along the perimeter may or may not be considered as inside
        Parameters:
        polygon - Convex polygon. Not modified.
        pt - Point. Not modified.
        Returns:
        True if the point is contained inside the polygon.
      • contains

        public static boolean contains(Quadrilateral_F32 quad,
                                       Point2D_F32 pt)
        True if the point is contained inside the quadrilateral.
        Parameters:
        quad - quadrilateral
        pt - point
        Returns:
        true if the point is inside and false if it is not.
      • containTriangle

        public static boolean containTriangle(Point2D_F32 a,
                                              Point2D_F32 b,
                                              Point2D_F32 c,
                                              Point2D_F32 pt)
        Returns true of the the point is inside the triangle. This function is simply an unrolled version of containConcave(Polygon2D_F32, Point2D_F32).
        Parameters:
        a - vertex in triangle
        b - vertex in triangle
        c - vertex in triangle
        pt - Point which is being tested for containment inside of triangle
        Returns:
        true if the point is inside of triangle
      • intersection

        public static Point2D_F32 intersection(LineParametric2D_F32 a,
                                               LineParametric2D_F32 b,
                                               Point2D_F32 ret)
        Finds the point of intersection between two lines and returns the point.
        Parameters:
        a - Line.
        b - Line.
        ret - storage for the point of intersection. If null a new point will be declared.
        Returns:
        If the two lines intersect it returns the point of intersection. null if they don't intersect or have infinite intersections.
      • intersection

        public static float intersection(LineParametric2D_F32 a,
                                         LineParametric2D_F32 b)
        Finds the point of intersection between two lines. The point of intersection is specified as a point along the parametric line 'a'. (x,y) = (x_0,y_0) + t*(slope_x,slope_y), where 't' is the location returned.
        Parameters:
        a - Line.
        b - Line.
        Returns:
        The location along 'target'. If the lines do not intersect or have infinite intersections Float.NaN is returned.
      • intersection

        public static Point2D_F32 intersection(LineSegment2D_F32 l_0,
                                               LineSegment2D_F32 l_1,
                                               Point2D_F32 ret)
        Finds the point of intersection between two lines segments.
        Parameters:
        l_0 - Line segment.
        l_1 - line segment.
        ret - storage for the point of intersection. If null a new point will be declared.
        Returns:
        If the two lines intersect it returns the point of intersection. null if they don't intersect or have infinite intersections.
      • intersection

        public static Point3D_F32 intersection(LineGeneral2D_F32 a,
                                               LineGeneral2D_F32 b,
                                               Point3D_F32 ret)

        Finds the intersection of two lines as a 2D point in homogeneous coordinates. Because the solution is found in homogeneous coordinates it can even handle parallel lines which "intersect at infinity".

        A 2D point in homogeneous coordinates is expressed as the triple (x,y,z), which can be converted into the standard notation as x' = x/z and y'= y/z. If the lines are parallel and intersect at infinity then z=0 and the above conversion will fail.

        Parameters:
        a - Line
        b - Line
        ret - Storage for point of intersection.
        Returns:
        Point of intersection represented in homogeneous coordinates.
      • intersection

        public static Point2D_F32 intersection(LineGeneral2D_F32 a,
                                               LineGeneral2D_F32 b,
                                               Point2D_F32 ret)

        Finds the intersection of two lines as a 2D point in coordinates. If the lines are parallel then null is returned.

        Parameters:
        a - Line
        b - Line
        ret - Storage for point of intersection.
        Returns:
        Point of intersection in 2D coordinates. null if intersection at infinity
      • intersection

        public static float intersection(LineParametric2D_F32 target,
                                         LineSegment2D_F32 l)
        Finds the point of intersection between a line and a line segment. The point of intersection is specified as the distance along the parametric line. If no intersection is found then Float.NaN is returned.
        Parameters:
        target - A line whose location along which the point of intersection is being found. Not modified.
        l - Line segment which is being tested for intersection. Not modified.
        Returns:
        The location along 'target'. If the lines do not intersect or have infinite intersections Float.NaN is returned.
      • contains

        public static boolean contains(RectangleLength2D_F32 a,
                                       float x,
                                       float y)

        Checks to see if the specified point is inside the rectangle. A point is inside if it is ≥ the lower extend and < the upper extent.

        inside = x ≥ x0 AND x < x0+width AND y ≥ y0 AND y < y0+height

        Parameters:
        a - Rectangle.
        x - x-coordinate of point being tested for containment
        y - y-coordinate of point being tested for containment
        Returns:
        true if inside and false if output
      • contains2

        public static boolean contains2(RectangleLength2D_F32 a,
                                        float x,
                                        float y)

        Checks to see if the specified point is inside the rectangle. A point is inside if it is ≥ the lower extend and ≤ the upper extent.

        inside = x &ge; x0 AND x &le; x0+width and y &ge; y0 AND y &le; y0+height

        Parameters:
        a - Rectangle.
        x - x-coordinate of point being tested for containment
        y - y-coordinate of point being tested for containment
        Returns:
        true if inside and false if output
      • contains

        public static boolean contains(Rectangle2D_F32 a,
                                       float x,
                                       float y)

        Checks to see if the specified point is inside the rectangle. A point is inside if it is ≥ the lower extend and < the upper extent.

        inside = x ≥ x0 AND x ≤ x1 AND y ≥ y0 AND y ≤ y1

        Parameters:
        a - Rectangle.
        x - x-coordinate of point being tested for containment
        y - y-coordinate of point being tested for containment
        Returns:
        true if inside and false if output
      • contains2

        public static boolean contains2(Rectangle2D_F32 a,
                                        float x,
                                        float y)

        Checks to see if the specified point is inside the rectangle. A point is inside if it is ≥ the lower extend and ≤ the upper extent.

        inside = x ≥ x0 AND x ≤ x1 AND y ≥ y0 AND y ≤ y1

        Parameters:
        a - Rectangle.
        x - x-coordinate of point being tested for containment
        y - y-coordinate of point being tested for containment
        Returns:
        true if inside and false if output
      • intersects

        public static boolean intersects(Rectangle2D_F32 a,
                                         Rectangle2D_F32 b)
        Checks to see if the two rectangles intersect each other
        Parameters:
        a - Rectangle
        b - Rectangle
        Returns:
        true if intersection
      • intersection

        public static boolean intersection(Rectangle2D_F32 a,
                                           Rectangle2D_F32 b,
                                           Rectangle2D_F32 result)
        Finds the intersection between two rectangles. If the rectangles don't intersect then false is returned.
        Parameters:
        a - Rectangle
        b - Rectangle
        result - Storage for the found intersection
        Returns:
        true if intersection
      • intersectionArea

        public static float intersectionArea(Rectangle2D_F32 a,
                                             Rectangle2D_F32 b)
        Returns the area of the intersection of two rectangles.
        Parameters:
        a - Rectangle
        b - Rectangle
        Returns:
        area of intersection

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.