mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
237 lines
11 KiB
C#
237 lines
11 KiB
C#
// <auto-generated/>
|
|
// Generated by Brutal.Jolt.Generate; do not edit by hand.
|
|
#nullable enable
|
|
|
|
using System.Runtime.CompilerServices;
|
|
using Brutal.Interop;
|
|
using Brutal.Numerics;
|
|
|
|
namespace Brutal.JoltApi
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Constrains rotation around all axis so that only translation is allowed
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L35">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:35</see>
|
|
/// <br/>
|
|
/// <c>class RotationEulerConstraintPart</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Constrains rotation around all axis so that only translation is allowed
|
|
///
|
|
/// Based on: "Constraints Derivation for Rigid Body Simulation in 3D" - Daniel Chappuis, section 2.5.1
|
|
///
|
|
/// Constraint equation (eq 129):
|
|
///
|
|
/// \f[C = \begin{bmatrix}\Delta\theta_x, \Delta\theta_y, \Delta\theta_z\end{bmatrix}\f]
|
|
///
|
|
/// Jacobian (eq 131):
|
|
///
|
|
/// \f[J = \begin{bmatrix}0 & -E & 0 & E\end{bmatrix}\f]
|
|
///
|
|
/// Used terms (here and below, everything in world space):\n
|
|
/// delta_theta_* = difference in rotation between initial rotation of bodies 1 and 2.\n
|
|
/// x1, x2 = center of mass for the bodies.\n
|
|
/// v = [v1, w1, v2, w2].\n
|
|
/// v1, v2 = linear velocity of body 1 and 2.\n
|
|
/// w1, w2 = angular velocity of body 1 and 2.\n
|
|
/// M = mass matrix, a diagonal matrix of the mass and inertia with diagonal [m1, I1, m2, I2].\n
|
|
/// \f$K^{-1} = \left( J M^{-1} J^T \right)^{-1}\f$ = effective mass.\n
|
|
/// b = velocity bias.\n
|
|
/// \f$\beta\f$ = baumgarte constant.\n
|
|
/// E = identity matrix.\n
|
|
/// </code>
|
|
/// </remarks>
|
|
[InteropHandle]
|
|
public readonly partial struct RotationEulerConstraintPart : IDisposable
|
|
{
|
|
public static RotationEulerConstraintPart Create() => Jolt.PInvoke.RotationEulerConstraintPart_Create();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Return inverse of initial rotation from body 1 to body 2 in body 1 space
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L63">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:63</see>
|
|
/// <br/>
|
|
/// <c>static Quat sGetInvInitialOrientation(const Body &inBody1, const Body &inBody2)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public static floatQuat GetInvInitialOrientation(Body body1, Body body2) =>
|
|
Jolt.PInvoke.RotationEulerConstraintPart_GetInvInitialOrientation(body1, body2);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Return inverse of initial rotation from body 1 to body 2 in body 1 space
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L82">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:82</see>
|
|
/// <br/>
|
|
/// <c>static Quat sGetInvInitialOrientationXY(Vec3Arg inAxisX1, Vec3Arg inAxisY1, Vec3Arg inAxisX2, Vec3Arg inAxisY2)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @brief Return inverse of initial rotation from body 1 to body 2 in body 1 space
|
|
/// @param inAxisX1 Reference axis X for body 1
|
|
/// @param inAxisY1 Reference axis Y for body 1
|
|
/// @param inAxisX2 Reference axis X for body 2
|
|
/// @param inAxisY2 Reference axis Y for body 2
|
|
/// </code>
|
|
/// </remarks>
|
|
public static floatQuat GetInvInitialOrientationXY(
|
|
float3 axisX1,
|
|
float3 axisY1,
|
|
float3 axisX2,
|
|
float3 axisY2
|
|
) => Jolt.PInvoke.RotationEulerConstraintPart_GetInvInitialOrientationXY(axisX1, axisY1, axisX2, axisY2);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Return inverse of initial rotation from body 1 to body 2 in body 1 space
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L123">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:123</see>
|
|
/// <br/>
|
|
/// <c>static Quat sGetInvInitialOrientationXZ(Vec3Arg inAxisX1, Vec3Arg inAxisZ1, Vec3Arg inAxisX2, Vec3Arg inAxisZ2)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// @brief Return inverse of initial rotation from body 1 to body 2 in body 1 space
|
|
/// @param inAxisX1 Reference axis X for body 1
|
|
/// @param inAxisZ1 Reference axis Z for body 1
|
|
/// @param inAxisX2 Reference axis X for body 2
|
|
/// @param inAxisZ2 Reference axis Z for body 2
|
|
/// </code>
|
|
/// </remarks>
|
|
public static floatQuat GetInvInitialOrientationXZ(
|
|
float3 axisX1,
|
|
float3 axisZ1,
|
|
float3 axisX2,
|
|
float3 axisZ2
|
|
) => Jolt.PInvoke.RotationEulerConstraintPart_GetInvInitialOrientationXZ(axisX1, axisZ1, axisX2, axisZ2);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Calculate properties used during the functions below
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L139">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:139</see>
|
|
/// <br/>
|
|
/// <c>inline void CalculateConstraintProperties(const Body &inBody1, Mat44Arg inRotation1, const Body &inBody2, Mat44Arg inRotation2)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void CalculateConstraintProperties(
|
|
Body body1,
|
|
in float4x4 rotation1,
|
|
Body body2,
|
|
in float4x4 rotation2
|
|
) =>
|
|
Jolt.PInvoke.RotationEulerConstraintPart_CalculateConstraintProperties(
|
|
this,
|
|
body1,
|
|
in rotation1,
|
|
body2,
|
|
in rotation2
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Deactivate this constraint
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L164">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:164</see>
|
|
/// <br/>
|
|
/// <c>inline void Deactivate()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Deactivate() => Jolt.PInvoke.RotationEulerConstraintPart_Deactivate(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Check if constraint is active
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L171">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:171</see>
|
|
/// <br/>
|
|
/// <c>inline bool IsActive() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsActive() => Jolt.PInvoke.RotationEulerConstraintPart_IsActive(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L177">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:177</see>
|
|
/// <br/>
|
|
/// <c>inline void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void WarmStart(Body body1, Body body2, float warmStartImpulseRatio) =>
|
|
Jolt.PInvoke.RotationEulerConstraintPart_WarmStart(this, body1, body2, warmStartImpulseRatio);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint
|
|
/// equation.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L184">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:184</see>
|
|
/// <br/>
|
|
/// <c>inline bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool SolveVelocityConstraint(Body body1, Body body2) =>
|
|
Jolt.PInvoke.RotationEulerConstraintPart_SolveVelocityConstraint(this, body1, body2);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Iteratively update the position constraint. Makes sure C(...) = 0.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L195">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:195</see>
|
|
/// <br/>
|
|
/// <c>inline bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inInvInitialOrientation, float inBaumgarte) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool SolvePositionConstraint(Body body1, Body body2, floatQuat invInitialOrientation, float baumgarte) =>
|
|
Jolt.PInvoke.RotationEulerConstraintPart_SolvePositionConstraint(
|
|
this,
|
|
body1,
|
|
body2,
|
|
invInitialOrientation,
|
|
baumgarte
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Return lagrange multiplier
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h#L259">Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:259</see>
|
|
/// <br/>
|
|
/// <c>Vec3 GetTotalLambda() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetTotalLambda() => Jolt.PInvoke.RotationEulerConstraintPart_GetTotalLambda(this);
|
|
|
|
public void Dispose() => Jolt.PInvoke.RotationEulerConstraintPart_Destroy(this);
|
|
}
|
|
}
|