< Summary

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

Metrics

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

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.
 06  public bool ShouldLaunch { get; init; }
 7
 8  // Launch angle in degrees measured from the horizon.
 09  public float LaunchAngle { get; init; }
 10
 11  // Absolute intercept position.
 012  public Vector3 InterceptPosition { get; init; }
 13
 14  // No-launch launch plan.
 015  public static LaunchPlan NoLaunch() {
 016    return new LaunchPlan { ShouldLaunch = false };
 017  }
 18
 19  // Get the normalized launch vector given the agent's position.
 020  public Vector3 NormalizedLaunchVector(in Vector3 position) {
 021    Vector3 relativeInterceptPosition = InterceptPosition - position;
 022    Vector3 interceptDirection =
 23        Coordinates3.ConvertCartesianToSpherical(relativeInterceptPosition);
 024    return Coordinates3.ConvertSphericalToCartesian(r: 1, azimuth: interceptDirection[1],
 25                                                    elevation: LaunchAngle);
 026  }
 27}