CodingTrain/Coding-Challenges

145_Ray_Casting - optimice performance by using square distance

strech345 opened this issue · 0 comments

when using dist only for compare, its better to use the square distance. Because otherwise quare-root needs to be calculated which is much more cpu heavy.

const d = p5.Vector.dist(this.pos, pt);