+ 2

How to normalize a vector?

How can i normalize a 2d vector in the easiest way possible?

17th Jul 2020, 4:37 AM
MSN
MSN - avatar
9 ответов
+ 3
I finally figured it out. First find the magnitude or length of the vector. Suppose i have a vector (5,3) var x=5,y=3; var length = Math.sqrt(x**2+y**2); //Then divide the x and y by the length. x = x/length; y = y/length; Btw I found the ans in stack over flow.
17th Jul 2020, 6:19 AM
MSN
MSN - avatar
+ 2
Easy on you or the system?
17th Jul 2020, 4:39 AM
Arsenic
Arsenic - avatar
+ 2
Easy for me... 😅😅😅
17th Jul 2020, 4:40 AM
MSN
MSN - avatar
+ 2
No by normalize i mean... Ok let me give an example: Suppose i have a Cartesian Vector (4,2) By normalize it means minimising the vector to the range of 0 to 1 So (4,2) = (1,0.5) But how can i do it in Programming???
17th Jul 2020, 4:43 AM
MSN
MSN - avatar
+ 2
NUHEEN according to your defination of normalisation: Just devide the whole vector with the highest value present in it.
17th Jul 2020, 4:45 AM
Arsenic
Arsenic - avatar
+ 2
Oh. Thanks man I'll notify u if it works! 👍👍👍👍
17th Jul 2020, 4:46 AM
MSN
MSN - avatar
0
By Normalize I'm guessing you mean to make it Pixel-Based. If you made it with code, then idk, but if you import it from an image, try to put it in your Image Editor and Pixelize it just the tiniest bit
17th Jul 2020, 4:40 AM
AlexCreeper
AlexCreeper - avatar
0
You can use the sigmoid function. 1 / 1 + e^-x where x is the value you want to normalise and 'e' is the Mathematical constant or euler's number.
17th Jul 2020, 5:11 AM
Saphal Poudyal
Saphal Poudyal - avatar
0
Just Google it! 🤣🤣🤣🤣
18th Jul 2020, 3:45 AM
MSN
MSN - avatar