Mercurial Hosting > traffic-intelligence
view include/utils.hpp @ 64:c75bcdaed00f
added functions for plotting points
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Fri, 05 Nov 2010 11:07:44 -0400 |
parents | ef0d7caf8e91 |
children | a52653dca25d |
line wrap: on
line source
#ifndef UTILS_HPP #define UTILS_HPP #include <iofwd> static const double pi = 3.14159265358979323846; /** Opens file for writing with fixed scientific precision. */ void openWriteScientific(ofstream& out, const string& filename, const int& precision); void openWritePrecision(ofstream& out, const string& filename, const int& precision); /** Opens files and checks how it went. */ bool openCheck(ifstream& f, const string& filename, const string& callingFunctionName); bool openCheck(ofstream& f, const string& filename, const string& callingFunctionName); // inline inline double square(const int& a) { return a*a;} /** Implements key bindings, for example for cvWaitKey(). */ inline bool forwardKey(const int& pressedKey) { return (((char)pressedKey) == '+');} inline bool backwardKey(const int& pressedKey) { return (((char)pressedKey) == '-');} inline bool saveKey(const int& pressedKey) { return (((char)pressedKey) == 's' || ((char)pressedKey) == 'S');} inline bool interruptionKey(const int& pressedKey) { return (((char)pressedKey) == 'q' || ((char)pressedKey) == 'Q');} inline bool skipKey(const int& pressedKey) { return (((char)pressedKey) == 'n' || ((char)pressedKey) == 'N');} #endif