|
|
Tim Cook <z99### [at] gmailcom> wrote:
> scott wrote:
> >> 53: Vec nl=n.dot(r.d)<0?n:n*-1;
> >>
> >> different from "nl = -abs(n.dot(r.d))"?
> >
> > a?b:c evaluates to b if a is true, or c otherwise.
> LPC might be a little different, but can't you negate a variable by
> saying a=-a;? Saves a little CPU cost.
Yes, but since 'nl' is of type struct Vec, he would have to define
operator-() for it for that to work. Maybe he wanted to save one line
of code.
--
- Warp
Post a reply to this message
|
|