UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TetUtil.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "VectorTypes.h"
6#include "TriangleTypes.h"
8
10{
11 // Fill an array with the oriented triangle faces of the tet
12 template<bool bReverseOrientation = false>
21
22 // Test whether point Pt is inside or on a (non-degenerate) tetrahedron Tet.
23 // Note: Will always report 'outside' for a fully degenerate (flat) tetrahedron
24 // @return 0 if Pt is outside Tet (or Tet is degenerate), 1 if Pt is inside a positively-oriented Tet, -1 if Pt is inside and Tet is inverted
25 template<typename RealType>
27 {
28 int32 SeenSide = 0;
29 for (int32 TetFace = 0; TetFace < 4; ++TetFace)
30 {
31 FIndex3i FaceInds = Tet.GetFaceIndices(TetFace);
32 int32 Side = TMathUtil<RealType>::SignAsInt(ExactPredicates::Orient3<RealType>(Tet.V[FaceInds.A], Tet.V[FaceInds.B], Tet.V[FaceInds.C], Pt));
33 if (Side != 0)
34 {
35 if (Side * SeenSide < 0)
36 {
37 return 0;
38 }
39 SeenSide = Side;
40 }
41 }
42
43 return SeenSide;
44 }
45
46} // end namespace UE::Geometry::TetUtil
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
static int32 SignAsInt(const RealType Value)
Definition MathUtil.h:228
Definition TetUtil.h:10
void GetTetFaces(const FIndex4i &Tet, FIndex3i OutFaces[4])
Definition TetUtil.h:13
int32 IsInsideExact(const TTetrahedron3< RealType > &Tet, TVector< RealType > &Pt)
Definition TetUtil.h:26
Definition IndexTypes.h:158
Definition IndexTypes.h:296
Definition TriangleTypes.h:351
Definition Vector.h:51