Check for Point Collinearity and rearrange line












0












$begingroup$


imagine you are having a 2D object, which looks like this:
$$
l = (p_1,p_2,...,p_n)
$$

with $p_i = (x_i, y_i)$.
It may be possible that $p_1 = p_n$, or that $l$ only contains two points, which are not the same. (Am i correct that even if $p_1 = p_n$ the object is still considered a line-like object ? Since in this case it would basically represent the shell of a polygon without a surface.)



My Question is:
In $l$ there are points which are not collinear, meaning that $l$ is not just a straight line. Now my goal is to extract all straight lines from $l$, such that $l$ is seperated into a set of new lines. If you would plot the new lines all together, it would be equivalent to plotting $l$.



Does someone has an idea how to do that correctly, and how this process is adequately notated?



Greetings !










share|cite|improve this question











$endgroup$












  • $begingroup$
    If your set $l$ is ordered, and you're trying to draw the line segments from one point to the next, you could do each line segment like this: $(1-t)p_i+t p_{i+1},$ as $t$ ranges from $0$ to $1$.
    $endgroup$
    – Adrian Keister
    Dec 11 '18 at 16:07










  • $begingroup$
    How exactly do you want to seperate $l$ into new lines? Do you want to seperate the polygon in a minimal partition or do you want to draw only new segments of each line $[p_i,p_{i+1}]$?
    $endgroup$
    – bruderjakob17
    Dec 11 '18 at 16:40












  • $begingroup$
    If i use $(p_{i}, p_{i+1})$ to create new lines this would result in a giant set of lines. As an example, imagine $l = {(1,1), (2,2), (3,3), (2,4), (1,5) }$, in this case i want the result to be a set of two lines : {(1,1), (3,3)} and {(3,3),(1,5)} instead of 4 lines like in the approach of using $(p_i, p_{i+1})$.
    $endgroup$
    – Ekko
    Dec 11 '18 at 16:49


















0












$begingroup$


imagine you are having a 2D object, which looks like this:
$$
l = (p_1,p_2,...,p_n)
$$

with $p_i = (x_i, y_i)$.
It may be possible that $p_1 = p_n$, or that $l$ only contains two points, which are not the same. (Am i correct that even if $p_1 = p_n$ the object is still considered a line-like object ? Since in this case it would basically represent the shell of a polygon without a surface.)



My Question is:
In $l$ there are points which are not collinear, meaning that $l$ is not just a straight line. Now my goal is to extract all straight lines from $l$, such that $l$ is seperated into a set of new lines. If you would plot the new lines all together, it would be equivalent to plotting $l$.



Does someone has an idea how to do that correctly, and how this process is adequately notated?



Greetings !










share|cite|improve this question











$endgroup$












  • $begingroup$
    If your set $l$ is ordered, and you're trying to draw the line segments from one point to the next, you could do each line segment like this: $(1-t)p_i+t p_{i+1},$ as $t$ ranges from $0$ to $1$.
    $endgroup$
    – Adrian Keister
    Dec 11 '18 at 16:07










  • $begingroup$
    How exactly do you want to seperate $l$ into new lines? Do you want to seperate the polygon in a minimal partition or do you want to draw only new segments of each line $[p_i,p_{i+1}]$?
    $endgroup$
    – bruderjakob17
    Dec 11 '18 at 16:40












  • $begingroup$
    If i use $(p_{i}, p_{i+1})$ to create new lines this would result in a giant set of lines. As an example, imagine $l = {(1,1), (2,2), (3,3), (2,4), (1,5) }$, in this case i want the result to be a set of two lines : {(1,1), (3,3)} and {(3,3),(1,5)} instead of 4 lines like in the approach of using $(p_i, p_{i+1})$.
    $endgroup$
    – Ekko
    Dec 11 '18 at 16:49
















0












0








0





$begingroup$


imagine you are having a 2D object, which looks like this:
$$
l = (p_1,p_2,...,p_n)
$$

with $p_i = (x_i, y_i)$.
It may be possible that $p_1 = p_n$, or that $l$ only contains two points, which are not the same. (Am i correct that even if $p_1 = p_n$ the object is still considered a line-like object ? Since in this case it would basically represent the shell of a polygon without a surface.)



