Open ikudrickiy opened 6 months ago
I had to call it "refactoring" but initially it seemed to me single instance optimisation was totally useless here (it is not, we have atleast 2 divisions per instance) and I just forgot to rename the issue.
This issue hasn't had any recent activity lately and is being marked as stale automatically.
@ikudrickiy Awesome, these are great suggestions! Definitely watching this video
Context
public rayCast(ray: Ray, farClipDistance = Infinity): boolean
andpublic rayCastTime(ray: Ray, farClipDistance = Infinity): number
blindly follow attached article:tmin
andtmax
variables are initiated for no reasontmax >= Math.max(0, tmin)
contains the original logictmax >= 0 && tmax >= tmin
, but hides it and so reduces readabilitytmin
is actually maxtmin
from a pair ortMaxMin
and so it should be named. Similar stands for 'tmax'Proposal
Optimize the code to get rid of the above shortcomings: