I'm trying to split a generic Shape into list of Points so we can move a certain sprite along the path depending on a certain percentage.
Right now I can split the shape into multiple points:
This was produced by the following code:
shapeComp = system.gui.getParentWindow(event).getComponentForPath('Root Container.Path')
shape=shapeComp.getShape()
pathIterator = FlatteningPathIterator(shape.getPathIterator(AffineTransform()), 1)
graphics = system.gui.getParentWindow(event).graphics
segment = jarray.zeros(6,'d')
path = []
while not pathIterator.isDone():
pathIterator.currentSegment(segment)
path.append([segment[0], segment[1]])
graphics.fillOval(int(segment[0]), int(segment[1]), 5, 5)
pathIterator.next()
As you can see on the picture, the points are not evenly distributed along the path. Is there a way to make the distance between all points the same?