Interface Shape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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
,Serializable
,Shape2D<ST,IT,PathIterator2ai<IE>,P,V,B>
- All Known Subinterfaces:
Circle2ai<ST,IT,IE,P,V,B>
,MultiShape2ai<ST,IT,CT,IE,P,V,B>
,Path2ai<ST,IT,IE,P,V,B>
,Rectangle2ai<ST,IT,IE,P,V,B>
,RectangularShape2ai<ST,IT,IE,P,V,B>
,Segment2ai<ST,IT,IE,P,V,B>
,Shape2i<IT>
,Shape2ifx<IT>
- All Known Implementing Classes:
AbstractRectangularShape2i
,AbstractRectangularShape2ifx
,AbstractShape2i
,AbstractShape2ifx
,Circle2i
,Circle2ifx
,MultiShape2i
,MultiShape2ifx
,Path2i
,Path2ifx
,Rectangle2i
,Rectangle2ifx
,Segment2i
,Segment2ifx
,SegmentPoint2i
public interface Shape2ai<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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 Shape2D<ST,IT,PathIterator2ai<IE>,P,V,B>
2D shape with 2d floating coordinates.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
contains(int x, int y)
Replies if the given point is inside this shape.boolean
contains(Rectangle2ai<?,?,?,?,?,?> box)
Replies if the given rectangle is inside this shape.default boolean
contains(Point2D<?,?> pt)
Replies if the given point is inside this shape.default boolean
contains(Shape2D<?,?,?,?,?,?> shape)
Replies if this shape is inside the given shape.default ST
createTransformedShape(Transform2D transform)
Apply the transformation to the shape and reply the result.P
getClosestPointTo(Circle2ai<?,?,?,?,?,?> circle)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(MultiShape2ai<?,?,?,?,?,?,?> multishape)
Replies the closest point on this shape to the given rectangle.P
getClosestPointTo(Path2ai<?,?,?,?,?,?> path)
Replies the closest point on this shape to the given rectangle.P
getClosestPointTo(Rectangle2ai<?,?,?,?,?,?> rectangle)
Replies the closest point on this shape to the given rectangle.P
getClosestPointTo(Segment2ai<?,?,?,?,?,?> segment)
Replies the closest point on this shape to the given rectangle.default P
getClosestPointTo(Shape2D<?,?,?,?,?,?> shape)
Replies the point on the shape that is closest to the given shape.default double
getDistanceSquared(Circle2ai<?,?,?,?,?,?> circle)
Replies the minimum distance between this shape and the given circle.default double
getDistanceSquared(MultiShape2ai<?,?,?,?,?,?,?> multishape)
Replies the minimum distance between this shape and the given multishape.default double
getDistanceSquared(Path2ai<?,?,?,?,?,?> path)
Replies the minimum distance between this shape and the given path.default double
getDistanceSquared(Rectangle2ai<?,?,?,?,?,?> rectangle)
Replies the minimum distance between this shape and the given rectangle.default double
getDistanceSquared(Segment2ai<?,?,?,?,?,?> segment)
Replies the minimum distance between this shape and the given segment.default double
getDistanceSquared(Shape2D<?,?,?,?,?,?> shape)
Replies the squared value of the minimal distance from this shape to the given shape.GeomFactory2ai<IE,P,V,B>
getGeomFactory()
Replies the geometry factory associated to this point.Iterator<P>
getPointIterator()
Replies an iterator on the points covered by the perimeter of this shape.boolean
intersects(Circle2ai<?,?,?,?,?,?> circle)
Replies if this shape is intersecting the given circle.boolean
intersects(MultiShape2ai<?,?,?,?,?,?,?> multishape)
Replies if this shape is intersecting the given multishape.default boolean
intersects(Path2ai<?,?,?,?,?,?> path)
Replies if this shape is intersecting the given path.boolean
intersects(PathIterator2ai<?> iterator)
Replies if this shape is intersecting the path described by the given iterator.boolean
intersects(Rectangle2ai<?,?,?,?,?,?> rectangle)
Replies if this shape is intersecting the given rectangle.boolean
intersects(Segment2ai<?,?,?,?,?,?> segment)
Replies if this shape is intersecting the given segment.default boolean
intersects(Shape2D<?,?,?,?,?,?> shape)
Replies if this shape is intersecting the given shape.default B
toBoundingBox()
Replies the bounding box of this shape.void
translate(int dx, int dy)
Translate the shape.default void
translate(Vector2D<?,?> vector)
Translate the shape.-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Shape2D
clear, clone, equalsToPathIterator, equalsToShape, getClosestPointTo, getDistance, getDistance, getDistanceL1, getDistanceLinf, getDistanceSquared, getFarthestPointTo, getPathIterator, getPathIterator, isEmpty, operator_add, operator_and, operator_and, operator_minus, operator_multiply, operator_plus, operator_remove, operator_upTo, set, toBoundingBox
-
-
-
-
Method Detail
-
getPointIterator
@Pure Iterator<P> getPointIterator()
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.
- Returns:
- an iterator on the points that are located at the perimeter of the shape.
-
contains
@Pure default boolean contains(Point2D<?,?> pt)
Description copied from interface:Shape2D
Replies if the given point is inside this shape.- Specified by:
contains
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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:
true
if the given shape is intersecting this shape, otherwisefalse
.
-
contains
@Pure boolean contains(int x, int y)
Replies if the given point is inside this shape.- 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 boolean contains(Rectangle2ai<?,?,?,?,?,?> box)
Replies if the given rectangle is inside this shape.- Parameters:
box
- the rectangle to test.- Returns:
true
if the given box is inside the shape.
-
contains
@Pure default boolean contains(Shape2D<?,?,?,?,?,?> shape)
Description copied from interface:Shape2D
Replies if this shape is inside the given shape.You must use the containing functions with a specific parameter type in place of this general function. Indeed, the implementation of this function is unefficient due to the tests against the types of the given shape, and the cast operators.
- Specified by:
contains
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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 the given shape is inside this shape;false
otherwise.
-
translate
@Pure default void translate(Vector2D<?,?> vector)
Description copied from interface:Shape2D
Translate the shape.- Specified by:
translate
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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:
vector
- the translation vector.
-
translate
void translate(int dx, int dy)
Translate the shape.- Parameters:
dx
- x translation.dy
- y translation.
-
toBoundingBox
@Pure default B toBoundingBox()
Description copied from interface:Shape2D
Replies the bounding box of this shape.- Specified by:
toBoundingBox
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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:
- the bounding box of this shape.
-
intersects
@Pure default boolean intersects(Shape2D<?,?,?,?,?,?> shape)
Description copied from interface:Shape2D
Replies if this shape is intersecting the given shape.You must use the intersection functions with a specific parameter type in place of this general function. Indeed, the implementation of this function is unefficient due to the tests against the types of the given shape, and the cast operators.
- Specified by:
intersects
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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 intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure boolean intersects(Rectangle2ai<?,?,?,?,?,?> rectangle)
Replies if this shape is intersecting the given rectangle.- Parameters:
rectangle
- the rectangle.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure boolean intersects(Circle2ai<?,?,?,?,?,?> circle)
Replies if this shape is intersecting the given circle.- Parameters:
circle
- the circle.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure boolean intersects(Segment2ai<?,?,?,?,?,?> segment)
Replies if this shape is intersecting the given segment.- Parameters:
segment
- the segment.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure boolean intersects(MultiShape2ai<?,?,?,?,?,?,?> multishape)
Replies if this shape is intersecting the given multishape.- Parameters:
multishape
- the multishape.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure default boolean intersects(Path2ai<?,?,?,?,?,?> path)
Replies if this shape is intersecting the given path.- Parameters:
path
- the path.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
intersects
@Pure boolean intersects(PathIterator2ai<?> iterator)
Replies if this shape is intersecting the path described by the given iterator.- Parameters:
iterator
- the path iterator.- Returns:
true
if this shape is intersecting the given shape;false
if there is no intersection.
-
getDistanceSquared
@Pure default double getDistanceSquared(Shape2D<?,?,?,?,?,?> shape)
Description copied from interface:Shape2D
Replies the squared value of the minimal distance from this shape to the given shape.- Specified by:
getDistanceSquared
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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.- Returns:
- squared value of the minimal distance between this shape and the given shape.
-
getDistanceSquared
@Pure default double getDistanceSquared(Rectangle2ai<?,?,?,?,?,?> rectangle)
Replies the minimum distance between this shape and the given rectangle.- Parameters:
rectangle
- the rectangle.- Returns:
- the minimum distance between the two shapes.
-
getDistanceSquared
@Pure default double getDistanceSquared(Circle2ai<?,?,?,?,?,?> circle)
Replies the minimum distance between this shape and the given circle.- Parameters:
circle
- the circle- Returns:
- the minimum distance between the two shapes.
-
getDistanceSquared
@Pure default double getDistanceSquared(Segment2ai<?,?,?,?,?,?> segment)
Replies the minimum distance between this shape and the given segment.- Parameters:
segment
- the segment.- Returns:
- the minimum distance between the two shapes.
-
getDistanceSquared
@Pure default double getDistanceSquared(MultiShape2ai<?,?,?,?,?,?,?> multishape)
Replies the minimum distance between this shape and the given multishape.- Parameters:
multishape
- the multishape.- Returns:
- the minimum distance between the two shapes.
-
getDistanceSquared
@Pure default double getDistanceSquared(Path2ai<?,?,?,?,?,?> path)
Replies the minimum distance between this shape and the given path.- Parameters:
path
- the path.- Returns:
- the minimum distance between the two shapes.
-
getClosestPointTo
@Pure default P getClosestPointTo(Shape2D<?,?,?,?,?,?> shape)
Description copied from interface:Shape2D
Replies the point on the shape that is closest to the given shape.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 interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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.- Returns:
- the closest point on the shape.
-
getClosestPointTo
@Pure P getClosestPointTo(Rectangle2ai<?,?,?,?,?,?> rectangle)
Replies the closest point on this shape to the given rectangle.- 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
@Pure P getClosestPointTo(Circle2ai<?,?,?,?,?,?> circle)
Replies the closest point on this shape to the given rectangle.- 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
@Pure P getClosestPointTo(Segment2ai<?,?,?,?,?,?> segment)
Replies the closest point on this shape to the given rectangle.- 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
@Pure default P getClosestPointTo(MultiShape2ai<?,?,?,?,?,?,?> multishape)
Replies the closest point on this shape to the given rectangle.- Parameters:
multishape
- the multishape.- Returns:
- the closest point on this shape to the given shape; or the point if the point is in this shape.
-
getClosestPointTo
@Pure P getClosestPointTo(Path2ai<?,?,?,?,?,?> path)
Replies the closest point on this shape to the given rectangle.- 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.
-
getGeomFactory
GeomFactory2ai<IE,P,V,B> getGeomFactory()
Description copied from interface:Shape2D
Replies the geometry factory associated to this point.- Specified by:
getGeomFactory
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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:
- the factory.
-
createTransformedShape
@Pure default ST createTransformedShape(Transform2D transform)
Description copied from interface:Shape2D
Apply the transformation to the shape and reply the result. This function does not change the current shape.- Specified by:
createTransformedShape
in interfaceShape2D<ST extends Shape2ai<?,?,IE,P,V,B>,IT extends Shape2ai<?,?,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 shape.- Returns:
- the result of the transformation.
-
-