RE: Need help for faster processing
2023-11-02, 21:26 (This post was last modified: 2023-11-02, 21:28 by Travis Cobbs. Edit Reason: Stupid automatic smilies suck )
2023-11-02, 21:26 (This post was last modified: 2023-11-02, 21:28 by Travis Cobbs. Edit Reason: Stupid automatic smilies suck )
(2023-11-02, 21:12)Max Murtazin Wrote: For a while, I've been writing a custom LDraw to Collada converter for Bricklink Studio, as the one currently in the program is, to put it lightly, sucks
Have a problem with it's performance of finding and merging same vertex positions
Here's the code for one I have currently:
...
In short, it subdivides space in sections, in each of which it checks each pair of vertices on if they are close enough to be considered the same, or not. Wonder if there is a way to make it faster
LDView has a custom vertex key class that it uses specifically for merging vertices. The class converts the coordinate values from floats to long (with a scale factor that represents how close together they need to be in each axis) and implements the less than operator. I then use std :: set and std :: map with these vertex keys, and nearby points automatically get merged. I'm not sure if this would be faster than what you're doing or not. Something similar could be done without conversion from float to long. On modern CPUs, I'm honestly not sure how much that conversion helps.