本文整理汇总了C++中Plotter::plot方法的典型用法代码示例。如果您正苦于以下问题:C++ Plotter::plot方法的具体用法?C++ Plotter::plot怎么用?C++ Plotter::plot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plotter
的用法示例。
在下文中一共展示了Plotter::plot方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlotAll
static void PlotAll (Scene& scene, Plotter& plotter)
{
Vector x(1,steps), Pot(1,steps);
for (int i = 1; i <= steps; i++) {
x(i) = xmin + (i-1)*(xmax-xmin)/(steps-1);
Pot(i) = V(x(i));
}
plotter.clear();
double ymin = -1, ymax = min(6.0,max(1.0,Max(Pot))); // betwwen 1 and 6 !!
plotter.axisframe(xmin,xmax,ymin,ymax, "x","V(x), Psi(x)");
plotter.style(plotter.LINES);
plotter.plot(x,Pot); // potential
scene.Line(xmin,ymin,xmin,ymax);
scene.Line(xmax,ymin,xmax,ymax);
scene.SetColor(ColorB(255,0,0)); // wave function
plotter.plot(x,Psi);
scene.SetColor(ColorB(0,0,255)); // eigen energy
scene.Line(xmin,E,xmax,E);
scene.SetTextStyle(Standard);
char label[60];
sprintf(label,"E=%.8g",E);
scene.Write(xmin+0.01,E+0.05,label);
}
示例2: erase
void paddleType::erase (Plotter& g)
{
if (oldLoc.getX() != loc.getX())
{
g.setColor(black);
for(int i = -width/2; i <= width/2; i ++)
{
g.plot(oldLoc.getX() + i, oldLoc.getY(), SQUARE);
}
}
}
示例3: draw
void paddleType::draw (Plotter& g)
{
if (oldLoc.getX() != loc.getX())
{
g.setColor(color);
for(int i = -width/2; i <= width/2; i ++)
{
g.plot(loc.getX() + i, loc.getY(), SQUARE);
}
}
oldLoc = loc;
}
示例4: Draw
void Ship::Draw(double x, double y)
{
// draw ship
Plotter p;
for (int r = 0; r < 5; r++)
{
for (int c = 0; c < 5; c++)
{
p.setColor(rocket[r][c]);
p.plot(x + c, y + r, SQUARE);
}
}
}
示例5: printPicture
//Picture that prints rocket
void printPicture(char ch)
{
Plotter screen;
int x=200;
int y=200;
if(ch=='@')
{
screen.setColor(darkgreen);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='0')
{
screen.setColor(darkgreen);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='8')
{
screen.setColor(green);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='b')
{
screen.setColor(blue);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='C')
{
screen.setColor(yellow);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='G')
{
screen.setColor(darkyellow);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='O')
{
screen.setColor(black);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='#')
{
screen.setColor(red);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if (ch==';')
{
screen.setColor(red);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch==',')
{
screen.setColor(white);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='+')
{
screen.setColor(grey);
screen.plot(x,y,SQUARE);
x++;
y++;
}
else if(ch=='`')
{
screen.setColor(grey);
screen.plot(x,y,SQUARE);
x++;
y++;
}
//.........这里部分代码省略.........
示例6: main
int main(int argc, char *argv[]) {
FILE* fp = fopen("config.txt", "r");
if (fp) {
int a, b;
if (fscanf(fp," cores %d", &a) == 1) plotter.n_threads = a;
if (fscanf(fp," def_res %d %d", &a, &b) == 2) {
gfx.screen_w_default = a;
gfx.screen_h_default = b;
}
if (fscanf(fp," max_iter %d", &a) == 1) plotter.max_iter = a;
}
if (SDL_Init(SDL_INIT_EVERYTHING) == -1 || !gfx.init()) return 1;
plotter.init();
plotter.resize(gfx.get_screen_w(), gfx.get_screen_h());
plotter.plot();
while (true) {
frame_time = SDL_GetTicks();
input.update();
if (input.key_pressed(SDLK_ESCAPE) || input.is_quitting())
break;
if (input.key_down( SDLK_LCTRL ) &&
input.mouse_pressed(SDL_BUTTON_LEFT)) {
plotter.center();
} else if (input.mouse_pressed(SDL_BUTTON_LEFT)) {
if (input.key_down(SDLK_LSHIFT)) {
plotter.zoom(zoom_factor * 5);
} else {
plotter.zoom(zoom_factor);
}
} else if (input.mouse_pressed(SDL_BUTTON_RIGHT)) {
if (input.key_down(SDLK_LSHIFT)) {
plotter.zoom(1/(zoom_factor * 5));
} else {
plotter.zoom(1/zoom_factor);
}
}
if (input.key_pressed(SDLK_f)) {
plotter.end_plotting();
gfx.toggle_fullscreen();
plotter.resize(gfx.get_screen_w(), gfx.get_screen_h());
plotter.plot();
//zoom_on();
}
if (input.key_pressed(SDLK_p)) {
plotter.print_pos();
}
gfx.update();
int time_rem = 1000 / FPS - (SDL_GetTicks() - frame_time);
if (time_rem >= 5)
SDL_Delay(time_rem);
}
plotter.end_plotting();
SDL_Quit();
return 0;
}