Author Topic: algorithm for drawing an irregular polygon  (Read 764 times)

0 Members and 1 Guest are viewing this topic.

domenicomaria

  • Bull Frog
  • Posts: 389
algorithm for drawing an irregular polygon
« on: February 13, 2022, 02:14:24 AM »
Hello everyone.
I write a few times, but I always read.
And it is always interesting to see
the interventions of the various gurus.
And it is always an opportunity to learn something.

is there anyone who can show me
the link to an algorithm for drawing an irregular polygon?

In other words, I have a polygon of which I know some measures.
The measures are sufficient or overabundant.

I want to write a LISP which helps me to draw the polygon
and which calculates an error compensation.

That is, I want it to return me a polygon with an average error.

In other words, I know the length of all the red segments and all the green segments.

And I want to draw the red polygon, with the least possible error.


domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #1 on: February 13, 2022, 04:47:56 AM »
I am aware that what I am asking is complex.

First of all you have to find all the triangles,
which are inside the polygon,
that is, that do not intersect the edges of the polygon,

then you have to make sure that the points of each triangle
are arranged counterclockwise (for example),

then you have to eliminate the triangles of which all three measures are not known,

then you have to calculate them one by one,

and decide on a criterion to position them with respect to the others already calculated,

and then it is necessary to decide on a method
to calculate the "average" position of each point,

because it is assumed that the measures are not perfectly exact,
as they derive from an architectural survey . . .

. . . the polygon is a room with a complex shape. . .

(and this is very common in the ancient architecture of my city)

https://www.matera.cloud/it/index.asp?nav=matera





VovKa

  • Swamp Rat
  • Posts: 1468
  • Ukraine

domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #3 on: February 13, 2022, 05:14:10 AM »
"The name is derived from trilateration,
the geometrical problem of determining an unknown position on a plane
based on the distance to other two known vertices of a triangle (the length of two sides)."

I had already solved this problem (which is simple)

the link you sent me is interesting, but it is much more than what I need.

However I will try to read it to find some useful information for the question I have posed.

Ciao

VovKa

  • Swamp Rat
  • Posts: 1468
  • Ukraine
Re: algorithm for drawing an irregular polygon
« Reply #4 on: February 13, 2022, 10:19:30 AM »
i'm sure you are searching for the ways to adjust the trilateral network

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: algorithm for drawing an irregular polygon
« Reply #5 on: February 15, 2022, 02:53:01 AM »

In other words, I know the length of all the red segments and all the green segments.

And I want to draw the red polygon, with the least possible error.

I don't understand the assignment. Write an example for the specified figure, I'm interested in the structure of the source data. Structure = how you connect this data with each other. Is there an indication of which dimensions refer to one triangle or to adjacent triangles?

d2010

  • Bull Frog
  • Posts: 283
Re: algorithm for drawing an irregular polygon
« Reply #6 on: February 15, 2022, 03:15:22 AM »
I don't understand the assignment. Write an example for the specified figure, I'm interested in the structure of the source data. Structure = how you connect this data with each other. Is there an indication of which dimensions refer to one triangle or to adjacent triangles?

Please develop this tool, only, but only for market-solution, or business
needs,with using the freelancer.com or any outsourcing.site.
 :police:
, because, sharing full-ascii-lisp.txt, otherwise you kill the autodesk.store.com. and solidwork/selling/Team.
Code - Auto/Visual Lisp: [Select]
  1.  
  2. (Defun rod_epscolor(j_newarray kKeyColorList tzxelse / $rr loopede pde nop cld cec sbb)
  3.    (setq
  4.  $rr tzxelse) (princ j_newarray) (princ " ") (princ kKeyColorList) (jc_aro10 (list "C024terpri"  )) (setq
  5.  cec (jc_aro10 (list "C025getint"  "="))
  6.  sbb (if (jc_aro10 (list "C026ssget"  "X" (list (jc_aro10 (list "C027cons"  62 tzxelse)) (jc_aro10 (list "C028cons"  67 0))))) nil)
  7.  loopde (if(and  sbb (>   (jc_aro10 (list "C029sslength"  sbb)) 0)) (jc_aro10 (list "C030dfn_ssg_tolistvla"  sbb)))) (if loopde (progn  (setq
  8.  nop (foreach pde (jc_aro10 (list "C031vla-put-color"  pde cec)))
  9.  nop (jc_aro10 (list "C032vla-regen"  con_acdoc acAllViewports))
  10.  $rr cec)))
  11. $rr)
  12.  
« Last Edit: February 15, 2022, 03:23:29 AM by d2010 »

domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #7 on: February 15, 2022, 06:01:26 AM »
I don't understand the assignment. Write an example for the specified figure, I'm interested in the structure of the source data. Structure = how you connect this data with each other. Is there an indication of which dimensions refer to one triangle or to adjacent triangles?

perhaps it is simpler if I explain the practical problem -
I have made a survey of a house .
"survey " means that I have made a SKETCH
and I have measured the sides and diagonals of each room.
This is because there are some rooms that have an irregular shape.

I need to draw the room.
. . .
Given two points A and B,
we need to determine the position of point C,
knowing the distances of C, from A and B.
This is the basic problem. Which is very simple.

The problem is to determine the complete shape of the polygon,
taking into account the available measures.

The measures can be insufficient, sufficient or overabundant.
The solution does not exist for an insufficient number of measures.

While, since the measures detected, NOT PERFECTLY EXACT,
it is necessary to calculate as many times as the whole figure,
how many overabundant measures are there.
(but I think several times,
because each superabundant measure generates
a new series of combinations of known measures)

And a criterion must be found to calculate an average of the results.

