diff --git a/index.html b/index.html index cface13..d5b022e 100644 --- a/index.html +++ b/index.html @@ -238,8 +238,12 @@ this.z = z; } + length() { + return Math.sqrt(this.x ** 2 + this.y ** 2 + this.z ** 2); + } + normalize() { - const length = Math.sqrt(this.x ** 2 + this.y ** 2 + this.z ** 2); + const length = this.length(); if (length != 0) { this.x /= length; @@ -365,4 +369,4 @@ - + \ No newline at end of file