static void Main(string[] args) { float x = 2; float y = 2; float z = +x * +y; Console.WriteLine(z); Vector2D[] loc = new Vector2D[] { new Vector2D(0, 0), new Vector2D(10, 0) }; Vector2D[] loc2 = Polygon.Subdivide(loc, 2); ALVector2D alv = new ALVector2D(MathHelper.PI / 2, new Vector2D(50, 100)); Matrix2D matrix; Matrix2D.FromALVector2D(ref alv, out matrix); Vector2D vector = new Vector2D(0,10); Console.WriteLine(vector); Vector2D r1 = matrix.NormalMatrix * vector; Vector2D r2 = matrix.VertexMatrix * vector; Console.WriteLine(r1); Console.WriteLine(r2); Matrix2D matrixInv; Matrix2D.Invert(ref matrix, out matrixInv); Console.WriteLine(matrixInv.NormalMatrix * r1); Console.WriteLine(matrixInv.VertexMatrix * r2); Polygon polygon = new Polygon(Polygon.CreateRectangle(20, 20), 2); Circle circle = new Circle(10,8); IntersectionInfo info; if (circle.TryGetIntersection(new Vector2D(0,10), out info) || info != null) { Console.WriteLine("circle"); Console.WriteLine(info.Normal); Console.WriteLine(info.Distance); } if (polygon.TryGetIntersection(new Vector2D(3, 5), out info) || info != null) { Console.WriteLine("polygon"); Console.WriteLine(info.Normal); Console.WriteLine(info.Distance); } Console.ReadLine(); /* int[,,] arr = new int[,,] { { { 1, 2 }, { 3, 4 } }, { { 5, 6}, { 7,8 } } }; int[,,] arr3 = new int[2, 2,3]; Array.Copy(arr, arr3, 4); //Functions.ArrayCopy(arr, new int[] { 0, 0,0 }, arr3, new int[] { 0, 0,0 }, new int[] { 2, 2,2 }); int[,,] arr2 = (int[,,])Functions.ArrayRemoveRange(arr, 0, 1, 0); return;*/ /* Form1 gggg = new Form1(); gggg.propertyGrid1.SelectedObject = new TESTObj(); Application.Run(gggg); return; TimeTester test = new TimeTester(100000000, TEST1, TEST2); test.Run(); Console.WriteLine(test); Polygon firstOld, firstNew, secondOld, secondNew; Vector2D[] shape = new Vector2D[]{new Vector2D(1,1),new Vector2D(1,-1),new Vector2D(-1,-1),new Vector2D(-1,1)}; //Array.Reverse(shape); firstOld = new Polygon(shape); firstNew = (Polygon)firstOld.Clone(); secondOld = new Polygon(shape); secondNew = (Polygon)secondOld.Clone(); ALVector2D pos = new ALVector2D(); pos.Linear = new Vector2D(20, 0); firstOld.ApplyMatrix(pos.ToMatrix2D()); // pos.Angular = .01f; secondNew.ApplyMatrix(pos.ToMatrix2D()); pos.Linear = new Vector2D(-20, 0); firstNew.ApplyMatrix(pos.ToMatrix2D()); //pos.Angular = .02f; secondOld.ApplyMatrix(pos.ToMatrix2D()); HorrableNarrowPhase phase = new HorrableNarrowPhase(); Matrix2D g = pos.ToMatrix2D(); Vector2D tt = new Vector2D(); Vector2D.Multiply(ref g.VertexMatrix, ref tt, out tt); CollisionInfo info = phase.TestCollision(1, firstOld, firstNew, secondOld, secondNew); nothering(info); nothering(tt);*/ Console.WriteLine("Finished"); Console.ReadLine(); }
private Circle(Circle copy) : base(copy) { this.position = copy.position; this.radius = copy.radius; }
Body AddCircle(float radius, int vertexCount, float mass, ALVector2D position) { count++; Shape circleShape = new Physics2DDotNet.Circle(radius, vertexCount); ; Body e = new Body( new PhysicsState(position), circleShape, mass, new Coefficients(.2f, .2f, friction), new Lifespan()); AddGlObject(e); engine.AddBody(e); return e; }