Getting perimeter coordinates of a polygon

Hi i need help on how to get the perimeter coordinates(on shape) and in shape coordinates of a polygon with 12 points of vertices, like a cross.

The shape of the polygon can be irregular but the points will not intersect.



The coordinates are input via user prompt and stored in 2 arrays
1
2
x[i];
y[i]; 
Last edited on
Consider the two points (x0, y0) and (x1, y1). To get the distance between them:
dist = pow(x1 - x0, 2) + pow(y1 - y0, 2).

@integralfx
That is not the formula for calculating the distance between two points.
dist = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
closed account (48T7M4Gy)
Two points j and k.
Distance between the two:

dx = x[j] - x[k]
dy = y[j] - y[k]

distance = sqrt(dx*dx + dy*dy)

Remember for a closed perimeter you need to add the last side going from the last point back to the first.
What do these mean: "perimeter coordinates" and "in shape coordinates"?
What does it mean that "points will not intersect"?
Topic archived. No new replies allowed.