Visual studio and warnings fixes.

fixed visual studio's lack of M_PI definition in math.h. Fixed missing header for std::not1 (<functional>). Fixed all warnings.