vectorv1 {1, 2, 3}; vector v2 = v1.ScaledBy(2); // v2 contains {2, 4, 6}
vectorIn this example, vector `v1` is scaled by a factor of 0.5 to produce `v2`. Package library: The Vector ScaledBy method is available in the C++ Standard Library, which is included as part of any C++ compiler.v1 {1.0f, 2.0f, 3.0f}; vector v2 = v1.ScaledBy(0.5f); // v2 contains {0.5f, 1.0f, 1.5f}