From cad138f5c91510564ef3aef6b9976c598c0c735a Mon Sep 17 00:00:00 2001 From: Micheal Parks Date: Thu, 29 Feb 2024 14:49:02 -0500 Subject: [PATCH] autoconvert radians to degrees --- package.json | 2 +- src/orientation-vector.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index e98b010..a8d0ef5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@viamrobotics/three", - "version": "0.0.5", + "version": "0.0.6", "license": "Apache-2.0", "type": "module", "files": [ diff --git a/src/orientation-vector.ts b/src/orientation-vector.ts index 3a8b96d..4e067c8 100644 --- a/src/orientation-vector.ts +++ b/src/orientation-vector.ts @@ -131,6 +131,12 @@ export class OrientationVector { } setUnits(units: 'degrees' | 'radians'): this { + if (units === 'degrees' && this.#units === 'radians') { + this.#th = MathUtils.degToRad(this.#th); + } else if (units === 'radians' && this.#units === 'degrees') { + this.#th = MathUtils.radToDeg(this.#th); + } + this.#units = units; return this;