I have a simple cluster that works well if I pass it one data item but when I pass it a list of items it falls apart. The routine takes a closed curve and a reference point and calculates its moments of inertia by breaking the curve into a bunch of mesh boundaries. Simple numerical integration.
When I attach multiple closed curves the problem is that the indices in the two “forks” of the code do not match. The code at the top creates a list of boundary representations. The code at the bottom returns the centroid of the overall bodies. At the point where the two branches of the code merge (see the red circle in the image), I have a list of four points and a tree with four branches of points, where each branch consists of thousands of points representing the centroids of each of the tiny rectangles in the mesh. But the list of four points does not properly correspond to the branches in the tree, if this makes sense.
Welcome to the forum.
Your question is totally legit, you are already banging your head into data-tree manipulations
… me too.
“moment of inertia” means different things, and also translation into my language doesn’t help.
One thing i’m sure: you could subdivide your curve-section differently.
See the times also, your subdivision took almost 1 second… the other under 100ms.
Can you explain what you expect the cluster should do?
The formulas about d^2 * A seems good.
But you are also trying to re-construct the centroid from the sum of all the samples… why?
It’s not about the centroids, that part is easy. But the moment of inertia requires the distance between the centroid of the entire region and the individual centroids of the meshed regions.
But I think ultimately I am doing something wrong with the two lists, as they are not sychronized. I know that Rhino has some inherent method for calculating these properties of sections, but I am leery of black boxes and would like to complete the calculation myself.
Thanks again. I will work on the closed curve component to see if that helps.