My Question is:
In $l$ there are points which are not collinear, meaning that $l$ is not just a straight line. Now my goal is to extract all straight lines from $l$, such that $l$ is seperated into a set of new lines. If you would plot the new lines all together, it would be equivalent to plotting $l$.



Does someone has an idea how to do that correctly, and how this process is adequately notated?



Greetings !










share|cite|improve this question











$endgroup$




imagine you are having a 2D object, which looks like this:
$$
l = (p_1,p_2,...,p_n)
$$

with $p_i = (x_i, y_i)$.
It may be possible that $p_1 = p_n$, or that $l$ only contains two points, which are not the same. (Am i correct that even if $p_1 = p_n$ the object is still considered a line-like object ? Since in this case it would basically represent the shell of a polygon without a surface.)



My Question is:
In $l$ there are points which are not collinear, meaning that $l$ is not just a straight line. Now my goal is to extract all straight lines from $l$, such that $l$ is seperated into a set of new lines. If you would plot the new lines all together, it would be equivalent to plotting $l$.



Does someone has an idea how to do that correctly, and how this process is adequately notated?



Greetings !







geometry






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Dec 11 '18 at 16:11









Asaf Karagila

305k33435766




305k33435766










asked Dec 11 '18 at 16:03









EkkoEkko

12




12












  • $begingroup$
    If your set $l$ is ordered, and you're trying to draw the line segments from one point to the next, you could do each line segment like this: $(1-t)p_i+t p_{i+1},$ as $t$ ranges from $0$ to $1$.
    $endgroup$
    – Adrian Keister
    Dec 11 '18 at 16:07










  • $begingroup$
    How exactly do you want to seperate $l$ into new lines? Do you want to seperate the polygon in a minimal partition or do you want to draw only new segments of each line $[p_i,p_{i+1}]$?
    $endgroup$
    – bruderjakob17
    Dec 11 '18 at 16:40












  • $begingroup$
    If i use $(p_{i}, p_{i+1})$ to create new lines this would result in a giant set of lines. As an example, imagine $l = {(1,1), (2,2), (3,3), (2,4), (1,5) }$, in this case i want the result to be a set of two lines : {(1,1), (3,3)} and {(3,3),(1,5)} instead of 4 lines like in the approach of using $(p_i, p_{i+1})$.
    $endgroup$
    – Ekko
    Dec 11 '18 at 16:49




















  • $begingroup$
    If your set $l$ is ordered, and you're trying to draw the line segments from one point to the next, you could do each line segment like this: $(1-t)p_i+t p_{i+1},$ as $t$ ranges from $0$ to $1$.
    $endgroup$
    – Adrian Keister
    Dec 11 '18 at 16:07










  • $begingroup$
    How exactly do you want to seperate $l$ into new lines? Do you want to seperate the polygon in a minimal partition or do you want to draw only new segments of each line $[p_i,p_{i+1}]$?
    $endgroup$
    – bruderjakob17
    Dec 11 '18 at 16:40












  • $begingroup$
    If i use $(p_{i}, p_{i+1})$ to create new lines this would result in a giant set of lines. As an example, imagine $l = {(1,1), (2,2), (3,3), (2,4), (1,5) }$, in this case i want the result to be a set of two lines : {(1,1), (3,3)} and {(3,3),(1,5)} instead of 4 lines like in the approach of using $(p_i, p_{i+1})$.
    $endgroup$
    – Ekko
    Dec 11 '18 at 16:49


















$begingroup$
If your set $l$ is ordered, and you're trying to draw the line segments from one point to the next, you could do each line segment like this: $(1-t)p_i+t p_{i+1},$ as $t$ ranges from $0$ to $1$.
$endgroup$
– Adrian Keister
Dec 11 '18 at 16:07




$begingroup$
If your set $l$ is ordered, and you're trying to draw the line segments from one point to the next, you could do each line segment like this: $(1-t)p_i+t p_{i+1},$ as $t$ ranges from $0$ to $1$.
$endgroup$
– Adrian Keister
Dec 11 '18 at 16:07












$begingroup$
How exactly do you want to seperate $l$ into new lines? Do you want to seperate the polygon in a minimal partition or do you want to draw only new segments of each line $[p_i,p_{i+1}]$?
$endgroup$
– bruderjakob17
Dec 11 '18 at 16:40






$begingroup$
How exactly do you want to seperate $l$ into new lines? Do you want to seperate the polygon in a minimal partition or do you want to draw only new segments of each line $[p_i,p_{i+1}]$?
$endgroup$
– bruderjakob17
Dec 11 '18 at 16:40














$begingroup$
If i use $(p_{i}, p_{i+1})$ to create new lines this would result in a giant set of lines. As an example, imagine $l = {(1,1), (2,2), (3,3), (2,4), (1,5) }$, in this case i want the result to be a set of two lines : {(1,1), (3,3)} and {(3,3),(1,5)} instead of 4 lines like in the approach of using $(p_i, p_{i+1})$.
$endgroup$
– Ekko
Dec 11 '18 at 16:49






$begingroup$
If i use $(p_{i}, p_{i+1})$ to create new lines this would result in a giant set of lines. As an example, imagine $l = {(1,1), (2,2), (3,3), (2,4), (1,5) }$, in this case i want the result to be a set of two lines : {(1,1), (3,3)} and {(3,3),(1,5)} instead of 4 lines like in the approach of using $(p_i, p_{i+1})$.
$endgroup$
– Ekko
Dec 11 '18 at 16:49












1 Answer
1






active

oldest

votes


















0












$begingroup$

Set $V:= emptyset$.



Now, for $i = 1,dots, n-1$, do the following:




  • If $p_i = p_{i+1}$, continue.



  • Check, whether there is a tupel $(a,b,X)in V$ s.t.
    $DeclareMathOperator{span}{span} p_i,p_{i+1} in a +
    span{{b-a}}$
    .




    • If that is the case, write $p_i = a + lambda (b-a)$ and $p_{i+1} = a
      + mu (b-a)$
      . Without loss we may assume $lambda > mu$. Now, replace $(a,b,X)in V$ by $DeclareMathOperator{contract}{contract}
      (a,b,contract{(Xcup {[mu, lambda]})})$
      , where $contract({Y_1, dots, Y_k}):=begin{cases}contract({Y_1,dots ,Y_k}backslash{Y_i,Y_j}cup{Y_i cup Y_j})& text{if there are $ineq j$ s.t. $Y_i cap Y_j neq emptyset$}\
      {Y_1, dots , Y_k} & text{else}end{cases}$


    • Else, add $(p_i,p_{i+1}, {[0,1]})$ to $V$.





Now, you can draw all lines you need as follows: For every $(a,b,X) in V$ and for all $[mu,lambda]in X$, draw $[a+mu (b-a), a+lambda (b-a)] := {a + xi (b-a) space | space xi in [mu, lambda]}$.






share|cite|improve this answer









