iooxa.dev - logo

NPM Version MIT License GitHub Stars Twitter Follow

Coordinate Transformation

How do you change from a radial coordinate system to Cartesian coordinate system?!

Cartesian Coordinate System

$x$
$y$

Radial Coordinate System

$r$
$\theta$
°

Cartesian Update- $x$

x = <r-dynamic :value="x" :change="{x: value}"></r-dynamic>

Cartesian Update - $y$

y = <r-dynamic :value="y" :change="{y: value}"></r-dynamic>

Radius Update - $r$

r &= \sqrt{x^2 + y^2} = \\ x &= r \cos(\operatorname{atan2}(y, x)) = \\ y &= r \sin(\operatorname{atan2}(y, x)) = <r-dynamic :value="Math.sqrt(x*x + y*y)" :change="{ x: value * Math.cos(Math.atan2(y, x)), y: value * Math.sin(Math.atan2(y, x)) }"></r-dynamic>

Theta Update - $\theta$

\theta &= \operatorname{atan2}(y, x) = \\ x &= \sqrt{x^2 + y^2} \cos( \theta ) = \\ y &= \sqrt{x^2 + y^2} \sin( \theta ) = <r-dynamic :value="Math.atan2(y, x)" :change="{ x: Math.sqrt(x*x + y*y) * Math.cos(value), y: Math.sqrt(x*x + y*y) * Math.sin(value) }"></r-dynamic>

Made with love by iooxa
Last updated July 10th, 2020