public void CanSubtractTwoPoints() { var p1 = Tuple.NewPoint(3, 2, 1); var p2 = Tuple.NewPoint(5, 6, 7); Assert.Equal(Tuple.NewVector(-2, -4, -6), p1 - p2); }
public void CanSubtractAVectorFromAPoint() { var p = Tuple.NewPoint(3, 2, 1); var v = Tuple.NewVector(5, 6, 7); Assert.Equal(Tuple.NewPoint(-2, -4, -6), p - v); }
private static void Main(string[] args) { Console.WriteLine("Projectile Demo"); var p = new Projectile(Tuple.NewPoint(0, 1, 0), Tuple.NewVector(1, 1, 0).Normalized); var w = new World(Tuple.NewVector(0, -0.1, 0), Tuple.NewVector(-0.01, 0, 0)); var numTicks = 0; Console.WriteLine($"Y: {p.Position.Y}, Ticks: {numTicks}"); while (p.Position.Y > 0) { p = Tick(w, p); numTicks++; Console.WriteLine($"Y: {p.Position.Y}, Ticks: {numTicks}"); } Console.WriteLine($"It took {numTicks} ticks to hit the ground."); Console.Read(); }
public void TupleFactoryCanCreateAPoint() { var p = Tuple.NewPoint(4, -4, 3); Assert.Equal(new Tuple4(4, -4, 3, 1), p); }