[ Video ]
[ About ]
トーラスの座標上の線を結んだら綺麗なんじゃないか?という思い付きでやってみました。いい感じ。
トーラス
https://ja.wikipedia.org/wiki/%E3%83%88%E3%83%BC%E3%83%A9%E3%82%B9
[ Source ]
| 
					 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  | 
						#include "ofMain.h" class ofApp : public ofBaseApp { public: 	void setup(); 	void update(); 	void draw(); 	void keyPressed(int key) {}; 	void keyReleased(int key) {}; 	void mouseMoved(int x, int y) {}; 	void mouseDragged(int x, int y, int button) {}; 	void mousePressed(int x, int y, int button) {}; 	void mouseReleased(int x, int y, int button) {}; 	void mouseEntered(int x, int y) {}; 	void mouseExited(int x, int y) {}; 	void windowResized(int w, int h) {}; 	void dragEvent(ofDragInfo dragInfo) {}; 	void gotMessage(ofMessage msg) {}; 	ofEasyCam cam; 	ofPoint make_point(float radius, float small_radius, float deg, float small_deg); };  | 
					
| 
					 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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62  | 
						#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { 	ofSetFrameRate(60); 	ofBackground(239); 	ofSetWindowTitle("Insta"); 	ofEnableDepthTest(); 	ofSetColor(39); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { 	this->cam.begin(); 	ofRotateX(180); 	float radius = 350; 	float small_radius = 50; 	for (int deg = 0; deg <= 360; deg += 1) { 		ofPoint p1 = make_point(radius, small_radius, deg, deg * 8 + ofGetFrameNum()); 		ofPoint p2 = make_point(radius, small_radius, deg, deg * 8 + ofGetFrameNum() + 180); 		ofDrawLine(p1, p2); 		ofDrawSphere(p1, 2); 		ofDrawSphere(p2, 2); 	} 	this->cam.end(); } //-------------------------------------------------------------- ofPoint ofApp::make_point(float radius, float small_radius, float deg, float small_deg) { 	float x_1 = radius * cos(deg * DEG_TO_RAD); 	float y_1 = radius * sin(deg * DEG_TO_RAD); 	float x_2 = small_radius * cos(small_deg * DEG_TO_RAD) * cos(deg * DEG_TO_RAD); 	float y_2 = small_radius * cos(small_deg * DEG_TO_RAD) * sin(deg * DEG_TO_RAD); 	float x = x_1 + x_2; 	float y = y_1 + y_2; 	float z = small_radius * sin(small_deg * DEG_TO_RAD); 	return ofPoint(x, y, z); } //-------------------------------------------------------------- int main() { 	ofSetupOpenGL(720, 720, OF_WINDOW); 	ofRunApp(new ofApp()); }  |