public void ApplyStamp(MarchingSquaresGrid marchingGrid, OreGrid oreGrid) { TransformToRect(); // Vector2 position2d = new Vector2 (this.transform.position.x, this.transform.position.y); // QuadToHulls quad = new QuadToHulls(position2d, 0f, 20f, 20f); QuadToHulls quad = new QuadToHulls(position, angle, width, height); new OreStampTools(oreGrid).StampOreConvexHullFromWorld(quad.GetUpperHull(), quad.GetLowerHull(), oreType); Destroy(this.gameObject); }
//Test function. Construct a simple upper and lower hull. Call DigConvexHull. public void DigTestConvexHull(bool isSolid) { List <Vector2> topHull = new List <Vector2> (); List <Vector2> botHull = new List <Vector2> (); /* // new MarchingSquaresCutTools(nodeArray).DigConvexHull (topHull, botHull, isSolid); * for (int i = 0; i < 170; i += 10) { * QuadToHulls quadHulls = new QuadToHulls (new Vector2 (-20.01f + i*3, 100.5f), 0, 10f, 20f); * new MarchingSquaresCutTools (nodeArray).DigConvexHull (quadHulls.GetUpperHull (), quadHulls.GetLowerHull (), isSolid); * }*/ for (int i = 0; i < 170; i += 10) { QuadToHulls quadHulls = new QuadToHulls(new Vector2(-99.01f + i * 3, 50.5f), i * 3, 10f, 20f); new MarchingSquaresCutTools(this).DigConvexHullFromLocal(quadHulls.GetUpperHull(), quadHulls.GetLowerHull(), isSolid); } }