

Quelling the floating point demon in my line rendering code - mortoray
http://mortoray.com/2015/01/07/quelling-the-floating-point-demon-in-my-line-rendering-code/

======
Sharlin

      > angle = Collision2D.AngleBetween( lv, bisectNormal )
      > if( /*cusp*/ angle < 0.1f || angle > Math.PIf - 0.1f ) {
      >    //use alternate corner cap
      > }
    

Just a quick note: you might want to use dot product there:

    
    
      if( /*cusp*/ dotProduct(lv, bisectNormal) < 0.1f ) {
          //use alternate corner cap
      }

~~~
mortoray
I know in some situations you can use dot product and it's an optimization I
will apply. A bit more care must be taken though. The input must be unit
vectors and the output can be positive or negative.

I tend to do my first code as logically clean and then apply optimizations
later. This will likely be replaced by an `IsCusp` function instead, to make
it even clearer, and provide a clean place to do the optimization.

~~~
Sharlin
Oh, indeed. I'm a bit embarrassed I didn't consider the need for normalization
and the potential negative output :P

