RE: List of Parts and Connections
2024-02-26, 7:06 (This post was last modified: 2024-02-26, 7:07 by Cole.)
2024-02-26, 7:06 (This post was last modified: 2024-02-26, 7:07 by Cole.)
(2024-01-23, 6:59)Basil Bader Wrote: I have developed something similar recently. The code has three main parts:
1. Parsing the LDCad snap metas and converting them to a slightly different structure. This isn't difficult, it just took some time to fully understand the snap meta format.
2. Finding out which parts can interact (Broadphase collision). Each part has a bounding box. An AABB tree is built to efficiently find all the pairs where the bounding boxes intersect.
3. For each pair that intersects: Iterate through all combinations of connectors of both parts to determine which connectors are connected. This sounds computationally expensive, but most combinations can be ruled out pretty fast (cylindrical connectors must be colinear for example).
This method is pretty fast. I can compute a full connection graph for datsville in a few seconds on my i7-6700k. But the graph is too large to visualize with GraphViz.
Here's a visualization of a submodel of the Porsche 911 OMR model:
That's very cool! I'm surprised that Graphviz won't handle it. I manually made the 42052 helicopter from the instructions and networkx was able to process and present it just fine—about 1100 pieces.
Any advice on the snap meta part? I'm unsure what that is, other than seeing a few references to connectivity files. I've started looking at just the file tree with the idea being to examine intersections via alphashape collisions. Convex full would be faster, but that only works with some parts. In the end, even if it's time-consuming, it'll be quicker than making it myself lol