| | | 1 | | //======================================================================= |
| | | 2 | | // ConeSurfaceFamilySelection.cs |
| | | 3 | | //======================================================================= |
| | | 4 | | // MIT License, Copyright (c) 2024-present David Oravsky (mrdav30) |
| | | 5 | | // See LICENSE file in the project root for full license information. |
| | | 6 | | //======================================================================= |
| | | 7 | | |
| | | 8 | | using System; |
| | | 9 | | using static FixedMathSharp.Geometry.ContactQuadratic; |
| | | 10 | | |
| | | 11 | | namespace FixedMathSharp.Geometry; |
| | | 12 | | |
| | | 13 | | /// <summary>Caller-owned finite pool of already admitted exact family events.</summary> |
| | | 14 | | internal ref struct ConeSurfaceFamilySelection |
| | | 15 | | { |
| | | 16 | | private readonly Span<ConeSurfaceFamilyEvent> events; |
| | | 17 | | internal int Count { get; private set; } |
| | 388 | 18 | | internal ConeSurfaceFamilyEvent this[int index] => events[..Count][index]; |
| | 783 | 19 | | internal ConeSurfaceFamilySelection(Span<ConeSurfaceFamilyEvent> events) { this.events = events; Count = 0; } |
| | | 20 | | internal void Add(ConeSurfaceFamilyEvent item) |
| | | 21 | | { |
| | 547 | 22 | | if (Count == events.Length) throw new InvalidOperationException("The caller-owned family event storage is full." |
| | 545 | 23 | | events[Count++] = item; |
| | 545 | 24 | | } |
| | | 25 | | } |