//
// 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
{
///
///
/// Describes the mass and inertia properties of a body. Used during body construction only.
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:15
///
/// class MassProperties
///
///
[InteropHandle]
public readonly partial struct MassProperties : IDisposable
{
public static MassProperties Create() => Jolt.PInvoke.MassProperties_Create();
///
///
/// Using eigendecomposition, decompose the inertia tensor into a diagonal matrix D and a right-handed
/// rotation matrix R so that the inertia tensor is \f$R \: D \: R^{-1}\f$.
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:36
///
/// bool DecomposePrincipalMomentsOfInertia(Mat44 &outRotation, Vec3 &outDiagonal) const
///
///
///
///
/// Using eigendecomposition, decompose the inertia tensor into a diagonal matrix D and a right-handed rotation matrix R so that the inertia tensor is \f$R \: D \: R^{-1}\f$.
/// @see https://en.wikipedia.org/wiki/Moment_of_inertia section 'Principal axes'
/// @param outRotation The rotation matrix R
/// @param outDiagonal The diagonal of the diagonal matrix D
/// @return True if successful, false if failed
///
///
public bool DecomposePrincipalMomentsOfInertia(out float4x4 rotation, out float3 diagonal) =>
Jolt.PInvoke.MassProperties_DecomposePrincipalMomentsOfInertia(this, out rotation, out diagonal);
///
///
/// Set the mass and inertia of a box with edge size inBoxSize and density inDensity
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:39
///
/// void SetMassAndInertiaOfSolidBox(Vec3Arg inBoxSize, float inDensity)
///
///
public void SetMassAndInertiaOfSolidBox(float3 boxSize, float density) =>
Jolt.PInvoke.MassProperties_SetMassAndInertiaOfSolidBox(this, boxSize, density);
///
///
/// Set the mass and scale the inertia tensor to match the mass
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:42
///
/// void ScaleToMass(float inMass)
///
///
public void ScaleToMass(float mass) => Jolt.PInvoke.MassProperties_ScaleToMass(this, mass);
///
///
/// Calculates the size of the solid box that has an inertia tensor diagonal inInertiaDiagonal
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:45
///
/// static Vec3 sGetEquivalentSolidBoxSize(float inMass, Vec3Arg inInertiaDiagonal)
///
///
public static float3 GetEquivalentSolidBoxSize(float mass, float3 inertiaDiagonal) =>
Jolt.PInvoke.MassProperties_GetEquivalentSolidBoxSize(mass, inertiaDiagonal);
///
///
/// Rotate the inertia by 3x3 matrix inRotation
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:48
///
/// void Rotate(Mat44Arg inRotation)
///
///
public void Rotate(in float4x4 rotation) => Jolt.PInvoke.MassProperties_Rotate(this, in rotation);
///
///
/// Translate the inertia by a vector inTranslation
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:51
///
/// void Translate(Vec3Arg inTranslation)
///
///
public void Translate(float3 translation) => Jolt.PInvoke.MassProperties_Translate(this, translation);
///
///
/// Scale the mass and inertia by inScale, note that elements can be < 0 to flip the shape
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:54
///
/// void Scale(Vec3Arg inScale)
///
///
public void Scale(float3 scale) => Jolt.PInvoke.MassProperties_Scale(this, scale);
///
///
/// Saves the state of this object in binary form to inStream.
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:57
///
/// void SaveBinaryState(StreamOut &inStream) const
///
///
public void SaveBinaryState(StreamOut stream) => Jolt.PInvoke.MassProperties_SaveBinaryState(this, stream);
///
///
/// Restore the state of this object from inStream.
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:60
///
/// void RestoreBinaryState(StreamIn &inStream)
///
///
public void RestoreBinaryState(StreamIn stream) => Jolt.PInvoke.MassProperties_RestoreBinaryState(this, stream);
///
///
/// Mass of the shape (kg)
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:63
///
/// float mMass = 0.0f
///
///
public float GetMass() => Jolt.PInvoke.MassProperties_GetMass(this);
///
///
/// Mass of the shape (kg)
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:63
///
/// float mMass = 0.0f
///
///
public void SetMass(float value) => Jolt.PInvoke.MassProperties_SetMass(this, value);
///
///
/// Inertia tensor of the shape (kg m^2)
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:66
///
/// Mat44 mInertia = Mat44::sZero()
///
///
public float4x4 GetInertia() => Jolt.PInvoke.MassProperties_GetInertia(this);
///
///
/// Inertia tensor of the shape (kg m^2)
///
///
/// C++:
/// Jolt/Physics/Body/MassProperties.h:66
///
/// Mat44 mInertia = Mat44::sZero()
///
///
public void SetInertia(in float4x4 value) => Jolt.PInvoke.MassProperties_SetInertia(this, in value);
public void Dispose() => Jolt.PInvoke.MassProperties_Destroy(this);
}
}