//
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
///
///
/// 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();
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:63
///
/// static Quat sGetInvInitialOrientation(const Body &inBody1, const Body &inBody2)
///
///
///
///
/// Return inverse of initial rotation from body 1 to body 2 in body 1 space
///
///
public static floatQuat sGetInvInitialOrientation(Body body1, Body body2) => Jolt.PInvoke.RotationEulerConstraintPart_sGetInvInitialOrientation(body1, body2);
///
///
/// 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 sGetInvInitialOrientationXY(float3 axisX1, float3 axisY1, float3 axisX2, float3 axisY2) => Jolt.PInvoke.RotationEulerConstraintPart_sGetInvInitialOrientationXY(axisX1, axisY1, axisX2, axisY2);
///
///
/// 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 sGetInvInitialOrientationXZ(float3 axisX1, float3 axisZ1, float3 axisX2, float3 axisZ2) => Jolt.PInvoke.RotationEulerConstraintPart_sGetInvInitialOrientationXZ(axisX1, axisZ1, axisX2, axisZ2);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:139
///
/// inline void CalculateConstraintProperties(const Body &inBody1, Mat44Arg inRotation1, const Body &inBody2, Mat44Arg inRotation2)
///
///
///
///
/// Calculate properties used during the functions below
///
///
public void CalculateConstraintProperties(Body body1, float4x4 rotation1, Body body2, float4x4 rotation2) => Jolt.PInvoke.RotationEulerConstraintPart_CalculateConstraintProperties(this, body1, rotation1, body2, rotation2);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:164
///
/// inline void Deactivate()
///
///
///
///
/// Deactivate this constraint
///
///
public void Deactivate() => Jolt.PInvoke.RotationEulerConstraintPart_Deactivate(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:171
///
/// inline bool IsActive() const
///
///
///
///
/// Check if constraint is active
///
///
public bool IsActive() => Jolt.PInvoke.RotationEulerConstraintPart_IsActive(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:177
///
/// inline void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)
///
///
///
///
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
///
///
public void WarmStart(Body body1, Body body2, float warmStartImpulseRatio) => Jolt.PInvoke.RotationEulerConstraintPart_WarmStart(this, body1, body2, warmStartImpulseRatio);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:184
///
/// inline bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2)
///
///
///
///
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint
/// equation.
///
///
public bool SolveVelocityConstraint(Body body1, Body body2) => Jolt.PInvoke.RotationEulerConstraintPart_SolveVelocityConstraint(this, body1, body2);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:195
///
/// inline bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, QuatArg inInvInitialOrientation, float inBaumgarte) const
///
///
///
///
/// Iteratively update the position constraint. Makes sure C(...) = 0.
///
///
public bool SolvePositionConstraint(Body body1, Body body2, floatQuat invInitialOrientation, float baumgarte) => Jolt.PInvoke.RotationEulerConstraintPart_SolvePositionConstraint(this, body1, body2, invInitialOrientation, baumgarte);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/RotationEulerConstraintPart.h:259
///
/// Vec3 GetTotalLambda() const
///
///
///
///
/// Return lagrange multiplier
///
///
public float3 GetTotalLambda() => Jolt.PInvoke.RotationEulerConstraintPart_GetTotalLambda(this);
public void Dispose() => Jolt.PInvoke.RotationEulerConstraintPart_Destroy(this);
}
}