< Summary

Information
Class: FixedMathSharp.Geometry.SegmentConeSurfaceGeometry
Assembly: FixedMathSharp
File(s): /home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/FiniteAxis/SegmentConeSurfaceGeometry.cs
Line coverage
100%
Covered lines: 24
Uncovered lines: 0
Coverable lines: 24
Total lines: 55
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_FullHeight()100%11100%
get_Words()100%11100%
get_FamilyWords()100%11100%
get_ValueWords()100%11100%
.ctor(...)100%44100%

File(s)

/home/runner/work/FixedMathSharp/FixedMathSharp/src/FixedMathSharp/Geometry/Wide/FiniteAxis/SegmentConeSurfaceGeometry.cs

#LineLine coverage
 1//=======================================================================
 2// SegmentConeSurfaceGeometry.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
 8using System;
 9using static FixedMathSharp.Geometry.CylinderContactAlgebra;
 10using static FixedMathSharp.Geometry.ContactQuadratic;
 11
 12namespace FixedMathSharp.Geometry;
 13
 14/// <summary>One exact centered frame shared by the segment's support charts.</summary>
 15internal readonly struct SegmentConeSurfaceGeometry
 16{
 17    internal readonly SegmentConeSurfaceInput Input;
 18    internal readonly ConeFiniteSectionFrame Finite;
 19    internal readonly WideDirection3d A, B, Edge, BaseOffset;
 20    internal readonly Signed576 Radius;
 21    // Affine coordinates have at most 306 bits, dots at most 615. Weighted
 22    // points can exceed 832 bits and remain in the existing borrowed banks.
 23    internal readonly Signed320 RawScale;
 24    internal readonly Signed576 Cap;
 213425    internal Signed576 FullHeight => WideArithmetic.AddSigned576(Cap, Cap);
 1728126    internal int Words => Input.Words;
 834527    internal int FamilyWords => Input.FamilyWords;
 1828    internal int ValueWords => Input.ValueWords;
 29    internal readonly int ValueShift;
 30
 31    internal SegmentConeSurfaceGeometry(in SegmentConeSurfaceInput input)
 32    {
 209433        Input = input;
 209434        Finite = input.HasSourceFrame
 209435            ? new ConeFiniteSectionFrame(input.SourceFrame, input.Center, input.ConeRotation, input.Height, input.Radius
 209436            : new ConeFiniteSectionFrame(input.Origin, input.Rotation, input.Center, input.ConeRotation, input.Height, i
 418837        WideAxis3 first = Finite.ShapeFrame.Transform(input.Segment.Start), second = Finite.ShapeFrame.Transform(input.S
 209438        Span<Signed320> components = stackalloc Signed320[9]
 209439        {
 209440            WideArithmetic.AddSigned320(Finite.ShapeFrame.CoordinateDenominator, Finite.ShapeFrame.CoordinateDenominator
 209441            first.X, first.Y, first.Z, second.X, second.Y, second.Z, Finite.ShapeFrame.Cap,
 209442            Signed320.NarrowValue(WideArithmetic.MultiplySigned320(Finite.ShapeFrame.CoordinateDenominator, Finite.Shape
 209443        };
 44        // One common reduction preserves the entire line and shape together.
 45        // It removes harmless composed-frame factors before fixed-degree charts.
 211846        if (input.IsAffine) WideArithmetic.ReduceCommonScale(components);
 628247        RawScale = components[0]; A = new(components[1], components[2], components[3]); B = new(components[4], component
 418848        Cap = Signed576.ExtendValue(components[7]); Radius = Signed576.ExtendValue(components[8]);
 209449        Edge = TriangleCircularGeometry.Subtract(B, A);
 209450        BaseOffset = new(A.X, WideArithmetic.AddSigned576(A.Y, Cap), A.Z);
 209451        Span<Signed576> coordinates = stackalloc Signed576[8]
 209452        { A.X, A.Y, A.Z, B.X, B.Y, B.Z, Cap, Radius };
 209453        ValueShift = TriangleCircularGeometry.GetValueShift(coordinates, 4);
 209454    }
 55}