Content
@
https://opensea.io/collection/dev-21
0 reply
0 recast
2 reactions
xh3b4sd ↑
@xh3b4sd.eth
I have been working a lot on 2D vector manipulation for an onchain game that I am cooking. An interesting challenge was to constrict a curve as an alternative to standard smoothing functions. And the best approach I found was to simply lower the apex of a triangle of neighbouring nodes. The Golang code I got calculates the updated mid point in 50 nanoseconds per triplet. Check the graph editor if you are interested in visualizing these types of polygons. https://www.desmos.com/calculator/bg2iwrsgpx
1 reply
0 recast
3 reactions
xh3b4sd ↑
@xh3b4sd.eth
Correction, the calculation happens within 2 nanoseconds. I noticed I had the race flag enabled in the benchmarks, which adds a lot of compiler instrumentations.
0 reply
0 recast
0 reaction