//
// 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/SpringPart.h:13
///
/// class SpringPart
///
///
///
///
/// Class used in other constraint parts to calculate the required bias factor in the lagrange multiplier for
/// creating springs
///
///
[InteropHandle]
public readonly partial struct SpringPart : IDisposable
{
public static SpringPart Create() => Jolt.PInvoke.SpringPart_Create();
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SpringPart.h:71
///
/// inline void CalculateSpringPropertiesWithBias(float inBias)
///
///
///
///
/// Turn off the spring and set a bias only
///
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
///
///
public void CalculateSpringPropertiesWithBias(float bias) => Jolt.PInvoke.SpringPart_CalculateSpringPropertiesWithBias(this, bias);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SpringPart.h:86
///
/// inline void CalculateSpringPropertiesWithFrequencyAndDamping(float inDeltaTime, float inInvEffectiveMass, float inBias, float inC, float inFrequency, float inDamping, float &outEffectiveMass)
///
///
///
///
/// Calculate spring properties based on frequency and damping ratio
///
/// @param inDeltaTime Time step
/// @param inInvEffectiveMass Inverse effective mass K
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
/// @param inC Value of the constraint equation (C). Set to zero if you don't want to drive the constraint to zero with a spring.
/// @param inFrequency Oscillation frequency (Hz). Set to zero if you don't want to drive the constraint to zero with a spring.
/// @param inDamping Damping factor (0 = no damping, 1 = critical damping). Set to zero if you don't want to drive the constraint to zero with a spring.
/// @param outEffectiveMass On return, this contains the new effective mass K^-1
///
///
public void CalculateSpringPropertiesWithFrequencyAndDamping(float deltaTime, float invEffectiveMass, float bias, float c, float frequency, float damping, out float effectiveMass) => Jolt.PInvoke.SpringPart_CalculateSpringPropertiesWithFrequencyAndDamping(this, deltaTime, invEffectiveMass, bias, c, frequency, damping, out effectiveMass);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SpringPart.h:116
///
/// inline void CalculateSpringPropertiesWithStiffnessAndDamping(float inDeltaTime, float inInvEffectiveMass, float inBias, float inC, float inStiffness, float inDamping, float &outEffectiveMass)
///
///
///
///
/// Calculate spring properties with spring Stiffness (k) and damping (c), this is based on the spring equation: F = -k * x - c * v
///
/// @param inDeltaTime Time step
/// @param inInvEffectiveMass Inverse effective mass K
/// @param inBias Bias term (b) for the constraint impulse: lambda = J v + b
/// @param inC Value of the constraint equation (C). Set to zero if you don't want to drive the constraint to zero with a spring.
/// @param inStiffness Spring stiffness k. Set to zero if you don't want to drive the constraint to zero with a spring.
/// @param inDamping Spring damping coefficient c. Set to zero if you don't want to drive the constraint to zero with a spring.
/// @param outEffectiveMass On return, this contains the new effective mass K^-1
///
///
public void CalculateSpringPropertiesWithStiffnessAndDamping(float deltaTime, float invEffectiveMass, float bias, float c, float stiffness, float damping, out float effectiveMass) => Jolt.PInvoke.SpringPart_CalculateSpringPropertiesWithStiffnessAndDamping(this, deltaTime, invEffectiveMass, bias, c, stiffness, damping, out effectiveMass);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SpringPart.h:131
///
/// inline bool IsActive() const
///
///
///
///
/// Returns if this spring is active
///
///
public bool IsActive() => Jolt.PInvoke.SpringPart_IsActive(this);
///
///
/// C++:
/// Jolt/Physics/Constraints/ConstraintPart/SpringPart.h:137
///
/// inline float GetBias(float inTotalLambda) const
///
///
///
///
/// Get total bias b, including supplied bias and bias for spring: lambda = J v + b
///
///
public float GetBias(float totalLambda) => Jolt.PInvoke.SpringPart_GetBias(this, totalLambda);
public void Dispose() => Jolt.PInvoke.SpringPart_Destroy(this);
}
}