Login to WatchAwear


Polar Coordinates

If you know how far something is from the center (say, the radius of your watch dial), and what angle it's at (say, the second-hand rotation value), and need to translate that into X and Y coordinates (e.g., moving a shape around as a second hand), you'll need these formulæ. It's handy to define functions for them in the main watch script:

function var_x(r, theta) return r*math.sin(math.rad(theta)) end
function var_y(r, theta) return -r*math.cos(math.rad(theta)) end

Don't forget the math.rad part This is a common mistake, because it's easy to forget, and then you get mystifying results. The lua trigonometry functions (sin, cos, etc.) operate on radians, while WM (and most people) measures angles in degrees. The math.rad() function converts degrees to radians. If you need to convert from radians to degrees (say, after using an arctan function), multiply by 180/math.pi.

Published by Mark Shoulson on 27 August 2015WatchMaker Tips & Tricks Posted

Download the
'WatchAwear - Resources for WatchMaker' App

WatchAwear - Companion for WatchMaker

Download The Best Watch Designing App
for Wear OS, and Tizen:

WatchMaker Beautiful Watches for Android Wear

No smartwatch required!!
Best clock wallpaper for Android!

WatchMaker Live WallPaper