Radians Guide


Two of the meters in Rainmeter use a unit of measurement called Radians in order to calculate a position on the circumference of a circle. This is a common unit used by mathematicians, scientists, and yes, programmers when working with things that are round. This guide will try to make it easier to understand and use radians in the context of Rainmeter.

The two meters that use radians in their options are Roundline and Rotator. Roundline draws a line or solid fill that rotates around a center point based on some measure value. Rotator does much the same, using an image you provide rather than drawing the meter. Both use StartAngle and RotationAngle to control the starting point on the circle, and the total amount of distance around the circle that constitutes 100 percent. That way they can be used to display the value of any measure that defines a percentage.

So what are radians?

Without going too deeply into the math involved, (there are tons of sites like Wikipedia that can melt your brain with the details) radians measure an arc angle that defines a distance around the circumference of a circle. The default starting point, or 0 radians, is directly to the right of the center point. This is probably the most important thing to wrap your head around right from the start. Radians have nothing at all to do with the degrees on a compass, which is traditionally shown with 0° degrees (or North) pointing straight up.

So in short, radians are a way of defining a point on a circle of any size, measuring a distance around the circle from 0 radians to the point you want.

It is a bit cumbersome to try to think of a circle in terms of radians. It is more intuitive to think of a circle in terms of degrees. A circle has 360 degrees, and we are all used to and can easily picture what 45°, 90°, 180° and 270° mean in terms of distance. All we need to do is think about the circle with 0° pointing to the right of center, and add the number of degrees we need to get to the desired point.

So for example, if we want to define the point at the top of a circle, we can easily see that it will be 270° away from 0°, going clockwise around the circle. So what we want is a way to define that distance of 270° as a number of radians.

Calculating radians

Degrees to Radians: (degrees*(PI/180))

You can also reverse the process if you need to:

Radians to Degrees: (radians*(180/PI))

Note: The simplest way to do this is to just use Google. If you search using "nn degrees in radians" it will provide exactly the answer you need.

45 degrees = 0.785398163 radians

A Rainmeter shortcut

While we think it is important to have a basic understanding of how radians work in Rainmeter, there is a way to cheat. There is a function in Rainmeter that can be used to automatically convert a number of degrees to a number of radians for you. It is the Rad(x) formula function, which will convert "x" as a number of degrees to the corresponding number of radians. Remember that any formula used outside of the Formula option of a Calc measure must be enclosed in parentheses.

StartAngle=(Rad(270))

Example

We can use a CPU measure, which returns the amount of CPU usage as a percentage from 0% to 100%. Then we want to have a Roundline meter that displays the current value as filling a circle. We want the starting point at the top of the circle, and 100% defined as coming all the way back around to the top.

[MeasureCPU]
Measure=CPU

[MeterCPUCircle]
Meter=Roundline
MeasureName=MeasureCPU
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineWidth=5
LineStart=15
LineLength=20
LineColor=255,255,255,255
Solid=1
AntiAlias=1

The important bits here are the two options StartAngle and RotationAngle. StartAngle is defined as (Rad(270)), which is to say 270° in radians. This means that if you start directly from the right of center at it will take 270° degrees in radians to define the distance to the top of the circle moving clockwise. That will be the starting point for the meter. RotationAngle is defined as (Rad(360)), which is telling Rainmeter that the distance defined as 100% is all the way around 360°, or the full circle.

In another example, if you wanted to do a "VU Meter" type of approach, with the starting point on the left and 100% defined on the right, you would use:

StartAngle=(Rad(180))
RotationAngle=(Rad(180))

This is saying start 180° clockwise from 0° / 360° (remember, starting directly right of center), and travel a total distance of 180° from there to define 100%.