- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm making a recursive function to create a solid which is the union of all solids that are given. Here's my code:
private static Solid SolidByUnion(List<Solid> solids) { Solid result; if (solids.Count > 2) { List<Solid> restOfSolids = solids.Skip(0).Take(solids.Count - 1).ToList(); Solid solid1 = solids[0]; Solid solid2 = SolidByUnion(restOfSolids); result = BooleanOperationsUtils.ExecuteBooleanOperation(solid1, solid2, BooleanOperationsType.Union); return result; } else { Solid solid1 = solids[0]; Solid solid2 = solids[1]; result = BooleanOperationsUtils.ExecuteBooleanOperation(solid1, solid2, BooleanOperationsType.Union); return result; } }
However what I'm getting as the result is only the union of first two ( or maybe last two ) solids in the list. It's probably a basic recursion mistake but I can't figure out what I'm doing wrong here. Any hints?
Thanks.
Solved! Go to Solution.
Link copied