Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
ShaderMath.h
Go to the documentation of this file.
1// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
2// SPDX-FileCopyrightText: 2025 Jorrit Rouwe
3// SPDX-License-Identifier: MIT
4
5// Calculate inValue^2
6inline float JPH_Square(float inValue)
7{
8 return inValue * inValue;
9}
10
11// Get the closest point on a line segment defined by inA + x * inAB for x e [0, 1] to the origin
12inline float3 JPH_GetClosestPointOnLine(float3 inA, float3 inAB)
13{
14 float v = clamp(-dot(inA, inAB) / dot(inAB, inAB), 0.0f, 1.0f);
15 return inA + v * inAB;
16}
float JPH_Square(float inValue)
Definition ShaderMath.h:6
float3 JPH_GetClosestPointOnLine(float3 inA, float3 inAB)
Definition ShaderMath.h:12