Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Proper use of translate,rotate in ofPath

$
0
0

@cuinjune wrote:

Hi, I just figured out calling translate or rotate BEFORE setting the path doesn't have any effect.
It was only effective when translate, rotate were called after setting the path (e.g rectangle)

For example, when I write

void ofApp::draw(){

ofPath path;
path.translate(ofPoint(100,100,0));
path.rectangle(0, 0, 100, 100);
path.draw();

}

It draws a rectangle at (0,0) so it doesn't get translated.

but when I set rectangle path first and then translate it like below,

void ofApp::draw(){

ofPath path;
path.rectangle(0, 0, 100, 100);
path.translate(ofPoint(100,100,0));
path.draw();

}

Now it properly draws a rectangle at (100,100)

Is this a normal behavior of ofPath?
I think it's a bit confusing to use since ofTranslate and ofRotate gets called before drawing any shape to have an effect.
Could someone please explain why the order is opposite in ofPath? Thank you :slight_smile:

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles