path-iterator

Using PathIterator to return all line segments that constrain an Area?

谁说胖子不能爱 提交于 2019-11-29 08:32:56
In Java, how would one employ PathIterator to iterate through the line segments that constrain an Area ? The Area is bound only by lines (but curve support wouldn't hurt). The method should return a collection of all the line segments. Peter This works (in all situations, I believe), but it might require more thorough testing: Area area; // The value is set elsewhere in the code ArrayList<double[]> areaPoints = new ArrayList<double[]>(); ArrayList<Line2D.Double> areaSegments = new ArrayList<Line2D.Double>(); double[] coords = new double[6]; for (PathIterator pi = area.getPathIterator(null);

Using PathIterator to return all line segments that constrain an Area?

喜夏-厌秋 提交于 2019-11-28 02:03:51
问题 In Java, how would one employ PathIterator to iterate through the line segments that constrain an Area? The Area is bound only by lines (but curve support wouldn't hurt). The method should return a collection of all the line segments. 回答1: This works (in all situations, I believe), but it might require more thorough testing: Area area; // The value is set elsewhere in the code ArrayList<double[]> areaPoints = new ArrayList<double[]>(); ArrayList<Line2D.Double> areaSegments = new ArrayList