Navigation
API > API/Runtime > API/Runtime/GeometryCore
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.
| Name | FSegmentTree3 |
| Type | class |
| Header File | /Engine/Source/Runtime/GeometryCore/Public/Spatial/SegmentTree3.h |
| Include Path | #include "Spatial/SegmentTree3.h" |
Syntax
class FSegmentTree3
Structs
| Name | Remarks |
|---|---|
| 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 | Type | Remarks | Include Path |
|---|---|---|---|
| GetSplitAxisFunc | TUniqueFunction< int(int Depth, const FAxisAlignedBox3d &Box)> | Spatial/SegmentTree3.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
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. | Spatial/SegmentTree3.h | |
bool FindNearestSegment
(
const FVector3d& P, |
Find the nearest segment to query point P, and return it in NearestSegmentOut | Spatial/SegmentTree3.h | |
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. | Spatial/SegmentTree3.h | |
void SetTolerance
(
double Tolerance |
Sets the box intersection tolerance TODO: move into the IMeshSpatial::FQueryOptions and delete this function | Spatial/SegmentTree3.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Spatial/SegmentTree3.h | |||
void FindNearestSegmentInternal
(
int BoxIndex, |
Spatial/SegmentTree3.h | ||
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"). | Spatial/SegmentTree3.h | |
double GetBoxDistanceSqr
(
int BoxIndex, |
Spatial/SegmentTree3.h | ||
double GetRayBoxIntersectionParam
(
int BoxIndex, |
Spatial/SegmentTree3.h | ||
| Spatial/SegmentTree3.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static GetSplitAxisFunc MakeDefaultSplitAxisFunc() |
Spatial/SegmentTree3.h |