Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swapped left and right datapoints and missing datapoint in vertices #1

Open
GoogleCodeExporter opened this issue Sep 10, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Hi folks,

First of all, cool code. It is somewhat over my skill level. I am therefore 
posting my issue here in the hope of a hint.

Here is what I did:

1) Create 5 datapoints and run the algorithm:

    places = new List<Vector>();
        float low = 0.1f;
    float high = 0.9f;
    places.Add(new Vector(low, low));
    places.Add(new Vector(high, low));
        places.Add(new Vector(low, high));
        places.Add(new Vector(high, high));
        places.Add(new Vector(0.5f, 0.5f));
    Debug.Log ("Number of entries in places: " + places.Count);
        vg = Fortune.ComputeVoronoiGraph(places);
        Debug.Log ("Number of entries in graph datapoints: " + vg.Vertizes.Count);
        List<Vector3> verts = new List<Vector3>();
    List<Vector2> uvs = new List<Vector2>();
    int ix = 0;
    foreach(VoronoiEdge ve in vg.Edges)
        Debug.Log (string.Format("{0}) L: {1} R: {2} A: {3} B: {4} D: {5}", ix++, ve.LeftData, ve.RightData, ve.VVertexA, ve.VVertexB, ve.DirectionVector));

The output is:

Number of entries in places: 5
Number of entries in graph datapoints: 4
0) L: (0.9;0.1) R: (0.1;0.1) A: (0.5;0.1) B: (Infinity;Infinity) D: (0;-1)
1) L: (0.9;0.1) R: (0.5;0.5) A: (0.5;0.1) B: (0.9;0.5) D: (0.7071;0.7071)
2) L: (0.1;0.1) R: (0.5;0.5) A: (0.5;0.1) B: (0.1;0.5) D: (-0.7071;0.7071)
3) L: (0.1;0.1) R: (0.1;0.9) A: (0.1;0.5) B: (Infinity;Infinity) D: (-1;0)
4) L: (0.5;0.5) R: (0.9;0.9) A: (0.9;0.5) B: (0.5;0.9) D: (-0.7071;0.7071)
5) L: (0.1;0.9) R: (0.5;0.5) A: (0.1;0.5) B: (0.5;0.9) D: (0.7071;0.7071)
6) L: (0.9;0.9) R: (0.9;0.1) A: (0.9;0.5) B: (Infinity;Infinity) D: (1;0)
7) L: (0.1;0.9) R: (0.9;0.9) A: (0.5;0.9) B: (Infinity;Infinity) D: (0;1)

Problems
1) I expected vertizes and places to be of same length?
2) Edge #1 has swapped left and right datapoint.

I am using 0.1 on OSX

I am using the algorithm to split a rectangle into polygons. I am having an 
easy time doing so just by creating two triangles from every edge. But its more 
complicated to handle the areas touching the sides. Is there a hint on how to 
generate those?

Kind regards

Jesper Taxbøl

Original issue reported on code.google.com by jes...@taxboel.dk on 16 Sep 2013 at 8:04

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

No branches or pull requests

1 participant