Class Euclidean2DPassage
-
- All Implemented Interfaces:
public final class Euclidean2DPassage
Defines a passage between two ConvexPolygons in an euclidean bidimensional space. The passage is oriented, which means it connects tail to head, but the opposite is not necessarily true. tail and head can be non-adjacent (there can be some distance between them), this introduces navigation issues as agents may not know which direction to follow when crossing a passage. passageShapeOnTail is a Segment2D representing the shape of the passage on tail's boundary (e.g. in indoor environments, the segment should represent the shape of the door between two rooms). passageShapeOnTail must be determined so as to guarantee that head is reachable by throwing a ray from any point of the segment in its normal direction. This solves navigation issues as it provides agents with a direction to follow when crossing Euclidean2DPassages (namely, the normal direction to passageShapeOnTail).
-
-
Field Summary
Fields Modifier and Type Field Description private final ConvexPolygon
tail
private final ConvexPolygon
head
private final Segment2D<Euclidean2DPosition>
passageShapeOnTail
-
Constructor Summary
Constructors Constructor Description Euclidean2DPassage(ConvexPolygon tail, ConvexPolygon head, Segment2D<Euclidean2DPosition> passageShapeOnTail)
-
Method Summary
Modifier and Type Method Description final ConvexPolygon
getTail()
final ConvexPolygon
getHead()
final Segment2D<Euclidean2DPosition>
getPassageShapeOnTail()
final Euclidean2DPosition
crossingPointOnTail(Euclidean2DPosition position)
Provided the position of an agent that may want to cross this passage, this method computes the point belonging to passageShapeOnTail which is more convenient to cross. final Euclidean2DPosition
crossingPointOnHead(Euclidean2DPosition crossingPointOnTail)
Provided the crossingPointOnTail that an agent has reached (or will reach), this method computes the point belonging to the boundary of head that the agent should point towards to cross the passage (i.e. final Pair<Euclidean2DPosition, Euclidean2DPosition>
crossingPoints(Euclidean2DPosition position)
Provided the position of an agent that may want to cross this passage, this method returns a pair containing both crossingPointOnTail and crossingPointOnHead. -
-
Constructor Detail
-
Euclidean2DPassage
Euclidean2DPassage(ConvexPolygon tail, ConvexPolygon head, Segment2D<Euclidean2DPosition> passageShapeOnTail)
-
-
Method Detail
-
getTail
final ConvexPolygon getTail()
-
getHead
final ConvexPolygon getHead()
-
getPassageShapeOnTail
final Segment2D<Euclidean2DPosition> getPassageShapeOnTail()
-
crossingPointOnTail
final Euclidean2DPosition crossingPointOnTail(Euclidean2DPosition position)
Provided the position of an agent that may want to cross this passage, this method computes the point belonging to passageShapeOnTail which is more convenient to cross. Note that the agent must be inside tail.
-
crossingPointOnHead
final Euclidean2DPosition crossingPointOnHead(Euclidean2DPosition crossingPointOnTail)
Provided the crossingPointOnTail that an agent has reached (or will reach), this method computes the point belonging to the boundary of head that the agent should point towards to cross the passage (i.e. the first point belonging to head's boundary that is encountered by throwing a ray from crossingPointOnTail along passageShapeOnTail's normal direction). Note that the returned point may not be formally contained in head depending on the definition of insideness used by ConvexPolygon.contains, prefer using ConvexPolygon.containsBoundaryIncluded.
-
crossingPoints
final Pair<Euclidean2DPosition, Euclidean2DPosition> crossingPoints(Euclidean2DPosition position)
Provided the position of an agent that may want to cross this passage, this method returns a pair containing both crossingPointOnTail and crossingPointOnHead.
-
-
-
-