class MAGES::MeshDeformations::SceneGraph::TearActionGhostMath¶
Overview¶
Pure, side-effect-free helpers backing the Tear Action ghost effect. Extracted from TearActionGhostEffectImplementor and TearActionGhostMarker so the centroid, disc-geometry, and cut-detection logic can be unit-tested without a live scene, camera, or simulation mesh. Mirrors the role of CutActionVolumeSelectionMath. More…
class TearActionGhostMath
{
public:
// methods
static bool GroupCenter(
IReadOnlyList positions,
IReadOnlyList indices,
out float3 center
);
static void BuildCircleMesh(
int segments,
float radius,
out Vector3[] vertices,
out int[] triangles,
out Vector3[] normals
);
static bool AnyConstraintDisabled(
IReadOnlyList enabledStates,
IReadOnlyList indices
);
static bool IsConstraintDisabled(
int constraintIndex,
int constraintCount,
System.Func isDisabled
);
};
Detailed Documentation¶
Pure, side-effect-free helpers backing the Tear Action ghost effect. Extracted from TearActionGhostEffectImplementor and TearActionGhostMarker so the centroid, disc-geometry, and cut-detection logic can be unit-tested without a live scene, camera, or simulation mesh. Mirrors the role of CutActionVolumeSelectionMath.
Methods¶
static bool GroupCenter(
IReadOnlyList positions,
IReadOnlyList indices,
out float3 center
)
Returns the average of the positions referenced by indices.
Parameters:
positions |
Particle positions, indexed by the values in indices. |
indices |
The positions to average. Indices outside positions are ignored. |
center |
The averaged centre, or float3.zero when nothing was averaged. |
Returns:
true when at least one in-range position contributed.
static void BuildCircleMesh(
int segments,
float radius,
out Vector3[] vertices,
out int[] triangles,
out Vector3[] normals
)
Builds a flat, camera-facing disc as a triangle fan in the XY plane (z = 0), facing +Z.
Parameters:
segments |
The number of fan triangles around the rim. Clamped to a minimum of 3. |
radius |
The disc radius. |
vertices |
The resulting vertices: index 0 is the centre, indices 1.. segments are the rim. Length is |
triangles |
The triangle index buffer. Length is |
normals |
Per-vertex normals, all pointing +Z. Length matches vertices. |
static bool AnyConstraintDisabled(
IReadOnlyList enabledStates,
IReadOnlyList indices
)
Returns true when at least one of indices is disabled (its enabledStates entry is false). Indices outside enabledStates are ignored rather than throwing.
Parameters:
enabledStates |
Per-constraint enabled flags, indexed by volume-constraint index. |
indices |
The volume-constraint indices to inspect. |
Returns:
true if any observed, in-range constraint is disabled.
static bool IsConstraintDisabled(
int constraintIndex,
int constraintCount,
System.Func isDisabled
)
Returns true only when constraintIndex is in range (0 <= index < *constraintCount*) and isDisabled reports it disabled. An out-of-range index returns false. Mirrors the closure pattern of TearActionData.AreAllConstraintsDestroyed, sidestepping the NativeArray<bool> vs IReadOnlyList<bool> mismatch between the runtime enabled buffer and a plain list.
Parameters:
constraintIndex |
The single volume-constraint index to inspect. |
constraintCount |
The number of constraints in the runtime buffer. |
isDisabled |
Reports whether the constraint at a given index is disabled. |
Returns:
true when the in-range constraint is disabled.