Algorithm to construct irregular polygon












1














I have number of line segments (they represent walls in floor scheme) each accompanied with length and adjacent angle. What sequence of steps should my algorithm perform in order to obtain set of vertices for irregular polygon which will correspond to given side lengths and angles?










share|cite|improve this question
























  • Might you include a picture showing what the adjacent angles are in terms of the sides entering and leaving a vertex? It seems to me that once you know one vertex, you can find the remaining vertices one by one. For convenient, maybe set the first vertex to be $(0,0)$.
    – D.B.
    Jan 1 at 21:59












  • Basically i know all internal angles for every corner i just need to turn this thing from plan with lengths and angles in degrees into polygon for further usage without use of image processing i search here and googled on github and npm but found nothing
    – Anatoly Strashkevich
    Jan 1 at 22:06










  • I recommend coordinatizing the plane of the floor, and, starting with one corner, using the trigonometry of right triangles to get the coordinates of each corner in turn. You might consider this simple-minded, but it is an algorithm, and it will work.
    – Lubin
    Jan 2 at 1:21


















1














I have number of line segments (they represent walls in floor scheme) each accompanied with length and adjacent angle. What sequence of steps should my algorithm perform in order to obtain set of vertices for irregular polygon which will correspond to given side lengths and angles?










share|cite|improve this question
























  • Might you include a picture showing what the adjacent angles are in terms of the sides entering and leaving a vertex? It seems to me that once you know one vertex, you can find the remaining vertices one by one. For convenient, maybe set the first vertex to be $(0,0)$.
    – D.B.
    Jan 1 at 21:59












  • Basically i know all internal angles for every corner i just need to turn this thing from plan with lengths and angles in degrees into polygon for further usage without use of image processing i search here and googled on github and npm but found nothing
    – Anatoly Strashkevich
    Jan 1 at 22:06










  • I recommend coordinatizing the plane of the floor, and, starting with one corner, using the trigonometry of right triangles to get the coordinates of each corner in turn. You might consider this simple-minded, but it is an algorithm, and it will work.
    – Lubin
    Jan 2 at 1:21
















1












1








1







I have number of line segments (they represent walls in floor scheme) each accompanied with length and adjacent angle. What sequence of steps should my algorithm perform in order to obtain set of vertices for irregular polygon which will correspond to given side lengths and angles?










share|cite|improve this question















I have number of line segments (they represent walls in floor scheme) each accompanied with length and adjacent angle. What sequence of steps should my algorithm perform in order to obtain set of vertices for irregular polygon which will correspond to given side lengths and angles?







geometry algorithms polygons






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 1 at 22:19









David G. Stork

9,87021232




9,87021232










asked Jan 1 at 21:53









Anatoly Strashkevich

184411




184411












  • Might you include a picture showing what the adjacent angles are in terms of the sides entering and leaving a vertex? It seems to me that once you know one vertex, you can find the remaining vertices one by one. For convenient, maybe set the first vertex to be $(0,0)$.
    – D.B.
    Jan 1 at 21:59












  • Basically i know all internal angles for every corner i just need to turn this thing from plan with lengths and angles in degrees into polygon for further usage without use of image processing i search here and googled on github and npm but found nothing
    – Anatoly Strashkevich
    Jan 1 at 22:06










  • I recommend coordinatizing the plane of the floor, and, starting with one corner, using the trigonometry of right triangles to get the coordinates of each corner in turn. You might consider this simple-minded, but it is an algorithm, and it will work.
    – Lubin
    Jan 2 at 1:21




















  • Might you include a picture showing what the adjacent angles are in terms of the sides entering and leaving a vertex? It seems to me that once you know one vertex, you can find the remaining vertices one by one. For convenient, maybe set the first vertex to be $(0,0)$.
    – D.B.
    Jan 1 at 21:59












  • Basically i know all internal angles for every corner i just need to turn this thing from plan with lengths and angles in degrees into polygon for further usage without use of image processing i search here and googled on github and npm but found nothing
    – Anatoly Strashkevich
    Jan 1 at 22:06










  • I recommend coordinatizing the plane of the floor, and, starting with one corner, using the trigonometry of right triangles to get the coordinates of each corner in turn. You might consider this simple-minded, but it is an algorithm, and it will work.
    – Lubin
    Jan 2 at 1:21


















