Hemesh Finding points of existing polygons

Hi,

I have only a small issue to look at Hemesh library for my processing script.

I have a bunch of polygons in ArrayList and all I want to do is to put polygons' points into new ArrayList - points, but I cannot find this functionality for gettting polygons points.

A quote from my script:

//inputPolys is ArrayList with polygons and points1 is an empty ArrayList for inputPolys points.

ArrayList inputPolys = new ArrayList(); List points1 = new ArrayList ();

//Here I just want to put polygons points into points1 Arraylist.

for(int i = 0; i < inputPolys.size(); i++){ WB_Polygon2D a = inputPolys.get(i);

     points1.add(a.  ?function for getting points?  )       

}

I found closest point function, that shows that there is possibility to get points from existing polygons.

Hope you could help me.

Best, Petras

Answers

  • Answer ✓

    according to this

    http://code.google.com/p/hemesh2010/source/browse/hemesh/hemesh/wblut/geom/WB_Polygon2D.java?r=10

    the points member is public so should just be available using a.points

    public class WB_Polygon2D {
    
            /** Ordered array of WB_Point. */
            public WB_Point2d[] points;
    
            /** Number of points. */
            public int n;
    ...
    

    (and the x and y values in WB_Point2d are similarly public so just use .x and .y)

  • Dealing with this problem for almost a week, after you post I see that it was an array of points, as every polygons has poits * number of polygons existing on the script.

    Thank you, I finally understood, what I was doing wrong:)

    Have a nice day:)

Sign In or Register to comment.