Plot 2D curves example.
#include <visp/vpConfig.h>
#include <visp/vpDebug.h>
#include <visp/vpPlot.h>
#include <visp/vpMath.h>
int main ()
{
#if defined(VISP_HAVE_DISPLAY)
try {
vpPlot plot(2, 700, 700, 100, 200,
"Curves...");
char title[40];
strncpy( title, "cos function", 40 );
strncpy( title, "sin function", 40 );
char legend[40];
strncpy( legend, "cos x", 40 );
strncpy( legend, "sin x", 40 );
char unit[40];
strncpy( unit, "x", 40 );
strncpy( unit, "x", 40 );
strncpy( unit, "y", 40 );
strncpy( unit, "y", 40 );
double i = 0;
while(i <= 20*2*M_PI)
{
double co = cos(i);
double si = sin(i);
i+=0.1;
}
return 0;
}
std::cout << "Catch an exception: " << e << std::endl;
return 1;
}
#else
std::cout << "Plot functionalities are not avalaible since no display is available." << std::endl;
#endif
}