#define _USE_MATH_DEFINES#include "../matplotlibcpp.h"#include <cmath>using namespace std;namespace plt = matplotlibcpp;// Example fill plot taken from:// https://matplotlib.org/gallery/misc/fill_spiral.htmlint main() {// Prepare data.vector<double> theta;for (double d = 0; d < 8 * M_PI; d += 0.1)theta.push_back(d);const int a = 1;const double b = 0.2;for (double dt = 0; dt < 2 * M_PI; dt += M_PI/2.0) {vector<double> x1, y1, x2, y2;for (double th : theta) {x1.push_back( a*cos(th + dt) * exp(b*th) );y1.push_back( a*sin(th + dt) * exp(b*th) );x2.push_back( a*cos(th + dt + M_PI/4.0) * exp(b*th) );y2.push_back( a*sin(th + dt + M_PI/4.0) * exp(b*th) );}x1.insert(x1.end(), x2.rbegin(), x2.rend());y1.insert(y1.end(), y2.rbegin(), y2.rend());plt::fill(x1, y1, {});}plt::show();}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。