< Summary

Class:LaunchAngleDataInterpolatorBase
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Algorithms/Planning/LaunchAngleDataInterpolatorBase.cs
Covered lines:0
Uncovered lines:9
Coverable lines:9
Total lines:25
Line coverage:0% (0 of 9)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:2
Method coverage:0% (0 of 2)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
LaunchAngleDataInterpolatorBase(...)0%2100%
InitInterpolator()0%12300%

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 {
 08  public LaunchAngleDataInterpolatorBase(IAgent agent) : base(agent) {}
 9
 10  // Initialize the interpolator.
 011  protected override void InitInterpolator() {
 012    var interpolatorDataPoints = new List<Interpolator2DDataPoint>();
 013    foreach (var dataPoint in GenerateData()) {
 014      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      };
 018      interpolatorDataPoints.Add(interpolatorDataPoint);
 019    }
 020    _interpolator = new NearestNeighborInterpolator2D(interpolatorDataPoints);
 021  }
 22
 23  // Generate the launch angle data points to interpolate.
 24  protected abstract IEnumerable<LaunchAngleDataPoint> GenerateData();
 25}