deanm / plask

Plask is a multimedia programming environment.
www.plask.org
Other
443 stars 38 forks source link

Add distance functions to Vec2 and Vec3 #4

Closed notlion closed 13 years ago

notlion commented 13 years ago

I think we should have this. The other option is to do something like:

vec2.subbed(vec1).length()

which creates a new object, vs:

vec1.distance(vec2)
deanm commented 13 years ago

What do you think about calling it dist() and distSquared()?

You are also missing semicolons after the last } of the function (since it's an assignment statement).

Otherwise sounds great.

deanm commented 13 years ago

Oh yeah, also a period at the end of comments! :)

notlion commented 13 years ago

Doh I knew there would be something. Okay. Made those changes and re-committed.

What do you think about truncating distSquared and lengthSquared to distSq and lengthSq?

deanm commented 13 years ago

The others are squared (lengthSquared). I realize it's length and not len, so maybe it should have been distance() afterall, but dist feels better still in this case. We'll see.

Thanks!