< Summary

Class:LaunchPlan
Assembly:bamlab.micromissiles
File(s):/github/workspace/Assets/Scripts/Algorithms/Planning/LaunchPlan.cs
Covered lines:11
Uncovered lines:0
Coverable lines:11
Total lines:27
Line coverage:100% (11 of 11)
Covered branches:0
Total branches:0
Covered methods:8
Total methods:8
Method coverage:100% (8 of 8)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
NoLaunch()0%110100%
NormalizedLaunchVector(...)0%110100%

File(s)

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

#LineLine coverage
 1using UnityEngine;
 2
 3// The launch planner outputs a launch plan.
 4public struct LaunchPlan {
 5  // If true, the interceptor should be launched.
 186  public bool ShouldLaunch { get; init; }
 7
 8  // Launch angle in degrees measured from the horizon.
 149  public float LaunchAngle { get; init; }
 10
 11  // Absolute intercept position.
 1412  public Vector3 InterceptPosition { get; init; }
 13
 14  // No-launch launch plan.
 415  public static LaunchPlan NoLaunch() {
 416    return new LaunchPlan { ShouldLaunch = false };
 417  }
 18
 19  // Get the normalized launch vector given the agent's position.
 420  public Vector3 NormalizedLaunchVector(in Vector3 position) {
 421    Vector3 relativeInterceptPosition = InterceptPosition - position;
 422    Vector3 interceptDirection =
 23        Coordinates3.ConvertCartesianToSpherical(relativeInterceptPosition);
 424    return Coordinates3.ConvertSphericalToCartesian(r: 1, azimuth: interceptDirection[1],
 25                                                    elevation: LaunchAngle);
 426  }
 27}