Hiya,
I'm trying to figure out a way to code my trigonometry so that
collections of points are correctly associated with the right geometric
objects. These objects are created dynamically [randomly] at run time so
I can't know which points belong to which geometric shape.
Where I am scratching my head is with the following,
I have 5 points:
A,B,C,D,E
These 5 points all have little arrays that tell them who they are next
to [ie who they should make a shape with]:
A = [A,B,C]
B = [A,B,C]
C = [A,B,C,D,E]
D = [C,D,E]
E = [C,D,E]
My problem is, I need to break C into two arrays:
A = [A,B,C]
B = [A,B,C]
C = [[A,B,C],[C,D,E]]
D = [C,D,E]
E = [C,D,E]
Which results in 2 shapes:
[A,B,C] and [C,D,E]
And there are not always 5 points, there could be any number of points,
less or more, so it could also get more complex like this:
A= [A,B]
B= [A,B,C,D]
C= [B,C,D,E]
D= [B,C,D,E]
E= [C,D,E,F,G,H]
F= [E,F,G,H]
G= [E,F,G,H]
H= [E,F,G,H]
In this second example, it should break into 4 different shapes/arrays:
A= [A,B]
B= [[A,B],[B,C,D]]
C= [[B,C,D],[C,D,E]]
D= [[B,C,D],[C,D,E]]
E= [[C,D,E],[E,F,G,H]]
F= [[C,D,E],[E,F,G,H]]
G= [[C,D,E],[E,F,G,H]]
H= [[C,D,E],[E,F,G,H]]
which results in these 4 shapes:
[A,B],[B,C,D],[C,D,E],[E,F,G,H]
Can anyone think of a good way [not processor heavy] for me to correctly
create sub-arrays that match the points being generated? The only way I
can think of is doing some complex array compares, by building arrays
from arrays of other arrays... but that seems convoluted...?
Thank you so much,
Sebastian.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders