コード例 #1
0
ファイル: MathTest.cs プロジェクト: pheney/PLibUnitTests
        public void AngleSum3d_ReturnsCorrectly()
        {
            //  arrange
            Vector3[] polygon       = new Vector3[] { Vector3.left, Vector3.up, Vector3.right, Vector3.down };
            Vector3   pointInside   = Vector3.zero;
            Vector3   planarOutside = Vector3.up + Vector3.right;
            Vector3   extraplanar   = Vector3.forward;

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

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