mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-26 13:08:24 +01:00
144 lines
5.9 KiB
C#
144 lines
5.9 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>
|
|
/// A convex hull builder that tries to create 2D hulls as accurately as possible. Used for offline processing.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Geometry/ConvexHullBuilder2D.h#L14">Jolt/Geometry/ConvexHullBuilder2D.h:14</see>
|
|
/// <br/>
|
|
/// <c>class ConvexHullBuilder2D : public NonCopyable</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct ConvexHullBuilder2D : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Result enum that indicates how the hull got created
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Geometry/ConvexHullBuilder2D.h#L28">Jolt/Geometry/ConvexHullBuilder2D.h:28</see>
|
|
/// <br/>
|
|
/// <c>enum class EResult</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public enum Result : int
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// Hull building finished successfully
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Geometry/ConvexHullBuilder2D.h#L30">Jolt/Geometry/ConvexHullBuilder2D.h:30</see>
|
|
/// <br/>
|
|
/// <c>Success</c>
|
|
/// </para>
|
|
/// </summary>
|
|
Success,
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Hull building finished successfully, but the desired accuracy was not reached because the max
|
|
/// vertices limit was reached
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Geometry/ConvexHullBuilder2D.h#L31">Jolt/Geometry/ConvexHullBuilder2D.h:31</see>
|
|
/// <br/>
|
|
/// <c>MaxVerticesReached</c>
|
|
/// </para>
|
|
/// </summary>
|
|
MaxVerticesReached,
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Constructor
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Geometry/ConvexHullBuilder2D.h#L22">Jolt/Geometry/ConvexHullBuilder2D.h:22</see>
|
|
/// <br/>
|
|
/// <c>explicit ConvexHullBuilder2D(const Positions &inPositions)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Constructor
|
|
/// @param inPositions Positions used to make the hull. Uses X and Y component of Vec3 only!
|
|
/// </code>
|
|
/// <para>
|
|
/// positions is copied into a native container the object keeps; the span is only read.
|
|
/// </para>
|
|
/// </remarks>
|
|
public static unsafe ConvexHullBuilder2D Create(ReadOnlySpan<float3> positions)
|
|
{
|
|
fixed (float3* positions_fixed = positions)
|
|
{
|
|
return Jolt.PInvoke.ConvexHullBuilder2D_Create(positions_fixed, (nuint)positions.Length);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Takes all positions as provided by the constructor and use them to build a hull Any points that are
|
|
/// closer to the hull than inTolerance will be discarded
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Geometry/ConvexHullBuilder2D.h#L41">Jolt/Geometry/ConvexHullBuilder2D.h:41</see>
|
|
/// <br/>
|
|
/// <c>EResult Initialize(int inIdx1, int inIdx2, int inIdx3, int inMaxVertices, float inTolerance, Edges &outEdges)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <code>
|
|
/// Takes all positions as provided by the constructor and use them to build a hull
|
|
/// Any points that are closer to the hull than inTolerance will be discarded
|
|
/// @param inIdx1 , inIdx2 , inIdx3 The indices to use as initial hull (in any order)
|
|
/// @param inMaxVertices Max vertices to allow in the hull. Specify INT_MAX if there is no limit.
|
|
/// @param inTolerance Max distance that a point is allowed to be outside of the hull
|
|
/// @param outEdges On success this will contain the list of indices that form the hull (counter clockwise)
|
|
/// @return Status code that reports if the hull was created or not
|
|
/// </code>
|
|
/// <para>
|
|
/// edges is an owned native buffer - read it through AsSpan() and Dispose it when you are done with it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public ConvexHullBuilder2D.Result Initialize(
|
|
int idx1,
|
|
int idx2,
|
|
int idx3,
|
|
int maxVertices,
|
|
float tolerance,
|
|
out NativeArray<int> edges
|
|
)
|
|
{
|
|
var _result = Jolt.PInvoke.ConvexHullBuilder2D_Initialize(
|
|
this,
|
|
idx1,
|
|
idx2,
|
|
idx3,
|
|
maxVertices,
|
|
tolerance,
|
|
out var edges_raw
|
|
);
|
|
edges = new NativeArray<int>(edges_raw);
|
|
return _result;
|
|
}
|
|
|
|
public void Dispose() => Jolt.PInvoke.ConvexHullBuilder2D_Destroy(this);
|
|
}
|
|
}
|