Navigation
API > API/Runtime > API/Runtime/GeometryCore > API/Runtime/GeometryCore/Spatial
References
| Module | GeometryCore |
| Header | /Engine/Source/Runtime/GeometryCore/Public/Spatial/SegmentTree3.h |
| Include | #include "Spatial/SegmentTree3.h" |
Syntax
class FSegmentTree3
Remarks
FSegmentTree3 is a spatial data structure for a set of 3D line segments. The line segments are provided externally, and each segment can have an arbitrary ID. The line segment geometry (ie endpoints) are stored directly by FSegmentTree3, so the class does not hold onto any reference to the source geometry (ie unlike FMeshAABBTree3).
Available queries:
- FindNearestSegment(Point) - finds the nearest segment to the 3D point
- FindNearestVisibleSegmentHitByRay(Ray) - finds the nearest segment that is "hit" by the ray under a tolerance check (see comments below). This is mainly intended for UI hit testing.
Variables
| Type | Name | Description | |
|---|---|---|---|
| double | BoxEps | TODO: move BoxEps to IMeshSpatial::FQueryOptions. | |
| GetSplitAxisFunc | GetSplitAxis | ||
| TArray< int > | IndexList | List of indices for a given Box. | |
| int | RootBoxIndex | RootBoxIndex is the index of the root box of the tree, index into TreeBoxes. | |
| TArray< FSegment > | SegmentList | List of segments | |
| int | SegmentsEnd | IndexList[i] for i < SegmentsEnd is a segment-index list, ie a leaf-box list. | |
| int | TopDownLeafMaxSegmentCount | ||
| TArray< FTreeBox > | TreeBoxes |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Build
(
SegmentIDEnumerable Enumerable, |
Build the segment tree based on the given Enumerable (ie something that supports a range-based for loop over a set of integer IDs) and a function GetSegmentForID that returns the 3D line segment for a given ID. | |
| void | BuildTopDown
(
TArray< int >& SegmentIndices, |
||
| bool | FindNearestSegment
(
const FVector3d& P, |
Find the nearest segment to query point P, and return it in NearestSegmentOut | |
| void | FindNearestSegmentInternal
(
int BoxIndex, |
||
| bool | FindNearestVisibleSegmentHitByRay
(
const FRay3d& Ray, |
Find the segment that is hit by a 3D ray under a function WithinToleranceCheck, which will be called with the Ray and Segment points. | |
| void | FindNearestVisibleSegmentHitByRayInternal
(
int BoxIndex, |
This function tries to find the segment "hit" by the ray, where the definition of "hit" tries to balance distance from the ray origin (ie "close to eye") and distance from the hit segment (ie "on the line"). | |
| double | GetBoxDistanceSqr
(
int BoxIndex, |
||
| double | GetRayBoxIntersectionParam
(
int BoxIndex, |
||
| GetSplitAxisFunc | |||
| void | SetTolerance
(
double Tolerance |
Sets the box intersection tolerance TODO: move into the IMeshSpatial::FQueryOptions and delete this function | |
| int | SplitSegmentSetMidpoints
(
TArray< int >& SegmentIndices, |
Classes
| Type | Name | Description | |
|---|---|---|---|
| FBoxesSet | This is a temporary data structure used in tree building | ||
| FRayNearestSegmentInfo | Information on a nearest-segment returned by query functions | ||
| FSegment | FSegment is a 3D line segment with an external identifier | ||
| FTreeBox | Storage for Box Nodes. |
Typedefs
| Name | Description |
|---|---|
| GetSplitAxisFunc |