@minecraft/math 1.4.2 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/general/clamp.ts", "../src/vector3/coreHelpers.ts", "../src/vector3/vectorWrapper.ts"],
4
- "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Clamps the passed in number to the passed in min and max values.\n *\n * @public\n */\nexport function clampNumber(val: number, min: number, max: number): number {\n return Math.min(Math.max(val, min), max);\n}\n", "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Vector2, Vector3 } from '@minecraft/server';\nimport { clampNumber } from '../general/clamp';\n\n/**\n * Utilities operating on Vector3 objects. All methods are static and do not modify the input objects.\n *\n * @public\n */\nexport class Vector3Utils {\n /**\n * equals\n *\n * Check the equality of two vectors\n */\n static equals(v1: Vector3, v2: Vector3): boolean {\n return v1.x === v2.x && v1.y === v2.y && v1.z === v2.z;\n }\n\n /**\n * add\n *\n * Add two vectors to produce a new vector\n */\n static add(v1: Vector3, v2: Vector3): Vector3 {\n return { x: v1.x + v2.x, y: v1.y + v2.y, z: v1.z + v2.z };\n }\n\n /**\n * subtract\n *\n * Subtract two vectors to produce a new vector (v1-v2)\n */\n static subtract(v1: Vector3, v2: Vector3): Vector3 {\n return { x: v1.x - v2.x, y: v1.y - v2.y, z: v1.z - v2.z };\n }\n\n /** scale\n *\n * Multiple all entries in a vector by a single scalar value producing a new vector\n */\n static scale(v1: Vector3, scale: number): Vector3 {\n return { x: v1.x * scale, y: v1.y * scale, z: v1.z * scale };\n }\n\n /**\n * dot\n *\n * Calculate the dot product of two vectors\n */\n static dot(a: Vector3, b: Vector3): number {\n return a.x * b.x + a.y * b.y + a.z * b.z;\n }\n\n /**\n * cross\n *\n * Calculate the cross product of two vectors. Returns a new vector.\n */\n static cross(a: Vector3, b: Vector3): Vector3 {\n return {\n x: a.y * b.z - a.z * b.y,\n y: a.z * b.x - a.x * b.z,\n z: a.x * b.y - a.y * b.x,\n };\n }\n\n /**\n * magnitude\n *\n * The magnitude of a vector\n */\n static magnitude(v: Vector3): number {\n return Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2);\n }\n\n /**\n * distance\n *\n * Calculate the distance between two vectors\n */\n static distance(a: Vector3, b: Vector3): number {\n return Vector3Utils.magnitude(Vector3Utils.subtract(a, b));\n }\n\n /**\n * normalize\n *\n * Takes a vector 3 and normalizes it to a unit vector\n */\n static normalize(v: Vector3): Vector3 {\n const mag = Vector3Utils.magnitude(v);\n return { x: v.x / mag, y: v.y / mag, z: v.z / mag };\n }\n\n /**\n * floor\n *\n * Floor the components of a vector to produce a new vector\n */\n static floor(v: Vector3): Vector3 {\n return { x: Math.floor(v.x), y: Math.floor(v.y), z: Math.floor(v.z) };\n }\n\n /**\n * toString\n *\n * Create a string representation of a vector3\n */\n static toString(v: Vector3, options?: { decimals?: number; delimiter?: string }): string {\n const decimals = options?.decimals ?? 2;\n const str: string[] = [v.x.toFixed(decimals), v.y.toFixed(decimals), v.z.toFixed(decimals)];\n return str.join(options?.delimiter ?? ', ');\n }\n\n /**\n * clamp\n *\n * Clamps the components of a vector to limits to produce a new vector\n */\n static clamp(\n v: Vector3,\n limits?: {\n min?: Partial<Vector3>;\n max?: Partial<Vector3>;\n }\n ): Vector3 {\n return {\n x: clampNumber(v.x, limits?.min?.x ?? Number.MIN_SAFE_INTEGER, limits?.max?.x ?? Number.MAX_SAFE_INTEGER),\n y: clampNumber(v.y, limits?.min?.y ?? Number.MIN_SAFE_INTEGER, limits?.max?.y ?? Number.MAX_SAFE_INTEGER),\n z: clampNumber(v.z, limits?.min?.z ?? Number.MIN_SAFE_INTEGER, limits?.max?.z ?? Number.MAX_SAFE_INTEGER),\n };\n }\n\n /**\n * lerp\n *\n * Constructs a new vector using linear interpolation on each component from two vectors.\n */\n static lerp(a: Vector3, b: Vector3, t: number): Vector3 {\n return {\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n z: a.z + (b.z - a.z) * t,\n };\n }\n\n /**\n * slerp\n *\n * Constructs a new vector using spherical linear interpolation on each component from two vectors.\n */\n static slerp(a: Vector3, b: Vector3, t: number): Vector3 {\n const theta = Math.acos(Vector3Utils.dot(a, b));\n const sinTheta = Math.sin(theta);\n const ta = Math.sin((1.0 - t) * theta) / sinTheta;\n const tb = Math.sin(t * theta) / sinTheta;\n return Vector3Utils.add(Vector3Utils.scale(a, ta), Vector3Utils.scale(b, tb));\n }\n}\n\n/**\n * Utilities operating on Vector2 objects. All methods are static and do not modify the input objects.\n *\n * @public\n */\nexport class Vector2Utils {\n /**\n * toString\n *\n * Create a string representation of a vector2\n */\n static toString(v: Vector2, options?: { decimals?: number; delimiter?: string }): string {\n const decimals = options?.decimals ?? 2;\n const str: string[] = [v.x.toFixed(decimals), v.y.toFixed(decimals)];\n return str.join(options?.delimiter ?? ', ');\n }\n}\n\n/**\n * up\n *\n * A unit vector representing the world UP direction (0,1,0)\n *\n * @public\n */\nexport const VECTOR3_UP: Vector3 = { x: 0, y: 1, z: 0 };\n/**\n * down\n *\n * A unit vector representing the world DOWN direction (0,-1,0)\n *\n * @public\n */\nexport const VECTOR3_DOWN: Vector3 = { x: 0, y: -1, z: 0 };\n/**\n * left\n *\n * A unit vector representing the world LEFT direction (-1,0,0)\n *\n * @public\n */\nexport const VECTOR3_LEFT: Vector3 = { x: -1, y: 0, z: 0 };\n/**\n * right\n *\n * A unit vector representing the world RIGHT direction (1,0,0)\n *\n * @public\n */\nexport const VECTOR3_RIGHT: Vector3 = { x: 1, y: 0, z: 0 };\n/**\n * forward\n *\n * A unit vector representing the world FORWARD direction (0,0,1)\n *\n * @public\n */\nexport const VECTOR3_FORWARD: Vector3 = { x: 0, y: 0, z: 1 };\n/**\n * back\n *\n * A unit vector representing the world BACK direction (0,0,-1)\n *\n * @public\n */\nexport const VECTOR3_BACK: Vector3 = { x: 0, y: 0, z: -1 };\n/**\n * one\n *\n * A unit vector representing the value of 1 in all directions (1,1,1)\n *\n * @public\n */\nexport const VECTOR3_ONE: Vector3 = { x: 1, y: 1, z: 1 };\n/**\n * zero\n *\n * A unit vector representing the value of 0 in all directions (0,0,0)\n *\n * @public\n */\nexport const VECTOR3_ZERO: Vector3 = { x: 0, y: 0, z: 0 };\n/**\n * west\n *\n * A unit vector representing the world WEST direction (-1,0,0)\n * (same as LEFT)\n *\n * @public\n */\nexport const VECTOR3_WEST: Vector3 = { x: -1, y: 0, z: 0 };\n/**\n * east\n *\n * A unit vector representing the world EAST direction (-1,0,0)\n * (same as RIGHT)\n *\n * @public\n */\nexport const VECTOR3_EAST: Vector3 = { x: 1, y: 0, z: 0 };\n/**\n * north\n *\n * A unit vector representing the world NORTH direction (-1,0,0)\n * (same as FORWARD)\n *\n * @public\n */\nexport const VECTOR3_NORTH: Vector3 = { x: 0, y: 0, z: 1 };\n/**\n * south\n *\n * A unit vector representing the world SOUTH direction (-1,0,0)\n * (same as BACK)\n *\n * @public\n */\nexport const VECTOR3_SOUTH: Vector3 = { x: 0, y: 0, z: -1 };\n", "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Vector2, Vector3 } from '@minecraft/server';\nimport { Vector2Utils, Vector3Utils } from './coreHelpers';\n\n/**\n * Vector3 wrapper class which can be used as a Vector3 for APIs on \\@minecraft/server which require a Vector,\n * but also contain additional helper methods. This is an alternative to using the core Vector 3 utility\n * methods directly, for those who prefer a more object-oriented approach. This version of the class is mutable\n * and changes state inline.\n *\n * For an immutable version of the build, use ImmutableVector3Builder.\n *\n * @public\n */\nexport class Vector3Builder implements Vector3 {\n x: number;\n y: number;\n z: number;\n\n constructor(vec: Vector3, arg?: never, arg2?: never);\n constructor(x: number, y: number, z: number);\n constructor(first: number | Vector3, y?: number, z?: number) {\n if (typeof first === 'object') {\n this.x = first.x;\n this.y = first.y;\n this.z = first.z;\n } else {\n this.x = first;\n this.y = y ?? 0;\n this.z = z ?? 0;\n }\n }\n\n /**\n * Assigns the values of the passed in vector to this vector. Returns itself.\n */\n assign(vec: Vector3): this {\n this.x = vec.x;\n this.y = vec.y;\n this.z = vec.z;\n return this;\n }\n\n /**\n * equals\n *\n * Check the equality of two vectors\n */\n equals(v: Vector3): boolean {\n return Vector3Utils.equals(this, v);\n }\n\n /**\n * add\n *\n * Adds the vector v to this, returning itself.\n */\n add(v: Vector3): this {\n return this.assign(Vector3Utils.add(this, v));\n }\n\n /**\n * subtract\n *\n * Subtracts the vector v from this, returning itself.\n */\n subtract(v: Vector3): this {\n return this.assign(Vector3Utils.subtract(this, v));\n }\n\n /** scale\n *\n * Scales this by the passed in value, returning itself.\n */\n scale(val: number): this {\n return this.assign(Vector3Utils.scale(this, val));\n }\n\n /**\n * dot\n *\n * Computes the dot product of this and the passed in vector.\n */\n dot(vec: Vector3): number {\n return Vector3Utils.dot(this, vec);\n }\n\n /**\n * cross\n *\n * Computes the cross product of this and the passed in vector, returning itself.\n */\n cross(vec: Vector3): this {\n return this.assign(Vector3Utils.cross(this, vec));\n }\n\n /**\n * magnitude\n *\n * The magnitude of the vector\n */\n magnitude(): number {\n return Vector3Utils.magnitude(this);\n }\n\n /**\n * distance\n *\n * Calculate the distance between two vectors\n */\n distance(vec: Vector3): number {\n return Vector3Utils.distance(this, vec);\n }\n\n /**\n * normalize\n *\n * Normalizes this vector, returning itself.\n */\n normalize(): this {\n return this.assign(Vector3Utils.normalize(this));\n }\n\n /**\n * floor\n *\n * Floor the components of a vector to produce a new vector\n */\n floor(): this {\n return this.assign(Vector3Utils.floor(this));\n }\n\n /**\n * toString\n *\n * Create a string representation of a vector\n */\n toString(options?: { decimals?: number; delimiter?: string }): string {\n return Vector3Utils.toString(this, options);\n }\n\n /**\n * clamp\n *\n * Clamps the components of a vector to limits to produce a new vector\n */\n clamp(limits: { min?: Partial<Vector3>; max?: Partial<Vector3> }): this {\n return this.assign(Vector3Utils.clamp(this, limits));\n }\n\n /**\n * lerp\n *\n * Constructs a new vector using linear interpolation on each component from two vectors.\n */\n lerp(vec: Vector3, t: number): this {\n return this.assign(Vector3Utils.lerp(this, vec, t));\n }\n\n /**\n * slerp\n *\n * Constructs a new vector using spherical linear interpolation on each component from two vectors.\n */\n slerp(vec: Vector3, t: number): this {\n return this.assign(Vector3Utils.slerp(this, vec, t));\n }\n}\n\n/**\n * Vector2 wrapper class which can be used as a Vector2 for APIs on \\@minecraft/server which require a Vector2.\n * @public\n */\nexport class Vector2Builder implements Vector2 {\n x: number;\n y: number;\n\n constructor(vec: Vector2, arg?: never);\n constructor(x: number, y: number);\n constructor(first: number | Vector2, y?: number) {\n if (typeof first === 'object') {\n this.x = first.x;\n this.y = first.y;\n } else {\n this.x = first;\n this.y = y ?? 0;\n }\n }\n\n toString(options?: { decimals?: number; delimiter?: string }): string {\n return Vector2Utils.toString(this, options);\n }\n}\n"],
5
- "mappings": ";AAQM,SAAU,YAAY,KAAa,KAAa,KAAW;AAC7D,SAAO,KAAK,IAAI,KAAK,IAAI,KAAK,GAAG,GAAG,GAAG;AAC3C;;;ACCM,IAAO,eAAP,MAAO,cAAY;;;;;;EAMrB,OAAO,OAAO,IAAa,IAAW;AAClC,WAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG;EACzD;;;;;;EAOA,OAAO,IAAI,IAAa,IAAW;AAC/B,WAAO,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,EAAC;EAC3D;;;;;;EAOA,OAAO,SAAS,IAAa,IAAW;AACpC,WAAO,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,EAAC;EAC3D;;;;;EAMA,OAAO,MAAM,IAAa,OAAa;AACnC,WAAO,EAAE,GAAG,GAAG,IAAI,OAAO,GAAG,GAAG,IA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AC;EACpD;;;;;;EAOA,IAAI,KAAY;AACZ,WAAO,aAAa,IAAI,MAAM,GAAG;EACrC;;;;;;EAOA,MAAM,KAAY;AACd,WAAO,KAAK,OAAO,aAAa,MAAM,MAAM,GAAG,CAAC;EACpD;;;;;;EAOA,YAAS;AACL,WAAO,aAAa,UAAU,IAAI;EACtC;;;;;;EAOA,SAAS,KAAY;AACjB,WAAO,aAAa,SAAS,MAAM,GAAG;EAC1C;;;;;;EAOA,YAAS;AACL,WAAO,KAAK,OAAO,aAAa,UAAU,IAAI,CAAC;EACnD;;;;;;EAOA,QAAK;AACD,WAAO,KAAK,OAAO,aAAa,MAAM,IAAI,CAAC;EAC/C;;;;;;EAOA,SAAS,SAAmD;AACxD,WAAO,aAAa,SAAS,MAAM,OAAO;EAC9C;;;;;;EAOA,MAAM,QAA0D;AAC5D,WAAO,KAAK,OAAO,aAAa,MAAM,MAAM,MAAM,CAAC;EACvD;;;;;;EAOA,KAAK,KAAc,GAAS;AACxB,WAAO,KAAK,OAAO,aAAa,KAAK,MAAM,KAAK,CAAC,CAAC;EACtD;;;;;;EAOA,MAAM,KAAc,GAAS;AACzB,WAAO,KAAK,OAAO,aAAa,MAAM,MAAM,KAAK,CAAC,CAAC;EACvD;;AAOE,IAAO,iBAAP,MAAqB;EAMvB,YAAY,OAAyB,GAAU;AAC3C,QAAI,OAAO,UAAU,UAAU;AAC3B,WAAK,IAAI,MAAM;AACf,WAAK,IAAI,MAAM;IACnB,OAAO;AACH,WAAK,IAAI;AACT,WAAK,IAAI,KAAK;IAClB;EACJ;EAEA,SAAS,SAAmD;AACxD,WAAO,aAAa,SAAS,MAAM,OAAO;EAC9C;;",
3
+ "sources": ["../src/general/clamp.ts", "../src/vector3/coreHelpers.ts", "../src/vector3/vectorWrapper.ts", "../src/vector3/index.ts", "../src/general/index.ts", "../src/index.ts"],
4
+ "sourcesContent": ["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Clamps the passed in number to the passed in min and max values.\n *\n * @public\n */\nexport function clampNumber(val: number, min: number, max: number): number {\n return Math.min(Math.max(val, min), max);\n}\n", "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Vector2, Vector3 } from '@minecraft/server';\nimport { clampNumber } from '../general/clamp';\n\n/**\n * Utilities operating on Vector3 objects. All methods are static and do not modify the input objects.\n *\n * @public\n */\nexport class Vector3Utils {\n /**\n * equals\n *\n * Check the equality of two vectors\n */\n static equals(v1: Vector3, v2: Vector3): boolean {\n return v1.x === v2.x && v1.y === v2.y && v1.z === v2.z;\n }\n\n /**\n * add\n *\n * Add two vectors to produce a new vector\n */\n static add(v1: Vector3, v2: Vector3): Vector3 {\n return { x: v1.x + v2.x, y: v1.y + v2.y, z: v1.z + v2.z };\n }\n\n /**\n * subtract\n *\n * Subtract two vectors to produce a new vector (v1-v2)\n */\n static subtract(v1: Vector3, v2: Vector3): Vector3 {\n return { x: v1.x - v2.x, y: v1.y - v2.y, z: v1.z - v2.z };\n }\n\n /** scale\n *\n * Multiple all entries in a vector by a single scalar value producing a new vector\n */\n static scale(v1: Vector3, scale: number): Vector3 {\n return { x: v1.x * scale, y: v1.y * scale, z: v1.z * scale };\n }\n\n /**\n * dot\n *\n * Calculate the dot product of two vectors\n */\n static dot(a: Vector3, b: Vector3): number {\n return a.x * b.x + a.y * b.y + a.z * b.z;\n }\n\n /**\n * cross\n *\n * Calculate the cross product of two vectors. Returns a new vector.\n */\n static cross(a: Vector3, b: Vector3): Vector3 {\n return {\n x: a.y * b.z - a.z * b.y,\n y: a.z * b.x - a.x * b.z,\n z: a.x * b.y - a.y * b.x,\n };\n }\n\n /**\n * magnitude\n *\n * The magnitude of a vector\n */\n static magnitude(v: Vector3): number {\n return Math.sqrt(v.x ** 2 + v.y ** 2 + v.z ** 2);\n }\n\n /**\n * distance\n *\n * Calculate the distance between two vectors\n */\n static distance(a: Vector3, b: Vector3): number {\n return Vector3Utils.magnitude(Vector3Utils.subtract(a, b));\n }\n\n /**\n * normalize\n *\n * Takes a vector 3 and normalizes it to a unit vector\n */\n static normalize(v: Vector3): Vector3 {\n const mag = Vector3Utils.magnitude(v);\n return { x: v.x / mag, y: v.y / mag, z: v.z / mag };\n }\n\n /**\n * floor\n *\n * Floor the components of a vector to produce a new vector\n */\n static floor(v: Vector3): Vector3 {\n return { x: Math.floor(v.x), y: Math.floor(v.y), z: Math.floor(v.z) };\n }\n\n /**\n * toString\n *\n * Create a string representation of a vector3\n */\n static toString(v: Vector3, options?: { decimals?: number; delimiter?: string }): string {\n const decimals = options?.decimals ?? 2;\n const str: string[] = [v.x.toFixed(decimals), v.y.toFixed(decimals), v.z.toFixed(decimals)];\n return str.join(options?.delimiter ?? ', ');\n }\n\n /**\n * clamp\n *\n * Clamps the components of a vector to limits to produce a new vector\n */\n static clamp(\n v: Vector3,\n limits?: {\n min?: Partial<Vector3>;\n max?: Partial<Vector3>;\n }\n ): Vector3 {\n return {\n x: clampNumber(v.x, limits?.min?.x ?? Number.MIN_SAFE_INTEGER, limits?.max?.x ?? Number.MAX_SAFE_INTEGER),\n y: clampNumber(v.y, limits?.min?.y ?? Number.MIN_SAFE_INTEGER, limits?.max?.y ?? Number.MAX_SAFE_INTEGER),\n z: clampNumber(v.z, limits?.min?.z ?? Number.MIN_SAFE_INTEGER, limits?.max?.z ?? Number.MAX_SAFE_INTEGER),\n };\n }\n\n /**\n * lerp\n *\n * Constructs a new vector using linear interpolation on each component from two vectors.\n */\n static lerp(a: Vector3, b: Vector3, t: number): Vector3 {\n return {\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n z: a.z + (b.z - a.z) * t,\n };\n }\n\n /**\n * slerp\n *\n * Constructs a new vector using spherical linear interpolation on each component from two vectors.\n */\n static slerp(a: Vector3, b: Vector3, t: number): Vector3 {\n const theta = Math.acos(Vector3Utils.dot(a, b));\n const sinTheta = Math.sin(theta);\n const ta = Math.sin((1.0 - t) * theta) / sinTheta;\n const tb = Math.sin(t * theta) / sinTheta;\n return Vector3Utils.add(Vector3Utils.scale(a, ta), Vector3Utils.scale(b, tb));\n }\n\n /**\n * multiply\n *\n * Element-wise multiplication of two vectors together.\n * Not to be confused with {@link Vector3Utils.dot} product or {@link Vector3Utils.cross} product\n */\n static multiply(a: Vector3, b: Vector3): Vector3 {\n return {\n x: a.x * b.x,\n y: a.y * b.y,\n z: a.z * b.z,\n };\n }\n\n /**\n * rotateX\n *\n * Rotates the vector around the x axis counterclockwise (left hand rule)\n * @param a - Angle in radians\n */\n static rotateX(v: Vector3, a: number): Vector3 {\n let cos = Math.cos(a);\n let sin = Math.sin(a);\n return {\n x: v.x,\n y: v.y * cos - v.z * sin,\n z: v.z * cos + v.y * sin,\n };\n }\n\n /**\n * rotateY\n *\n * Rotates the vector around the y axis counterclockwise (left hand rule)\n * @param a - Angle in radians\n */\n static rotateY(v: Vector3, a: number): Vector3 {\n let cos = Math.cos(a);\n let sin = Math.sin(a);\n return {\n x: v.x * cos + v.z * sin,\n y: v.y,\n z: v.z * cos - v.x * sin,\n };\n }\n\n /**\n * rotateZ\n *\n * Rotates the vector around the z axis counterclockwise (left hand rule)\n * @param a - Angle in radians\n */\n static rotateZ(v: Vector3, a: number): Vector3 {\n let cos = Math.cos(a);\n let sin = Math.sin(a);\n return {\n x: v.x * cos - v.y * sin,\n y: v.y * cos + v.x * sin,\n z: v.z,\n };\n }\n}\n\n/**\n * Utilities operating on Vector2 objects. All methods are static and do not modify the input objects.\n *\n * @public\n */\nexport class Vector2Utils {\n /**\n * toString\n *\n * Create a string representation of a vector2\n */\n static toString(v: Vector2, options?: { decimals?: number; delimiter?: string }): string {\n const decimals = options?.decimals ?? 2;\n const str: string[] = [v.x.toFixed(decimals), v.y.toFixed(decimals)];\n return str.join(options?.delimiter ?? ', ');\n }\n}\n\n/**\n * up\n *\n * A unit vector representing the world UP direction (0,1,0)\n *\n * @public\n */\nexport const VECTOR3_UP: Vector3 = { x: 0, y: 1, z: 0 };\n/**\n * down\n *\n * A unit vector representing the world DOWN direction (0,-1,0)\n *\n * @public\n */\nexport const VECTOR3_DOWN: Vector3 = { x: 0, y: -1, z: 0 };\n/**\n * left\n *\n * A unit vector representing the world LEFT direction (-1,0,0)\n *\n * @public\n */\nexport const VECTOR3_LEFT: Vector3 = { x: -1, y: 0, z: 0 };\n/**\n * right\n *\n * A unit vector representing the world RIGHT direction (1,0,0)\n *\n * @public\n */\nexport const VECTOR3_RIGHT: Vector3 = { x: 1, y: 0, z: 0 };\n/**\n * forward\n *\n * A unit vector representing the world FORWARD direction (0,0,1)\n *\n * @public\n */\nexport const VECTOR3_FORWARD: Vector3 = { x: 0, y: 0, z: 1 };\n/**\n * back\n *\n * A unit vector representing the world BACK direction (0,0,-1)\n *\n * @public\n */\nexport const VECTOR3_BACK: Vector3 = { x: 0, y: 0, z: -1 };\n/**\n * one\n *\n * A unit vector representing the value of 1 in all directions (1,1,1)\n *\n * @public\n */\nexport const VECTOR3_ONE: Vector3 = { x: 1, y: 1, z: 1 };\n/**\n * zero\n *\n * A unit vector representing the value of 0 in all directions (0,0,0)\n *\n * @public\n */\nexport const VECTOR3_ZERO: Vector3 = { x: 0, y: 0, z: 0 };\n/**\n * west\n *\n * A unit vector representing the world WEST direction (-1,0,0)\n * (same as LEFT)\n *\n * @public\n */\nexport const VECTOR3_WEST: Vector3 = { x: -1, y: 0, z: 0 };\n/**\n * east\n *\n * A unit vector representing the world EAST direction (-1,0,0)\n * (same as RIGHT)\n *\n * @public\n */\nexport const VECTOR3_EAST: Vector3 = { x: 1, y: 0, z: 0 };\n/**\n * north\n *\n * A unit vector representing the world NORTH direction (-1,0,0)\n * (same as FORWARD)\n *\n * @public\n */\nexport const VECTOR3_NORTH: Vector3 = { x: 0, y: 0, z: 1 };\n/**\n * south\n *\n * A unit vector representing the world SOUTH direction (-1,0,0)\n * (same as BACK)\n *\n * @public\n */\nexport const VECTOR3_SOUTH: Vector3 = { x: 0, y: 0, z: -1 };\n", "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Vector2, Vector3 } from '@minecraft/server';\nimport { Vector2Utils, Vector3Utils } from './coreHelpers';\n\n/**\n * Vector3 wrapper class which can be used as a Vector3 for APIs on \\@minecraft/server which require a Vector,\n * but also contain additional helper methods. This is an alternative to using the core Vector 3 utility\n * methods directly, for those who prefer a more object-oriented approach. This version of the class is mutable\n * and changes state inline.\n *\n * For an immutable version of the build, use ImmutableVector3Builder.\n *\n * @public\n */\nexport class Vector3Builder implements Vector3 {\n x: number;\n y: number;\n z: number;\n\n constructor(vec: Vector3, arg?: never, arg2?: never);\n constructor(x: number, y: number, z: number);\n constructor(first: number | Vector3, y?: number, z?: number) {\n if (typeof first === 'object') {\n this.x = first.x;\n this.y = first.y;\n this.z = first.z;\n } else {\n this.x = first;\n this.y = y ?? 0;\n this.z = z ?? 0;\n }\n }\n\n /**\n * Assigns the values of the passed in vector to this vector. Returns itself.\n */\n assign(vec: Vector3): this {\n this.x = vec.x;\n this.y = vec.y;\n this.z = vec.z;\n return this;\n }\n\n /**\n * equals\n *\n * Check the equality of two vectors\n */\n equals(v: Vector3): boolean {\n return Vector3Utils.equals(this, v);\n }\n\n /**\n * add\n *\n * Adds the vector v to this, returning itself.\n */\n add(v: Vector3): this {\n return this.assign(Vector3Utils.add(this, v));\n }\n\n /**\n * subtract\n *\n * Subtracts the vector v from this, returning itself.\n */\n subtract(v: Vector3): this {\n return this.assign(Vector3Utils.subtract(this, v));\n }\n\n /** scale\n *\n * Scales this by the passed in value, returning itself.\n */\n scale(val: number): this {\n return this.assign(Vector3Utils.scale(this, val));\n }\n\n /**\n * dot\n *\n * Computes the dot product of this and the passed in vector.\n */\n dot(vec: Vector3): number {\n return Vector3Utils.dot(this, vec);\n }\n\n /**\n * cross\n *\n * Computes the cross product of this and the passed in vector, returning itself.\n */\n cross(vec: Vector3): this {\n return this.assign(Vector3Utils.cross(this, vec));\n }\n\n /**\n * magnitude\n *\n * The magnitude of the vector\n */\n magnitude(): number {\n return Vector3Utils.magnitude(this);\n }\n\n /**\n * distance\n *\n * Calculate the distance between two vectors\n */\n distance(vec: Vector3): number {\n return Vector3Utils.distance(this, vec);\n }\n\n /**\n * normalize\n *\n * Normalizes this vector, returning itself.\n */\n normalize(): this {\n return this.assign(Vector3Utils.normalize(this));\n }\n\n /**\n * floor\n *\n * Floor the components of a vector to produce a new vector\n */\n floor(): this {\n return this.assign(Vector3Utils.floor(this));\n }\n\n /**\n * toString\n *\n * Create a string representation of a vector\n */\n toString(options?: { decimals?: number; delimiter?: string }): string {\n return Vector3Utils.toString(this, options);\n }\n\n /**\n * clamp\n *\n * Clamps the components of a vector to limits to produce a new vector\n */\n clamp(limits: { min?: Partial<Vector3>; max?: Partial<Vector3> }): this {\n return this.assign(Vector3Utils.clamp(this, limits));\n }\n\n /**\n * lerp\n *\n * Constructs a new vector using linear interpolation on each component from two vectors.\n */\n lerp(vec: Vector3, t: number): this {\n return this.assign(Vector3Utils.lerp(this, vec, t));\n }\n\n /**\n * slerp\n *\n * Constructs a new vector using spherical linear interpolation on each component from two vectors.\n */\n slerp(vec: Vector3, t: number): this {\n return this.assign(Vector3Utils.slerp(this, vec, t));\n }\n\n /**\n * multiply\n *\n * Element-wise multiplication of two vectors together.\n * Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product\n */\n multiply(vec: Vector3): this {\n return this.assign(Vector3Utils.multiply(this, vec));\n }\n\n /**\n * rotateX\n *\n * Rotates the vector around the x axis counterclockwise (left hand rule)\n * @param a - Angle in radians\n */\n rotateX(a: number): this {\n return this.assign(Vector3Utils.rotateX(this, a));\n }\n\n /**\n * rotateY\n *\n * Rotates the vector around the y axis counterclockwise (left hand rule)\n * @param a - Angle in radians\n */\n rotateY(a: number): this {\n return this.assign(Vector3Utils.rotateY(this, a));\n }\n\n /**\n * rotateZ\n *\n * Rotates the vector around the z axis counterclockwise (left hand rule)\n * @param a - Angle in radians\n */\n rotateZ(a: number): this {\n return this.assign(Vector3Utils.rotateZ(this, a));\n }\n}\n\n/**\n * Vector2 wrapper class which can be used as a Vector2 for APIs on \\@minecraft/server which require a Vector2.\n * @public\n */\nexport class Vector2Builder implements Vector2 {\n x: number;\n y: number;\n\n constructor(vec: Vector2, arg?: never);\n constructor(x: number, y: number);\n constructor(first: number | Vector2, y?: number) {\n if (typeof first === 'object') {\n this.x = first.x;\n this.y = first.y;\n } else {\n this.x = first;\n this.y = y ?? 0;\n }\n }\n\n toString(options?: { decimals?: number; delimiter?: string }): string {\n return Vector2Utils.toString(this, options);\n }\n}\n", "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from './coreHelpers';\nexport * from './vectorWrapper';\n", "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from './clamp';\n", "// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport * from './vector3';\nexport * from './general';\n"],
5
+ "mappings": ";;;;;;;;;;;AAQA,aAAgB,YAAY,KAAa,KAAa,KAAW;AAC7D,aAAO,KAAK,IAAI,KAAK,IAAI,KAAK,GAAG,GAAG,GAAG;IAC3C;AAFA,YAAA,cAAA;;;;;;;;;;ACJA,QAAA,UAAA;AAOA,QAAa,eAAb,MAAa,cAAY;;;;;;MAMrB,OAAO,OAAO,IAAa,IAAW;AAClC,eAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG;MACzD;;;;;;MAOA,OAAO,IAAI,IAAa,IAAW;AAC/B,eAAO,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,EAAC;MAC3D;;;;;;MAOA,OAAO,SAAS,IAAa,IAAW;AACpC,eAAO,EAAE,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,EAAC;MAC3D;;;;;MAMA,OAAO,MAAM,IAAa,OAAa;AACnC,eAAO,EAAE,GAAG,GA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Aa,SAAS,MAAM,OAAO;MAC9C;;AAlBJ,YAAA,iBAAA;;;;;;;;;;;;;;;;;;;;;;;;;ACpNA,iBAAA,uBAAA,OAAA;AACA,iBAAA,yBAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;ACDA,iBAAA,iBAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;;;ACAA,iBAAA,mBAAA,OAAA;AACA,iBAAA,mBAAA,OAAA;;;",
6
6
  "names": []
