public Point2D OnDivide() { if (MiddlePoint == null) { MiddlePoint = new Point2D(Middle, string.Format("[{0}+{1}]", Points[0].Name, Points[1].Name)); MiddlePoint.AddRigidbody(); } DivisionCount++; return(MiddlePoint); }
public void OnDivide() { if (Scale < 0.5f) { return; } if (!IsLowest) { throw new System.Exception("This face has divided!"); } CenterPoint = new Point2D(Center, "Center"); CenterPoint.AddRigidbody(); List <Point2D> division = DivideBasicEdges(); /*Face2D f0 = Shape.AddPoints(division[0], division[1], division[2], division[3], CenterPoint, division[11]); * Face2D f1 = Shape.AddPoints(CenterPoint, division[3], division[4], division[5], division[6], division[7]); * Face2D f2 = Shape.AddPoints(division[10], division[11], CenterPoint, division[7], division[8], division[9]);*/ /*Face2D f0 = Shape.AddPoints(division[11], division[0], division[1], division[2], division[3], CenterPoint); * Face2D f1 = Shape.AddPoints(division[3], division[4], division[5], division[6], division[7], CenterPoint); * Face2D f2 = Shape.AddPoints( division[7], division[8], division[9], division[10], division[11], CenterPoint);*/ Face2D f0 = Shape.AddPoints(division[1], division[2], division[3], division[4], division[5], CenterPoint); Face2D f1 = Shape.AddPoints(division[5], division[6], division[7], division[8], division[9], CenterPoint); Face2D f2 = Shape.AddPoints(division[9], division[10], division[11], division[0], division[1], CenterPoint); f0.Name = Name + "-0"; f1.Name = Name + "-1"; f2.Name = Name + "-2"; Shape.RemoveFace(this); DivideTo(f0, f1, f2); }