Respuesta :

AL2006

From the way you worded the question, it sounds like you have
the (x, y) coordinates of each corner of the rectangle.

The perimeter of any shape is the distance all the way around it,
or the sum of the lengths of all the sides.

So you have to take the coordinates of the four corners of the
rectangle, and find the length of each side ... that's the distance
between each pair of corner-points.  Then addum up to get the
perimeter.

I know finding the distance between two points is a pain, so I'll
tell you a way to make it a bit simpler:  You don't actually need to
do it 4 times.  You can get away with doing it only 2 times, and
you'll have enough information to find the perimeter.

Take the coordinates at the ends of any side of the rectangle.
Find the distance between them.  The side opposite that one
has the same length.

Then take the coordinates of either side that hooks onto the
side you just did.  One end of it will have the same coordinates
that you just worked with.  Find the distance between the two ends.
You know that this distance is the other dimension of the rectangle,
and you also know that the side opposite it has the same length.

So now, you found the distance between two pairs of points,
and you know both dimensions of the rectangle, and you know
the length of all four sides.

Now you can wrap it up !