Draw a multipolygon












2












$begingroup$


I need to build a shutter like this:



picture of a shutter



What is the formulas to draw each vertex?



Suppose I have num which is the number of triangles (in this case num=7) and the radius of the circle. How can I obtain the coordinates of each vertex of each triangle of the shutter?



I don't know how to obtain these coordinates.



Thank you very much










share|cite|improve this question











$endgroup$












  • $begingroup$
    Maybe you can start by considering the edges of the outer $n$-gon (7-gon, in the picture) and think about the coordinates of those edge points ...
    $endgroup$
    – Matti P.
    Jan 14 at 12:36










  • $begingroup$
    @MattiP. I need the coordinates of each triangle beacuse I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
    $endgroup$
    – user609071
    Jan 14 at 12:39












  • $begingroup$
    Once you know the coordinates of all vertices you can draw each triangle and also draw the entire shutter: there is no difference.
    $endgroup$
    – Aretino
    Jan 14 at 16:41
















2












$begingroup$


I need to build a shutter like this:



picture of a shutter



What is the formulas to draw each vertex?



Suppose I have num which is the number of triangles (in this case num=7) and the radius of the circle. How can I obtain the coordinates of each vertex of each triangle of the shutter?



I don't know how to obtain these coordinates.



Thank you very much










share|cite|improve this question











$endgroup$












  • $begingroup$
    Maybe you can start by considering the edges of the outer $n$-gon (7-gon, in the picture) and think about the coordinates of those edge points ...
    $endgroup$
    – Matti P.
    Jan 14 at 12:36










  • $begingroup$
    @MattiP. I need the coordinates of each triangle beacuse I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
    $endgroup$
    – user609071
    Jan 14 at 12:39












  • $begingroup$
    Once you know the coordinates of all vertices you can draw each triangle and also draw the entire shutter: there is no difference.
    $endgroup$
    – Aretino
    Jan 14 at 16:41














2












2








2





$begingroup$


I need to build a shutter like this:



picture of a shutter



What is the formulas to draw each vertex?



Suppose I have num which is the number of triangles (in this case num=7) and the radius of the circle. How can I obtain the coordinates of each vertex of each triangle of the shutter?



I don't know how to obtain these coordinates.



Thank you very much










share|cite|improve this question











$endgroup$




I need to build a shutter like this:



picture of a shutter



What is the formulas to draw each vertex?



Suppose I have num which is the number of triangles (in this case num=7) and the radius of the circle. How can I obtain the coordinates of each vertex of each triangle of the shutter?



I don't know how to obtain these coordinates.



Thank you very much







geometry triangle circle






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 14 at 18:22

























asked Jan 14 at 12:34







user609071



















  • $begingroup$
    Maybe you can start by considering the edges of the outer $n$-gon (7-gon, in the picture) and think about the coordinates of those edge points ...
    $endgroup$
    – Matti P.
    Jan 14 at 12:36










  • $begingroup$
    @MattiP. I need the coordinates of each triangle beacuse I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
    $endgroup$
    – user609071
    Jan 14 at 12:39












  • $begingroup$
    Once you know the coordinates of all vertices you can draw each triangle and also draw the entire shutter: there is no difference.
    $endgroup$
    – Aretino
    Jan 14 at 16:41


















  • $begingroup$
    Maybe you can start by considering the edges of the outer $n$-gon (7-gon, in the picture) and think about the coordinates of those edge points ...
    $endgroup$
    – Matti P.
    Jan 14 at 12:36










  • $begingroup$
    @MattiP. I need the coordinates of each triangle beacuse I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
    $endgroup$
    – user609071
    Jan 14 at 12:39












  • $begingroup$
    Once you know the coordinates of all vertices you can draw each triangle and also draw the entire shutter: there is no difference.
    $endgroup$
    – Aretino
    Jan 14 at 16:41
















$begingroup$
Maybe you can start by considering the edges of the outer $n$-gon (7-gon, in the picture) and think about the coordinates of those edge points ...
$endgroup$
– Matti P.
Jan 14 at 12:36




$begingroup$
Maybe you can start by considering the edges of the outer $n$-gon (7-gon, in the picture) and think about the coordinates of those edge points ...
$endgroup$
– Matti P.
Jan 14 at 12:36












$begingroup$
@MattiP. I need the coordinates of each triangle beacuse I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
$endgroup$
– user609071
Jan 14 at 12:39






$begingroup$
@MattiP. I need the coordinates of each triangle beacuse I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
$endgroup$
– user609071
Jan 14 at 12:39














$begingroup$
Once you know the coordinates of all vertices you can draw each triangle and also draw the entire shutter: there is no difference.
$endgroup$
– Aretino
Jan 14 at 16:41




$begingroup$
Once you know the coordinates of all vertices you can draw each triangle and also draw the entire shutter: there is no difference.
$endgroup$
– Aretino
Jan 14 at 16:41










2 Answers
2






active

oldest

votes


















1












$begingroup$

I'll use the name $n$ instead of num for the number of triangles because it works better in math formulas. You can translate back when using it in your software.



In the "shutter" we can see an outer $n$-gon (containing all the rest of the figure)
and an inner $n$-gon (the white or empty region in the middle).
The inner $n$-gon is smaller than the outer $n$-gon and is rotated so that each edge of the inner $n$-gon, extended in a clockwise direction relative to the center of the $n$-gon, intersects a vertex of the outer $n$-gon.



The regions bounded by these extended edges and the edges of the outer $n$-gon are the triangles you want to draw.



One edge of a triangle is simply one of the edges of the outer $n$-gon,
which is easy enough to plot.
Assuming you are using standard Cartesian coordinates
(perpendicular $x$ and $y$ axes, and the positive $y$ axis is counterclockwise from the positive $x$ axis),
if the center of the shutter is to be at the point $O = (x_0,y_0),$
you can plot the vertices of side $k$ of the $n$-gon at
$$ A = left(x_0 + Rcosleft(theta_0 + frac{2pi}n kright),
y_0 + Rsinleft(theta_0 + frac{2pi}n kright)right) $$

and
$$ B = left(x_0 + Rcosleft(theta_0 + frac{2pi}n (k + 1)right),
y_0 + Rsinleft(theta_0 + frac{2pi}n (k + 1)right)right), $$

where $theta_0$ is an angle that determines how the entire shutter is oriented relative to your drawing; increasing $theta_0$ will rotate the entire shutter counterclockwise.



Now let $M$ be the midpoint of the segment $AB.$
Then $triangle OMA$ is a right triangle with its right angle at $M.$
The hypotenuse $OA$ has length $R$ and the angle at $O$ is $pi/n,$
so $OM = R cos(pi/n).$



If $C$ is the third vertex of the triangle that you want to draw adjacent edge $AB,$
if $D$ is the vertex of the inner $n$-gon between $A$ and $C,$ and if $P$ is the midpoint of $CD,$ then $triangle OPA$ is a right triangle with its right angle at $P,$ again with hypotenuse $OA.$



The next part depends on how you want to set the inner shape of the shutter.
You can specify the angle $alpha$ at $A$ in the triangle $triangle ABC,$
you can specify the distance from the center to one of the vertices of the inner $n$-gon (that is, specify the length $OC$),
or you can specify the distance from the center to the midpoint of a side of the inner $n$-gon (that is, specify the length $OP$).



Any one of these measurements gives you the other two.
When we know either $OC$ or $OP,$ we can derive the other value using the formula
$$ OP = OC cos(pi/n). $$
When we know either $alpha$ or $OP$ we can derive the other value from the formula
$$ OP = R cosleft(fracpi n + alpharight), $$
because $angle POM = alpha.$



So let's suppose you specified the inner shape of the shutter somehow and that you now have the values of $alpha$ and $OC.$ Then the coordinates of $C$ are obtained by a formula similar to the one for $B,$ but scaled down (because it is a vertex of a smaller $n$-gon) and rotated by the angle $alpha$:
$$ C = left(x_0 + OCcosleft(theta_0 + frac{2pi}n (k + 1) + alpharight),
y_0 + OCsinleft(theta_0 + frac{2pi}n (k + 1) + alpharight)right). $$



If you would like to know the sides and angles of triangle $triangle ABC,$
they are
begin{align}
AB &= 2R sinleft(fracpi nright), \
AC &= R left(sinleft(fracpi n + alpharight)
+ sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
BC &= R left(sinleft(fracpi n + alpharight)
- sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
angle BAC &= alpha, \
angle ACB &= frac{2pi}n, \
angle ABC &= pi - frac{2pi}n - alpha.
end{align}






share|cite|improve this answer











$endgroup$





















    0












    $begingroup$

    $$x=rcos(theta), y=rsin(theta), theta = frac{360i + offset}{num}$$



    Where $i = 0,...,num-1$, and offset can 'rotate' the starting point.
    Look up polar coordinates or circle parametric equation.






    share|cite|improve this answer









    $endgroup$













    • $begingroup$
      I need the coordinates of each triangle because I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
      $endgroup$
      – user609071
      Jan 14 at 12:41










    • $begingroup$
      What I wrote solves your problem. You have 1 bigger n-gon with n vertices and one smaller inside with also n vertices. Let the bigger polygon's vertices be $p_1,...,p_n$ and the inner one be $q_1,...,q_n$, then form tris $(p_1,p_2,q_1), (p_2, p_3, q_2), ..., (p_n, p_1, q_n)$, set different offset and radius for p and q and you are done.
      $endgroup$
      – lightxbulb
      Jan 14 at 12:47













    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%2f3073182%2fdraw-a-multipolygon%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown
























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1












    $begingroup$

    I'll use the name $n$ instead of num for the number of triangles because it works better in math formulas. You can translate back when using it in your software.



    In the "shutter" we can see an outer $n$-gon (containing all the rest of the figure)
    and an inner $n$-gon (the white or empty region in the middle).
    The inner $n$-gon is smaller than the outer $n$-gon and is rotated so that each edge of the inner $n$-gon, extended in a clockwise direction relative to the center of the $n$-gon, intersects a vertex of the outer $n$-gon.



    The regions bounded by these extended edges and the edges of the outer $n$-gon are the triangles you want to draw.



    One edge of a triangle is simply one of the edges of the outer $n$-gon,
    which is easy enough to plot.
    Assuming you are using standard Cartesian coordinates
    (perpendicular $x$ and $y$ axes, and the positive $y$ axis is counterclockwise from the positive $x$ axis),
    if the center of the shutter is to be at the point $O = (x_0,y_0),$
    you can plot the vertices of side $k$ of the $n$-gon at
    $$ A = left(x_0 + Rcosleft(theta_0 + frac{2pi}n kright),
    y_0 + Rsinleft(theta_0 + frac{2pi}n kright)right) $$

    and
    $$ B = left(x_0 + Rcosleft(theta_0 + frac{2pi}n (k + 1)right),
    y_0 + Rsinleft(theta_0 + frac{2pi}n (k + 1)right)right), $$

    where $theta_0$ is an angle that determines how the entire shutter is oriented relative to your drawing; increasing $theta_0$ will rotate the entire shutter counterclockwise.



    Now let $M$ be the midpoint of the segment $AB.$
    Then $triangle OMA$ is a right triangle with its right angle at $M.$
    The hypotenuse $OA$ has length $R$ and the angle at $O$ is $pi/n,$
    so $OM = R cos(pi/n).$



    If $C$ is the third vertex of the triangle that you want to draw adjacent edge $AB,$
    if $D$ is the vertex of the inner $n$-gon between $A$ and $C,$ and if $P$ is the midpoint of $CD,$ then $triangle OPA$ is a right triangle with its right angle at $P,$ again with hypotenuse $OA.$



    The next part depends on how you want to set the inner shape of the shutter.
    You can specify the angle $alpha$ at $A$ in the triangle $triangle ABC,$
    you can specify the distance from the center to one of the vertices of the inner $n$-gon (that is, specify the length $OC$),
    or you can specify the distance from the center to the midpoint of a side of the inner $n$-gon (that is, specify the length $OP$).



    Any one of these measurements gives you the other two.
    When we know either $OC$ or $OP,$ we can derive the other value using the formula
    $$ OP = OC cos(pi/n). $$
    When we know either $alpha$ or $OP$ we can derive the other value from the formula
    $$ OP = R cosleft(fracpi n + alpharight), $$
    because $angle POM = alpha.$



    So let's suppose you specified the inner shape of the shutter somehow and that you now have the values of $alpha$ and $OC.$ Then the coordinates of $C$ are obtained by a formula similar to the one for $B,$ but scaled down (because it is a vertex of a smaller $n$-gon) and rotated by the angle $alpha$:
    $$ C = left(x_0 + OCcosleft(theta_0 + frac{2pi}n (k + 1) + alpharight),
    y_0 + OCsinleft(theta_0 + frac{2pi}n (k + 1) + alpharight)right). $$



    If you would like to know the sides and angles of triangle $triangle ABC,$
    they are
    begin{align}
    AB &= 2R sinleft(fracpi nright), \
    AC &= R left(sinleft(fracpi n + alpharight)
    + sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
    BC &= R left(sinleft(fracpi n + alpharight)
    - sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
    angle BAC &= alpha, \
    angle ACB &= frac{2pi}n, \
    angle ABC &= pi - frac{2pi}n - alpha.
    end{align}






    share|cite|improve this answer











    $endgroup$


















      1












      $begingroup$

      I'll use the name $n$ instead of num for the number of triangles because it works better in math formulas. You can translate back when using it in your software.



      In the "shutter" we can see an outer $n$-gon (containing all the rest of the figure)
      and an inner $n$-gon (the white or empty region in the middle).
      The inner $n$-gon is smaller than the outer $n$-gon and is rotated so that each edge of the inner $n$-gon, extended in a clockwise direction relative to the center of the $n$-gon, intersects a vertex of the outer $n$-gon.



      The regions bounded by these extended edges and the edges of the outer $n$-gon are the triangles you want to draw.



      One edge of a triangle is simply one of the edges of the outer $n$-gon,
      which is easy enough to plot.
      Assuming you are using standard Cartesian coordinates
      (perpendicular $x$ and $y$ axes, and the positive $y$ axis is counterclockwise from the positive $x$ axis),
      if the center of the shutter is to be at the point $O = (x_0,y_0),$
      you can plot the vertices of side $k$ of the $n$-gon at
      $$ A = left(x_0 + Rcosleft(theta_0 + frac{2pi}n kright),
      y_0 + Rsinleft(theta_0 + frac{2pi}n kright)right) $$

      and
      $$ B = left(x_0 + Rcosleft(theta_0 + frac{2pi}n (k + 1)right),
      y_0 + Rsinleft(theta_0 + frac{2pi}n (k + 1)right)right), $$

      where $theta_0$ is an angle that determines how the entire shutter is oriented relative to your drawing; increasing $theta_0$ will rotate the entire shutter counterclockwise.



      Now let $M$ be the midpoint of the segment $AB.$
      Then $triangle OMA$ is a right triangle with its right angle at $M.$
      The hypotenuse $OA$ has length $R$ and the angle at $O$ is $pi/n,$
      so $OM = R cos(pi/n).$



      If $C$ is the third vertex of the triangle that you want to draw adjacent edge $AB,$
      if $D$ is the vertex of the inner $n$-gon between $A$ and $C,$ and if $P$ is the midpoint of $CD,$ then $triangle OPA$ is a right triangle with its right angle at $P,$ again with hypotenuse $OA.$



      The next part depends on how you want to set the inner shape of the shutter.
      You can specify the angle $alpha$ at $A$ in the triangle $triangle ABC,$
      you can specify the distance from the center to one of the vertices of the inner $n$-gon (that is, specify the length $OC$),
      or you can specify the distance from the center to the midpoint of a side of the inner $n$-gon (that is, specify the length $OP$).



      Any one of these measurements gives you the other two.
      When we know either $OC$ or $OP,$ we can derive the other value using the formula
      $$ OP = OC cos(pi/n). $$
      When we know either $alpha$ or $OP$ we can derive the other value from the formula
      $$ OP = R cosleft(fracpi n + alpharight), $$
      because $angle POM = alpha.$



      So let's suppose you specified the inner shape of the shutter somehow and that you now have the values of $alpha$ and $OC.$ Then the coordinates of $C$ are obtained by a formula similar to the one for $B,$ but scaled down (because it is a vertex of a smaller $n$-gon) and rotated by the angle $alpha$:
      $$ C = left(x_0 + OCcosleft(theta_0 + frac{2pi}n (k + 1) + alpharight),
      y_0 + OCsinleft(theta_0 + frac{2pi}n (k + 1) + alpharight)right). $$



      If you would like to know the sides and angles of triangle $triangle ABC,$
      they are
      begin{align}
      AB &= 2R sinleft(fracpi nright), \
      AC &= R left(sinleft(fracpi n + alpharight)
      + sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
      BC &= R left(sinleft(fracpi n + alpharight)
      - sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
      angle BAC &= alpha, \
      angle ACB &= frac{2pi}n, \
      angle ABC &= pi - frac{2pi}n - alpha.
      end{align}






      share|cite|improve this answer











      $endgroup$
















        1












        1








        1





        $begingroup$

        I'll use the name $n$ instead of num for the number of triangles because it works better in math formulas. You can translate back when using it in your software.



        In the "shutter" we can see an outer $n$-gon (containing all the rest of the figure)
        and an inner $n$-gon (the white or empty region in the middle).
        The inner $n$-gon is smaller than the outer $n$-gon and is rotated so that each edge of the inner $n$-gon, extended in a clockwise direction relative to the center of the $n$-gon, intersects a vertex of the outer $n$-gon.



        The regions bounded by these extended edges and the edges of the outer $n$-gon are the triangles you want to draw.



        One edge of a triangle is simply one of the edges of the outer $n$-gon,
        which is easy enough to plot.
        Assuming you are using standard Cartesian coordinates
        (perpendicular $x$ and $y$ axes, and the positive $y$ axis is counterclockwise from the positive $x$ axis),
        if the center of the shutter is to be at the point $O = (x_0,y_0),$
        you can plot the vertices of side $k$ of the $n$-gon at
        $$ A = left(x_0 + Rcosleft(theta_0 + frac{2pi}n kright),
        y_0 + Rsinleft(theta_0 + frac{2pi}n kright)right) $$

        and
        $$ B = left(x_0 + Rcosleft(theta_0 + frac{2pi}n (k + 1)right),
        y_0 + Rsinleft(theta_0 + frac{2pi}n (k + 1)right)right), $$

        where $theta_0$ is an angle that determines how the entire shutter is oriented relative to your drawing; increasing $theta_0$ will rotate the entire shutter counterclockwise.



        Now let $M$ be the midpoint of the segment $AB.$
        Then $triangle OMA$ is a right triangle with its right angle at $M.$
        The hypotenuse $OA$ has length $R$ and the angle at $O$ is $pi/n,$
        so $OM = R cos(pi/n).$



        If $C$ is the third vertex of the triangle that you want to draw adjacent edge $AB,$
        if $D$ is the vertex of the inner $n$-gon between $A$ and $C,$ and if $P$ is the midpoint of $CD,$ then $triangle OPA$ is a right triangle with its right angle at $P,$ again with hypotenuse $OA.$



        The next part depends on how you want to set the inner shape of the shutter.
        You can specify the angle $alpha$ at $A$ in the triangle $triangle ABC,$
        you can specify the distance from the center to one of the vertices of the inner $n$-gon (that is, specify the length $OC$),
        or you can specify the distance from the center to the midpoint of a side of the inner $n$-gon (that is, specify the length $OP$).



        Any one of these measurements gives you the other two.
        When we know either $OC$ or $OP,$ we can derive the other value using the formula
        $$ OP = OC cos(pi/n). $$
        When we know either $alpha$ or $OP$ we can derive the other value from the formula
        $$ OP = R cosleft(fracpi n + alpharight), $$
        because $angle POM = alpha.$



        So let's suppose you specified the inner shape of the shutter somehow and that you now have the values of $alpha$ and $OC.$ Then the coordinates of $C$ are obtained by a formula similar to the one for $B,$ but scaled down (because it is a vertex of a smaller $n$-gon) and rotated by the angle $alpha$:
        $$ C = left(x_0 + OCcosleft(theta_0 + frac{2pi}n (k + 1) + alpharight),
        y_0 + OCsinleft(theta_0 + frac{2pi}n (k + 1) + alpharight)right). $$



        If you would like to know the sides and angles of triangle $triangle ABC,$
        they are
        begin{align}
        AB &= 2R sinleft(fracpi nright), \
        AC &= R left(sinleft(fracpi n + alpharight)
        + sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
        BC &= R left(sinleft(fracpi n + alpharight)
        - sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
        angle BAC &= alpha, \
        angle ACB &= frac{2pi}n, \
        angle ABC &= pi - frac{2pi}n - alpha.
        end{align}






        share|cite|improve this answer











        $endgroup$



        I'll use the name $n$ instead of num for the number of triangles because it works better in math formulas. You can translate back when using it in your software.



        In the "shutter" we can see an outer $n$-gon (containing all the rest of the figure)
        and an inner $n$-gon (the white or empty region in the middle).
        The inner $n$-gon is smaller than the outer $n$-gon and is rotated so that each edge of the inner $n$-gon, extended in a clockwise direction relative to the center of the $n$-gon, intersects a vertex of the outer $n$-gon.



        The regions bounded by these extended edges and the edges of the outer $n$-gon are the triangles you want to draw.



        One edge of a triangle is simply one of the edges of the outer $n$-gon,
        which is easy enough to plot.
        Assuming you are using standard Cartesian coordinates
        (perpendicular $x$ and $y$ axes, and the positive $y$ axis is counterclockwise from the positive $x$ axis),
        if the center of the shutter is to be at the point $O = (x_0,y_0),$
        you can plot the vertices of side $k$ of the $n$-gon at
        $$ A = left(x_0 + Rcosleft(theta_0 + frac{2pi}n kright),
        y_0 + Rsinleft(theta_0 + frac{2pi}n kright)right) $$

        and
        $$ B = left(x_0 + Rcosleft(theta_0 + frac{2pi}n (k + 1)right),
        y_0 + Rsinleft(theta_0 + frac{2pi}n (k + 1)right)right), $$

        where $theta_0$ is an angle that determines how the entire shutter is oriented relative to your drawing; increasing $theta_0$ will rotate the entire shutter counterclockwise.



        Now let $M$ be the midpoint of the segment $AB.$
        Then $triangle OMA$ is a right triangle with its right angle at $M.$
        The hypotenuse $OA$ has length $R$ and the angle at $O$ is $pi/n,$
        so $OM = R cos(pi/n).$



        If $C$ is the third vertex of the triangle that you want to draw adjacent edge $AB,$
        if $D$ is the vertex of the inner $n$-gon between $A$ and $C,$ and if $P$ is the midpoint of $CD,$ then $triangle OPA$ is a right triangle with its right angle at $P,$ again with hypotenuse $OA.$



        The next part depends on how you want to set the inner shape of the shutter.
        You can specify the angle $alpha$ at $A$ in the triangle $triangle ABC,$
        you can specify the distance from the center to one of the vertices of the inner $n$-gon (that is, specify the length $OC$),
        or you can specify the distance from the center to the midpoint of a side of the inner $n$-gon (that is, specify the length $OP$).



        Any one of these measurements gives you the other two.
        When we know either $OC$ or $OP,$ we can derive the other value using the formula
        $$ OP = OC cos(pi/n). $$
        When we know either $alpha$ or $OP$ we can derive the other value from the formula
        $$ OP = R cosleft(fracpi n + alpharight), $$
        because $angle POM = alpha.$



        So let's suppose you specified the inner shape of the shutter somehow and that you now have the values of $alpha$ and $OC.$ Then the coordinates of $C$ are obtained by a formula similar to the one for $B,$ but scaled down (because it is a vertex of a smaller $n$-gon) and rotated by the angle $alpha$:
        $$ C = left(x_0 + OCcosleft(theta_0 + frac{2pi}n (k + 1) + alpharight),
        y_0 + OCsinleft(theta_0 + frac{2pi}n (k + 1) + alpharight)right). $$



        If you would like to know the sides and angles of triangle $triangle ABC,$
        they are
        begin{align}
        AB &= 2R sinleft(fracpi nright), \
        AC &= R left(sinleft(fracpi n + alpharight)
        + sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
        BC &= R left(sinleft(fracpi n + alpharight)
        - sinleft(fracpi nright)cosleft(fracpi n + alpharight)right),\
        angle BAC &= alpha, \
        angle ACB &= frac{2pi}n, \
        angle ABC &= pi - frac{2pi}n - alpha.
        end{align}







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Jan 15 at 1:51

























        answered Jan 14 at 14:33









        David KDavid K

        55.3k344120




        55.3k344120























            0












            $begingroup$

            $$x=rcos(theta), y=rsin(theta), theta = frac{360i + offset}{num}$$



            Where $i = 0,...,num-1$, and offset can 'rotate' the starting point.
            Look up polar coordinates or circle parametric equation.






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              I need the coordinates of each triangle because I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
              $endgroup$
              – user609071
              Jan 14 at 12:41










            • $begingroup$
              What I wrote solves your problem. You have 1 bigger n-gon with n vertices and one smaller inside with also n vertices. Let the bigger polygon's vertices be $p_1,...,p_n$ and the inner one be $q_1,...,q_n$, then form tris $(p_1,p_2,q_1), (p_2, p_3, q_2), ..., (p_n, p_1, q_n)$, set different offset and radius for p and q and you are done.
              $endgroup$
              – lightxbulb
              Jan 14 at 12:47


















            0












            $begingroup$

            $$x=rcos(theta), y=rsin(theta), theta = frac{360i + offset}{num}$$



            Where $i = 0,...,num-1$, and offset can 'rotate' the starting point.
            Look up polar coordinates or circle parametric equation.






            share|cite|improve this answer









            $endgroup$













            • $begingroup$
              I need the coordinates of each triangle because I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
              $endgroup$
              – user609071
              Jan 14 at 12:41










            • $begingroup$
              What I wrote solves your problem. You have 1 bigger n-gon with n vertices and one smaller inside with also n vertices. Let the bigger polygon's vertices be $p_1,...,p_n$ and the inner one be $q_1,...,q_n$, then form tris $(p_1,p_2,q_1), (p_2, p_3, q_2), ..., (p_n, p_1, q_n)$, set different offset and radius for p and q and you are done.
              $endgroup$
              – lightxbulb
              Jan 14 at 12:47
















            0












            0








            0





            $begingroup$

            $$x=rcos(theta), y=rsin(theta), theta = frac{360i + offset}{num}$$



            Where $i = 0,...,num-1$, and offset can 'rotate' the starting point.
            Look up polar coordinates or circle parametric equation.






            share|cite|improve this answer









            $endgroup$



            $$x=rcos(theta), y=rsin(theta), theta = frac{360i + offset}{num}$$



            Where $i = 0,...,num-1$, and offset can 'rotate' the starting point.
            Look up polar coordinates or circle parametric equation.







            share|cite|improve this answer












            share|cite|improve this answer



            share|cite|improve this answer










            answered Jan 14 at 12:36









            lightxbulblightxbulb

            1,140311




            1,140311












            • $begingroup$
              I need the coordinates of each triangle because I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
              $endgroup$
              – user609071
              Jan 14 at 12:41










            • $begingroup$
              What I wrote solves your problem. You have 1 bigger n-gon with n vertices and one smaller inside with also n vertices. Let the bigger polygon's vertices be $p_1,...,p_n$ and the inner one be $q_1,...,q_n$, then form tris $(p_1,p_2,q_1), (p_2, p_3, q_2), ..., (p_n, p_1, q_n)$, set different offset and radius for p and q and you are done.
              $endgroup$
              – lightxbulb
              Jan 14 at 12:47




















            • $begingroup$
              I need the coordinates of each triangle because I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
              $endgroup$
              – user609071
              Jan 14 at 12:41










            • $begingroup$
              What I wrote solves your problem. You have 1 bigger n-gon with n vertices and one smaller inside with also n vertices. Let the bigger polygon's vertices be $p_1,...,p_n$ and the inner one be $q_1,...,q_n$, then form tris $(p_1,p_2,q_1), (p_2, p_3, q_2), ..., (p_n, p_1, q_n)$, set different offset and radius for p and q and you are done.
              $endgroup$
              – lightxbulb
              Jan 14 at 12:47


















            $begingroup$
            I need the coordinates of each triangle because I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
            $endgroup$
            – user609071
            Jan 14 at 12:41




            $begingroup$
            I need the coordinates of each triangle because I need to consider each triangle individually. So, I'm not looking for a formula to draw the entire shutter but a formula to draw each triangle of the shutter.
            $endgroup$
            – user609071
            Jan 14 at 12:41












            $begingroup$
            What I wrote solves your problem. You have 1 bigger n-gon with n vertices and one smaller inside with also n vertices. Let the bigger polygon's vertices be $p_1,...,p_n$ and the inner one be $q_1,...,q_n$, then form tris $(p_1,p_2,q_1), (p_2, p_3, q_2), ..., (p_n, p_1, q_n)$, set different offset and radius for p and q and you are done.
            $endgroup$
            – lightxbulb
            Jan 14 at 12:47






            $begingroup$
            What I wrote solves your problem. You have 1 bigger n-gon with n vertices and one smaller inside with also n vertices. Let the bigger polygon's vertices be $p_1,...,p_n$ and the inner one be $q_1,...,q_n$, then form tris $(p_1,p_2,q_1), (p_2, p_3, q_2), ..., (p_n, p_1, q_n)$, set different offset and radius for p and q and you are done.
            $endgroup$
            – lightxbulb
            Jan 14 at 12:47




















            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3073182%2fdraw-a-multipolygon%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

            Human spaceflight

            Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

            張江高科駅