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