This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Normalize vs Normalized

Tags: None
(comma "," separated)
Waxwing
Registered Member
Posts
10
Karma
0
OS

Normalize vs Normalized

Wed Aug 17, 2011 12:43 pm
Why do we need both?

At the moment I can replace normalized() with normalize() when the return type is a void.

Code: Select all
void Arcball::endTracking() {
   
   q = delta_q * q;
   q.normalize();
}


But not when I need to return a value.

Code: Select all
Vector3d d = (p2 - p1).normalized();


I'd prefer it if we just had normalize(), but I guess it is too late for that now.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Normalize vs Normalized

Wed Aug 17, 2011 7:37 pm
they does a different job, one returns the normalized vector without modifying it, while the other does an inplace normalization. We offer both to accommodate for different use cases and user tastes.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]