Class CompositeBoundary2D
java.lang.Object
org.episteme.core.mathematics.geometry.boundaries.CompositeBoundary2D
- All Implemented Interfaces:
Serializable, Boundary<Point2D>, Boundary2D
A composite 2D boundary supporting exclaves and enclaves.
This class represents complex territorial shapes:
- Exclaves - Multiple disjoint regions that belong to the same territory (e.g., Alaska as an exclave of the contiguous USA)
- Enclaves - Holes within a region that don't belong to it (e.g., Vatican City as an enclave within Rome)
A point is considered "inside" the composite boundary if it is inside at least one inclusion region AND not inside any exclusion region.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classResult of a containment check with detailed status. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty composite boundary.CompositeBoundary2D(List<Boundary2D> inclusions, List<Boundary2D> exclusions) Creates a composite from inclusions and exclusions.CompositeBoundary2D(Boundary2D mainBoundary) Creates a composite boundary with a single inclusion. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExclusion(Boundary2D region) Adds an exclusion region (enclave/hole).voidaddInclusion(Boundary2D region) Adds an inclusion region (exclave).booleanChecks if a point is inside the composite boundary.Computes the convex hull of this boundary.Creates an extruded 3D boundary from this 2D boundary.getArea()Returns the area of this 2D boundary.Returns the bounding box of this boundary.Returns the centroid of this boundary.getContainmentStatus(Point2D point) Determines the containment status of a point.intReturns the number of holes (enclaves).intReturns the number of disjoint regions (exclaves).Returns the exclusion regions (enclaves/holes).Returns the inclusion regions (exclaves).Returns the perimeter of this 2D boundary.getVertex(int index) Returns a specific vertex.intReturns the number of vertices.Returns the vertices of this boundary in order.intersection(Boundary<Point2D> other) Computes the intersection of this boundary with another.booleanintersects(Boundary<Point2D> other) Checks if this boundary intersects with another.booleanisConvex()Checks if this boundary is convex.booleanisEmpty()Checks if this boundary is empty.Rotates the boundary around the centroid.rotateAround(Real angleRadians, Point2D pivot) Rotates around a specific pivot point.Creates a scaled copy of this boundary.toString()Creates a copy of this boundary translated by a vector.Computes the union of this boundary with another.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Boundary2D
getBoundaryMeasure, getDimension, getMeasure
-
Constructor Details
-
CompositeBoundary2D
public CompositeBoundary2D()Creates an empty composite boundary. -
CompositeBoundary2D
Creates a composite boundary with a single inclusion.- Parameters:
mainBoundary- the main boundary
-
CompositeBoundary2D
Creates a composite from inclusions and exclusions.- Parameters:
inclusions- the inclusion regions (exclaves)exclusions- the exclusion regions (enclaves/holes)
-
-
Method Details
-
addInclusion
Adds an inclusion region (exclave).- Parameters:
region- the region to include
-
addExclusion
Adds an exclusion region (enclave/hole).- Parameters:
region- the region to exclude
-
getInclusions
Returns the inclusion regions (exclaves).- Returns:
- unmodifiable list of inclusions
-
getExclusions
Returns the exclusion regions (enclaves/holes).- Returns:
- unmodifiable list of exclusions
-
getExclaveCount
public int getExclaveCount()Returns the number of disjoint regions (exclaves).- Returns:
- exclave count
-
getEnclaveCount
public int getEnclaveCount()Returns the number of holes (enclaves).- Returns:
- enclave count
-
contains
Checks if a point is inside the composite boundary.A point is IN if:
- It is inside at least one inclusion (exclave)
- AND it is not inside any exclusion (enclave)
-
getContainmentStatus
Determines the containment status of a point.- Parameters:
point- the point to check- Returns:
- the containment result
-
getVertices
Description copied from interface:Boundary2DReturns the vertices of this boundary in order.- Specified by:
getVerticesin interfaceBoundary2D- Returns:
- list of vertices
-
getVertexCount
public int getVertexCount()Description copied from interface:Boundary2DReturns the number of vertices.- Specified by:
getVertexCountin interfaceBoundary2D- Returns:
- vertex count
-
getVertex
Description copied from interface:Boundary2DReturns a specific vertex.- Specified by:
getVertexin interfaceBoundary2D- Parameters:
index- the vertex index- Returns:
- the vertex
-
getArea
Description copied from interface:Boundary2DReturns the area of this 2D boundary.- Specified by:
getAreain interfaceBoundary2D- Returns:
- the area
-
getPerimeter
Description copied from interface:Boundary2DReturns the perimeter of this 2D boundary.- Specified by:
getPerimeterin interfaceBoundary2D- Returns:
- the perimeter
-
isConvex
public boolean isConvex()Description copied from interface:Boundary2DChecks if this boundary is convex.- Specified by:
isConvexin interfaceBoundary2D- Returns:
- true if convex
-
isEmpty
-
getCentroid
Description copied from interface:BoundaryReturns the centroid of this boundary.- Specified by:
getCentroidin interfaceBoundary<Point2D>- Returns:
- the geometric center
-
getBoundingBox
Description copied from interface:BoundaryReturns the bounding box of this boundary.- Specified by:
getBoundingBoxin interfaceBoundary<Point2D>- Returns:
- an axis-aligned bounding box
-
intersects
-
union
-
intersection
-
convexHull
-
translate
-
scale
-
rotate
Description copied from interface:Boundary2DRotates the boundary around the centroid.- Specified by:
rotatein interfaceBoundary2D- Parameters:
angleRadians- rotation angle in radians- Returns:
- rotated boundary
-
rotateAround
Description copied from interface:Boundary2DRotates around a specific pivot point.- Specified by:
rotateAroundin interfaceBoundary2D- Parameters:
angleRadians- rotation anglepivot- the pivot point- Returns:
- rotated boundary
-
extrude
Description copied from interface:Boundary2DCreates an extruded 3D boundary from this 2D boundary.- Specified by:
extrudein interfaceBoundary2D- Parameters:
height- the extrusion height- Returns:
- a 3D boundary
-
toString
-