2013-07-22 120 views
1

我正在使用腳本來創建形狀,通常您可以使用圖像映射來繪製座標,但此腳本使用的是圓半徑中的座標。使用圓形半徑查找座標以創建形狀

是否有陰謀的工具從圓半徑座標或情節的更好的方式協調例如:

這是一個多邊形/星形其很難得到形狀對稱。 我將作出其他形狀,這將是更加複雜的

circles.push(new Circle(width/2 - 70, height/2 - 120, circleRadius)); 
circles.push(new Circle(width/2 - 0, height/2 - 250, circleRadius)); 
circles.push(new Circle(width/2 + 70, height/2 - 120, circleRadius)); 
circles.push(new Circle(width/2 + 220, height/2 - 120, circleRadius)); 
circles.push(new Circle(width/2 + 120, height/2 - 0, circleRadius)); 
circles.push(new Circle(width/2 + 180, height/2 + 180, circleRadius)); 
circles.push(new Circle(width/2 - 0, height/2 + 120, circleRadius)); 
circles.push(new Circle(width/2 - 180, height/2 + 180, circleRadius)); 
circles.push(new Circle(width/2 - 120, height/2 - 0, circleRadius)); 
circles.push(new Circle(width/2 - 220, height/2 - 120, circleRadius)); 

回答

1

你爲什麼不嘗試使用的背景圖片,你需要相同的形狀,這將有助於你得到的形狀完全按照自己的需要。

對於你說的多邊形嘗試使用這些座標應該給你一個更好的形狀。

circles.push(new Circle(width/2 - 60, height/2 - 60, circleRadius)); 
circles.push(new Circle(width/2 - 0, height/2 - 250, circleRadius)); 
circles.push(new Circle(width/2 + 60, height/2 - 60, circleRadius)); 
circles.push(new Circle(width/2 + 260, height/2 - 60, circleRadius)); 
circles.push(new Circle(width/2 + 100, height/2 + 60, circleRadius)); 
circles.push(new Circle(width/2 + 160, height/2 + 250, circleRadius)); 
circles.push(new Circle(width/2 - 0, height/2 + 130, circleRadius)); 
circles.push(new Circle(width/2 - 160, height/2 + 250, circleRadius)); 
circles.push(new Circle(width/2 - 100, height/2 + 60, circleRadius)); 
circles.push(new Circle(width/2 - 260, height/2 - 60, circleRadius));