UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ConvexVolume.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
7/*=============================================================================
8 ConvexVolume.h: Convex volume definitions.
9=============================================================================*/
10
15{
16private:
17 bool bInside;
18 bool bOutside;
19
20public:
21
22 // Constructor.
23
25 bInside(false), bOutside(false)
26 {}
28 bInside(bInInside), bOutside(bInOutside)
29 {}
30
31 // Accessors.
32
33 void SetInside(bool bNewInside) { bInside = bNewInside; }
34 void SetOutside(bool bNewOutside) { bOutside = bNewOutside; }
35 bool GetInside() const { return bInside; }
36 bool GetOutside() const { return bOutside; }
37};
38
39//
40// FConvexVolume
41//
42
44{
45public:
46
49
53
55 {
56// int32 N = 5;
57 }
58
69
73 ENGINE_API void Init(void);
74
83 ENGINE_API bool ClipPolygon(class FPoly& Polygon) const;
84
85 // Intersection tests.
86
87 ENGINE_API FOutcode GetBoxIntersectionOutcode(const FVector& Origin,const FVector& Extent) const;
88
96 ENGINE_API bool IntersectBox(const FVector& Origin,const FVector& Extent) const;
97
106 ENGINE_API bool IntersectBox(const FVector& Origin,const FVector& Extent, bool& bOutFullyContained) const;
107
114 ENGINE_API bool IntersectSphere(const FVector& Origin,const float& Radius) const;
115
123 ENGINE_API bool IntersectSphere(const FVector& Origin,const float& Radius, bool& bOutFullyContained) const;
124
130 ENGINE_API bool IntersectTriangle(const FVector& PointA, const FVector& PointB, const FVector& PointC, bool& bOutFullyContained) const;
131
139 ENGINE_API bool IntersectLineSegment(const FVector& Start, const FVector& End) const;
140
147 ENGINE_API float DistanceTo(const FVector& Point) const;
148
156 ENGINE_API bool IntersectBox(const FVector& Origin,const FVector& Translation,const FVector& Extent) const;
157
163 bool IntersectPoint(const FVector& Point) const
164 {
165 return IntersectSphere(Point, 0.0f);
166 }
167
176 friend ENGINE_API FArchive& operator<<(FArchive& Ar,FConvexVolume& ConvexVolume);
177};
178
186extern ENGINE_API void GetViewFrustumBounds(FConvexVolume& OutResult, const FMatrix& ViewProjectionMatrix, bool bUseNearPlane);
187
196extern ENGINE_API void GetViewFrustumBounds(FConvexVolume& OutResult, const FMatrix& ViewProjectionMatrix, bool bUseNearPlane, bool bUseFarPlane);
197
207extern ENGINE_API void GetViewFrustumBounds(FConvexVolume& OutResult, const FMatrix& ViewProjectionMatrix, const FPlane& InFarPlane, bool bOverrideFarPlane, bool bUseNearPlane);
ENGINE_API void GetViewFrustumBounds(FConvexVolume &OutResult, const FMatrix &ViewProjectionMatrix, bool bUseNearPlane)
Definition ConvexVolume.cpp:768
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Archive.h:1208
Definition Polys.h:38
Definition Array.h:670
Definition ContainerAllocationPolicies.h:894
@ false
Definition radaudio_common.h:23
Definition ConvexVolume.h:44
ENGINE_API float DistanceTo(const FVector &Point) const
Definition ConvexVolume.cpp:666
ENGINE_API bool IntersectLineSegment(const FVector &Start, const FVector &End) const
Definition ConvexVolume.cpp:616
FConvexVolume()
Definition ConvexVolume.h:54
TArray< FPlane, TInlineAllocator< 8 > > FPermutedPlaneArray
Definition ConvexVolume.h:48
FConvexVolume(const TArray< FPlane, TInlineAllocator< 6 > > &InPlanes)
Definition ConvexVolume.h:64
ENGINE_API void Init(void)
Definition ConvexVolume.cpp:14
ENGINE_API bool IntersectSphere(const FVector &Origin, const float &Radius) const
Definition ConvexVolume.cpp:310
TArray< FPlane, TInlineAllocator< 6 > > FPlaneArray
Definition ConvexVolume.h:47
ENGINE_API bool IntersectTriangle(const FVector &PointA, const FVector &PointB, const FVector &PointC, bool &bOutFullyContained) const
Definition ConvexVolume.cpp:412
friend ENGINE_API FArchive & operator<<(FArchive &Ar, FConvexVolume &ConvexVolume)
Definition ConvexVolume.cpp:791
ENGINE_API bool IntersectBox(const FVector &Origin, const FVector &Extent) const
Definition ConvexVolume.cpp:217
ENGINE_API bool ClipPolygon(class FPoly &Polygon) const
Definition ConvexVolume.cpp:76
FPermutedPlaneArray PermutedPlanes
Definition ConvexVolume.h:52
FPlaneArray Planes
Definition ConvexVolume.h:50
ENGINE_API FOutcode GetBoxIntersectionOutcode(const FVector &Origin, const FVector &Extent) const
Definition ConvexVolume.cpp:92
bool IntersectPoint(const FVector &Point) const
Definition ConvexVolume.h:163
Definition ConvexVolume.h:15
FOutcode()
Definition ConvexVolume.h:24
void SetInside(bool bNewInside)
Definition ConvexVolume.h:33
FOutcode(bool bInInside, bool bInOutside)
Definition ConvexVolume.h:27
bool GetInside() const
Definition ConvexVolume.h:35
void SetOutside(bool bNewOutside)
Definition ConvexVolume.h:34
bool GetOutside() const
Definition ConvexVolume.h:36