7
7
  }
@@ -1,11 +1,15 @@
1
+ "use strict";
1
2
  // Copyright (c) Microsoft Corporation.
2
3
  // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.clampNumber = void 0;
3
6
  /**
4
7
  * Clamps the passed in number to the passed in min and max values.
5
8
  *
6
9
  * @public
7
10
  */
8
- export function clampNumber(val, min, max) {
11
+ function clampNumber(val, min, max) {
9
12
  return Math.min(Math.max(val, min), max);
10
13
  }
14
+ exports.clampNumber = clampNumber;
11
15
  //# sourceMappingURL=clamp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../src/general/clamp.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,GAAW;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"file":"clamp.js","sourceRoot":"","sources":["../../src/general/clamp.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAElC;;;;GAIG;AACH,SAAgB,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,GAAW;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC;AAFD,kCAEC"}
@@ -1,4 +1,20 @@
1
+ "use strict";
1
2
  // Copyright (c) Microsoft Corporation.
2
3
  // Licensed under the MIT License.
3
- export * from './clamp';
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ __exportStar(require("./clamp"), exports);
4
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/general/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/general/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;AAElC,0CAAwB"}
package/lib/index.js CHANGED
@@ -1,5 +1,21 @@
1
+ "use strict";
1
2
  // Copyright (c) Microsoft Corporation.
2
3
  // Licensed under the MIT License.
3
- export * from './vector3';
4
- export * from './general';
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ __exportStar(require("./vector3"), exports);
20
+ __exportStar(require("./general"), exports);
5
21
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;;;;;;;;;;;;;AAElC,4CAA0B;AAC1B,4CAA0B"}
package/lib/index.test.js CHANGED
@@ -1,9 +1,11 @@
1
+ "use strict";
1
2
  // Copyright (c) Microsoft Corporation.
2
3
  // Licensed under the MIT License.
3
- import { describe, expect, it } from 'vitest';
4
- describe('Test', () => {
5
- it('should pass', () => {
6
- expect(true).toBe(true);
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const vitest_1 = require("vitest");
6
+ (0, vitest_1.describe)('Test', () => {
7
+ (0, vitest_1.it)('should pass', () => {
8
+ (0, vitest_1.expect)(true).toBe(true);
7
9
  });
8
10
  });
9
11
  //# sourceMappingURL=index.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IAClB,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;QACnB,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,mCAA8C;AAE9C,IAAA,iBAAQ,EAAC,MAAM,EAAE,GAAG,EAAE;IAClB,IAAA,WAAE,EAAC,aAAa,EAAE,GAAG,EAAE;QACnB,IAAA,eAAM,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -261,6 +261,34 @@ export declare class Vector3Builder implements Vector3 {
261
261
  * Constructs a new vector using spherical linear interpolation on each component from two vectors.
262
262
  */
263
263
  slerp(vec: Vector3, t: number): this;
264
+ /**
265
+ * multiply
266
+ *
267
+ * Element-wise multiplication of two vectors together.
268
+ * Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product
269
+ */
270
+ multiply(vec: Vector3): this;
271
+ /**
272
+ * rotateX
273
+ *
274
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
275
+ * @param a - Angle in radians
276
+ */
277
+ rotateX(a: number): this;
278
+ /**
279
+ * rotateY
280
+ *
281
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
282
+ * @param a - Angle in radians
283
+ */
284
+ rotateY(a: number): this;
285
+ /**
286
+ * rotateZ
287
+ *
288
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
289
+ * @param a - Angle in radians
290
+ */
291
+ rotateZ(a: number): this;
264
292
  }
265
293
 
266
294
  /**
@@ -358,6 +386,34 @@ export declare class Vector3Utils {
358
386
  * Constructs a new vector using spherical linear interpolation on each component from two vectors.
359
387
  */
360
388
  static slerp(a: Vector3, b: Vector3, t: number): Vector3;
389
+ /**
390
+ * multiply
391
+ *
392
+ * Element-wise multiplication of two vectors together.
393
+ * Not to be confused with {@link Vector3Utils.dot} product or {@link Vector3Utils.cross} product
394
+ */
395
+ static multiply(a: Vector3, b: Vector3): Vector3;
396
+ /**
397
+ * rotateX
398
+ *
399
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
400
+ * @param a - Angle in radians
401
+ */
402
+ static rotateX(v: Vector3, a: number): Vector3;
403
+ /**
404
+ * rotateY
405
+ *
406
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
407
+ * @param a - Angle in radians
408
+ */
409
+ static rotateY(v: Vector3, a: number): Vector3;
410
+ /**
411
+ * rotateZ
412
+ *
413
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
414
+ * @param a - Angle in radians
415
+ */
416
+ static rotateZ(v: Vector3, a: number): Vector3;
361
417
  }
362
418
 
363
419
  export { }
@@ -261,6 +261,34 @@ export declare class Vector3Builder implements Vector3 {
261
261
  * Constructs a new vector using spherical linear interpolation on each component from two vectors.
262
262
  */
263
263
  slerp(vec: Vector3, t: number): this;
264
+ /**
265
+ * multiply
266
+ *
267
+ * Element-wise multiplication of two vectors together.
268
+ * Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product
269
+ */
270
+ multiply(vec: Vector3): this;
271
+ /**
272
+ * rotateX
273
+ *
274
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
275
+ * @param a - Angle in radians
276
+ */
277
+ rotateX(a: number): this;
278
+ /**
279
+ * rotateY
280
+ *
281
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
282
+ * @param a - Angle in radians
283
+ */
284
+ rotateY(a: number): this;
285
+ /**
286
+ * rotateZ
287
+ *
288
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
289
+ * @param a - Angle in radians
290
+ */
291
+ rotateZ(a: number): this;
264
292
  }
265
293
 
266
294
  /**
@@ -358,6 +386,34 @@ export declare class Vector3Utils {
358
386
  * Constructs a new vector using spherical linear interpolation on each component from two vectors.
359
387
  */
360
388
  static slerp(a: Vector3, b: Vector3, t: number): Vector3;
389
+ /**
390
+ * multiply
391
+ *
392
+ * Element-wise multiplication of two vectors together.
393
+ * Not to be confused with {@link Vector3Utils.dot} product or {@link Vector3Utils.cross} product
394
+ */
395
+ static multiply(a: Vector3, b: Vector3): Vector3;
396
+ /**
397
+ * rotateX
398
+ *
399
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
400
+ * @param a - Angle in radians
401
+ */
402
+ static rotateX(v: Vector3, a: number): Vector3;
403
+ /**
404
+ * rotateY
405
+ *
406
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
407
+ * @param a - Angle in radians
408
+ */
409
+ static rotateY(v: Vector3, a: number): Vector3;
410
+ /**
411
+ * rotateZ
412
+ *
413
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
414
+ * @param a - Angle in radians
415
+ */
416
+ static rotateZ(v: Vector3, a: number): Vector3;
361
417
  }
362
418
 
363
419
  export { }
@@ -261,6 +261,34 @@ export declare class Vector3Builder implements Vector3 {
261
261
  * Constructs a new vector using spherical linear interpolation on each component from two vectors.
262
262
  */
263
263
  slerp(vec: Vector3, t: number): this;
264
+ /**
265
+ * multiply
266
+ *
267
+ * Element-wise multiplication of two vectors together.
268
+ * Not to be confused with {@link Vector3Builder.dot} product or {@link Vector3Builder.cross} product
269
+ */
270
+ multiply(vec: Vector3): this;
271
+ /**
272
+ * rotateX
273
+ *
274
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
275
+ * @param a - Angle in radians
276
+ */
277
+ rotateX(a: number): this;
278
+ /**
279
+ * rotateY
280
+ *
281
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
282
+ * @param a - Angle in radians
283
+ */
284
+ rotateY(a: number): this;
285
+ /**
286
+ * rotateZ
287
+ *
288
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
289
+ * @param a - Angle in radians
290
+ */
291
+ rotateZ(a: number): this;
264
292
  }
265
293
 
266
294
  /**
@@ -358,6 +386,34 @@ export declare class Vector3Utils {
358
386
  * Constructs a new vector using spherical linear interpolation on each component from two vectors.
359
387
  */
360
388
  static slerp(a: Vector3, b: Vector3, t: number): Vector3;
389
+ /**
390
+ * multiply
391
+ *
392
+ * Element-wise multiplication of two vectors together.
393
+ * Not to be confused with {@link Vector3Utils.dot} product or {@link Vector3Utils.cross} product
394
+ */
395
+ static multiply(a: Vector3, b: Vector3): Vector3;
396
+ /**
397
+ * rotateX
398
+ *
399
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
400
+ * @param a - Angle in radians
401
+ */
402
+ static rotateX(v: Vector3, a: number): Vector3;
403
+ /**
404
+ * rotateY
405
+ *
406
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
407
+ * @param a - Angle in radians
408
+ */
409
+ static rotateY(v: Vector3, a: number): Vector3;
410
+ /**
411
+ * rotateZ
412
+ *
413
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
414
+ * @param a - Angle in radians
415
+ */
416
+ static rotateZ(v: Vector3, a: number): Vector3;
361
417
  }
362
418
 
363
419
  export { }
@@ -1,12 +1,15 @@
1
+ "use strict";
1
2
  // Copyright (c) Microsoft Corporation.
2
3
  // Licensed under the MIT License.
3
- import { clampNumber } from '../general/clamp';
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.VECTOR3_SOUTH = exports.VECTOR3_NORTH = exports.VECTOR3_EAST = exports.VECTOR3_WEST = exports.VECTOR3_ZERO = exports.VECTOR3_ONE = exports.VECTOR3_BACK = exports.VECTOR3_FORWARD = exports.VECTOR3_RIGHT = exports.VECTOR3_LEFT = exports.VECTOR3_DOWN = exports.VECTOR3_UP = exports.Vector2Utils = exports.Vector3Utils = void 0;
6
+ const clamp_1 = require("../general/clamp");
4
7
  /**
5
8
  * Utilities operating on Vector3 objects. All methods are static and do not modify the input objects.
6
9
  *
7
10
  * @public
8
11
  */
9
- export class Vector3Utils {
12
+ class Vector3Utils {
10
13
  /**
11
14
  * equals
12
15
  *
@@ -108,9 +111,9 @@ export class Vector3Utils {
108
111
  */
109
112
  static clamp(v, limits) {
110
113
  return {
111
- x: clampNumber(v.x, limits?.min?.x ?? Number.MIN_SAFE_INTEGER, limits?.max?.x ?? Number.MAX_SAFE_INTEGER),
112
- y: clampNumber(v.y, limits?.min?.y ?? Number.MIN_SAFE_INTEGER, limits?.max?.y ?? Number.MAX_SAFE_INTEGER),
113
- z: clampNumber(v.z, limits?.min?.z ?? Number.MIN_SAFE_INTEGER, limits?.max?.z ?? Number.MAX_SAFE_INTEGER),
114
+ x: (0, clamp_1.clampNumber)(v.x, limits?.min?.x ?? Number.MIN_SAFE_INTEGER, limits?.max?.x ?? Number.MAX_SAFE_INTEGER),
115
+ y: (0, clamp_1.clampNumber)(v.y, limits?.min?.y ?? Number.MIN_SAFE_INTEGER, limits?.max?.y ?? Number.MAX_SAFE_INTEGER),
116
+ z: (0, clamp_1.clampNumber)(v.z, limits?.min?.z ?? Number.MIN_SAFE_INTEGER, limits?.max?.z ?? Number.MAX_SAFE_INTEGER),
114
117
  };
115
118
  }
116
119
  /**
@@ -137,13 +140,72 @@ export class Vector3Utils {
137
140
  const tb = Math.sin(t * theta) / sinTheta;
138
141
  return Vector3Utils.add(Vector3Utils.scale(a, ta), Vector3Utils.scale(b, tb));
139
142
  }
143
+ /**
144
+ * multiply
145
+ *
146
+ * Element-wise multiplication of two vectors together.
147
+ * Not to be confused with {@link Vector3Utils.dot} product or {@link Vector3Utils.cross} product
148
+ */
149
+ static multiply(a, b) {
150
+ return {
151
+ x: a.x * b.x,
152
+ y: a.y * b.y,
153
+ z: a.z * b.z,
154
+ };
155
+ }
156
+ /**
157
+ * rotateX
158
+ *
159
+ * Rotates the vector around the x axis counterclockwise (left hand rule)
160
+ * @param a - Angle in radians
161
+ */
162
+ static rotateX(v, a) {
163
+ let cos = Math.cos(a);
164
+ let sin = Math.sin(a);
165
+ return {
166
+ x: v.x,
167
+ y: v.y * cos - v.z * sin,
168
+ z: v.z * cos + v.y * sin,
169
+ };
170
+ }
171
+ /**
172
+ * rotateY
173
+ *
174
+ * Rotates the vector around the y axis counterclockwise (left hand rule)
175
+ * @param a - Angle in radians
176
+ */
177
+ static rotateY(v, a) {
178
+ let cos = Math.cos(a);
179
+ let sin = Math.sin(a);
180
+ return {
181
+ x: v.x * cos + v.z * sin,
182
+ y: v.y,
183
+ z: v.z * cos - v.x * sin,
184
+ };
185
+ }
186
+ /**
187
+ * rotateZ
188
+ *
189
+ * Rotates the vector around the z axis counterclockwise (left hand rule)
190
+ * @param a - Angle in radians
191
+ */
192
+ static rotateZ(v, a) {
193
+ let cos = Math.cos(a);
194
+ let sin = Math.sin(a);
195
+ return {
196
+ x: v.x * cos - v.y * sin,
197
+ y: v.y * cos + v.x * sin,
198
+ z: v.z,
199
+ };
200
+ }
140
201
  }
202
+ exports.Vector3Utils = Vector3Utils;
141
203
  /**
142
204
  * Utilities operating on Vector2 objects. All methods are static and do not modify the input objects.
143
205
  *
144
206
  * @public
145
207
  */
146
- export class Vector2Utils {
208
+ class Vector2Utils {
147
209
  /**
148
210
  * toString
149
211
  *
@@ -155,6 +217,7 @@ export class Vector2Utils {
155
217
  return str.join(options?.delimiter ?? ', ');
156
218
  }
157
219
  }
220
+ exports.Vector2Utils = Vector2Utils;
158
221
  /**
159
222
  * up
160
223
  *
@@ -162,7 +225,7 @@ export class Vector2Utils {
162
225
  *
163
226
  * @public
164
227
  */
165
- export const VECTOR3_UP = { x: 0, y: 1, z: 0 };
228
+ exports.VECTOR3_UP = { x: 0, y: 1, z: 0 };
166
229
  /**
167
230
  * down
168
231
  *
@@ -170,7 +233,7 @@ export const VECTOR3_UP = { x: 0, y: 1, z: 0 };
170
233
  *
171
234
  * @public
172
235
  */
173
- export const VECTOR3_DOWN = { x: 0, y: -1, z: 0 };
236
+ exports.VECTOR3_DOWN = { x: 0, y: -1, z: 0 };
174
237
  /**
175
238
  * left
176
239
  *
@@ -178,7 +241,7 @@ export const VECTOR3_DOWN = { x: 0, y: -1, z: 0 };
178
241
  *
179
242
  * @public
180
243
  */
181
- export const VECTOR3_LEFT = { x: -1, y: 0, z: 0 };
244
+ exports.VECTOR3_LEFT = { x: -1, y: 0, z: 0 };
182
245
  /**
183
246
  * right
184
247
  *
@@ -186,7 +249,7 @@ export const VECTOR3_LEFT = { x: -1, y: 0, z: 0 };
186
249
  *
187
250
  * @public
188
251
  */
189
- export const VECTOR3_RIGHT = { x: 1, y: 0, z: 0 };
252
+ exports.VECTOR3_RIGHT = { x: 1, y: 0, z: 0 };
190
253
  /**
191
254
  * forward
192
255
  *
@@ -194,7 +257,7 @@ export const VECTOR3_RIGHT = { x: 1, y: 0, z: 0 };
194
257
  *
195
258
  * @public
196
259
  */
197
- export const VECTOR3_FORWARD = { x: 0, y: 0, z: 1 };
260
+ exports.VECTOR3_FORWARD = { x: 0, y: 0, z: 1 };
198
261
  /**
199
262
  * back
200
263
  *
@@ -202,7 +265,7 @@ export const VECTOR3_FORWARD = { x: 0, y: 0, z: 1 };
202
265
  *
203
266
  * @public
204
267
  */
205
- export const VECTOR3_BACK = { x: 0, y: 0, z: -1 };
268
+ exports.VECTOR3_BACK = { x: 0, y: 0, z: -1 };
206
269
  /**
207
270
  * one
208
271
  *
@@ -210,7 +273,7 @@ export const VECTOR3_BACK = { x: 0, y: 0, z: -1 };
210
273
  *
211
274
  * @public
212
275
  */
213
- export const VECTOR3_ONE = { x: 1, y: 1, z: 1 };
276
+ exports.VECTOR3_ONE = { x: 1, y: 1, z: 1 };
214
277
  /**
215
278
  * zero
216
279
  *
@@ -218,7 +281,7 @@ export const VECTOR3_ONE = { x: 1, y: 1, z: 1 };
218
281
  *
219
282
  * @public
220
283
  */
221
- export const VECTOR3_ZERO = { x: 0, y: 0, z: 0 };
284
+ exports.VECTOR3_ZERO = { x: 0, y: 0, z: 0 };
222
285
  /**
223
286
  * west
224
287
  *
@@ -227,7 +290,7 @@ export const VECTOR3_ZERO = { x: 0, y: 0, z: 0 };
227
290
  *
228
291
  * @public
229
292
  */
230
- export const VECTOR3_WEST = { x: -1, y: 0, z: 0 };
293
+ exports.VECTOR3_WEST = { x: -1, y: 0, z: 0 };
231
294
  /**
232
295
  * east
233
296
  *
@@ -236,7 +299,7 @@ export const VECTOR3_WEST = { x: -1, y: 0, z: 0 };
236
299
  *
237
300
  * @public
238
301
  */
239
- export const VECTOR3_EAST = { x: 1, y: 0, z: 0 };
302
+ exports.VECTOR3_EAST = { x: 1, y: 0, z: 0 };
240
303
  /**
241
304
  * north
242
305
  *
@@ -245,7 +308,7 @@ export const VECTOR3_EAST = { x: 1, y: 0, z: 0 };
245
308
  *
246
309
  * @public
247
310
  */
248
- export const VECTOR3_NORTH = { x: 0, y: 0, z: 1 };
311
+ exports.VECTOR3_NORTH = { x: 0, y: 0, z: 1 };
249
312
  /**
250
313
  * south
251
314
  *
@@ -254,5 +317,5 @@ export const VECTOR3_NORTH = { x: 0, y: 0, z: 1 };
254
317
  *
255
318
  * @public
256
319
  */
257
- export const VECTOR3_SOUTH = { x: 0, y: 0, z: -1 };
320
+ exports.VECTOR3_SOUTH = { x: 0, y: 0, z: -1 };
258
321
  //# sourceMappingURL=coreHelpers.js.map