@cuinjune wrote:
Hi, I just found out the two functions return different values.
Shouldn't they do the same thing in 2d space?Here's my test code.
//-------------------------------------------------------------- void ofApp::setup(){ ofPath path; path.moveTo(100, 100); path.lineTo(200, 100); path.lineTo(200, 200); path.lineTo(100, 200); path.lineTo(150, 150); path.close(); polyline = path.getOutline()[0]; mesh = path.getTessellation(); cout << polyline.getCentroid2D() << endl; cout << mesh.getCentroid() << endl; } //-------------------------------------------------------------- void ofApp::update(){ } //-------------------------------------------------------------- void ofApp::draw(){ polyline.draw(); ofTranslate(200, 0); mesh.draw(); }
If you run the code, it outputs
161.111, 150, 0
150, 150, 0The shapes look exactly the same though.
Why does the two functions return different values and which one is correct?
Thanks in advance!
Posts: 1
Participants: 1