【发布时间】:2020-06-17 22:34:14
【问题描述】:
我想不出办法来做到这一点。我有一个 vector2 点列表,我需要该多边形内的所有点,距离为x。
所以我有一个 Green 点的 List 并寻找与各个绿点有 x 距离的 Red 点的 List。
我正在考虑获得 2 个虚点,1 个对上一点和下一点的统一。
然后向这两个点的中心移动x 距离。但是如果内角不是 90 度,它就会移到多边形之外。
Vector2 me = point; // point
Vector2 next = n_point; // on left
Vector2 previous = p_point; // on right
//Debug.DrawLine(me, (me - next), Color.green);
// 2 points ep1 & ep2
Vector2 center = Vector2.Lerp(ep1,ep2, 0.5f);
Vector2 finalpoint = Vector2.Lerp(me,center,0.1f); //move towards center
我想我想多了。有没有一种超级简单的方法来做到这一点?
【问题讨论】:
-
见en.wikipedia.org/wiki/Parallel_curve。它是一个多边形使它更容易,但不是“超级简单”
-
画一个圆,圆心为红点,半径为距离。然后在圆圈内找到绿色点。九十度不重要。 d= sqrt(x2 + y2).
-
点的顺序是顺时针还是逆时针?