Interface RectangularPrism3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>

  • Type Parameters:
    ST - is the type of the general implementation.
    IT - is the type of the implementation of this shape.
    IE - is the type of the path elements.
    P - is the type of the points.
    V - is the type of the vectors.
    B - is the type of the bounding boxes.
    All Superinterfaces:
    Cloneable, JsonableObject, Prism3ai<ST,​IT,​IE,​P,​V,​B>, Serializable, Shape3ai<ST,​IT,​IE,​P,​V,​B>, Shape3D<ST,​IT,​PathIterator3ai<IE>,​P,​V,​B>
    All Known Implementing Classes:
    RectangularPrism3i, RectangularPrism3ifx

    public interface RectangularPrism3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
    extends Prism3ai<ST,​IT,​IE,​P,​V,​B>
    Fonctional interface that represented a 2D rectangle on a plane.
    Since:
    13.0
    Version:
    17.0 2020-01-04 14:41:43
    Author:
    Stéphane GALLAND, Hamza JAFFALI
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    mathgeom
    • Method Detail

      • intersectsRectangleRectangle

        @Pure
        static boolean intersectsRectangleRectangle​(int x1,
                                                    int y1,
                                                    int z1,
                                                    int x2,
                                                    int y2,
                                                    int z2,
                                                    int x3,
                                                    int y3,
                                                    int z3,
                                                    int x4,
                                                    int y4,
                                                    int z4)
        Replies if two rectangles are intersecting.
        Parameters:
        x1 - is the first corner of the first rectangle.
        y1 - is the first corner of the first rectangle.
        z1 - is the first corner of the first rectangle.
        x2 - is the second corner of the first rectangle.
        y2 - is the second corner of the first rectangle.
        z2 - is the second corner of the first rectangle.
        x3 - is the first corner of the second rectangle.
        y3 - is the first corner of the second rectangle.
        z3 - is the first corner of the second rectangle.
        x4 - is the second corner of the second rectangle.
        y4 - is the second corner of the second rectangle.
        z4 - is the second corner of the second rectangle.
        Returns:
        true if the two shapes are intersecting; otherwise false
      • intersectsRectangleSegment

        @Pure
        static boolean intersectsRectangleSegment​(int x1,
                                                  int y1,
                                                  int z1,
                                                  int x2,
                                                  int y2,
                                                  int z2,
                                                  int x3,
                                                  int y3,
                                                  int z3,
                                                  int x4,
                                                  int y4,
                                                  int z4)
        Replies if a rectangle is intersecting a segment.

        The intersection test is partly based on the Cohen-Sutherland classification of the segment. This classification permits to detect the base cases; and to run a clipping-like algorithm for the intersection detection.

        Parameters:
        x1 - is the first corner of the rectangle.
        y1 - is the first corner of the rectangle.
        z1 - is the first corner of the rectangle.
        x2 - is the second corner of the rectangle.
        y2 - is the second corner of the rectangle.
        z2 - is the second corner of the rectangle.
        x3 - is the first point of the segment.
        y3 - is the first point of the segment.
        z3 - is the first point of the segment.
        x4 - is the second point of the segment.
        y4 - is the second point of the segment.
        z4 - is the second point of the segment.
        Returns:
        true if the two shapes are intersecting; otherwise false
      • computeClosestPoint

        @Pure
        static void computeClosestPoint​(int minx,
                                        int miny,
                                        int minz,
                                        int maxx,
                                        int maxy,
                                        int maxz,
                                        int px,
                                        int py,
                                        int pz,
                                        Point3D<?,​?> result)
        Compute the closest point on the rectangle from the given point.
        Parameters:
        minx - is the x-coordinate of the lowest coordinate of the rectangle.
        miny - is the y-coordinate of the lowest coordinate of the rectangle.
        minz - is the z-coordinate of the lowest coordinate of the rectangle.
        maxx - is the x-coordinate of the highest coordinate of the rectangle.
        maxy - is the y-coordinate of the highest coordinate of the rectangle.
        maxz - is the z-coordinate of the highest coordinate of the rectangle.
        px - is the x-coordinate of the point.
        py - is the y-coordinate of the point.
        pz - is the z-coordinate of the point.
        result - the closest point.
      • computeFarthestPoint

        @Pure
        static void computeFarthestPoint​(int minx,
                                         int miny,
                                         int minz,
                                         int maxx,
                                         int maxy,
                                         int maxz,
                                         int px,
                                         int py,
                                         int pz,
                                         Point3D<?,​?> result)
        Compute the farthest point on the rectangle from the given point.
        Parameters:
        minx - is the x-coordinate of the lowest coordinate of the rectangle.
        miny - is the y-coordinate of the lowest coordinate of the rectangle.
        minz - is the z-coordinate of the lowest coordinate of the rectangle.
        maxx - is the x-coordinate of the highest coordinate of the rectangle.
        maxy - is the y-coordinate of the highest coordinate of the rectangle.
        maxz - is the z-coordinate of the highest coordinate of the rectangle.
        px - is the x-coordinate of the point.
        py - is the y-coordinate of the point.
        pz - is the z-coordinate of the point.
        result - the farthest point.
      • reduceCohenSutherlandZoneRectangularPrismSegment

        @Pure
        static int reduceCohenSutherlandZoneRectangularPrismSegment​(int rx1,
                                                                    int ry1,
                                                                    int rz1,
                                                                    int rx2,
                                                                    int ry2,
                                                                    int rz2,
                                                                    int sx1,
                                                                    int sy1,
                                                                    int sz1,
                                                                    int sx2,
                                                                    int sy2,
                                                                    int sz2,
                                                                    int codePoint1,
                                                                    int codePoint2,
                                                                    Point3D<?,​?> newSegmentP1,
                                                                    Point3D<?,​?> newSegmentP2)
        Update the given Cohen-Sutherland code that corresponds to the given segment in order to obtain a segment restricted to a single Cohen-Sutherland zone. This function is at the heart of the Cohen-Sutherland algorithm.

        The result of this function may be:

        • the code for a single zone, or
        • the code that corresponds to a single column, or
        • the code that corresponds to a single row.
        Parameters:
        rx1 - is the first corner of the rectangle.
        ry1 - is the first corner of the rectangle.
        rz1 - is the first corner of the rectangle.
        rx2 - is the second corner of the rectangle.
        ry2 - is the second corner of the rectangle.
        rz2 - is the second corner of the rectangle.
        sx1 - is the first point of the segment.
        sy1 - is the first point of the segment.
        sz1 - is the first point of the segment.
        sx2 - is the second point of the segment.
        sy2 - is the second point of the segment.
        sz2 - is the second point of the segment.
        codePoint1 - the Cohen-Sutherland code for the first point of the segment.
        codePoint2 - the Cohen-Sutherland code for the second point of the segment.
        newSegmentP1 - is set with the new coordinates of the segment first point. If null, this parameter is ignored.
        newSegmentP2 - is set with the new coordinates of the segment second point. If null, this parameter is ignored.
        Returns:
        the rectricted Cohen-Sutherland zone.
      • contains

        @Pure
        default boolean contains​(int x,
                                 int y,
                                 int z)
        Description copied from interface: Shape3ai
        Replies if the given point is inside this shape.
        Specified by:
        contains in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Parameters:
        x - x coordinate of the point to test.
        y - y coordinate of the point to test.
        z - z coordinate of the point to test.
        Returns:
        true if the given point is inside this shape, otherwise false.
      • getPointIterator

        @Pure
        default Iterator<P> getPointIterator()
        Description copied from interface: Shape3ai
        Replies an iterator on the points covered by the perimeter of this shape.

        The implementation of the iterator depends on the shape type. There is no warranty about the order of the points.

        Specified by:
        getPointIterator in interface Shape3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>
        Returns:
        an iterator on the points that are located at the perimeter of the shape.
      • getPointIterator

        @Pure
        default Iterator<P> getPointIterator​(RectangularPrism3ai.Side startingBorder)
        Replies the points on the bounds of the rectangle.
        Parameters:
        startingBorder - is the first border to reply.
        Returns:
        the points on the bounds of the rectangle.
      • createUnion

        @Pure
        default B createUnion​(Prism3ai<?,​?,​?,​?,​?,​?> prism)
        Compute and replies the union of this rectangular prism and the given prism. This function does not change this rectangular prism.

        It is equivalent to (where ur is the union):

        
         RectangularPrism3d ur = new RectangularPrism3d(this);
         ur.setUnion(r);
         
        Parameters:
        prism - the prism
        Returns:
        the union of this rectangle and the given rectangle.
        See Also:
        setUnion(Prism3ai)
      • createIntersection

        @Pure
        default B createIntersection​(Prism3ai<?,​?,​?,​?,​?,​?> prism)
        Compute and replies the intersection of this rectangular prism and the given prism. This function does not change this rectangular prism.

        It is equivalent to (where ir is the union):

        
         RectangularPrism3d ir = new RectangularPrism3d(this);
         ur.setIntersection(r);
         
        Parameters:
        prism - the prism
        Returns:
        the intersection of this rectangle and the given rectangle.
        See Also:
        setIntersection(Prism3ai)
      • setUnion

        default void setUnion​(Prism3ai<?,​?,​?,​?,​?,​?> prism)
        Compute the union of this rectangular prism and the given prism. This function changes this rectangular prism.
        Parameters:
        prism - the prism
        See Also:
        createUnion(Prism3ai)
      • setIntersection

        default void setIntersection​(Prism3ai<?,​?,​?,​?,​?,​?> prism)
        Compute the intersection of this rectangular prism and the given prism. This function changes this rectangular prism.

        If there is no intersection, this rectangular Prism is cleared.

        Parameters:
        prism - the prism
        See Also:
        createIntersection(Prism3ai), Prism3ai.clear()