Interface RectangularPrism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​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, Prism3afp<ST,​IT,​IE,​P,​V,​B>, Serializable, Shape3afp<ST,​IT,​IE,​P,​V,​B>, Shape3D<ST,​IT,​PathIterator3afp<IE>,​P,​V,​B>
    All Known Implementing Classes:
    RectangularPrism3d, RectangularPrism3dfx

    public interface RectangularPrism3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
    extends Prism3afp<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

      • computeClosestPointRectanglePoint

        @Pure
        static void computeClosestPointRectanglePoint​(double rminx,
                                                      double rminy,
                                                      double rminz,
                                                      double rmaxx,
                                                      double rmaxy,
                                                      double rmaxz,
                                                      double px,
                                                      double py,
                                                      double pz,
                                                      Point3D<?,​?> closest)
        Compute the point on the rectangle that is the closest to the given point.
        Parameters:
        rminx - the minimum x coordinate of the rectangle.
        rminy - the minimum y coordinate of the rectangle.
        rminz - the minimum z coordinate of the rectangle.
        rmaxx - the maximum x coordinate of the rectangle.
        rmaxy - the maximum y coordinate of the rectangle.
        rmaxz - the maximum z coordinate of the rectangle.
        px - the x coordinate of the point.
        py - the y coordinate of the point.
        pz - the z coordinate of the point.
        closest - is set with the closest point on the rectangle.
      • computeClosestPointRectangleRectangle

        @Pure
        static void computeClosestPointRectangleRectangle​(double rminx1,
                                                          double rminy1,
                                                          double rminz1,
                                                          double rmaxx1,
                                                          double rmaxy1,
                                                          double rmaxz1,
                                                          double rminx2,
                                                          double rminy2,
                                                          double rminz2,
                                                          double rmaxx2,
                                                          double rmaxy2,
                                                          double rmaxz2,
                                                          Point3D<?,​?> closest)
        Compute the point on the first rectangle that is the closest to the second rectangle.
        Parameters:
        rminx1 - the minimum x coordinate of the first rectangle.
        rminy1 - the minimum y coordinate of the first rectangle.
        rminz1 - the minimum z coordinate of the first rectangle.
        rmaxx1 - the maximum x coordinate of the first rectangle.
        rmaxy1 - the maximum y coordinate of the first rectangle.
        rmaxz1 - the maximum z coordinate of the first rectangle.
        rminx2 - the minimum x coordinate of the second rectangle.
        rminy2 - the minimum y coordinate of the second rectangle.
        rminz2 - the minimum z coordinate of the second rectangle.
        rmaxx2 - the maximum x coordinate of the second rectangle.
        rmaxy2 - the maximum y coordinate of the second rectangle.
        rmaxz2 - the maximum z coordinate of the second rectangle.
        closest - is set with the closest point on the first rectangle.
      • computeClosestPointRectangleSegment

        @Pure
        static void computeClosestPointRectangleSegment​(double rminx,
                                                        double rminy,
                                                        double rminz,
                                                        double rmaxx,
                                                        double rmaxy,
                                                        double rmaxz,
                                                        double sx1,
                                                        double sy1,
                                                        double sz1,
                                                        double sx2,
                                                        double sy2,
                                                        double sz2,
                                                        Point3D<?,​?> closest)
        Compute the point on the rectangle that is the closest to the segment.
        Parameters:
        rminx - the minimum x coordinate of the rectangle.
        rminy - the minimum y coordinate of the rectangle.
        rminz - the minimum z coordinate of the rectangle.
        rmaxx - the maximum x coordinate of the rectangle.
        rmaxy - the maximum y coordinate of the rectangle.
        rmaxz - the maximum z coordinate of the rectangle.
        sx1 - the x coordinate of the first point of the segment.
        sy1 - the y coordinate of the first point of the segment.
        sz1 - the z coordinate of the first point of the segment.
        sx2 - the x coordinate of the second point of the segment.
        sy2 - the y coordinate of the second point of the segment.
        sz2 - the z coordinate of the second point of the segment.
        closest - is set with the closest point on the rectangle.
      • reduceCohenSutherlandZoneRectangleSegment

        @Pure
        static int reduceCohenSutherlandZoneRectangleSegment​(double rx1,
                                                             double ry1,
                                                             double rz1,
                                                             double rx2,
                                                             double ry2,
                                                             double rz2,
                                                             double sx1,
                                                             double sy1,
                                                             double sz1,
                                                             double sx2,
                                                             double sy2,
                                                             double 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.
      • intersectsRectangleRectangle

        @Pure
        static boolean intersectsRectangleRectangle​(double x1,
                                                    double y1,
                                                    double z1,
                                                    double x2,
                                                    double y2,
                                                    double z2,
                                                    double x3,
                                                    double y3,
                                                    double z3,
                                                    double x4,
                                                    double y4,
                                                    double 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
      • intersectsRectangleLine

        @Pure
        static boolean intersectsRectangleLine​(double x1,
                                               double y1,
                                               double z1,
                                               double x2,
                                               double y2,
                                               double z2,
                                               double x3,
                                               double y3,
                                               double z3,
                                               double x4,
                                               double y4,
                                               double z4)
        Replies if two rectangles are intersecting.
        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 line.
        y3 - is the first point of the line.
        z3 - is the first point of the line.
        x4 - is the second point of the line.
        y4 - is the second point of the line.
        z4 - is the second point of the line.
        Returns:
        true if the two shapes are intersecting; otherwise false
      • intersectsRectangleSegment

        @Pure
        static boolean intersectsRectangleSegment​(double rx1,
                                                  double ry1,
                                                  double rx2,
                                                  double ry2,
                                                  double sx1,
                                                  double sy1,
                                                  double sx2,
                                                  double sy2)
        Replies if the rectangle is intersecting the segment.
        Parameters:
        rx1 - is the first corner of the rectangle.
        ry1 - is the first corner of the rectangle.
        rx2 - is the second corner of the rectangle.
        ry2 - is the second corner of the rectangle.
        sx1 - is the first point of the segment.
        sy1 - is the first point of the segment.
        sx2 - is the second point of the segment.
        sy2 - is the second point of the segment.
        Returns:
        true if the two shapes are intersecting; otherwise false
      • containsRectangleRectangle

        @Pure
        static boolean containsRectangleRectangle​(double enclosingX1,
                                                  double enclosingY1,
                                                  double enclosingZ1,
                                                  double enclosingX2,
                                                  double enclosingY2,
                                                  double enclosingZ2,
                                                  double innerX1,
                                                  double innerY1,
                                                  double innerZ1,
                                                  double innerX2,
                                                  double innerY2,
                                                  double innerZ2)
        Replies if a rectangle is inside in the rectangle.
        Parameters:
        enclosingX1 - is the lowest corner of the enclosing-candidate rectangle.
        enclosingY1 - is the lowest corner of the enclosing-candidate rectangle.
        enclosingZ1 - is the lowest corner of the enclosing-candidate rectangle.
        enclosingX2 - is the uppest corner of the enclosing-candidate rectangle.
        enclosingY2 - is the uppest corner of the enclosing-candidate rectangle.
        enclosingZ2 - is the uppest corner of the enclosing-candidate rectangle.
        innerX1 - is the lowest corner of the inner-candidate rectangle.
        innerY1 - is the lowest corner of the inner-candidate rectangle.
        innerZ1 - is the lowest corner of the inner-candidate rectangle.
        innerX2 - is the uppest corner of the inner-candidate rectangle.
        innerY2 - is the uppest corner of the inner-candidate rectangle.
        innerZ2 - is the uppest corner of the inner-candidate rectangle.
        Returns:
        true if the given rectangle is inside the ellipse; otherwise false.
      • containsRectanglePoint

        @Pure
        static boolean containsRectanglePoint​(double rx1,
                                              double ry1,
                                              double rz1,
                                              double rx2,
                                              double ry2,
                                              double rz2,
                                              double px,
                                              double py,
                                              double pz)
        Replies if a point is inside in the rectangle.
        Parameters:
        rx1 - is the lowest corner of the rectangle.
        ry1 - is the lowest corner of the rectangle.
        rz1 - is the lowest corner of the rectangle.
        rx2 - is the uppest corner of the rectangle.
        ry2 - is the uppest corner of the rectangle.
        rz2 - is the uppest corner of the rectangle.
        px - is the point.
        py - is the point.
        pz - is the point.
        Returns:
        true if the given point is inside the rectangle; otherwise false.
      • contains

        @Pure
        default boolean contains​(double x,
                                 double y,
                                 double z)
        Description copied from interface: Shape3afp
        Replies if the given point is inside this shape.
        Specified by:
        contains in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​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.
      • add

        default void add​(Point3D<?,​?> pt)
        Add the given coordinate in the rectangle.

        The corners of the rectangles are moved to enclose the given coordinate.

        Parameters:
        pt - the point
      • add

        default void add​(double x,
                         double y,
                         double z)
        Add the given coordinate in the rectangle.

        The corners of the rectangles are moved to enclose the given coordinates.

        Parameters:
        x - x coordinate of the point.
        y - y coordinate of the point.
        z - z coordinate of the point.
      • createUnion

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

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

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

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

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

        
         Rectangle2f ir = new Rectangle2f(this);
         ir.setIntersection(r);
         
        Parameters:
        prism - the prism
        Returns:
        the union of this rectangle and the given rectangle.
        See Also:
        setIntersection(Prism3afp)
      • setUnion

        default void setUnion​(Prism3afp<?,​?,​?,​?,​?,​?> prism)
        Compute the union of this rectangle and the given rectangle and change this rectangle with the result of the union.
        Parameters:
        prism - the prism
        See Also:
        createUnion(Prism3afp)
      • setIntersection

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

        If there is no intersection, this rectangle is cleared.

        Parameters:
        prism - the prism
        See Also:
        createIntersection(Prism3afp), Prism3afp.clear()
      • avoidCollisionWith

        default void avoidCollisionWith​(RectangularPrism3afp<?,​?,​?,​?,​?,​?> reference,
                                        Vector3D<?,​?> result)
        Move this rectangular prism to avoid collision with the reference rectangular prism.
        Parameters:
        reference - is the rectangular prism we want to avoid collision with.
        result - the displacement vector.
      • avoidCollisionWith

        default void avoidCollisionWith​(RectangularPrism3afp<?,​?,​?,​?,​?,​?> reference,
                                        Vector3D<?,​?> displacementDirection,
                                        Vector3D<?,​?> result)
        Move this rectangle to avoid collision with the reference rectangle.
        Parameters:
        reference - is the rectangle to avoid collision with.
        displacementDirection - is the direction of the allowed displacement (it is an input). This vector is set according to the result before returning.
        result - the displacement vector.
      • getClosestPointTo

        default P getClosestPointTo​(Sphere3afp<?,​?,​?,​?,​?,​?> circle)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given sphere.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        circle - the sphere.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.
      • getClosestPointTo

        default P getClosestPointTo​(Path3afp<?,​?,​?,​?,​?,​?> path)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given path.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        path - the path.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.
      • getClosestPointTo

        default P getClosestPointTo​(RectangularPrism3afp<?,​?,​?,​?,​?,​?> rectangle)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given rectangular prism.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        rectangle - the rectangular prism.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.
      • getClosestPointTo

        default P getClosestPointTo​(Segment3afp<?,​?,​?,​?,​?,​?> segment)
        Description copied from interface: Shape3afp
        Replies the closest point on this shape to the given segment.

        If the two shapes are intersecting, the replied point is always at the intersection of the two shapes. This function does not enforce the meaning of the replied point in the case of shape intersection. In other words, this function is warranting that the reply point is the either the penetration point, nor a perimeter point, nor any point with a specific meaning.

        Specified by:
        getClosestPointTo in interface Shape3afp<ST extends Shape3afp<?,​?,​IE,​P,​V,​B>,​IT extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3afp,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3afp<?,​?,​IE,​P,​V,​B>>
        Parameters:
        segment - the segment.
        Returns:
        the closest point on the shape; or the point itself if it is inside the shape.