Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void RunScript(List<Curve> C, ref object G)
- {
- DataTree<Curve> CurveGroups = new DataTree<Curve>();
- bool[] Assigned = new bool[C.Count];
- int PathCounter = 0;
- for (int i = 0; i < C.Count; i++)
- {
- if (!Assigned[i])
- {
- List<int> GroupIndices = new List<int>();
- GroupIndices.Add(i);
- CurveGroups.Add(C[i], new GH_Path(PathCounter));
- Assigned[i] = true;
- do
- {
- for (int j = 0; j < C.Count; j++)
- {
- if (j != GroupIndices[0] && !Assigned[j])
- {
- Rhino.Geometry.Intersect.CurveIntersections CI =
- Rhino.Geometry.Intersect.Intersection.CurveCurve(C[GroupIndices[0]], C[j], RhinoDoc.ActiveDoc.ModelAbsoluteTolerance, 0);
- if (CI.Count > 0)
- {
- GroupIndices.Add(j);
- CurveGroups.Add(C[j], new GH_Path(PathCounter));
- Assigned[j] = true;
- }
- }
- }
- GroupIndices.RemoveAt(0);
- } while (GroupIndices.Count > 0);
- PathCounter += 1;
- }
- }
- G = CurveGroups;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement