Permalink
Browse files

Overloads for Point(int, MathObject) etc

  • Loading branch information...
1 parent 6065a87 commit 1a4fa482a4625ed1f5b2094a3dcd26fe1993a424 @dharmatech committed Feb 4, 2013
@@ -30,7 +30,7 @@ static void Main(string[] args)
var g = new Symbol("g"); // magnitude of gravity
- var _g = new Point(new Integer(0), -g); // gravity vector
+ var _g = new Point(0, -g); // gravity vector
// An Obj representing the object at A:
@@ -47,7 +47,7 @@ static void Main(string[] args)
new Obj()
{
position = new Point(),
- velocity = new Point(objA.velocity.x, new Integer(0)),
+ velocity = new Point(objA.velocity.x, 0),
acceleration = _g
};
@@ -33,11 +33,20 @@ public class Point
public Point() { }
+ public Point(MathObject x_val, MathObject y_val)
+ { x = x_val; y = y_val; }
+
+ //////////////////////////////////////////////////////////////////////
+ // overloads for 'int'
public Point(int x_val, int y_val)
{ x = new Integer(x_val); y = new Integer(y_val); }
- public Point(MathObject x_val, MathObject y_val)
- { x = x_val; y = y_val; }
+ public Point(int x_val, MathObject y_val)
+ { x = new Integer(x_val); y = y_val; }
+
+ public Point(MathObject x_val, int y_val)
+ { x = x_val; y = new Integer(y_val); }
+ //////////////////////////////////////////////////////////////////////
public static Point FromAngle(MathObject angle, MathObject mag)
{ return new Point(Trig.Cos(angle) * mag, Trig.Sin(angle) * mag); }
View
@@ -46,7 +46,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Program.cs" />
+ <Compile Include="Physics.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
File renamed without changes.
@@ -46,7 +46,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Program.cs" />
+ <Compile Include="Symbolism.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
View
@@ -148,6 +148,8 @@ static void Main(string[] args)
// ==(double a, MathObject b)
AssertIsTrue(1.0 == new DoubleFloat(3.0) - 2.0);
+
+ // Console.WriteLine((x + x + x + x) / x);
}
{
@@ -158,7 +160,7 @@ static void Main(string[] args)
var g = new Symbol("g"); // magnitude of gravity
- var _g = new Point(new Integer(0), -g); // gravity vector
+ var _g = new Point(0, -g); // gravity vector
var objA =
new Obj()
@@ -173,7 +175,7 @@ static void Main(string[] args)
new Obj()
{
position = new Point(),
- velocity = new Point(objA.velocity.x, new Integer(0)),
+ velocity = new Point(objA.velocity.x, 0),
acceleration = _g
};
@@ -213,6 +215,9 @@ static void Main(string[] args)
==
0.72215756424454336);
}
+
+
+
Console.WriteLine("Testing complete");
Console.ReadLine();

0 comments on commit 1a4fa48

Please sign in to comment.