private Vector2 getLeast(Block block, float deg) { Vector2 least = new Vector2(); bool calculated = false; foreach (Vector2 col in block.getCollision()) { Vector2 temp = VectorCalculation.rotateVector(col, deg); if (!calculated) { least = temp; calculated = true; } if (temp.x < least.x) { least.x = temp.x; } if (temp.y < least.y) { least.y = temp.y; } } least.x = Mathf.Abs(least.x); least.y = Mathf.Abs(least.y); return(least); }
public Vector2 getWidthHeight(float deg) { if (deg == cachedDeg) { return((Vector2)cachedWidthHight); } cachedDeg = deg; float width = 0; float height = 0; foreach (Vector2 collision in getCollision()) { Vector2 temp = VectorCalculation.rotateVector(collision, deg); width = Mathf.Max(width, Mathf.Abs(temp.x)); height = Mathf.Max(height, Mathf.Abs(temp.y)); } cachedWidthHight = new Vector2((width + 1), ((height + 1))); return((Vector2)cachedWidthHight); }
private Vector2 getGridPoint(Vector2 col, Vector2 start, Vector2 least, float deg) { Vector2 temp = start + VectorCalculation.rotateVector(col, deg) + least; return(VectorCalculation.revertToOrigin(temp, this)); }