| | | 1 | | //======================================================================= |
| | | 2 | | // SegmentConeSurfaceInput.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.CylinderContactAlgebra; |
| | | 10 | | using static FixedMathSharp.Geometry.ContactQuadratic; |
| | | 11 | | |
| | | 12 | | namespace FixedMathSharp.Geometry; |
| | | 13 | | |
| | | 14 | | /// <summary>Neutral source provenance sufficient to reconstruct one exact chart.</summary> |
| | | 15 | | internal readonly struct SegmentConeSurfaceInput |
| | | 16 | | { |
| | | 17 | | internal readonly FixedSegment Segment; |
| | | 18 | | internal readonly Vector3d Origin, Center; |
| | | 19 | | internal readonly FixedQuaternion Rotation, ConeRotation; |
| | | 20 | | internal readonly Fixed64 Height, Radius; |
| | | 21 | | internal readonly ScaledRigidFrame3d SourceFrame; |
| | | 22 | | internal readonly bool HasSourceFrame; |
| | 30896 | 23 | | internal bool IsAffine => HasSourceFrame && !SourceFrame.IsRigid; |
| | 18267 | 24 | | internal int Words => IsAffine ? 120 : CylinderContactAlgebra.Words; |
| | 9170 | 25 | | internal int FamilyWords => IsAffine ? 3 * SegmentConeSurfaceCandidates.FamilyWords : SegmentConeSurfaceCandidates.F |
| | 269 | 26 | | internal int ValueWords => IsAffine ? 3 * CircularRimContactAlgebra.ValueWords : CircularRimContactAlgebra.ValueWord |
| | | 27 | | |
| | | 28 | | internal SegmentConeSurfaceInput(FixedSegment segment, Vector3d origin, FixedQuaternion rotation, |
| | | 29 | | Vector3d center, FixedQuaternion coneRotation, Fixed64 height, Fixed64 radius) |
| | | 30 | | { |
| | 354 | 31 | | SourceFrame = default; HasSourceFrame = false; |
| | 708 | 32 | | Segment = segment; Origin = origin; Rotation = rotation; Center = center; |
| | 531 | 33 | | ConeRotation = coneRotation; Height = height; Radius = radius; |
| | 177 | 34 | | } |
| | | 35 | | |
| | | 36 | | internal SegmentConeSurfaceInput(FixedSegment segment, in ScaledRigidFrame3d sourceFrame, |
| | | 37 | | Vector3d center, FixedQuaternion rotation, Fixed64 height, Fixed64 radius) |
| | | 38 | | { |
| | 9 | 39 | | SourceFrame = sourceFrame; HasSourceFrame = true; Segment = segment; |
| | 3 | 40 | | Origin = sourceFrame.IsRigid ? sourceFrame.RigidOrigin : center; |
| | 3 | 41 | | Rotation = sourceFrame.IsRigid ? sourceFrame.Rotation : rotation; |
| | 12 | 42 | | Center = center; ConeRotation = rotation; Height = height; Radius = radius; |
| | 3 | 43 | | } |
| | | 44 | | } |