Might you include a picture showing what the adjacent angles are in terms of the sides entering and leaving a vertex? It seems to me that once you know one vertex, you can find the remaining vertices one by one. For convenient, maybe set the first vertex to be $(0,0)$.
– D.B.
Jan 1 at 21:59






Might you include a picture showing what the adjacent angles are in terms of the sides entering and leaving a vertex? It seems to me that once you know one vertex, you can find the remaining vertices one by one. For convenient, maybe set the first vertex to be $(0,0)$.
– D.B.
Jan 1 at 21:59














Basically i know all internal angles for every corner i just need to turn this thing from plan with lengths and angles in degrees into polygon for further usage without use of image processing i search here and googled on github and npm but found nothing
– Anatoly Strashkevich
Jan 1 at 22:06




Basically i know all internal angles for every corner i just need to turn this thing from plan with lengths and angles in degrees into polygon for further usage without use of image processing i search here and googled on github and npm but found nothing
– Anatoly Strashkevich
Jan 1 at 22:06












I recommend coordinatizing the plane of the floor, and, starting with one corner, using the trigonometry of right triangles to get the coordinates of each corner in turn. You might consider this simple-minded, but it is an algorithm, and it will work.
– Lubin
Jan 2 at 1:21






I recommend coordinatizing the plane of the floor, and, starting with one corner, using the trigonometry of right triangles to get the coordinates of each corner in turn. You might consider this simple-minded, but it is an algorithm, and it will work.
– Lubin
Jan 2 at 1:21












1 Answer
1






active

oldest

votes


















1














enter image description here



Suppose that the floor plan of your room is a polygon with $n$ sides and vertices $A_1,A_2,dots A_{n}$. The length of segments are:



$$l_1=overline{A_1A_2}, l_2=overline{A_2A_3}, dots l_i=overline{A_iA_{i+1}}, dots l_{n-1}=overline{A_{n-1}A_{n}}, l_n=overline{A_nA_{1}}$$



These lengths are given as well as internal angles of the polygon. Denote angle at point $A_i$ with $alpha_i$. Basically, on input you have a set of values $l_i,alpha_i$ for $i=1,2,dots n$. Your task is to compute coordinates of all vertices.



Suppose that you have already caclulated coordinates $A_i(x_i,y_i)$ and angle $beta_{i-1}$ between segment $A_{i-1}A_i$ and $x$-axis.



Coordinates of point $A_{i+1}$ are given with the following expressions:



$$beta_i=beta_{i-1}+pi-alpha_itag{1}$$



$$x_{i+1}=x_i+l_icosbeta_{i}tag{2}$$



$$y_{i+1}=y_i+l_isinbeta_{i}tag{3}$$



You need a starting point. You are free to choose $A_1$ to be the orgin of your coordinate system:



$$x_1=y_1=0 tag{4}$$



You can orient your $x$-axis along the segment $A_1A_2$ which means that:



$$x_2=l_1, y_2=0, beta_1=0tag{5}$$



With initial conditions set as in (4) and (5) you just need to repeat steps (1), (2) and (3) exactly $n-2$ times to calculate coordinates of the remaining $n-2$ polygon vertices:



$$beta_2=beta_1+pi-alpha_2$$



$$x_3=x_2+l_2cosbeta_{2}$$



$$y_3=y_2+l_2sinbeta_2$$



$$beta_3=beta_2+pi-alpha_3$$



$$x_4=x_3+l_3cosbeta_3$$



$$y_4=y_3+l_3sinbeta_3$$



$$dots$$






share|cite|improve this answer





















  • thank you for detailed explanation
    – Anatoly Strashkevich
    yesterday











Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3058912%2falgorithm-to-construct-irregular-polygon%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














enter image description here



Suppose that the floor plan of your room is a polygon with $n$ sides and vertices $A_1,A_2,dots A_{n}$. The length of segments are:



$$l_1=overline{A_1A_2}, l_2=overline{A_2A_3}, dots l_i=overline{A_iA_{i+1}}, dots l_{n-1}=overline{A_{n-1}A_{n}}, l_n=overline{A_nA_{1}}$$



