Plot 2D curves example.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpDebug.h>
#include <visp3/gui/vpPlot.h>
#include <visp3/core/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
}