Julian
Julian

Reputation: 9130

Difference between ofVec2f and ofPoint

I'm learning Openframeworks and have found that these two classes are often used to represent sometimes vectors and sometimes points. What are the reasons for using one over the other?

Upvotes: 3

Views: 1792

Answers (1)

Elie Génard
Elie Génard

Reputation: 1683

An ofPoint is in fact just an ofVec3f. It is defined like this:

typedef ofVec3f ofPoint;

(See here for the code)

I think it's just a question of convenience. When you want to represent a point in a 3-dimensional space, it's more explicit to use an ofPoint than an ofVec3f and it makes your code more readable.

Upvotes: 5

Related Questions