$endgroup$













    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%2f3035441%2fcheck-for-point-collinearity-and-rearrange-line%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









    0












    $begingroup$

    Set $V:= emptyset$.



    Now, for $i = 1,dots, n-1$, do the following:




    • If $p_i = p_{i+1}$, continue.



    • Check, whether there is a tupel $(a,b,X)in V$ s.t.
      $DeclareMathOperator{span}{span} p_i,p_{i+1} in a +
      span{{b-a}}$
      .




      • If that is the case, write $p_i = a + lambda (b-a)$ and $p_{i+1} = a
        + mu (b-a)$
        . Without loss we may assume $lambda > mu$. Now, replace $(a,b,X)in V$ by $DeclareMathOperator{contract}{contract}
        (a,b,contract{(Xcup {[mu, lambda]})})$
        , where $contract({Y_1, dots, Y_k}):=begin{cases}contract({Y_1,dots ,Y_k}backslash{Y_i,Y_j}cup{Y_i cup Y_j})& text{if there are $ineq j$ s.t. $Y_i cap Y_j neq emptyset$}\
        {Y_1, dots , Y_k} & text{else}end{cases}$


      • Else, add $(p_i,p_{i+1}, {[0,1]})$ to $V$.





    Now, you can draw all lines you need as follows: For every $(a,b,X) in V$ and for all $[mu,lambda]in X$, draw $[a+mu (b-a), a+lambda (b-a)] := {a + xi (b-a) space | space xi in [mu, lambda]}$.






    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      Set $V:= emptyset$.



      Now, for $i = 1,dots, n-1$, do the following:




      • If $p_i = p_{i+1}$, continue.



      • Check, whether there is a tupel $(a,b,X)in V$ s.t.
        $DeclareMathOperator{span}{span} p_i,p_{i+1} in a +
        span{{b-a}}$
        .




        • If that is the case, write $p_i = a + lambda (b-a)$ and $p_{i+1} = a
          + mu (b-a)$
          . Without loss we may assume $lambda > mu$. Now, replace $(a,b,X)in V$ by $DeclareMathOperator{contract}{contract}
          (a,b,contract{(Xcup {[mu, lambda]})})$
          , where $contract({Y_1, dots, Y_k}):=begin{cases}contract({Y_1,dots ,Y_k}backslash{Y_i,Y_j}cup{Y_i cup Y_j})& text{if there are $ineq j$ s.t. $Y_i cap Y_j neq emptyset$}\
          {Y_1, dots , Y_k} & text{else}end{cases}$


        • Else, add $(p_i,p_{i+1}, {[0,1]})$ to $V$.





      Now, you can draw all lines you need as follows: For every $(a,b,X) in V$ and for all $[mu,lambda]in X$, draw $[a+mu (b-a), a+lambda (b-a)] := {a + xi (b-a) space | space xi in [mu, lambda]}$.






      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        Set $V:= emptyset$.



        Now, for $i = 1,dots, n-1$, do the following:




        • If $p_i = p_{i+1}$, continue.



        • Check, whether there is a tupel $(a,b,X)in V$ s.t.
          $DeclareMathOperator{span}{span} p_i,p_{i+1} in a +
          span{{b-a}}$
          .




          • If that is the case, write $p_i = a + lambda (b-a)$ and $p_{i+1} = a
            + mu (b-a)$
            . Without loss we may assume $lambda > mu$. Now, replace $(a,b,X)in V$ by $DeclareMathOperator{contract}{contract}
            (a,b,contract{(Xcup {[mu, lambda]})})$
            , where $contract({Y_1, dots, Y_k}):=begin{cases}contract({Y_1,dots ,Y_k}backslash{Y_i,Y_j}cup{Y_i cup Y_j})& text{if there are $ineq j$ s.t. $Y_i cap Y_j neq emptyset$}\
            {Y_1, dots , Y_k} & text{else}end{cases}$


          • Else, add $(p_i,p_{i+1}, {[0,1]})$ to $V$.





        Now, you can draw all lines you need as follows: For every $(a,b,X) in V$ and for all $[mu,lambda]in X$, draw $[a+mu (b-a), a+lambda (b-a)] := {a + xi (b-a) space | space xi in [mu, lambda]}$.






        share|cite|improve this answer









        $endgroup$



        Set $V:= emptyset$.



        Now, for $i = 1,dots, n-1$, do the following:




        • If $p_i = p_{i+1}$, continue.



        • Check, whether there is a tupel $(a,b,X)in V$ s.t.
          $DeclareMathOperator{span}{span} p_i,p_{i+1} in a +
          span{{b-a}}$
          .




          • If that is the case, write $p_i = a + lambda (b-a)$ and $p_{i+1} = a
            + mu (b-a)$
            . Without loss we may assume $lambda > mu$. Now, replace $(a,b,X)in V$ by $DeclareMathOperator{contract}{contract}
            (a,b,contract{(Xcup {[mu, lambda]})})$
            , where $contract({Y_1, dots, Y_k}):=begin{cases}contract({Y_1,dots ,Y_k}backslash{Y_i,Y_j}cup{Y_i cup Y_j})& text{if there are $ineq j$ s.t. $Y_i cap Y_j neq emptyset$}\
            {Y_1, dots , Y_k} & text{else}end{cases}$


          • Else, add $(p_i,p_{i+1}, {[0,1]})$ to $V$.





        Now, you can draw all lines you need as follows: For every $(a,b,X) in V$ and for all $[mu,lambda]in X$, draw $[a+mu (b-a), a+lambda (b-a)] := {a + xi (b-a) space | space xi in [mu, lambda]}$.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Dec 16 '18 at 10:32









        bruderjakob17bruderjakob17

        416110




        416110






























            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%2f3035441%2fcheck-for-point-collinearity-and-rearrange-line%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

            Plaza Victoria

            Puebla de Zaragoza

            Musa