Contents
Interface SpatialStructure<T>
- Type Parameters:
T- the type of data stored in the structure.
- All Known Implementing Classes:
KDTree
public interface SpatialStructure<T>
A spatial structure for organizing and accessing spatial data.
-
Method Summary
Modifier and TypeMethodDescriptionclosest(org.joml.Vector3dc point) Gets the data closest to a point, ornullif there is no data in the structure.voidGets all data that is within a specified spherical radius of a point, defined by center and radius.voidcollectBox(org.joml.Vector3dc min, org.joml.Vector3dc max, List<T> results) Gets all data that is within a specified axis-aligned box, defined by min and max positions.voidcollectCylinder(org.joml.Vector3dc center, double radius, double height, List<T> results) Gets all data that is within a specified cylindrical area, defined by a center point, radius, and height.dump()voidGets all data that is within a specified radius of a point in order of closest to furthest.voidordered3DAxis(org.joml.Vector3dc center, double xSearchRadius, double ySearchRadius, double zSearchRadius, List<T> results) Gets all data that is within specified radius along each axis of a point.voidrebuild(SpatialData<T> data) Builds the structure using the provided data.intsize()
-
Method Details
-
size
int size()- Returns:
- the number of pieces of data in the structure.
-
rebuild
Builds the structure using the provided data. This clears any existing data in the structure.- Parameters:
data- The data to build the structure with.
-
closest
Gets the data closest to a point, ornullif there is no data in the structure.- Parameters:
point- The point to search from.- Returns:
- the data closest to the provided point, or
nullif there is no data in the structure.
-
collect
Gets all data that is within a specified spherical radius of a point, defined by center and radius.- Parameters:
center- The center of the sphere.radius- The radius of the sphere.results- The list to populate with results.
-
collectCylinder
void collectCylinder(@Nonnull org.joml.Vector3dc center, double radius, double height, @Nonnull List<T> results) Gets all data that is within a specified cylindrical area, defined by a center point, radius, and height.- Parameters:
center- The center point of the cylinder's base.radius- The radius of the cylinder.height- The height of the cylinder.results- The list to populate with results.
-
collectBox
void collectBox(@Nonnull org.joml.Vector3dc min, @Nonnull org.joml.Vector3dc max, @Nonnull List<T> results) Gets all data that is within a specified axis-aligned box, defined by min and max positions.- Parameters:
min- The minimum corner of the box (inclusive).max- The maximum corner of the box (inclusive).results- The list to populate with results.
-
ordered
Gets all data that is within a specified radius of a point in order of closest to furthest.If the use case doesn't require the order then please use
collect(Vector3dc, double, List)instead.- Parameters:
center- The center point from which to search.radius- The radius of the search.results- The list to populate with results, ordered from closest to furthest.
-
ordered3DAxis
void ordered3DAxis(@Nonnull org.joml.Vector3dc center, double xSearchRadius, double ySearchRadius, double zSearchRadius, @Nonnull List<T> results) Gets all data that is within specified radius along each axis of a point.- Parameters:
center- The center point from which to search.xSearchRadius- The search radius along the X axis.ySearchRadius- The search radius along the Y axis.zSearchRadius- The search radius along the Z axis.results- The output list to store data within the specified radius, ordered from closest to furthest.
-
dump
- Returns:
- an information dump of this spatial structure, for debugging purposes.
-