Advertisement

how to lengthen a vector?

Started by July 03, 2002 02:41 PM
3 comments, last by CondiS 22 years, 7 months ago
how do i lengthen a vector with an int or float [edited by - CondiS on July 3, 2002 3:45:36 PM]
RTFM and push_back().

http://www.sgi.com/tech/stl
Advertisement
You multiply all of the components of the vector by the scalar (int or float).

I would suggest normalizing the vector first, or making sure it is of length ''1''. Most all graphics APIs have a vector normalization function.

Vector V;int scalar = 10;V.x = 1;V.y = 0;V.z = 0;V.x = V.x * scalar;V.y = V.y * scalar;V.z = V.z * scalar; 
as i thought then =)

thnx.
Hehe, now I''m curious. Which of the radically different responses was actually to what you were asking? I didn''t even think of the possibility that you were asking about a Geometry::Vector, rather than a std::vector.

This topic is closed to new replies.

Advertisement