UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ModelMesh.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Core/CADEntity.h"
5#include "Core/EntityGeom.h"
6#include "Core/Session.h"
7#include "Core/Types.h"
9
10namespace UE::CADKernel
11{
12class FCriterion;
13class FDatabase;
14class FEdgeMesh;
15class FFaceMesh;
16class FMesh;
17class FSession;
18class FVertexMesh;
19
21{
22 friend FEntity;
23
25
26 TArray<TArray<FVector>*> GlobalPointCloud;
27 FIdent LastIdUsed;
28
29 TArray<FVertexMesh*> VertexMeshes;
30 TArray<FEdgeMesh*> EdgeMeshes;
31 TArray<FFaceMesh*> FaceMeshes;
32
33 bool QuadAnalyse = false;
35 double MaxSize = HUGE_VALUE;
36 double MaxAngle = DOUBLE_PI;
37 double Sag = HUGE_VALUE;
38
40 : FEntityGeom()
41 , LastIdUsed(0)
42 {
43 }
44
45public:
46
47 const TArray<TArray<FVector>*>& GetGlobalPointCloud() const { return GlobalPointCloud; };
48
50 {
51 return FaceMeshes.Num();
52 }
53
55 {
56 return LastIdUsed;
57 }
58
59 int32 GetTriangleCount() const;
60
61 virtual void SpawnIdent(FDatabase& Database) override
62 {
63 if (!FEntity::SetId(Database))
64 {
65 return;
66 }
67
68 SpawnIdentOnEntities((TArray<FEntity*>&) VertexMeshes, Database);
69 SpawnIdentOnEntities((TArray<FEntity*>&) EdgeMeshes, Database);
70 SpawnIdentOnEntities((TArray<FEntity*>&) FaceMeshes, Database);
71 };
72
73 virtual void ResetMarkersRecursively() const override
74 {
75 ResetMarkers();
76 ResetMarkersRecursivelyOnEntities((TArray<FEntity*>&) VertexMeshes);
77 ResetMarkersRecursivelyOnEntities((TArray<FEntity*>&) EdgeMeshes);
78 ResetMarkersRecursivelyOnEntities((TArray<FEntity*>&) FaceMeshes);
79 };
80
81
82 virtual EEntity GetEntityType() const override
83 {
84 return EEntity::MeshModel;
85 }
86
88 {
89 return Criteria;
90 }
91
92 void AddCriterion(TSharedPtr<FCriterion>& Criterion);
93
94 double GetGeometricTolerance() const
95 {
96 return MinSize * 0.5; // MinSize is twice GeometricTolerance
97 }
98
99 double GetMinSize() const
100 {
101 return MinSize;
102 }
103
104 double GetMaxSize() const
105 {
106 return MaxSize;
107 }
108
110 {
111 return MaxAngle;
112 }
113
114 double GetSag() const
115 {
116 return Sag;
117 }
118
120 {
121 VertexMeshes.Add(&Mesh);
122 }
123
125 {
126 EdgeMeshes.Add(&Mesh);
127 }
128
130 {
131 FaceMeshes.Add(&Mesh);
132 }
133
135 {
136 OutIndex = (int32)GlobalPointCloud.Num();
137 OutStartVertexId = LastIdUsed;
138
139 GlobalPointCloud.Add(&Coordinates);
140 LastIdUsed += (int32)Coordinates.Num();
141 }
142
143 //const int32 GetIndexOfVertexFromId(const int32 Id) const;
144 //const int32 GetIndexOfEdgeFromId(const int32 Id) const;
145 //const int32 GetIndexOfSurfaceFromId(const int32 Id) const;
146
147 const FVertexMesh* GetMeshOfVertexNodeId(const int32 Id) const;
148
149 void GetNodeCoordinates(TArray<FVector>& NodeCoordinates) const;
150 void GetNodeCoordinates(TArray<FVector3f>& NodeCoordinates) const;
151
152 const TArray<FMesh*>& GetMeshes() const;
153
155 {
156 return FaceMeshes;
157 }
158
159#ifdef CADKERNEL_DEV
160 virtual FInfoEntity& GetInfo(FInfoEntity&) const override;
161#endif
162};
163
164}
165
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
uint32 FIdent
Definition Types.h:27
#define HUGE_VALUE
Definition Types.h:16
#define DOUBLE_SMALL_NUMBER
Definition UnrealMathUtility.h:72
#define DOUBLE_PI
Definition UnrealMathUtility.h:71
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
Definition SharedPointer.h:692
Definition Database.h:17
Definition EdgeMesh.h:12
Definition EntityGeom.h:15
Definition CADEntity.h:56
Definition FaceMesh.h:16
Definition ModelMesh.h:21
double GetSag() const
Definition ModelMesh.h:114
double GetAngleCriteria()
Definition ModelMesh.h:109
virtual void SpawnIdent(FDatabase &Database) override
Definition ModelMesh.h:61
double GetMaxSize() const
Definition ModelMesh.h:104
const TArray< FFaceMesh * > & GetFaceMeshes() const
Definition ModelMesh.h:154
virtual EEntity GetEntityType() const override
Definition ModelMesh.h:82
void AddMesh(FVertexMesh &Mesh)
Definition ModelMesh.h:119
double GetGeometricTolerance() const
Definition ModelMesh.h:94
const TArray< TArray< FVector > * > & GetGlobalPointCloud() const
Definition ModelMesh.h:47
double GetMinSize() const
Definition ModelMesh.h:99
int32 GetVertexCount() const
Definition ModelMesh.h:54
void AddMesh(FEdgeMesh &Mesh)
Definition ModelMesh.h:124
const TArray< TSharedPtr< FCriterion > > & GetCriteria() const
Definition ModelMesh.h:87
void AddMesh(FFaceMesh &Mesh)
Definition ModelMesh.h:129
int32 GetFaceCount() const
Definition ModelMesh.h:49
virtual void ResetMarkersRecursively() const override
Definition ModelMesh.h:73
void RegisterCoordinates(TArray< FVector > &Coordinates, int32 &OutStartVertexId, int32 &OutIndex)
Definition ModelMesh.h:134
Definition VertexMesh.h:11
Definition CADEntity.cpp:23
EEntity
Definition CADEntity.h:18