【发布时间】:2018-05-24 20:09:30
【问题描述】:
我正在尝试将通用形状拆分为点列表,以便我们可以根据特定百分比沿路径移动特定精灵。
现在我可以将形状分成多个点:
这是由以下代码生成的:
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()
正如您在图片上看到的,这些点沿路径分布不均。有没有办法让所有点之间的距离都一样?
【问题讨论】:
标签: java math jython java-2d bezier