3 ms·
For certain purposes (like graphics programming), this is not a viable option. Not only are you bounded by time (16ms for a single frame means you have to limit
by ohgodplsno 4y ago
For certain purposes (like graphics programming), this is not a viable option. Not only are you bounded by time (16ms for a single frame means you have to limit the number of points you sample, which may mean that from one frame to the other, you have way less samples), but checking for the distance is way, way less efficient than a simple math expression that can be easily parallelized.
- antirez 4y agoI think you can avoid taking the square root in the distance formula (by squaring the comparison term), so this actually could be the fastest way possible to reach the effect, because of all the sampling, the points outside are a minority. What the tweets mention instead is you need to take the square root, that is the slowest thing in the expression.
- whyever 4y agoThat is indeed the fastest way in my experience (at least on the CPU). It's very unlikely to have more than a few rejections, so any method that requires evaluating trigonometric functions cannot compete.
- hyperbovine 4y agoThe story on a GPU is much different though, thanks to branch divergence.
- Jarmsy 4y agoIt's not too bad in 2d, but the efficiency of the rejection method gets very bad in higher dimensions.