diff options
| author | ProfJski <49599659+ProfJski@users.noreply.github.com> | 2019-05-08 13:54:12 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-08 13:54:12 -0400 |
| commit | d3dae384497f61ad7eb1d9578db8860e6e6336aa (patch) | |
| tree | 664b740a204eaef448a1f3ebd72c297c1818030c /projects/Notepad++ | |
| parent | 97c8a28aaac8d2ac8689d18a619d32107d6b96f7 (diff) | |
| download | raylib-d3dae384497f61ad7eb1d9578db8860e6e6336aa.tar.gz raylib-d3dae384497f61ad7eb1d9578db8860e6e6336aa.zip | |
Update CheckCollisionSpheres() to avoid sqrt
Square root calls are computationally expensive. In this case, they can be avoided. Instead of checking distance<RadA+RadB, check distance squared against (RadA+RadB) squared. The dot product of Vector3Subtract(B,A) with itself gives distance squared, so I used this code instead of an element-by-element computation of distance squared. The only downside is that your geometric code is very readable, whereas this is less so.
Diffstat (limited to 'projects/Notepad++')
0 files changed, 0 insertions, 0 deletions
