UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IsoNode.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#include "Core/Types.h"
5#include "Math/SlopeUtils.h"
6#include "Mesh/MeshEnum.h"
8
9namespace UE::CADKernel
10{
11class FGrid;
12class FIsoSegment;
13
14enum class EIsoLink : uint8
15{
16 IsoUNext = 0,
17 IsoVNext = 1,
18 IsoUPrevious = 2,
19 IsoVPrevious = 3,
20};
21
23{
24 None = 0x0000u, // No flags.
25
26 LinkedToPreviousU = 0x0001u,
27 LinkedToNextU = 0x0002u,
28 LinkedToPreviousV = 0x0004u,
29 LinkedToNextV = 0x0008u,
30
31 NodeComplete = 0x000Fu,
32
33 LinkedToLoop = 0x0010u,
34 InnerMeshLoop = 0x0020u,
35 ThinZoneNode = 0x0040u,
36
37 Delete = 0x0080u,
38
39 FirstQuarter = 0x0100u,
40 SecondQuarter = 0x0200u,
41 ThirdQuarter = 0x0400u,
42 FourthQuarter = 0x0800u,
43
44 NearlyIsoU = 0x1000u, // Loop nodes
45 NearlyIsoV = 0x2000u, // Loop nodes
46
47 HasMarker1 = 0x4000u,
48 HasMarker2 = 0x8000u,
49
50 All = 0xFFFFu
51};
52
54
55class FIsoInnerNode;
56class FLoopNode;
57
62{
63protected:
66
67 int32 LocalIndex; // Index of the node either in loop nodes either in inner nodes
68 int32 GlobalIndex; // Index of the node in the face
69 int32 NodeId; // Id of the node in the mesh
70
71public:
81
82 virtual ~FIsoNode() = default;
83
84 virtual void Delete()
85 {
86 ConnectedSegments.Empty();
87 GlobalIndex = -1;
88
90 }
91
92 bool IsDelete() const
93 {
95 }
96
97 const int32 GetIndex() const
98 {
99 return LocalIndex;
100 }
101
102 const int32 GetGlobalIndex() const
103 {
104 return GlobalIndex;
105 }
106
107 const int32 GetNodeId() const
108 {
109 return NodeId;
110 }
111
113 {
114 return ConnectedSegments;
115 }
116
117 FIsoSegment* GetSegmentConnectedTo(const FIsoNode* Node) const;
118
123
125 {
126 ConnectedSegments.RemoveSingle(&Segment);
127 }
128
129 const virtual bool IsALoopNode() const = 0;
130
135
140
146
151
153 {
154 switch (Quarter)
155 {
156 case 0:
158 case 1:
160 case 2:
162 default:
164 }
165 }
166
185
186 void SetLinkedToIso(EIsoLink Iso) // [3Pi/2 2Pi]
187 {
188 switch (Iso)
189 {
192 break;
195 break;
198 break;
199 default:
201 }
202 }
203
204 void SetLinkedToIso(int32 Iso) // [3Pi/2 2Pi]
205 {
206 if (Iso > 3)
207 {
208 Iso -= 4;
209 }
210 switch ((EIsoLink)Iso)
211 {
214 break;
217 break;
220 break;
221 default:
223 }
224 }
225
226 bool HasMarker1() const
227 {
229 }
230
231 bool HasMarker2() const
232 {
234 }
235
241
247
249 {
251 }
252
254 {
256 }
257
263
267 virtual const FVector2d& Get2DPoint(EGridSpace Space, const FGrid& Grid) const = 0;
268 virtual void Set2DPoint(EGridSpace Space, FGrid& Grid, const FVector2d& NewCoordinate) = 0;
269
270 virtual const FVector& Get3DPoint(const FGrid& Grid) const = 0;
271 virtual const FVector3f& GetNormal(const FGrid& Grid) const = 0;
272
273 virtual bool operator==(const FIsoNode& OtherNode) const = 0;
274 virtual bool IsEqualTo(const FLoopNode& OtherNode) const = 0;
275 virtual bool IsEqualTo(const FIsoInnerNode& OtherNode) const = 0;
276
277 virtual uint32 GetTypeHash() const = 0;
278
279};
280
284class FLoopNode : public FIsoNode
285{
286protected:
289
290public:
297
298 virtual void Delete() override
299 {
301
302 //LoopIndex = -1;
303 ConnectedLoopNodes[0] = nullptr;
304 ConnectedLoopNodes[1] = nullptr;
305 }
306
307 virtual bool IsEqualTo(const FLoopNode& OtherNode) const
308 {
309 return ((GetIndex() == OtherNode.GetIndex()) && (GetLoopIndex() == OtherNode.GetLoopIndex()));
310 }
311
312 virtual bool IsEqualTo(const FIsoInnerNode& OtherNode) const
313 {
314 return false;
315 }
316
317 bool operator==(const FIsoNode& OtherNode) const
318 {
319 return OtherNode.IsEqualTo(*this);
320 }
321
322 virtual const bool IsALoopNode() const override
323 {
324 return true;
325 }
326
327 const int32 GetLoopIndex() const
328 {
329 return LoopIndex;
330 }
331
333 {
334 ConnectedLoopNodes[1] = NextNode;
335 }
340
342 {
343 return *ConnectedLoopNodes[0];
344 }
345
347 {
348 return *ConnectedLoopNodes[1];
349 }
350
355
360
364 virtual const FVector2d& Get2DPoint(EGridSpace Space, const FGrid& Grid) const override
365 {
366 return Grid.GetLoop2DPoint(Space, LoopIndex, LocalIndex);
367 }
368
369 virtual void Set2DPoint(EGridSpace Space, FGrid& Grid, const FVector2d& NewCoordinate) override
370 {
371 Grid.SetLoop2DPoint(Space, LoopIndex, LocalIndex, NewCoordinate);
372 }
373
374 virtual const FVector& Get3DPoint(const FGrid& Grid) const override
375 {
376 return Grid.GetLoops3D()[LoopIndex][LocalIndex];
377 }
378
379 virtual const FVector3f& GetNormal(const FGrid& Grid) const override
380 {
381 return Grid.GetLoopNormals()[LoopIndex][LocalIndex];
382 }
383
387 //virtual const FVector GetPoint(EGridSpace Space, const FGrid& Grid) const override
388 //{
389 // switch (Space)
390 // {
391 // case EGridSpace::Default2D:
392 // case EGridSpace::Scaled:
393 // case EGridSpace::UniformScaled:
394 // return Grid.GetLoop2DPoint(Space, LoopIndex, LocalIndex);
395 // }
396 // return FVector::ZeroVector;
397 //}
398
429
430 virtual uint32 GetTypeHash() const override
431 {
432 return HashCombine(GetIndex(), GetLoopIndex() + 1);
433 }
434};
435
436inline uint32 GetTypeHash(const FIsoNode& Node)
437{
438 return Node.GetTypeHash();
439}
440
442{
443public:
445 : FIsoNode(NodeIndex, FaceIndex, NodeId)
446 {
447 };
448
449 virtual bool IsEqualTo(const FLoopNode& OtherNode) const
450 {
451 return false;
452 }
453
454 virtual bool IsEqualTo(const FIsoInnerNode& OtherNode) const
455 {
456 return (GetIndex() == OtherNode.GetIndex());
457 }
458
459 bool operator==(const FIsoNode& OtherNode) const
460 {
461 return OtherNode.IsEqualTo(*this);
462 }
463
464 const bool IsIsolated() const
465 {
466 return (ConnectedSegments.Num() == 0);
467 }
468
469 virtual const bool IsALoopNode() const override
470 {
471 return false;
472 }
473
478
483
488
493
499
504
505 virtual const FVector2d& Get2DPoint(EGridSpace Space, const FGrid& Grid) const override
506 {
507 return Grid.GetInner2DPoint(Space, LocalIndex);
508 }
509
510 virtual void Set2DPoint(EGridSpace Space, FGrid& Grid, const FVector2d& NewCoordinate) override
511 {
512 return Grid.SetInner2DPoint(Space, LocalIndex, NewCoordinate);
513 }
514
515 virtual const FVector& Get3DPoint(const FGrid& Grid) const override
516 {
517 return Grid.GetInner3DPoint(LocalIndex);
518 }
519
520 virtual const FVector3f& GetNormal(const FGrid& Grid) const override
521 {
522 return Grid.GetPointNormal(LocalIndex);
523 }
524
528 //virtual const FVector GetPoint(EGridSpace Space, const FGrid& Grid) const override
529 //{
530 // switch (Space)
531 // {
532 // case EGridSpace::Default2D:
533 // case EGridSpace::Scaled:
534 // case EGridSpace::UniformScaled:
535 // return Grid.GetInner2DPoint(Space, LocalIndex);
536 // }
537 // return FVector::ZeroVector;
538 //}
539
541 {
542 NodeId += StartId;
543 }
544
545 virtual uint32 GetTypeHash() const override
546 {
547 return ::GetTypeHash(GetIndex());
548 }
549};
550
551
552} // namespace UE::CADKernel
553
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
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
constexpr uint32 HashCombine(uint32 A, uint32 C)
Definition TypeHash.h:36
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Array.h:670
Definition Grid.h:46
Definition IsoNode.h:442
virtual const FVector & Get3DPoint(const FGrid &Grid) const override
Definition IsoNode.h:515
bool IsLinkedToNextV() const
Definition IsoNode.h:489
bool IsLinkedToNextU() const
Definition IsoNode.h:479
const bool IsIsolated() const
Definition IsoNode.h:464
virtual const FVector3f & GetNormal(const FGrid &Grid) const override
Definition IsoNode.h:520
virtual bool IsEqualTo(const FIsoInnerNode &OtherNode) const
Definition IsoNode.h:454
virtual uint32 GetTypeHash() const override
Definition IsoNode.h:545
bool IsLinkedToPreviousV() const
Definition IsoNode.h:484
virtual void Set2DPoint(EGridSpace Space, FGrid &Grid, const FVector2d &NewCoordinate) override
Definition IsoNode.h:510
bool operator==(const FIsoNode &OtherNode) const
Definition IsoNode.h:459
virtual bool IsEqualTo(const FLoopNode &OtherNode) const
Definition IsoNode.h:449
virtual const FVector2d & Get2DPoint(EGridSpace Space, const FGrid &Grid) const override
Definition IsoNode.h:505
FIsoInnerNode(int32 NodeIndex, int32 FaceIndex, int32 NodeId)
Definition IsoNode.h:444
bool IsLinkedToBoundary() const
Definition IsoNode.h:500
void OffsetId(int32 StartId)
Definition IsoNode.h:540
virtual const bool IsALoopNode() const override
Definition IsoNode.h:469
bool IsComplete() const
Definition IsoNode.h:495
bool IsLinkedToPreviousU() const
Definition IsoNode.h:474
Definition IsoNode.h:62
virtual void Set2DPoint(EGridSpace Space, FGrid &Grid, const FVector2d &NewCoordinate)=0
bool HasMarker1NotMarker2() const
Definition IsoNode.h:242
bool IsDeleteOrHasMarker2() const
Definition IsoNode.h:236
virtual ~FIsoNode()=default
void DisconnectSegment(FIsoSegment &Segment)
Definition IsoNode.h:124
const int32 GetIndex() const
Definition IsoNode.h:97
bool IsDelete() const
Definition IsoNode.h:92
int32 LocalIndex
Definition IsoNode.h:67
bool HasMarker2() const
Definition IsoNode.h:231
TArray< FIsoSegment * > ConnectedSegments
Definition IsoNode.h:64
virtual bool operator==(const FIsoNode &OtherNode) const =0
EIsoNodeStates States
Definition IsoNode.h:65
void SetThinZoneNodeMarker()
Definition IsoNode.h:131
virtual const FVector3f & GetNormal(const FGrid &Grid) const =0
int32 GlobalIndex
Definition IsoNode.h:68
int32 NodeId
Definition IsoNode.h:69
bool HasMarker1() const
Definition IsoNode.h:226
bool IsDeleteOrThinNode() const
Definition IsoNode.h:141
void SetMarker1()
Definition IsoNode.h:248
const int32 GetNodeId() const
Definition IsoNode.h:107
virtual uint32 GetTypeHash() const =0
void ResetMarkers()
Definition IsoNode.h:258
virtual bool IsEqualTo(const FIsoInnerNode &OtherNode) const =0
virtual bool IsEqualTo(const FLoopNode &OtherNode) const =0
virtual const FVector & Get3DPoint(const FGrid &Grid) const =0
FIsoSegment * GetSegmentConnectedTo(const FIsoNode *Node) const
Definition IsoSegment.h:376
void SetLinkedToLoopMarker()
Definition IsoNode.h:147
bool IsThinZoneNode() const
Definition IsoNode.h:136
const int32 GetGlobalIndex() const
Definition IsoNode.h:102
void SetLinkedToIso(int32 Iso)
Definition IsoNode.h:204
virtual void Delete()
Definition IsoNode.h:84
const TArray< FIsoSegment * > & GetConnectedSegments() const
Definition IsoNode.h:112
FIsoNode(int32 InNodeIndex, int32 InFaceIndex, int32 InNodeId)
Definition IsoNode.h:72
virtual const FVector2d & Get2DPoint(EGridSpace Space, const FGrid &Grid) const =0
bool IsLinkedToLoopInNearlyIso(int32 Iso) const
Definition IsoNode.h:167
virtual const bool IsALoopNode() const =0
void ConnectSegment(FIsoSegment &Segment)
Definition IsoNode.h:119
void SetLinkedToIso(EIsoLink Iso)
Definition IsoNode.h:186
void SetMarker2()
Definition IsoNode.h:253
void SetLinkedToLoopInQuarter(int32 Quarter)
Definition IsoNode.h:152
Definition IsoSegment.h:52
Definition IsoNode.h:285
FIsoSegment & GetNextSegment() const
Definition IsoNode.h:356
void SetPreviousConnectedNode(FLoopNode *PreviousNode)
Definition IsoNode.h:336
int32 LoopIndex
Definition IsoNode.h:287
virtual const FVector3f & GetNormal(const FGrid &Grid) const override
Definition IsoNode.h:379
FLoopNode * ConnectedLoopNodes[2]
Definition IsoNode.h:288
virtual bool IsEqualTo(const FLoopNode &OtherNode) const
Definition IsoNode.h:307
FLoopNode & GetPreviousNode() const
Definition IsoNode.h:341
void SetNextConnectedNode(FLoopNode *NextNode)
Definition IsoNode.h:332
virtual const FVector2d & Get2DPoint(EGridSpace Space, const FGrid &Grid) const override
Definition IsoNode.h:364
bool IsSegmentBeInsideFace(const FVector2d &EndSegmentCoordinate, const FGrid &Grid, const double FlatAngle) const
Definition IsoNode.h:425
virtual void Delete() override
Definition IsoNode.h:298
FLoopNode(int32 InLoopIndex, int32 InNodeLoopIndex, int32 InNodeFaceIndex, int32 NodeId)
Definition IsoNode.h:291
virtual uint32 GetTypeHash() const override
Definition IsoNode.h:430
virtual bool IsEqualTo(const FIsoInnerNode &OtherNode) const
Definition IsoNode.h:312
FIsoSegment & GetPreviousSegment() const
Definition IsoNode.h:351
virtual const FVector & Get3DPoint(const FGrid &Grid) const override
Definition IsoNode.h:374
virtual const bool IsALoopNode() const override
Definition IsoNode.h:322
bool operator==(const FIsoNode &OtherNode) const
Definition IsoNode.h:317
const int32 GetLoopIndex() const
Definition IsoNode.h:327
virtual void Set2DPoint(EGridSpace Space, FGrid &Grid, const FVector2d &NewCoordinate) override
Definition IsoNode.h:369
FLoopNode & GetNextNode() const
Definition IsoNode.h:346
Definition CADEntity.cpp:23
bool IsPointPInsideSectorABC(const FVector2d &PointA, const FVector2d &PointB, const FVector2d &PointC, const FVector2d &PointP, const double FlatAngle)
Definition SlopeUtils.h:401
uint32 GetTypeHash(const FIsoNode &Node)
Definition IsoNode.h:436
EIsoLink
Definition IsoNode.h:15
EGridSpace
Definition MeshEnum.h:17
@ UniformScaled
Definition MeshEnum.h:20
EIsoNodeStates
Definition IsoNode.h:23
@ Iso
Definition Visu.h:20