Esempio n. 1
0
        public void TestLineFormula()
        {
            //arrange
            float   angleInRadians      = (float)Math.PI / 4;
            Vector2 direction           = angleInRadians.AngleAsVector();
            var     knownPositionOnLine = Vector2.One;
            //act
            var line  = LineFormula.FromCoordinateAndDirection(knownPositionOnLine, direction);
            var line2 = LineFormula.FromCoordinateAndDirection(knownPositionOnLine, angleInRadians);

            //assert
            Assert.IsTrue(line.B == 0, "Not intersecting in origo!");
            Assert.AreEqual(line, line2, "Not getting same line objects from constructors");
        }
Esempio n. 2
0
 public static LineFormula FromCoordinateAndDirection(Vector2 coordinate, float angleInRadians)
 {
     return(FromCoordinateAndDirection(coordinate, angleInRadians.AngleAsVector()));
 }