< Summary

Class:LaunchAngleDataInterpolatorBase
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Algorithms/Planning/LaunchAngleDataInterpolatorBase.cs
Covered lines:9
Uncovered lines:0
Coverable lines:9
Total lines:25
Line coverage:100% (9 of 9)
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
LaunchAngleDataInterpolatorBase(...)0%110100%
InitInterpolator()0%330100%

File(s)

/github/workspace/Assets/Scripts/Algorithms/Planning/LaunchAngleDataInterpolatorBase.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using UnityEngine;
 3
 4// Base implementation of a launch angle data interpolator.
 5//
 6// The launch angle data interpolator interpolates the values from a static list of values.
 7public abstract class LaunchAngleDataInterpolatorBase : LaunchAngleInterpolatorBase {
 368  public LaunchAngleDataInterpolatorBase(IAgent agent) : base(agent) {}
 9
 10  // Initialize the interpolator.
 1211  protected override void InitInterpolator() {
 1212    var interpolatorDataPoints = new List<Interpolator2DDataPoint>();
 14413    foreach (var dataPoint in GenerateData()) {
 3614      var interpolatorDataPoint = new Interpolator2DDataPoint {
 15        Coordinates = new Vector2(dataPoint.Input.Distance, dataPoint.Input.Altitude),
 16        Data = new List<float> { dataPoint.Output.LaunchAngle, dataPoint.Output.TimeToPosition },
 17      };
 3618      interpolatorDataPoints.Add(interpolatorDataPoint);
 3619    }
 1220    _interpolator = new NearestNeighborInterpolator2D(interpolatorDataPoints);
 1221  }
 22
 23  // Generate the launch angle data points to interpolate.
 24  protected abstract IEnumerable<LaunchAngleDataPoint> GenerateData();
 25}