JAVA draw regular polygon
问题 I am looking for an algorithm to draw regular polygon like triangle, quadrangle, pentagon, hexagon etc. I guess it`s basically dealing with the fact that all polygon points are located on the line of the circle. What`s the algorithm to calculate those N points for Polygon object? After drawing a regular polygon I need to draw another regular polygon based on the first one but rotated by K degrees. 回答1: Use sin and cos: double theta = 2 * Math.PI / sides; for (int i = 0; i < sides; ++i) {