UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Intersector1.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 Intersector1.h ported from WildMagic5
5=============================================================================*/
6
7#pragma once
8
9#include "Math/UnrealMath.h"
10#include "VectorTypes.h"
11#include "BoxTypes.h"
12
13namespace UE
14{
15namespace Geometry
16{
17
23template<typename RealType>
25{
26private:
28 TInterval1<RealType> Intersections;
29
30public:
35
43
44 TIntersector1(RealType u0, RealType u1, RealType v0, RealType v1) : Intersections(0,0), U(u0, u1), V(v0, v1)
45 {
46 check(u0 <= u1);
47 check(v0 <= v1);
48 }
49
50 TIntersector1(const TInterval1<RealType>& u, const TInterval1<RealType>& v) : Intersections(0, 0), U(u), V(v)
51 {
52 }
53
58 bool Test() const
59 {
60 return U.Min <= V.Max && U.Max >= V.Min;
61 }
62
66 RealType GetIntersection(int i)
67 {
68 return i == 0 ? Intersections.Min : Intersections.Max;
69 }
70
75 bool Find()
76 {
77 if ((U.Max < V.Min) || (U.Min > V.Max))
78 {
80 }
81 else if (U.Max > V.Min)
82 {
83 if (U.Min < V.Max)
84 {
86 Intersections.Min = (U.Min < V.Min ? V.Min : U.Min);
87 Intersections.Max = (U.Max > V.Max ? V.Max : U.Max);
88 if (Intersections.Min == Intersections.Max)
89 {
91 }
92 }
93 else
94 {
95 // U.Min == V.Max
97 Intersections.Min = U.Min;
98 }
99 }
100 else
101 {
102 // U.Max == V.Min
104 Intersections.Min = U.Max;
105 }
106
107 return NumIntersections > 0;
108 }
109
110};
111
114
115} // end namespace UE::Geometry
116} // end namespace UE
#define check(expr)
Definition AssertionMacros.h:314
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Intersector1.h:25
TIntersector1(const TInterval1< RealType > &u, const TInterval1< RealType > &v)
Definition Intersector1.h:50
TInterval1< RealType > U
Definition Intersector1.h:32
bool Find()
Definition Intersector1.h:75
TInterval1< RealType > V
Definition Intersector1.h:34
bool Test() const
Definition Intersector1.h:58
TIntersector1(RealType u0, RealType u1, RealType v0, RealType v1)
Definition Intersector1.h:44
int NumIntersections
Definition Intersector1.h:42
RealType GetIntersection(int i)
Definition Intersector1.h:66
TIntersector1< double > FIntersector1d
Definition Intersector1.h:112
TIntersector1< float > FIntersector1f
Definition Intersector1.h:113
Definition AdvancedWidgetsModule.cpp:13
float v
Definition radaudio_mdct.cpp:62
Definition BoxTypes.h:19
RealType Min
Definition BoxTypes.h:20
RealType Max
Definition BoxTypes.h:21