Interface Rectangle2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,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
,RectangularShape2ai<ST,IT,IE,P,V,B>
,Serializable
,Shape2ai<ST,IT,IE,P,V,B>
,Shape2D<ST,IT,PathIterator2ai<IE>,P,V,B>
- All Known Implementing Classes:
Rectangle2i
,Rectangle2ifx
public interface Rectangle2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>> extends RectangularShape2ai<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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Rectangle2ai.RectanglePathIterator<E extends PathElement2ai>
Iterator on the path elements of the rectangle.static class
Rectangle2ai.RectangleSideIterator<P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>>
Iterates on points on the sides of a rectangle.static class
Rectangle2ai.Side
Sides of a rectangle.static class
Rectangle2ai.TransformedRectanglePathIterator<E extends PathElement2ai>
Iterator on the path elements of the rectangle.
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default boolean
contains(int x, int y)
Replies if the given point is inside this shape.default boolean
contains(Rectangle2ai<?,?,?,?,?,?> box)
Replies if the given rectangle is inside this shape.default B
createIntersection(RectangularShape2ai<?,?,?,?,?,?> rect)
Compute and replies the intersection of this rectangle and the given rectangle.default B
createUnion(RectangularShape2ai<?,?,?,?,?,?> rect)
Compute and replies the union of this rectangle and the given rectangle.default boolean
equalsToShape(IT shape)
Replies this shape is equal to the given shape.static void
findsClosestPointRectanglePoint(int minx, int miny, int maxx, int maxy, int px, int py, Point2D<?,?> result)
Compute the closest point on the rectangle from the given point.static void
findsClosestPointRectangleRectangle(int rx1, int ry1, int rmaxx1, int rmaxy1, int rx2, int ry2, int rmaxx2, int rmaxy2, Point2D<?,?> closest)
Compute the point on the first rectangle that is the closest to the second rectangle.static void
findsClosestPointRectangleSegment(int rx, int ry, int rmaxx, int rmaxy, int sx1, int sy1, int sx2, int sy2, Point2D<?,?> closest)
Compute the point on the rectangle that is the closest to the segment.static void
findsFarthestPointRectanglePoint(int minx, int miny, int maxx, int maxy, int px, int py, Point2D<?,?> result)
Compute the farthest point on the rectangle from the given point.default P
getClosestPointTo(Circle2ai<?,?,?,?,?,?> circle)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Path2ai<?,?,?,?,?,?> path)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Rectangle2ai<?,?,?,?,?,?> rectangle)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Segment2ai<?,?,?,?,?,?> segment)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Point2D<?,?> pt)
Replies the point on the shape that is closest to the given point.default double
getDistanceL1(Point2D<?,?> pt)
Computes the L-1 (Manhattan) distance between this shape and point p1.default double
getDistanceLinf(Point2D<?,?> pt)
Computes the L-infinite distance between this shape and point p1.default double
getDistanceSquared(Point2D<?,?> pt)
Replies the squared value of the minimal distance from this shape to the given point.default P
getFarthestPointTo(Point2D<?,?> pt)
Replies the point on the shape that is farthest the given point.default PathIterator2ai<IE>
getPathIterator(Transform2D transform)
Replies the elements of the paths.default Iterator<P>
getPointIterator()
Replies an iterator on the points covered by the perimeter of this shape.default Iterator<P>
getPointIterator(Rectangle2ai.Side startingBorder)
Replies the points on the bounds of the rectangle.default boolean
intersects(Circle2ai<?,?,?,?,?,?> circle)
Replies if this shape is intersecting the given circle.default boolean
intersects(MultiShape2ai<?,?,?,?,?,?,?> multishape)
Replies if this shape is intersecting the given multishape.default boolean
intersects(PathIterator2ai<?> iterator)
Replies if this shape is intersecting the path described by the given iterator.default boolean
intersects(Rectangle2ai<?,?,?,?,?,?> rectangle)
Replies if this shape is intersecting the given rectangle.default boolean
intersects(Segment2ai<?,?,?,?,?,?> segment)
Replies if this shape is intersecting the given segment.static boolean
intersectsRectangleRectangle(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
Replies if two rectangles are intersecting.static boolean
intersectsRectangleSegment(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
Replies if a rectangle is intersecting a segment.static int
reducesCohenSutherlandZoneRectangleSegment(int rx1, int ry1, int rx2, int ry2, int sx1, int sy1, int sx2, int sy2, int codePoint1, int codePoint2, Point2D<?,?> newSegmentP1, Point2D<?,?> 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.default void
set(IT shape)
Set this shape with the attributes of the given shape.default void
setIntersection(RectangularShape2ai<?,?,?,?,?,?> rect)
Compute the intersection of this rectangle and the given rectangle.default void
setUnion(RectangularShape2ai<?,?,?,?,?,?> rect)
Compute the union of this rectangle and the given rectangle and change this rectangle with the result of the union.-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.ai.RectangularShape2ai
clear, getCenter, getCenterX, getCenterY, getHeight, getMaxX, getMaxY, getMinX, getMinY, getWidth, inflate, isEmpty, set, set, setFromCenter, setFromCenter, setFromCorners, setFromCorners, setHeight, setMaxX, setMaxY, setMinX, setMinY, setWidth, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.ai.Shape2ai
contains, contains, createTransformedShape, getClosestPointTo, getClosestPointTo, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getDistanceSquared, getGeomFactory, intersects, intersects, toBoundingBox, translate
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Shape2D
clone, equalsToPathIterator, getDistance, getDistance, getPathIterator, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo
-
-
-
-
Method Detail
-
intersectsRectangleRectangle
@Pure static boolean intersectsRectangleRectangle(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
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.x2
- is the second corner of the first rectangle.y2
- 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.x4
- is the second corner of the second rectangle.y4
- is the second corner of the second rectangle.- Returns:
true
if the two shapes are intersecting; otherwisefalse
-
intersectsRectangleSegment
@Pure static boolean intersectsRectangleSegment(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
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.x2
- is the second corner of the rectangle.y2
- is the second corner of the rectangle.x3
- is the first point of the segment.y3
- is the first point of the segment.x4
- is the second point of the segment.y4
- is the second point of the segment.- Returns:
true
if the two shapes are intersecting; otherwisefalse
-
findsClosestPointRectangleRectangle
static void findsClosestPointRectangleRectangle(int rx1, int ry1, int rmaxx1, int rmaxy1, int rx2, int ry2, int rmaxx2, int rmaxy2, Point2D<?,?> closest)
Compute the point on the first rectangle that is the closest to the second rectangle.- Parameters:
rx1
- the minimum x coordinate of the first rectangle.ry1
- the minimum y coordinate of the first rectangle.rmaxx1
- the maximum x coordinate of the first rectangle.rmaxy1
- the maximum y coordinate of the first rectangle.rx2
- the minimum x coordinate of the second rectangle.ry2
- the minimum y coordinate of the second rectangle.rmaxx2
- the maximum x coordinate of the second rectangle.rmaxy2
- the maximum y coordinate of the second rectangle.closest
- is set with the closest point on the first rectangle.
-
findsClosestPointRectangleSegment
static void findsClosestPointRectangleSegment(int rx, int ry, int rmaxx, int rmaxy, int sx1, int sy1, int sx2, int sy2, Point2D<?,?> closest)
Compute the point on the rectangle that is the closest to the segment.- Parameters:
rx
- the minimum x coordinate of the rectangle.ry
- the minimum y coordinate of the rectangle.rmaxx
- the maximum x coordinate of the rectangle.rmaxy
- the maximum y 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.sx2
- the x coordinate of the second point of the segment.sy2
- the y coordinate of the second point of the segment.closest
- is set with the closest point on the rectangle.
-
findsClosestPointRectanglePoint
static void findsClosestPointRectanglePoint(int minx, int miny, int maxx, int maxy, int px, int py, Point2D<?,?> 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.maxx
- is the x-coordinate of the highest coordinate of the rectangle.maxy
- is the y-coordinate of the highest coordinate of the rectangle.px
- is the x-coordinate of the point.py
- is the y-coordinate of the point.result
- the closest point.
-
findsFarthestPointRectanglePoint
static void findsFarthestPointRectanglePoint(int minx, int miny, int maxx, int maxy, int px, int py, Point2D<?,?> 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.maxx
- is the x-coordinate of the highest coordinate of the rectangle.maxy
- is the y-coordinate of the highest coordinate of the rectangle.px
- is the x-coordinate of the point.py
- is the y-coordinate of the point.result
- the farthest point.
-
reducesCohenSutherlandZoneRectangleSegment
static int reducesCohenSutherlandZoneRectangleSegment(int rx1, int ry1, int rx2, int ry2, int sx1, int sy1, int sx2, int sy2, int codePoint1, int codePoint2, Point2D<?,?> newSegmentP1, Point2D<?,?> 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.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.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. Ifnull
, this parameter is ignored.newSegmentP2
- is set with the new coordinates of the segment second point. Ifnull
, this parameter is ignored.- Returns:
- the rectricted Cohen-Sutherland zone.
-
equalsToShape
@Pure default boolean equalsToShape(IT shape)
Description copied from interface:Shape2D
Replies this shape is equal to the given shape.- Specified by:
equalsToShape
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
shape
- the shape to compare to.- Returns:
true
if this shape is equal is equal to the given path.
-
intersects
@Pure default boolean intersects(Rectangle2ai<?,?,?,?,?,?> rectangle)
Description copied from interface:Shape2ai
Replies if this shape is intersecting the given rectangle.- Specified by:
intersects
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
rectangle
- the rectangle.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(Circle2ai<?,?,?,?,?,?> circle)
Description copied from interface:Shape2ai
Replies if this shape is intersecting the given circle.- Specified by:
intersects
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
circle
- the circle.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(Segment2ai<?,?,?,?,?,?> segment)
Description copied from interface:Shape2ai
Replies if this shape is intersecting the given segment.- Specified by:
intersects
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
segment
- the segment.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(PathIterator2ai<?> iterator)
Description copied from interface:Shape2ai
Replies if this shape is intersecting the path described by the given iterator.- Specified by:
intersects
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
iterator
- the path iterator.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(MultiShape2ai<?,?,?,?,?,?,?> multishape)
Description copied from interface:Shape2ai
Replies if this shape is intersecting the given multishape.- Specified by:
intersects
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
multishape
- the multishape.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
contains
@Pure default boolean contains(int x, int y)
Description copied from interface:Shape2ai
Replies if the given point is inside this shape.- Specified by:
contains
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
x
- x coordinate of the point to test.y
- y coordinate of the point to test.- Returns:
true
if the given point is inside this shape, otherwisefalse
.
-
contains
@Pure default boolean contains(Rectangle2ai<?,?,?,?,?,?> box)
Description copied from interface:Shape2ai
Replies if the given rectangle is inside this shape.- Specified by:
contains
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
box
- the rectangle to test.- Returns:
true
if the given box is inside the shape.
-
set
default void set(IT shape)
Description copied from interface:Shape2D
Set this shape with the attributes of the given shape.- Specified by:
set
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
shape
- the shape to copy.
-
getClosestPointTo
@Pure default P getClosestPointTo(Point2D<?,?> pt)
Description copied from interface:Shape2D
Replies the point on the shape that is closest to the given point.- Specified by:
getClosestPointTo
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
pt
- the point.- Returns:
- the closest point on the shape; or the point itself if it is inside the shape.
-
getClosestPointTo
default P getClosestPointTo(Rectangle2ai<?,?,?,?,?,?> rectangle)
Description copied from interface:Shape2ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
rectangle
- the rectangle.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getClosestPointTo
default P getClosestPointTo(Circle2ai<?,?,?,?,?,?> circle)
Description copied from interface:Shape2ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
circle
- the circle.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getClosestPointTo
default P getClosestPointTo(Segment2ai<?,?,?,?,?,?> segment)
Description copied from interface:Shape2ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
segment
- the segment.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getClosestPointTo
default P getClosestPointTo(Path2ai<?,?,?,?,?,?> path)
Description copied from interface:Shape2ai
Replies the closest point on this shape to the given rectangle.- Specified by:
getClosestPointTo
in interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
path
- the path.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getFarthestPointTo
@Pure default P getFarthestPointTo(Point2D<?,?> pt)
Description copied from interface:Shape2D
Replies the point on the shape that is farthest the given point.- Specified by:
getFarthestPointTo
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
pt
- the point.- Returns:
- the farthest point on the shape.
-
getDistanceSquared
@Pure default double getDistanceSquared(Point2D<?,?> pt)
Description copied from interface:Shape2D
Replies the squared value of the minimal distance from this shape to the given point.- Specified by:
getDistanceSquared
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
pt
- the point.- Returns:
- squared value of the minimal distance between this shape and the point.
-
getDistanceL1
@Pure default double getDistanceL1(Point2D<?,?> pt)
Description copied from interface:Shape2D
Computes the L-1 (Manhattan) distance between this shape and point p1. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).- Specified by:
getDistanceL1
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
pt
- the point- Returns:
- the distance.
-
getDistanceLinf
@Pure default double getDistanceLinf(Point2D<?,?> pt)
Description copied from interface:Shape2D
Computes the L-infinite distance between this shape and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].- Specified by:
getDistanceLinf
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
pt
- the point- Returns:
- the distance.
-
getPointIterator
@Pure default Iterator<P> getPointIterator()
Description copied from interface:Shape2ai
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 interfaceShape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,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(Rectangle2ai.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.
-
getPathIterator
default PathIterator2ai<IE> getPathIterator(Transform2D transform)
Description copied from interface:Shape2D
Replies the elements of the paths.- Specified by:
getPathIterator
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Rectangle2ai<?,?,IE,P,V,B>,IE extends PathElement2ai,P extends Point2D<? super P,? super V>,V extends Vector2D<? super V,? super P>,B extends Rectangle2ai<?,?,IE,P,V,B>>
- Parameters:
transform
- is the transformation to apply to the path.- Returns:
- the elements of the path.
-
createUnion
@Pure default B createUnion(RectangularShape2ai<?,?,?,?,?,?> rect)
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:
rect
- the rectangular shape.- Returns:
- the union of this rectangle and the given rectangle.
- See Also:
setUnion(RectangularShape2ai)
-
createIntersection
@Pure default B createIntersection(RectangularShape2ai<?,?,?,?,?,?> rect)
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:
rect
- the rectangular shape.- Returns:
- the union of this rectangle and the given rectangle.
- See Also:
setIntersection(RectangularShape2ai)
-
setUnion
default void setUnion(RectangularShape2ai<?,?,?,?,?,?> rect)
Compute the union of this rectangle and the given rectangle and change this rectangle with the result of the union.- Parameters:
rect
- the rectangular shape.- See Also:
createUnion(RectangularShape2ai)
-
setIntersection
default void setIntersection(RectangularShape2ai<?,?,?,?,?,?> rect)
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:
rect
- the rectangular shape.- See Also:
createIntersection(RectangularShape2ai)
,RectangularShape2ai.clear()
-
-