Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找计算多边形上每个点的 X 和 Y 点,给定边数,并且所有边都相等。我也会有整个形状的宽度和高度限制。如果有帮助,我会在 Java 中执行此操作(很可能使用 Line2D)。
您应该首先通过宽度和高度约束找出圆心(cx,cy)和半径R,这是微不足道的。每个多边形点均等地分布在圆上,它们的位置可以通过以下方式计算:
Xi = cx + R*cos(2.0*PI*i/n) Yi = cy + R*sin(2.0*PI*i/n)