D
D
Dmitry Boytsov2016-02-02 13:23:29
Mathematics
Dmitry Boytsov, 2016-02-02 13:23:29

How to calculate the length of the sides of a figure?

An algorithm for calculating the length of a side of a figure is required if known.
1. Segments (sides) create a closed figure.
2. All lines are straight.
3. Segments intersect only at the ends.
4. The end of the segment is the beginning of the next one.
5. X and Y are known for each beginning and end of the segment.
6. Known area in M2.
Find the length of each side in meters.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mercury13, 2016-02-02
@SlotDB

To go from pixels to meters, you need to calculate the area of ​​​​the figure in square pixels. The easiest way to do this is using the trapezoid formula.
For each side, you need to calculate the area of ​​​​the trapezoid OX - x \u003d x A - AB - x \u003d x B , with plus or minus. As far as I remember, it is equal to 0.5(y A + y B )·(x A − x B ). If you add everything up and take the absolute value, you get the area.
Then the scale factor will be sqrt(S px / S m ).

A
Anton Fedoryan, 2016-02-02
@AnnTHony

Pythagorean theorem?
I'll add it for clarity.

G
GavriKos, 2016-02-02
@GavriKos

If the coordinates of the beginning and end of each side are known (point 5), then what prevents you from simply calculating the length of the segment?

A
Alexander Polyakov, 2016-02-02
@MakedonskyLF

If I understand correctly, then the main problem is to move from conventional units (in which X and Y) to meters.
Then we only have area to determine the transition factor. It remains to calculate the area in conventional units. There is not enough information for a beautiful algorithm. The easiest way is to break the figure into triangles and calculate their areas using Heron's formula. It remains to think a little about how to do it correctly if the figure is not convex.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question