MCPcopy Create free account
hub / github.com/PCGEx/PCGExtendedToolkit / FindIntersection

Function FindIntersection

Source/PCGExtendedToolkit/Public/PCGExMath.h:100–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99 template <EIntersectionTestMode Mode = EIntersectionTestMode::Strict>
100 bool FindIntersection(const FVector& A2, const FVector& B2, double SquaredTolerance, FVector& OutSelf, FVector& OutOther) const
101 {
102 FMath::SegmentDistToSegment(A, B, A2, B2, OutSelf, OutOther);
103
104 if constexpr (Mode == EIntersectionTestMode::Strict)
105 {
106 if (A == OutSelf || B == OutSelf || A2 == OutOther || B2 == OutOther) { return false; }
107 }
108 else if constexpr (Mode == EIntersectionTestMode::StrictOnSelfA)
109 {
110 if (A == OutSelf) { return false; }
111 }
112 else if constexpr (Mode == EIntersectionTestMode::StrictOnSelfB)
113 {
114 if (B == OutSelf) { return false; }
115 }
116 else if constexpr (Mode == EIntersectionTestMode::StrictOnOtherA)
117 {
118 if (A2 == OutOther) { return false; }
119 }
120 else if constexpr (Mode == EIntersectionTestMode::StrictOnOtherB)
121 {
122 if (B2 == OutOther) { return false; }
123 }
124 else if constexpr (Mode == EIntersectionTestMode::LooseOnSelf)
125 {
126 if (A2 == OutOther || B2 == OutOther) { return false; }
127 }
128 else if constexpr (Mode == EIntersectionTestMode::LooseOnOther)
129 {
130 if (A == OutSelf || B == OutSelf) { return false; }
131 }
132 else if constexpr (Mode == EIntersectionTestMode::LooseOnSelfA)
133 {
134 if (B == OutSelf || A2 == OutOther || B2 == OutOther) { return false; }
135 }
136 else if constexpr (Mode == EIntersectionTestMode::LooseOnSelfB)
137 {
138 if (A == OutSelf || A2 == OutOther || B2 == OutOther) { return false; }
139 }
140 else if constexpr (Mode == EIntersectionTestMode::LooseOnOtherA)
141 {
142 if (A == OutSelf || B == OutSelf || B2 == OutOther) { return false; }
143 }
144 else if constexpr (Mode == EIntersectionTestMode::LooseOnOtherB)
145 {
146 if (A == OutSelf || B == OutSelf || A2 == OutOther) { return false; }
147 }
148
149 if (FVector::DistSquared(OutSelf, OutOther) >= SquaredTolerance) { return false; }
150 return true;
151 }
152 };
153
154 template <EPCGExPointBoundsSource S = EPCGExPointBoundsSource::ScaledBounds>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected