The most elegant way of doing this that cam eot mind was using trigonometry.
x = r*cos(theta);
y = r*sin(theta);
Given a radius r and angle theta you can calcuate the x and y coordiantes of a point.
multiple braches can be created around a point using different values for "theta".
Chains of nodes can be calcuaated using a const value for theta and making the coordinates cumulative.
So using actionscript we can gernalize this to create a coordiante calcuator that uses a set of constants to calcuate the node position based on its ID number.
code..
Each node position is calcuated from a series of cumulative steps. A step value is calcuated for x and y and then added to a running total for each number cluster in a node id. once all the number clusters a node id has been cycled through the final total is returned which gives the resulting x and y coordinates for that node ID, this is then stored in a corrdinate array.
This process continues until each node ID has a X and Y coordinate.
No comments:
Post a Comment