@cuinjune wrote:
I just figured out calling ofPolyline::getArea() returns a negative value if the polyline is set in CCW order.
Here's my test code.
//-------------------------------------------------------------- void ofApp::setup(){ polyline.addVertex(0, -58); polyline.addVertex(-50, 29); polyline.addVertex(50, 29); polyline.close(); cout << polyline.getArea() << endl; } //-------------------------------------------------------------- void ofApp::update(){ } //-------------------------------------------------------------- void ofApp::draw(){ ofTranslate(ofGetWidth()/2, ofGetHeight()/2); polyline.draw(); }
Result:
-4350
Shouldn't it always return positive values or is it intensionally designed this way?
Posts: 1
Participants: 1