I wish to create a dynamic outline to a Shape (AWT) by adding objects (with draw functions) to appropriate positions on screen along the shape’s perimeter. I want a roughly even distance between each object. (An alternative approach to the same affect will be fine.)
How might I acquire the locations for these objects? I know shapes have a path iterator, but I have no idea how to use it.
You might look at a library such as the one described in A Shape Diagram Editor.
If you want to experiment,
GraphPanelis a simple object drawing program that features moveable, resizable, colored nodes connected by edges. If the nodes were a little smaller, they’d be moveable points on aShapethat can be iterated as shown here forPolygon.Addendum: I want a roughly even distance between each object.
The
class Nodeexposes a number of static methods that operate on aList<Node>such asselected. Existing implementations serve, for example, to translate or resize multiple selections as a unit. Functions forAlignandDistributecould be implemented similarly. I’d look atLayoutMangeras an example for the latter.