Skip to content

Incorrect skeleton output of running Demo.py on geographical coordinates #27

Open

Description

@nikprt

I'm trying to run the demo script on some own testfiles in which the polygon is represented by geographical coordinates (float values with 7 decimal places). Do geographical coordinates in this format work for the algorithm or do I need to consider something special here? Thanks in advance!

Activity

  1. Botffy commented on Nov 10, 2023

    @Botffy
    Owner

    What is the wrong output you're getting? Could you share them?

    I haven't worked on this project since ages, but iirc there is an issue with the numeric calculations for too small floating point numbers (intersections and such don't happen due to the computation errors inherent to floating point arithmetic and precision).

  2. nikprt commented on Nov 14, 2023

    @nikprt
    Author

    @Botffy the test polygon I'm trying to generate a skeleton for is representing the nodes of a rectangular building footprint in latitude, longitude coorinates (coming from OpenStreetMap). Therefore the input polygon is in counterclockwise order and of the following format:

    7.1489466,50.9653194
    7.1489765,50.9652408
    7.1491593,50.9652698
    7.1491291,50.9653486

    When running the demo script, the generated skeleton looks like this:
    Bildschirmfoto 2023-11-14 um 10 19 05

    The output (on DEBUG level) looks like the following:
    `new line inn polygon: 7.1489466,50.9653194

    new line inn polygon: 7.1489765,50.9652408

    new line inn polygon: 7.1491593,50.9652698

    new line inn polygon: 7.1491291,50.9653486

    DEBUG:name:Created LAV LAV 4378335216
    INFO:name:Created vertex Vertex (reflex) (7.15;50.97), bisector Ray2(<7.15, 50.97> + u<-1.34, 0.78>), edges LineSegment2(<7.15, 50.97> to <7.15, 50.97>) LineSegment2(<7.15, 50.97> to <7.15, 50.97>)
    INFO:name:Created vertex Vertex (reflex) (7.15;50.97), bisector Ray2(<7.15, 50.97> + u<-0.63, -1.09>), edges LineSegment2(<7.15, 50.97> to <7.15, 50.97>) LineSegment2(<7.15, 50.97> to <7.15, 50.97>)
    INFO:name:Created vertex Vertex (reflex) (7.15;50.97), bisector Ray2(<7.15, 50.97> + u<1.35, -0.78>), edges LineSegment2(<7.15, 50.97> to <7.15, 50.97>) LineSegment2(<7.15, 50.97> to <7.15, 50.97>)
    INFO:name:Created vertex Vertex (reflex) (7.15;50.97), bisector Ray2(<7.15, 50.97> + u<0.63, 1.09>), edges LineSegment2(<7.15, 50.97> to <7.15, 50.97>) LineSegment2(<7.15, 50.97> to <7.15, 50.97>)
    DEBUG:name:looking for split candidates for vertex Vertex (7.15;50.97)
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<0.63, 1.09>), bisector_right=Ray2(<7.15, 50.97> + u<-1.34, 0.78>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<-1.34, 0.78>), bisector_right=Ray2(<7.15, 50.97> + u<-0.63, -1.09>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<-0.63, -1.09>), bisector_right=Ray2(<7.15, 50.97> + u<1.35, -0.78>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<1.35, -0.78>), bisector_right=Ray2(<7.15, 50.97> + u<0.63, 1.09>))
    DEBUG:name:looking for split candidates for vertex Vertex (7.15;50.97)
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<0.63, 1.09>), bisector_right=Ray2(<7.15, 50.97> + u<-1.34, 0.78>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<-1.34, 0.78>), bisector_right=Ray2(<7.15, 50.97> + u<-0.63, -1.09>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<-0.63, -1.09>), bisector_right=Ray2(<7.15, 50.97> + u<1.35, -0.78>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<1.35, -0.78>), bisector_right=Ray2(<7.15, 50.97> + u<0.63, 1.09>))
    DEBUG:name:looking for split candidates for vertex Vertex (7.15;50.97)
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<0.63, 1.09>), bisector_right=Ray2(<7.15, 50.97> + u<-1.34, 0.78>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<-1.34, 0.78>), bisector_right=Ray2(<7.15, 50.97> + u<-0.63, -1.09>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<-0.63, -1.09>), bisector_right=Ray2(<7.15, 50.97> + u<1.35, -0.78>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<1.35, -0.78>), bisector_right=Ray2(<7.15, 50.97> + u<0.63, 1.09>))
    DEBUG:name:looking for split candidates for vertex Vertex (7.15;50.97)
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<0.63, 1.09>), bisector_right=Ray2(<7.15, 50.97> + u<-1.34, 0.78>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<-1.34, 0.78>), bisector_right=Ray2(<7.15, 50.97> + u<-0.63, -1.09>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<-0.63, -1.09>), bisector_right=Ray2(<7.15, 50.97> + u<1.35, -0.78>))
    DEBUG:name: considering EDGE _OriginalEdge(edge=LineSegment2(<7.15, 50.97> to <7.15, 50.97>), bisector_left=Ray2(<7.15, 50.97> + u<1.35, -0.78>), bisector_right=Ray2(<7.15, 50.97> + u<0.63, 1.09>))
    skeleton generated:
    []`

    Do I have to transform the polygon points from geographic coordinates (latitude, longitude) into another representation first in order to make the algorithm work properly? If so, what kind of coordinate system do I need to convert to?

  3. nikprt commented on Nov 14, 2023

    @nikprt
    Author

    I have fixed my problem above by converting my input polygon from geographic coordinates into a UTM coordinate system and then into a relative cartesian system, where the coordinates represent the distances to a reference point (x,y).

    The results don't look very satisfying, especially for L-shaped input polygons, maybe due to the algorithm having problems with too small distances. Minor lack of accuracy when transforming into cartesian coordinate system might also be a factor here:
    Bildschirmfoto 2023-11-14 um 16 43 41

  4. Botffy commented on Nov 14, 2023

    @Botffy
    Owner

    This converted one looks correct to me! It's a good roof. If you multiplied the input by a factor of ten or so, it would look less pixelated.

    I'm sorry I cannot be of more help at the moment. I've been planning to revisit this project since ages :$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions