• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MissionEngineeringLtd / MissionEngineeringToolbox / 23765596749

30 Mar 2026 08:15PM UTC coverage: 70.201% (-0.05%) from 70.246%
23765596749

push

github

MissionEngineeringLtd
Merge branch 'main' of https://github.com/MissionEngineeringLtd/MissionEngineeringToolbox

100 of 164 branches covered (60.98%)

Branch coverage included in aggregate %.

1297 of 1826 relevant lines covered (71.03%)

1701.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

43.75
/MissionEngineering.Math/Source/Vector/Vector.cs
1
using System.Collections;
2
using static System.Math;
3

4
namespace MissionEngineering.Math;
5

6
public partial class Vector
7
{
8
    public int NumberOfElements => Data.Length;
26✔
9

10
    public double[] Data { get; set; }
114,179✔
11

12
    public Vector()
1✔
13
    {
1✔
14
        Data = [];
1✔
15
    }
1✔
16

17
    public Vector(int numberOfElements)
3,806✔
18
    {
3,806✔
19
        Data = new double[numberOfElements];
3,806✔
20
    }
3,806✔
21

22
    public Vector(params double[] data)
3,819✔
23
    {
3,819✔
24
        Data = data;
3,819✔
25
    }
3,819✔
26

27
    public Vector(PositionNED positionNED, VelocityNED velocityNED)
×
28
    {
×
29
        Data = new double[6];
×
30

31
        Data[0] = positionNED.PositionNorth_m;
×
32
        Data[1] = positionNED.PositionEast_m;
×
33
        Data[2] = positionNED.PositionDown_m;
×
34
        Data[3] = velocityNED.VelocityNorth_ms;
×
35
        Data[4] = velocityNED.VelocityEast_ms;
×
36
        Data[5] = velocityNED.VelocityDown_ms;
×
37
    }
×
38

39
    public Vector(PositionNED positionNED, VelocityNED velocityNED, AccelerationNED accelerationNED)
×
40
    {
×
41
        Data = new double[9];
×
42

43
        Data[0] = positionNED.PositionNorth_m;
×
44
        Data[1] = positionNED.PositionEast_m;
×
45
        Data[2] = positionNED.PositionDown_m;
×
46
        Data[3] = velocityNED.VelocityNorth_ms;
×
47
        Data[4] = velocityNED.VelocityEast_ms;
×
48
        Data[5] = velocityNED.VelocityDown_ms;
×
49
        Data[6] = accelerationNED.AccelerationNorth_ms2;
×
50
        Data[7] = accelerationNED.AccelerationEast_ms2;
×
51
        Data[8] = accelerationNED.AccelerationDown_ms2;
×
52
    }
×
53

54
    public double this[int index]
55
    {
56
        get => Data[index];
68,464✔
57
        set => Data[index] = value;
34,221✔
58
    }
59

60
    public double this[Index index]
61
    {
62
        get => Data[index];
12✔
63
        set => Data[index] = value;
1✔
64
    }
65

66
    public double[] this[Range index]
67
    {
68
        get => Data[index];
×
69
        set => Data = value;
×
70
    }
71

72
    public IEnumerator GetEnumerator()
73
    {
×
74
        return Data.GetEnumerator();
×
75
    }
×
76

77
    public Vector Copy()
78
    {
×
79
        var result = new Vector(NumberOfElements);
×
80

81
        Array.Copy(Data, result.Data, NumberOfElements);
×
82

83
        return result;
×
84
    }
×
85

86
    public bool Equals(Vector x, double tolerance = 1.0e-9)
87
    {
1✔
88
        if (this is null)
1!
89
        {
×
90
            return false;
×
91
        }
92

93
        if (x is null)
1!
94
        {
×
95
            return false;
×
96
        }
97

98
        if (x.NumberOfElements != NumberOfElements)
1!
99
        {
×
100
            return false;
×
101
        }
102

103
        for (int i = 0; i < Data.Length; i++)
16✔
104
        {
7✔
105
            var deltaX = Abs(x.Data[i] - Data[i]);
7✔
106

107
            if (deltaX > tolerance)
7!
108
            {
×
109
                return false;
×
110
            }
111
        }
7✔
112

113
        return true;
1✔
114
    }
1✔
115
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc