我想創建一個Rectangle
,它的一面與另一面不同。如何計算一個點的矩形座標及其與四個邊緣的距離
(所有的線描繪的意思是直線)
正常的矩形狀new Rectangle(50 /*LocationX*/, 50 */LocationY*/, 50 /*SizeX*/, 100 /*SizeY*/);
產生的,看起來是這樣的:
不過,我要像new Rectangle(50 /*LocationX*/, 50 */LocationY*/, 25 /*25 from the centre point for the red line*/, 30 /*30 from the centre point for the blue line*/, 50 /*50 from centre for green line*/, 100 /*100 from centre for yellow line*/);
構造換句話說,我實際上希望保持形狀相同,但移動中心點。
我該怎麼做?
所以,你只是想通過定義一個點的水平邊緣距離和同一點的垂直邊緣距離來定義一個矩形? – caveman 2015-04-03 16:05:53