For example, the same point C, calculating it using different or partially different data,
could result in a different position for each calculation.
And these results must be managed in order to find a "MIDDLE POSITION" of the point.

It is an ARCHITECTURAL SURVEY problem of ROOMS that have a shape
consisting of an irregular polygon whose sides (but not always all) and diagonals (some or all) are known.

It is not easy to explain it well.

In Italy, there is a software called ARTEN DIGIPLAN
http://www.artensrl.com/shop/it/software-arten/4-arten-digiplan.html
which solves this problem.

And certainly there are many others.

But it is complex.

I hope I managed to make myself understood a little better

I think we need to:

- define all possible triangles using known measurements.

- Calculate all these triangles

- Find a way to place them and connecting them each other

- Identify a criterion and a method to calculate the "average" position
of the vertices calculated many times

- and then connect all the external vertices, in order to obtain the final shape.

. . .
Be aware that the image I posted is a sketch and not a definite drawing.

so the stages are:
- make a sketch
- take all possible measures
- calculate and draw the final shape
« Last Edit: February 15, 2022, 06:06:42 AM by domenicomaria »

domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #8 on: February 15, 2022, 06:10:00 AM »
(Defun rod_epscolor(j_newarray kKeyColorList tzxelse / $rr loopede pde nop cld cec sbb)
   (setq
 $rr tzxelse) (princ j_newarray) (princ " ") (princ kKeyColorList) (jc_aro10 (list "C024terpri"  )) (setq
 cec (jc_aro10 (list "C025getint"  "="))
 sbb (if (jc_aro10 (list "C026ssget"  "X" (list (jc_aro10 (list "C027cons"  62 tzxelse)) (jc_aro10 (list "C028cons"  67 0))))) nil)
 loopde (if(and  sbb (>   (jc_aro10 (list "C029sslength"  sbb)) 0)) (jc_aro10 (list "C030dfn_ssg_tolistvla"  sbb)))) (if loopde (progn  (setq
 nop (foreach pde (jc_aro10 (list "C031vla-put-color"  pde cec)))
 nop (jc_aro10 (list "C032vla-regen"  con_acdoc acAllViewports))
 $rr cec)))
$rr)
:?  :?  :?

domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #9 on: February 15, 2022, 06:51:02 AM »
Code - Auto/Visual Lisp: [Select]
  1. ;   for example, we have a closed polygon of 7 vertices indicated by a letter
  2.  
  3. (setq vertex-list '("A" "B" "C" "D" "E" "F" "G") )
  4.  
  5. (setq   all-sides-list       '(   ("A" "B")   ("B" "C")   ("C" "D")   ("D" "E")   ("E" "F")   ("F" "G")   ("G" "A") ) )
  6.  
  7. (setq   all-diagonals-list   '(   ("A" "C")   ("A" "D")   ("A" "E")   ("A" "F") ;   ("A" "G")
  8.                                               ("B" "D")   ("B" "E")   ("B" "F")   ("B" "G")
  9.                                                           ("C" "E")   ("C" "F")   ("C" "G")
  10.                                                                       ("D" "F")   ("D" "G")
  11.                                                                                   ("E" "G")
  12.                            )
  13. )
  14.  
  15. (setq   all-triangle-list
  16.             '(   ("A" "B" "C")   ("A" "B" "D")   ("A" "C" "D")   ("A" "B" "E")   ("A" "C" "E")
  17.                  ("B" "C" "E")   ("A" "D" "E")   ("B" "D" "E")   ("C" "D" "E")   ("A" "B" "F")
  18.                  ("A" "C" "F")   ("B" "C" "F")   ("A" "D" "F")   ("B" "D" "F")   ("C" "D" "F")
  19.                  ("A" "E" "F")   ("B" "E" "F")   ("C" "E" "F")   ("D" "E" "F")   ("A" "B" "G")
  20.                  ("A" "C" "G")   ("B" "C" "G")   ("A" "D" "G")   ("B" "D" "G")   ("C" "D" "G")
  21.                  ("A" "E" "G")   ("B" "E" "G")   ("C" "E" "G")   ("D" "E" "G")   ("A" "F" "G")
  22.                  ("B" "F" "G")   ("C" "F" "G")   ("D" "F" "G")   ("E" "F" "G")
  23.             )
  24. )
  25.  
  26. ;   to begin with, we need to calculate all these triangles  
  27.  
« Last Edit: February 15, 2022, 06:56:26 AM by domenicomaria »

domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #10 on: February 15, 2022, 06:52:59 AM »
the picture looks better !
. . .
we must first identify all the triangles whose measures are known
and then calculate them ...
...
but this is only the first step ...
« Last Edit: February 15, 2022, 07:08:08 AM by domenicomaria »

domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #11 on: February 15, 2022, 08:14:51 AM »
this is the sketch with the measurements
where the sizes of sides and diagonals do NOT correspond to the drawing.
« Last Edit: February 15, 2022, 08:26:12 AM by domenicomaria »

domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #12 on: February 15, 2022, 08:15:12 AM »
and this is the SOLUTION
where the sizes of sides and diagonals correspond to the drawing.
« Last Edit: February 15, 2022, 08:24:28 AM by domenicomaria »

domenicomaria

  • Bull Frog
  • Posts: 389
Re: algorithm for drawing an irregular polygon
« Reply #13 on: February 15, 2022, 08:40:31 AM »
I am attaching the dwg file

ribarm

  • Gator
  • Posts: 2747
  • Marko Ribar, architect
Re: algorithm for drawing an irregular polygon
« Reply #14 on: June 27, 2022, 11:33:43 PM »
What is trilateration?
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube