示例#1
0
        public bool IsCollide(Ball ball)
        {
            var behindTheFront       = ball.Position.Dot(Normal) < Start.Dot(Normal);
            var rightFromStart       = ball.Position.Cross(Normal) > Start.Cross(Normal);
            var leftFromEnd          = ball.Position.Cross(Normal) < End.Cross(Normal);
            var hasOppositeDirection = Math.Abs(ball.Direction.Angle.EnsurePositiveAngle() - Normal.Angle.EnsurePositiveAngle()) > Math.PI / 2;

            return(behindTheFront && rightFromStart && leftFromEnd && hasOppositeDirection);
        }