//
// 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
{
///
///
/// Constrains rotation around all axis so that only translation is allowed
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:35
///
/// class RotationEulerConstraintPart
///
///
///
///
/// 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
///
///
[InteropHandle]
public readonly partial struct RotationEulerConstraintPart : IDisposable
{
public static RotationEulerConstraintPart Create() => Jolt.PInvoke.RotationEulerConstraintPart_Create();
///
///
/// Return inverse of initial rotation from body 1 to body 2 in body 1 space
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:63
///
/// static Quat sGetInvInitialOrientation(const Body &inBody1, const Body &inBody2)
///
///
public static floatQuat GetInvInitialOrientation(Body body1, Body body2) =>
Jolt.PInvoke.RotationEulerConstraintPart_GetInvInitialOrientation(body1, body2);
///
///
/// Return inverse of initial rotation from body 1 to body 2 in body 1 space
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:82
///
/// static Quat sGetInvInitialOrientationXY(Vec3Arg inAxisX1, Vec3Arg inAxisY1, Vec3Arg inAxisX2, Vec3Arg inAxisY2)
///
///
///
///
/// @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
///
///
public static floatQuat GetInvInitialOrientationXY(
float3 axisX1,
float3 axisY1,
float3 axisX2,
float3 axisY2
) => Jolt.PInvoke.RotationEulerConstraintPart_GetInvInitialOrientationXY(axisX1, axisY1, axisX2, axisY2);
///
///
/// Return inverse of initial rotation from body 1 to body 2 in body 1 space
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:123
///
/// static Quat sGetInvInitialOrientationXZ(Vec3Arg inAxisX1, Vec3Arg inAxisZ1, Vec3Arg inAxisX2, Vec3Arg inAxisZ2)
///
///
///
///
/// @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
///
///
public static floatQuat GetInvInitialOrientationXZ(
float3 axisX1,
float3 axisZ1,
float3 axisX2,
float3 axisZ2
) => Jolt.PInvoke.RotationEulerConstraintPart_GetInvInitialOrientationXZ(axisX1, axisZ1, axisX2, axisZ2);
///
///
/// Calculate properties used during the functions below
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:139
///
/// inline void CalculateConstraintProperties(const Body &inBody1, Mat44Arg inRotation1, const Body &inBody2, Mat44Arg inRotation2)
///
///
public void CalculateConstraintProperties(
Body body1,
in float4x4 rotation1,
Body body2,
in float4x4 rotation2
) =>
Jolt.PInvoke.RotationEulerConstraintPart_CalculateConstraintProperties(
this,
body1,
in rotation1,
body2,
in rotation2
);
///
///
/// Deactivate this constraint
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:164
///
/// inline void Deactivate()
///
///
public void Deactivate() => Jolt.PInvoke.RotationEulerConstraintPart_Deactivate(this);
///
///
/// Check if constraint is active
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:171
///
/// inline bool IsActive() const
///
///
public bool IsActive() => Jolt.PInvoke.RotationEulerConstraintPart_IsActive(this);
///
///
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:177
///
/// inline void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)
///
///
public void WarmStart(Body body1, Body body2, float warmStartImpulseRatio) =>
Jolt.PInvoke.RotationEulerConstraintPart_WarmStart(this, body1, body2, warmStartImpulseRatio);
///
///
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint
/// equation.
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:184
///
/// inline bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2)
///
///
public bool SolveVelocityConstraint(Body body1, Body body2) =>
Jolt.PInvoke.RotationEulerConstraintPart_SolveVelocityConstraint(this, body1, body2);
///
///
/// Iteratively update the position constraint. Makes sure C(...) = 0.
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:195
///
/// inline bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inInvInitialOrientation, float inBaumgarte) const
///
///
public bool SolvePositionConstraint(Body body1, Body body2, floatQuat invInitialOrientation, float baumgarte) =>
Jolt.PInvoke.RotationEulerConstraintPart_SolvePositionConstraint(
this,
body1,
body2,
invInitialOrientation,
baumgarte
);
///
///
/// Return lagrange multiplier
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:259
///
/// Vec3 GetTotalLambda() const
///
///
public float3 GetTotalLambda() => Jolt.PInvoke.RotationEulerConstraintPart_GetTotalLambda(this);
public void Dispose() => Jolt.PInvoke.RotationEulerConstraintPart_Destroy(this);
}
}