示例#1
0
        public void AngleSum2d_ReturnsCorrectly()
        {
            //  arrange
            Vector2[] polygon       = new Vector2[] { Vector2.left, Vector2.up, Vector2.right, Vector2.down };
            Vector2   pointInside   = Vector2.zero;
            Vector2   planarOutside = Vector2.up + Vector2.right;

            //  act
            bool inside  = Mathf.Approximately(Mathf.PI * 2, PMath.AngleSum2d(pointInside, polygon));
            bool outside = Mathf.Approximately(Mathf.PI * 2, PMath.AngleSum2d(planarOutside, polygon));

            //  assert
            Assert.IsTrue(inside);
            Assert.IsFalse(outside);
        }