UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SphericalSurface.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
5
6namespace UE::CADKernel
7{
9{
10 friend FEntity;
11
12protected:
14 double Radius;
15
27
44 , Radius(InRadius)
45 {
46 ComputeMinToleranceIso();
47 }
48
49 FSphericalSurface() = default;
50
52 {
53 double Tolerance2D = Tolerance3D / Radius;
54
55 FVector Origin = Matrix.Multiply(FVector::ZeroVector);
56
57 FVector Point2DU{ 1 , 0, 0 };
58 FVector Point2DV{ 0, 1, 0 };
59
60 double ToleranceU = Tolerance2D / ComputeScaleAlongAxis(Point2DU, Matrix, Origin);
61 double ToleranceV = Tolerance2D / ComputeScaleAlongAxis(Point2DV, Matrix, Origin);
62
63 MinToleranceIso.Set(ToleranceU, ToleranceV);
64 }
65
66public:
67
68 virtual void Serialize(FCADKernelArchive& Ar) override
69 {
70 FSurface::Serialize(Ar);
71 Ar << Matrix;
72 Ar << Radius;
73 }
74
76 {
77 return ESurface::Sphere;
78 }
79
80#ifdef CADKERNEL_DEV
81 virtual FInfoEntity& GetInfo(FInfoEntity&) const override;
82#endif
83
84 virtual TSharedPtr<FEntityGeom> ApplyMatrix(const FMatrixH& InMatrix) const override;
85
87 {
88 double CosU = cos(InSurfacicCoordinate.X);
89 double CosV = cos(InSurfacicCoordinate.Y);
90
91 double SinU = sin(InSurfacicCoordinate.X);
92 double SinV = sin(InSurfacicCoordinate.Y);
93
94 OutPoint3D.DerivativeOrder = InDerivativeOrder;
95 OutPoint3D.Point.Set(Radius * CosV * CosU, Radius * CosV * SinU, Radius * SinV);
96 OutPoint3D.Point = Matrix.Multiply(OutPoint3D.Point);
97
98 if (InDerivativeOrder > 0)
99 {
100 OutPoint3D.GradientU = FVector(-Radius * CosV * SinU, Radius * CosV * CosU, 0.0);
101 OutPoint3D.GradientV = FVector(-Radius * SinV * CosU, -Radius * SinV * SinU, Radius * CosV);
102
103 OutPoint3D.GradientU = Matrix.MultiplyVector(OutPoint3D.GradientU);
104 OutPoint3D.GradientV = Matrix.MultiplyVector(OutPoint3D.GradientV);
105 }
106
107 if (InDerivativeOrder > 1)
108 {
109 OutPoint3D.LaplacianU = FVector(-Radius * CosV * CosU, -Radius * CosV * SinU, 0.0);
110 OutPoint3D.LaplacianV = FVector(OutPoint3D.LaplacianU.X, OutPoint3D.LaplacianU.Y, -Radius * SinV);
111 OutPoint3D.LaplacianUV = FVector(Radius * SinV * SinU, -Radius * SinV * CosU, 0.);
112
113 OutPoint3D.LaplacianU = Matrix.MultiplyVector(OutPoint3D.LaplacianU);
114 OutPoint3D.LaplacianV = Matrix.MultiplyVector(OutPoint3D.LaplacianV);
115 OutPoint3D.LaplacianUV = Matrix.MultiplyVector(OutPoint3D.LaplacianUV);
116 }
117 }
118
119 virtual void EvaluatePointGrid(const FCoordinateGrid& Coordinates, FSurfacicSampling& OutPoints, bool bComputeNormals = false) const override;
120
122 {
123 double CosU = cos(InSurfacicCoordinate.X);
124 double CosV = cos(InSurfacicCoordinate.Y);
125
126 double SinU = sin(InSurfacicCoordinate.X);
127 double SwapOrientation = (InSurfacicCoordinate.Y < DOUBLE_PI&& InSurfacicCoordinate.Y >= 0) ? 1.0 : -1.0;
128
129 return FVector2d(Radius * CosV * CosU * SwapOrientation, Radius * CosV * SinU);
130 }
131
132 virtual void EvaluatePointGridInCylindricalSpace(const FCoordinateGrid& Coordinates, TArray<FVector2d>&) const override;
133
135 {
136 PresampleIsoCircle(InBoundaries, OutCoordinates, EIso::IsoU);
137 PresampleIsoCircle(InBoundaries, OutCoordinates, EIso::IsoV);
138 }
139};
140}
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 FVector
Definition IOSSystemIncludes.h:8
UE::Math::TVector2< double > FVector2d
Definition MathFwd.h:61
#define DOUBLE_HALF_PI
Definition UnrealMathUtility.h:84
#define DOUBLE_PI
Definition UnrealMathUtility.h:71
#define DOUBLE_TWO_PI
Definition UnrealMathUtility.h:85
Definition Array.h:670
Definition SharedPointer.h:692
Definition CADKernelArchive.h:19
Definition CADEntity.h:56
Definition MatrixH.h:14
Definition SphericalSurface.h:9
void ComputeMinToleranceIso()
Definition SphericalSurface.h:51
virtual void EvaluatePoint(const FVector2d &InSurfacicCoordinate, FSurfacicPoint &OutPoint3D, int32 InDerivativeOrder=0) const override
Definition SphericalSurface.h:86
virtual void Presample(const FSurfacicBoundary &InBoundaries, FCoordinateGrid &OutCoordinates) override
Definition SphericalSurface.h:134
FSphericalSurface(const double InToleranceGeometric, const FMatrixH &InMatrix, double InRadius, double InParallelStartAngle=0.0, double InParallelEndAngle=DOUBLE_TWO_PI, double InMeridianStartAngle=-DOUBLE_HALF_PI, double InMeridianEndAngle=DOUBLE_HALF_PI)
Definition SphericalSurface.h:23
FSphericalSurface(const double InToleranceGeometric, const FMatrixH &InMatrix, double InRadius, const FSurfacicBoundary &Boundary)
Definition SphericalSurface.h:41
ESurface GetSurfaceType() const
Definition SphericalSurface.h:75
virtual FVector2d EvaluatePointInCylindricalSpace(const FVector2d &InSurfacicCoordinate) const override
Definition SphericalSurface.h:121
double Radius
Definition SphericalSurface.h:14
FMatrixH Matrix
Definition SphericalSurface.h:13
virtual void Serialize(FCADKernelArchive &Ar) override
Definition SphericalSurface.h:68
Definition Surface.h:27
Definition Boundary.h:248
Definition CADEntity.cpp:23
void SwapOrientation(EOrientation &Orientation)
Definition GeoEnum.h:128
ESurface
Definition GeoEnum.h:34
Definition GeoPoint.h:103
Definition GeoPoint.h:19
Definition SurfacicSampling.h:14
static CORE_API const TVector< double > ZeroVector
Definition Vector.h:79