Commits

Karsten Schmidt committed cfeb415

adding getEdges()

Comments (0)

Files changed (1)

src.core/toxi/geom/LineStrip2D.java

         return uniform;
     }
 
+    /**
+     * Returns a list of {@link Line2D} segments representing the segments
+     * between the vertices of this strip.
+     * 
+     * @return list of lines
+     */
+    public List<Line2D> getEdges() {
+        int num = vertices.size();
+        List<Line2D> edges = new ArrayList<Line2D>(num - 1);
+        for (int i = 1; i < num; i++) {
+            edges.add(new Line2D(vertices.get(i - 1), vertices.get(i)));
+        }
+        return edges;
+    }
+
     public float getLength() {
         if (arcLenIndex == null
                 || (arcLenIndex != null && arcLenIndex.length != vertices