These lengths are given as well as internal angles of the polygon. Denote angle at point $A_i$ with $alpha_i$. Basically, on input you have a set of values $l_i,alpha_i$ for $i=1,2,dots n$. Your task is to compute coordinates of all vertices.



Suppose that you have already caclulated coordinates $A_i(x_i,y_i)$ and angle $beta_{i-1}$ between segment $A_{i-1}A_i$ and $x$-axis.



Coordinates of point $A_{i+1}$ are given with the following expressions:



$$beta_i=beta_{i-1}+pi-alpha_itag{1}$$



$$x_{i+1}=x_i+l_icosbeta_{i}tag{2}$$



$$y_{i+1}=y_i+l_isinbeta_{i}tag{3}$$



You need a starting point. You are free to choose $A_1$ to be the orgin of your coordinate system:



$$x_1=y_1=0 tag{4}$$



You can orient your $x$-axis along the segment $A_1A_2$ which means that:



$$x_2=l_1, y_2=0, beta_1=0tag{5}$$



With initial conditions set as in (4) and (5) you just need to repeat steps (1), (2) and (3) exactly $n-2$ times to calculate coordinates of the remaining $n-2$ polygon vertices:



$$beta_2=beta_1+pi-alpha_2$$



$$x_3=x_2+l_2cosbeta_{2}$$



$$y_3=y_2+l_2sinbeta_2$$



$$beta_3=beta_2+pi-alpha_3$$



$$x_4=x_3+l_3cosbeta_3$$



$$y_4=y_3+l_3sinbeta_3$$



$$dots$$






share|cite|improve this answer





















  • thank you for detailed explanation
    – Anatoly Strashkevich
    yesterday
















1














enter image description here



Suppose that the floor plan of your room is a polygon with $n$ sides and vertices $A_1,A_2,dots A_{n}$. The length of segments are:



$$l_1=overline{A_1A_2}, l_2=overline{A_2A_3}, dots l_i=overline{A_iA_{i+1}}, dots l_{n-1}=overline{A_{n-1}A_{n}}, l_n=overline{A_nA_{1}}$$



These lengths are given as well as internal angles of the polygon. Denote angle at point $A_i$ with $alpha_i$. Basically, on input you have a set of values $l_i,alpha_i$ for $i=1,2,dots n$. Your task is to compute coordinates of all vertices.



Suppose that you have already caclulated coordinates $A_i(x_i,y_i)$ and angle $beta_{i-1}$ between segment $A_{i-1}A_i$ and $x$-axis.



Coordinates of point $A_{i+1}$ are given with the following expressions:



$$beta_i=beta_{i-1}+pi-alpha_itag{1}$$



$$x_{i+1}=x_i+l_icosbeta_{i}tag{2}$$



$$y_{i+1}=y_i+l_isinbeta_{i}tag{3}$$



You need a starting point. You are free to choose $A_1$ to be the orgin of your coordinate system:



$$x_1=y_1=0 tag{4}$$



You can orient your $x$-axis along the segment $A_1A_2$ which means that:



$$x_2=l_1, y_2=0, beta_1=0tag{5}$$



With initial conditions set as in (4) and (5) you just need to repeat steps (1), (2) and (3) exactly $n-2$ times to calculate coordinates of the remaining $n-2$ polygon vertices:



$$beta_2=beta_1+pi-alpha_2$$



$$x_3=x_2+l_2cosbeta_{2}$$



$$y_3=y_2+l_2sinbeta_2$$



$$beta_3=beta_2+pi-alpha_3$$



$$x_4=x_3+l_3cosbeta_3$$



$$y_4=y_3+l_3sinbeta_3$$



$$dots$$






share|cite|improve this answer





















  • thank you for detailed explanation
    – Anatoly Strashkevich
    yesterday














1












1








1






enter image description here



Suppose that the floor plan of your room is a polygon with $n$ sides and vertices $A_1,A_2,dots A_{n}$. The length of segments are:



$$l_1=overline{A_1A_2}, l_2=overline{A_2A_3}, dots l_i=overline{A_iA_{i+1}}, dots l_{n-1}=overline{A_{n-1}A_{n}}, l_n=overline{A_nA_{1}}$$



These lengths are given as well as internal angles of the polygon. Denote angle at point $A_i$ with $alpha_i$. Basically, on input you have a set of values $l_i,alpha_i$ for $i=1,2,dots n$. Your task is to compute coordinates of all vertices.



Suppose that you have already caclulated coordinates $A_i(x_i,y_i)$ and angle $beta_{i-1}$ between segment $A_{i-1}A_i$ and $x$-axis.



Coordinates of point $A_{i+1}$ are given with the following expressions:



$$beta_i=beta_{i-1}+pi-alpha_itag{1}$$



$$x_{i+1}=x_i+l_icosbeta_{i}tag{2}$$



$$y_{i+1}=y_i+l_isinbeta_{i}tag{3}$$



You need a starting point. You are free to choose $A_1$ to be the orgin of your coordinate system:



$$x_1=y_1=0 tag{4}$$



You can orient your $x$-axis along the segment $A_1A_2$ which means that:



$$x_2=l_1, y_2=0, beta_1=0tag{5}$$



With initial conditions set as in (4) and (5) you just need to repeat steps (1), (2) and (3) exactly $n-2$ times to calculate coordinates of the remaining $n-2$ polygon vertices:



$$beta_2=beta_1+pi-alpha_2$$



$$x_3=x_2+l_2cosbeta_{2}$$



$$y_3=y_2+l_2sinbeta_2$$



$$beta_3=beta_2+pi-alpha_3$$



$$x_4=x_3+l_3cosbeta_3$$



$$y_4=y_3+l_3sinbeta_3$$



$$dots$$






share|cite|improve this answer












enter image description here



Suppose that the floor plan of your room is a polygon with $n$ sides and vertices $A_1,A_2,dots A_{n}$. The length of segments are:



$$l_1=overline{A_1A_2}, l_2=overline{A_2A_3}, dots l_i=overline{A_iA_{i+1}}, dots l_{n-1}=overline{A_{n-1}A_{n}}, l_n=overline{A_nA_{1}}$$



These lengths are given as well as internal angles of the polygon. Denote angle at point $A_i$ with $alpha_i$. Basically, on input you have a set of values $l_i,alpha_i$ for $i=1,2,dots n$. Your task is to compute coordinates of all vertices.



Suppose that you have already caclulated coordinates $A_i(x_i,y_i)$ and angle $beta_{i-1}$ between segment $A_{i-1}A_i$ and $x$-axis.



Coordinates of point $A_{i+1}$ are given with the following expressions:



$$beta_i=beta_{i-1}+pi-alpha_itag{1}$$



$$x_{i+1}=x_i+l_icosbeta_{i}tag{2}$$



$$y_{i+1}=y_i+l_isinbeta_{i}tag{3}$$



You need a starting point. You are free to choose $A_1$ to be the orgin of your coordinate system:



$$x_1=y_1=0 tag{4}$$



You can orient your $x$-axis along the segment $A_1A_2$ which means that:



$$x_2=l_1, y_2=0, beta_1=0tag{5}$$



With initial conditions set as in (4) and (5) you just need to repeat steps (1), (2) and (3) exactly $n-2$ times to calculate coordinates of the remaining $n-2$ polygon vertices:



$$beta_2=beta_1+pi-alpha_2$$



$$x_3=x_2+l_2cosbeta_{2}$$



$$y_3=y_2+l_2sinbeta_2$$



$$beta_3=beta_2+pi-alpha_3$$



$$x_4=x_3+l_3cosbeta_3$$



$$y_4=y_3+l_3sinbeta_3$$



$$dots$$







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered yesterday









Oldboy

7,1191832




7,1191832












  • thank you for detailed explanation
    – Anatoly Strashkevich
    yesterday


















  • thank you for detailed explanation
    – Anatoly Strashkevich
    yesterday
















thank you for detailed explanation
– Anatoly Strashkevich
yesterday




thank you for detailed explanation
– Anatoly Strashkevich
yesterday


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3058912%2falgorithm-to-construct-irregular-polygon%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

An IMO inspired problem

Management

Has there ever been an instance of an active nuclear power plant within or near a war zone?