| | | 1 | | //======================================================================= |
| | | 2 | | // CylinderPairValueDerivative.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 | | |
| | | 10 | | namespace FixedMathSharp.Geometry; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Caller-owned storage for one exact directional derivative of the rim value |
| | | 14 | | /// polynomial. The six input slots are rho', tau', (c²)', (c.u)', (c.w)', |
| | | 15 | | /// and (b.c)'; axes and perpendicular basis vectors remain fixed. |
| | | 16 | | /// </summary> |
| | | 17 | | /// <remarks> |
| | | 18 | | /// Each slot uses the value builder's word width and canonical signed-magnitude |
| | | 19 | | /// encoding. Output has nine slots. All storage is disjoint from the value |
| | | 20 | | /// construction and from each other. The default value disables derivatives; |
| | | 21 | | /// a supplied six-slot zero direction is still evaluated and cleared exactly. |
| | | 22 | | /// The derivative preserves the value polynomial's raw factor of three. |
| | | 23 | | /// </remarks> |
| | | 24 | | internal readonly ref struct CylinderPairValueDerivative |
| | | 25 | | { |
| | | 26 | | internal const int InvariantCount = 6; |
| | | 27 | | internal const int ScratchCoefficientCount = 72; |
| | | 28 | | |
| | | 29 | | internal readonly ReadOnlySpan<ulong> Invariants; |
| | | 30 | | internal readonly ReadOnlySpan<sbyte> InvariantSigns; |
| | | 31 | | internal readonly Span<ulong> Coefficients; |
| | | 32 | | internal readonly Span<sbyte> Signs; |
| | | 33 | | internal readonly Span<ulong> Scratch; |
| | | 34 | | internal readonly Span<sbyte> ScratchSigns; |
| | | 35 | | |
| | | 36 | | internal CylinderPairValueDerivative(ReadOnlySpan<ulong> invariants, |
| | | 37 | | ReadOnlySpan<sbyte> invariantSigns, Span<ulong> coefficients, |
| | | 38 | | Span<sbyte> signs, Span<ulong> scratch, Span<sbyte> scratchSigns) |
| | | 39 | | { |
| | 5128 | 40 | | Invariants = invariants; |
| | 5128 | 41 | | InvariantSigns = invariantSigns; |
| | 5128 | 42 | | Coefficients = coefficients; |
| | 5128 | 43 | | Signs = signs; |
| | 5128 | 44 | | Scratch = scratch; |
| | 5128 | 45 | | ScratchSigns = scratchSigns; |
| | 5128 | 46 | | } |
| | | 47 | | } |