forked from alandefreitas/matplotplusplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfplot3_4.cpp
28 lines (24 loc) · 798 Bytes
/
fplot3_4.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <cmath>
#include <thread>
#include <matplot/matplot.h>
int main() {
using namespace matplot;
auto xt = [](double t) { return exp(-abs(t)/10) * sin(5*abs(t)); };
auto yt = [](double t) { return exp(-abs(t)/10) * cos(5*abs(t)); };
auto zt = [](double t) { return t; };
auto fp = fplot3(xt, yt, zt)->t_range({-10,10}).color("r");
xlabel("e^{-|z|/10} sin(2|z|)");
ylabel("e^{-|z|/10} cos(2|z|)");
zlabel("z");
grid(true);
auto ax = gca();
float da = ax->azimuth();
float de = ax->elevation();
for (size_t i = 0; i <= 180; ++i) {
view(da+2*i, de+i);
title("Azimuth: " + num2str(da+2*i) + " Elevation: " + num2str(de+i));
std::this_thread::sleep_for(std::chrono::milliseconds(50));
}
wait();
return 0;
}