简介

使用旋转的方式来绘制

code

void Tests::test02() {
	qglviewer::Quaternion q;
	q.setAxisAngle(qglviewer::Vec(0, 0, 1), M_PI / 180.0);
	
	qglviewer::Vec r(1, 0, 0);
	s.push_back({ r[0], r[1], r[2] });
	for (int i = 0; i < 360; i++) {
		r = q * r;
		s.push_back({ r[0], r[1], r[2] });
	}
	getResult();
}

void Tests::getResult() {
	//if (getData()->edges.size() == 0) {
	//	getData()->edges.push_back(std::vector<V3f>());
	//}
	getData()->edges.push_back(std::vector<V3f>());
	for (int i = 0; i < s.size()-1; i++) {
		getData()->edges[0].push_back(s[i]);
		getData()->edges[0].push_back(s[i+1]);
	}
}

image

posted on 2022-01-05 23:11  HDU李少帅  阅读(86)  评论(0编辑  收藏  举报