mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
206 lines
9.6 KiB
C#
206 lines
9.6 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 movement along 3 axis
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h#L40">Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h:40</see>
|
|
/// <br/>
|
|
/// <c>class PointConstraintPart</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Constrains movement along 3 axis
|
|
///
|
|
/// @see "Constraints Derivation for Rigid Body Simulation in 3D" - Daniel Chappuis, section 2.2.1
|
|
///
|
|
/// Constraint equation (eq 45):
|
|
///
|
|
/// \f[C = p_2 - p_1\f]
|
|
///
|
|
/// Jacobian (transposed) (eq 47):
|
|
///
|
|
/// \f[J^T = \begin{bmatrix}-E & r1x & E & -r2x^T\end{bmatrix}
|
|
/// = \begin{bmatrix}-E^T \\ r1x^T \\ E^T \\ -r2x^T\end{bmatrix}
|
|
/// = \begin{bmatrix}-E \\ -r1x \\ E \\ r2x\end{bmatrix}\f]
|
|
///
|
|
/// Used terms (here and below, everything in world space):\n
|
|
/// p1, p2 = constraint points.\n
|
|
/// r1 = p1 - x1.\n
|
|
/// r2 = p2 - x2.\n
|
|
/// r1x = 3x3 matrix for which r1x v = r1 x v (cross product).\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.
|
|
/// </code>
|
|
/// </remarks>
|
|
[InteropHandle]
|
|
public readonly partial struct PointConstraintPart : IDisposable
|
|
{
|
|
public static PointConstraintPart Create() => Jolt.PInvoke.PointConstraintPart_Create();
|
|
|
|
/// <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/PointConstraintPart.h#L80">Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h:80</see>
|
|
/// <br/>
|
|
/// <c>inline void CalculateConstraintProperties(const Body &inBody1, Mat44Arg inRotation1, Vec3Arg inR1, const Body &inBody2, Mat44Arg inRotation2, Vec3Arg inR2)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Calculate properties used during the functions below
|
|
/// @param inBody1 The first body that this constraint is attached to
|
|
/// @param inBody2 The second body that this constraint is attached to
|
|
/// @param inRotation1 The 3x3 rotation matrix for body 1 (translation part is ignored)
|
|
/// @param inRotation2 The 3x3 rotation matrix for body 2 (translation part is ignored)
|
|
/// @param inR1 Local space vector from center of mass to constraint point for body 1
|
|
/// @param inR2 Local space vector from center of mass to constraint point for body 2
|
|
/// </code>
|
|
/// </remarks>
|
|
public void CalculateConstraintProperties(
|
|
Body body1,
|
|
in float4x4 rotation1,
|
|
float3 r1,
|
|
Body body2,
|
|
in float4x4 rotation2,
|
|
float3 r2
|
|
) =>
|
|
Jolt.PInvoke.PointConstraintPart_CalculateConstraintProperties(
|
|
this,
|
|
body1,
|
|
in rotation1,
|
|
r1,
|
|
body2,
|
|
in rotation2,
|
|
r2
|
|
);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Deactivate this constraint
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h#L129">Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h:129</see>
|
|
/// <br/>
|
|
/// <c>inline void Deactivate()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Deactivate() => Jolt.PInvoke.PointConstraintPart_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/PointConstraintPart.h#L136">Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h:136</see>
|
|
/// <br/>
|
|
/// <c>inline bool IsActive() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool IsActive() => Jolt.PInvoke.PointConstraintPart_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/PointConstraintPart.h#L145">Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h:145</see>
|
|
/// <br/>
|
|
/// <c>inline void WarmStart(Body &ioBody1, Body &ioBody2, float inWarmStartImpulseRatio)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Must be called from the WarmStartVelocityConstraint call to apply the previous frame's impulses
|
|
/// @param ioBody1 The first body that this constraint is attached to
|
|
/// @param ioBody2 The second body that this constraint is attached to
|
|
/// @param inWarmStartImpulseRatio Ratio of new step to old time step (dt_new / dt_old) for scaling the lagrange multiplier of the previous frame
|
|
/// </code>
|
|
/// </remarks>
|
|
public void WarmStart(Body body1, Body body2, float warmStartImpulseRatio) =>
|
|
Jolt.PInvoke.PointConstraintPart_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/PointConstraintPart.h#L154">Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h:154</see>
|
|
/// <br/>
|
|
/// <c>inline bool SolveVelocityConstraint(Body &ioBody1, Body &ioBody2)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Iteratively update the velocity constraint. Makes sure d/dt C(...) = 0, where C is the constraint equation.
|
|
/// @param ioBody1 The first body that this constraint is attached to
|
|
/// @param ioBody2 The second body that this constraint is attached to
|
|
/// </code>
|
|
/// </remarks>
|
|
public bool SolveVelocityConstraint(Body body1, Body body2) =>
|
|
Jolt.PInvoke.PointConstraintPart_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/PointConstraintPart.h#L168">Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h:168</see>
|
|
/// <br/>
|
|
/// <c>inline bool SolvePositionConstraint(Body &ioBody1, Body &ioBody2, float inBaumgarte) const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Iteratively update the position constraint. Makes sure C(...) = 0.
|
|
/// @param ioBody1 The first body that this constraint is attached to
|
|
/// @param ioBody2 The second body that this constraint is attached to
|
|
/// @param inBaumgarte Baumgarte constant (fraction of the error to correct)
|
|
/// </code>
|
|
/// </remarks>
|
|
public bool SolvePositionConstraint(Body body1, Body body2, float baumgarte) =>
|
|
Jolt.PInvoke.PointConstraintPart_SolvePositionConstraint(this, body1, body2, baumgarte);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Return lagrange multiplier
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h#L213">Jolt/Physics/Constraints/ConstraintPart/PointConstraintPart.h:213</see>
|
|
/// <br/>
|
|
/// <c>Vec3 GetTotalLambda() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public float3 GetTotalLambda() => Jolt.PInvoke.PointConstraintPart_GetTotalLambda(this);
|
|
|
|
public void Dispose() => Jolt.PInvoke.PointConstraintPart_Destroy(this);
|
|
}
|
|
}
|