public ScenePainter(DynamicCase scene) { Scene = scene; Pen spherePen = new Pen(Brushes.DarkGray, 2); Pen selectedSpherePen = new Pen(Brushes.Black, 2); foreach (Sphere3d @object in scene.Spheres) { PaintableSphere3d paintableSphere = new PaintableSphere3d(@object, spherePen); Objects.Add(paintableSphere); } Objects.Add(new CollisionPainter(scene.Spheres)); PaintableSphere3d selectedSphere = null; OnKeyDown = (KeyEventArgs keys) => { }; Vector3d mousePosition = new Vector3d(); OnMouseMove = (MouseEventArgs e) => { return(false); }; }
private void CalculateCollision() { for (int i = 0; i < Objects.Count - 1; i++) { for (int j = i + 1; j < Objects.Count; j++) { collisions[i, j] = DynamicCase.CalculateCollision(Objects[i], Objects[j]); } } }
private void CalculateCollision(int sphereIndex) { for (int i = 0; i < Objects.Count - 1; i++) { if (i != sphereIndex) { int a = Math.Min(i, sphereIndex); int b = Math.Max(i, sphereIndex); collisions[a, b] = DynamicCase.CalculateCollision(Objects[a], Objects[b]); } } }