using System;
using System.Numerics;

namespace NavisworksTransport.Utils.CoordinateSystem
{
    /// <summary>
    /// 当前宿主语义下的路径目标框架。
    /// Forward 表示路径前进方向，Up 表示路径语义上的“向上/法向”，Side 由二者叉乘得到。
    /// </summary>
    public sealed class PathTargetFrame
    {
        public PathTargetFrame(Vector3 forward, Vector3 up)
        {
            if (forward.LengthSquared() < 1e-12f)
            {
                throw new ArgumentException("forward 不能为空。", nameof(forward));
            }

            if (up.LengthSquared() < 1e-12f)
            {
                throw new ArgumentException("up 不能为空。", nameof(up));
            }

            Forward = Vector3.Normalize(forward);
            Up = Vector3.Normalize(up);
            Side = Vector3.Normalize(Vector3.Cross(Forward, Up));
        }

        public Vector3 Forward { get; }
        public Vector3 Up { get; }
        public Vector3 Side { get; }
    }
}
