Skip to content

Latest commit

 

History

History
62 lines (31 loc) · 902 Bytes

File metadata and controls

62 lines (31 loc) · 902 Bytes

Home > @josh-brown/vector > normalize

normalize() function

Returns a vector with the same direction as the input v, but with a Euclidean norm of 1

Signature:

export declare function normalize<S>(v: Vector<S>): Vector<S> | undefined;

Parameters

Parameter

Type

Description

v

Vector<S>

The vector to normalize

Returns:

Vector<S> | undefined

Example

const v = vec(3, 4);
const normalized = normalize(v); // [ 0.6, 0.8 ]