openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.94k stars 2.55k forks source link

Feature reuest: extend ofPolyline to scale, rotate and form bounding cubes #2172

Open OmerShapira opened 11 years ago

OmerShapira commented 11 years ago

In brief: ofPolyline is both 3D and drawable, and should therefore have the traits associated with drawables and 3D objects.

It should have, ideally:

ofPolyline::scale(ofVec3f scaleAmount, ofPoint anchorPoint);
ofPolyline::scale(float scaleAmount, ofPoint anchorPoint);
//anchorPoint can be the center of the bounding box by default

ofPolyline::rotate(ofVec3f angle, ofVec3f axis);
//rotation systems are a matter of taste, there must be a general preference somewhere. I suggest Euler angles by default and an about axis which defaults to (0,0,1)

ofPolyline::getBoundingCube();
//right now getBoundingBox() returns an ofRectangle which isn't a box at all. ofPolylines are 3D

ofPolyline::applyMatrix(ofMatrix4x4 m);
//because some people are just like that, right?

Most of these changes are inspired by 2D masks in After Effects and 3D masks in Flame/Flint/Inferno.

On a side note: right now, ofPolyline::resize() calls vector<ofPoint>::resize() inside it. Polyline is drawable, so I think that's an unhealthy semantic overloading that can be avoided.

I found this issue while extending memo's ofxIldaPoly class, which extends ofPolyline, and as of now contain a lot of the necessary additions.

yty commented 11 years ago

ofPolyline::scale() +1...

This is very necessary ... I do .. are now in the external scale.....