namespace MagesMath

Overview

namespace MagesMath {

// structs

struct FPointNormalPlane;
struct FQuadruplet;
struct FTriangle;
struct FTriplet;

// global functions

int FindRoots(float K, float M, float N, float Out[2]);

static FORCEINLINE FPointNormalPlane PlanePerpendicularToPlane(
    const FPointNormalPlane& TearPlane,
    FVector A,
    FVector B
    );

static FORCEINLINE FVector LineIntersectPlane(
    FVector Point0,
    FVector Point1,
    const FPointNormalPlane& Plane
    );

static FORCEINLINE float PointIntersectPlane(
    FVector Point,
    const FPointNormalPlane& Plane
    );

static FORCEINLINE bool SameSide(FVector P1, FVector P2, FVector A, FVector B);

static FORCEINLINE bool IsPointInsideTriangle(
    FVector Point,
    FTriangle& Triangle
    );

static FORCEINLINE FVector FindMidpoint(FVector A, FVector B);
static FORCEINLINE int Orient3D(FVector A, FVector B, FVector C, FVector D);

static FORCEINLINE FVector RotatePointAroundPivot(
    FVector Point,
    FVector Pivot,
    FQuat Rotation
    );

static FORCEINLINE FVector ProjectPointOntoPlane(
    FVector PlaneNormal,
    FVector PlanePoint,
    FVector Point
    );

static FORCEINLINE FVector2D SortSwizzleVector(FVector2D V);

static FORCEINLINE FTriplet FindNewFace(
    TArray<int32>& triangles,
    int32 i,
    int32 cid0,
    int32 cid1,
    int32 id0,
    int32 id1
    );

static FORCEINLINE bool IsPointWithinShapeComponent(
    FVector Point,
    UShapeComponent* Shape,
    const FTransform& Transform = FTransform::Identity
    );

static FORCEINLINE FVector LineIntersectPlane(
    const FLineSegment& Segment,
    const FPointNormalPlane& Plane
    );

static FORCEINLINE void DrawDebugWireTriangle(
    const UWorld* World,
    FVector A,
    FVector B,
    FVector C,
    FColor Color,
    bool Persistent = false,
    float Duration = 0.f
    );

static FORCEINLINE FVector4 BoundedPlaneToWorldSpaceCartesian(
    UBoundedPlane* plane,
    FTransform Transform
    );

static FORCEINLINE FVector4 PointNormalToCartesian(
    FVector point,
    FVector normal
    );

} // namespace MagesMath

Detailed Documentation

Global Functions

int FindRoots(float K, float M, float N, float Out[2])

Finds the roots of a 2nd degree equation with K, M, N as the parameters

static FORCEINLINE FPointNormalPlane PlanePerpendicularToPlane(
    const FPointNormalPlane& TearPlane,
    FVector A,
    FVector B
    )

Find a new plane perpendicular to the tear_plane and that passes from v1, v2

static FORCEINLINE FVector LineIntersectPlane(
    FVector Point0,
    FVector Point1,
    const FPointNormalPlane& Plane
    )

Find intersection of a line segment and a plane

static FORCEINLINE float PointIntersectPlane(
    FVector Point,
    const FPointNormalPlane& Plane
    )

Returns the side of the up-projected point with respect to the plane: +,- or 0 = on the plane

static FORCEINLINE bool IsPointInsideTriangle(
    FVector Point,
    FTriangle& Triangle
    )

Test Point inside Triangle

static FORCEINLINE FVector FindMidpoint(FVector A, FVector B)

Midpoint of A and B

static FORCEINLINE int Orient3D(FVector A, FVector B, FVector C, FVector D)

Returns the orientation of the tetrahedron defined by a,b,c,d

static FORCEINLINE FVector ProjectPointOntoPlane(
    FVector PlaneNormal,
    FVector PlanePoint,
    FVector Point
    )

Project point onto a plane with the specified normal and contained point

static FORCEINLINE bool IsPointWithinShapeComponent(
    FVector Point,
    UShapeComponent* Shape,
    const FTransform& Transform = FTransform::Identity
    )

Returns true when the point is inside the shape