예제 #1
0
        protected bool Cut(MarkupCrosswalk crosswalk, ITrajectory trajectory, float width, out ITrajectory cutTrajectory)
        {
            var delta = width / Mathf.Tan(crosswalk.CornerAndNormalAngle) / 2;

            if (2 * delta >= trajectory.Magnitude)
            {
                cutTrajectory = default;
                return(false);
            }
            else
            {
                var startCut = trajectory.Travel(0, delta);
                var endCut   = trajectory.Invert().Travel(0, delta);
                cutTrajectory = trajectory.Cut(startCut, 1 - endCut);
                return(true);
            }
        }