1
我有一個問題,這讓我瘋狂! :)我一直在日夜工作:) :)處理3 - PVector路徑偏移//向內/向外多邊形偏移
我的目標是什麼? I'm looking for a way for inward/outward polygon offsetting
在外面說2。 2裏面。使用Illustrator很容易:)
我的方法工作至今順時針
- 。獲取P1 P2 &
- 使用三角之間的角度來計算X & Y軸偏移
- 添加X & Y軸偏移到P1 P2 &。這是我如何獲得P1和P2之間的角度:
float getAngle = (atan((P1.y-P2.y)/(P1.x-p2.x))) * (180/PI) ;
2.
// (COS(angle) = (adjacent side)/(hypotenuse)) || 2 = 6/3
// (COS(angle) * (hypotenuse) = (adjacent side) || 2 * 3 = 6
// (SIN(angle) = (opposite side)/(hypotenuse)) || 2 = 6/3
// (SIN(angle) * (hypotenuse) = (opposite side) || 2 * 3 = 6
我的問題
- 我知道如何偏移路徑。但只限於一面。始終+ x和-Y。 So this is the result. Almost like just moving the path entirely. Instead of offsetting all around.它需要停留在中心/原始線之外。
我想從你那裏得到什麼?
- 是否有邏輯/公式來做到這一點?
- 還是有一個圖書館,已經有這??
我只是不能圍繞我如何保持第一/中心線外的線偏移。
cr * p,非常抱歉的延誤。我不知道怎麼收到通知.. 不過謝謝!我要去看看它。看起來很有希望! – Tim