You can use the modulus operation. With integers this is the % operator, with floats you can use std::fmod // \brief Calculates the sum of two angles // \param[in] a First angle [degrees] // \param[in] b Second angle [degrees] // \return Sum of two angles [degrees, [0, 360)] double AddAngles(double...

I'm not entirely sure if you are hung up on the syntax or the algorithmic part of this problem. I figure the syntax is simpler to look up so I will offer the simple calculation. Your tuple will be calculated using the lua math functions: math.rad, math.cos, math.sin {math.cos(math.rad(degrees)), math.sin(math.rad(degrees))}...

local function Rotate(X, Y, alpha) local c, s = math.cos(math.rad(alpha)), math.sin(math.rad(alpha)) local t1, t2, t3 = X[1]*s, X[2]*s, X[3]*s X[1], X[2], X[3] = X[1]*c+Y[1]*s, X[2]*c+Y[2]*s, X[3]*c+Y[3]*s Y[1], Y[2], Y[3] = Y[1]*c-t1, Y[2]*c-t2, Y[3]*c-t3 end local function convert_rotations(Yaw, Pitch, Roll) local F, L, T = {1,0,0}, {0,1,0}, {0,0,1} Rotate(F, L, Yaw)...

actionscript-3,geometry,displayobject,angles

const radiance:Number=180/Math.PI; angle=-(Math.atan2(mouseX-panel.x, mouseY-panel.y))*radiance; I used minus because usually the orientation is reverse when you don't add minus. hope this helps....

You could Add 180 and divide by 2 as @High Performance Mark suggests for your specific problem or here is a generalized version of it based on This post. This equation holds good for any limits I have written a simple function based on the equation: function [out] = normalizeLim(...