< Summary

Class:LinearExtrapolator
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Algorithms/Prediction/LinearExtrapolator.cs
Covered lines:6
Uncovered lines:1
Coverable lines:7
Total lines:22
Line coverage:85.7% (6 of 7)
Covered branches:0
Total branches:0
Covered methods:2
Total methods:2
Method coverage:100% (2 of 2)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
LinearExtrapolator(...)0%110100%
Predict(...)0%2.092071.43%

File(s)

/github/workspace/Assets/Scripts/Algorithms/Prediction/LinearExtrapolator.cs

#LineLine coverage
 1using UnityEngine;
 2
 3// The linear extrapolator class predicts the trajectory of an agent by linearly extrapolating its
 4// current position and velocity.
 5public class LinearExtrapolator : PredictorBase {
 276  public LinearExtrapolator(IHierarchical hierarchical) : base(hierarchical) {}
 7
 8  // Predict the future state of the hierarchical object by linearly extrapolating its current
 9  // position and velocity.
 2010  public override PredictorState Predict(float time) {
 2011    if (Hierarchical == null) {
 012      return new PredictorState();
 13    }
 14
 2015    Vector3 position = Hierarchical.Position + Hierarchical.Velocity * time;
 2016    return new PredictorState {
 17      Position = position,
 18      Velocity = Hierarchical.Velocity,
 19      Acceleration = Hierarchical.Acceleration,
 20    };
 2021  }
 22}