You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
This is in preparation of the creation of a CADKernelEngine module #rb jeanluc.corenthin #rnx [CL 34739992 by jeanluc corenthin in ue5-main branch]
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "Math/Point.h"
|
|
|
|
#include "Utils/Util.h"
|
|
#include "Math/MatrixH.h"
|
|
|
|
namespace UE::CADKernel
|
|
{
|
|
|
|
const FPoint FPoint::ZeroPoint(0.,0.,0.);
|
|
const FPoint FPoint::UnitPoint(1., 1., 1.);
|
|
const FPoint FPoint::FarawayPoint(HUGE_VALUE, HUGE_VALUE, HUGE_VALUE);
|
|
const int32 FPoint::Dimension = 3;
|
|
|
|
const FFPoint FFPoint::ZeroPoint(0.f, 0.f, 0.f);
|
|
const FFPoint FFPoint::FarawayPoint(HUGE_VALUE, HUGE_VALUE, HUGE_VALUE);
|
|
const int32 FFPoint::Dimension = 3;
|
|
|
|
const FPoint2D FPoint2D::ZeroPoint(0., 0.);
|
|
const FPoint2D FPoint2D::FarawayPoint(HUGE_VALUE, HUGE_VALUE);
|
|
const int32 FPoint2D::Dimension = 2;
|
|
|
|
const FPointH FPointH::ZeroPoint(0., 0., 0., 1.);
|
|
const FPointH FPointH::FarawayPoint(HUGE_VALUE, HUGE_VALUE, HUGE_VALUE, 1.);
|
|
const int32 FPointH::Dimension = 4;
|
|
|
|
double FPoint::SignedAngle(const FPoint & Other, const FPoint & Normal) const
|
|
{
|
|
FPoint Vector1 = *this;
|
|
FPoint Vector2 = Other;
|
|
FPoint Vector3 = Normal;
|
|
|
|
Vector1.Normalize();
|
|
Vector2.Normalize();
|
|
Vector3.Normalize();
|
|
|
|
double ScalarProduct = Vector1 * Vector2;
|
|
|
|
if (ScalarProduct >= 1 - DOUBLE_SMALL_NUMBER)
|
|
{
|
|
return 0.;
|
|
}
|
|
|
|
if (ScalarProduct <= -1 + DOUBLE_SMALL_NUMBER)
|
|
{
|
|
return DOUBLE_PI;
|
|
}
|
|
|
|
return MixedTripleProduct(Vector1, Vector2, Vector3) > 0 ? acos(ScalarProduct) : -acos(ScalarProduct);
|
|
}
|
|
|
|
|
|
} |