openframeworks/openFrameworks — Issue #821: suggest: ofRectangle internal ofVec
Author: danomatika
Created: 2011-11-26 20:19:31+00:00
State: open

It'd be nice if ofRectangle used a ofVec2f or ofVec3f internally so you could do the something like:

ofRectangle myRect;
ofVec2f vel(-1, 2);
myRect.pos += vel;

Now I'm not saying drop the x and y member vars, but link them to the ofVec internals thorugh either a union or reference. A reference would be easy through the constructor:

class ofRectangle {

public:

float &x, &y;
ofVec2f pos;
....

ofRectangle::ofRectangle() : x(pos.x), y(pos.y) {

...

This way we get the best of both worlds ...