It is currently April 25th, 2024, 12:04 am

Radian Issue...

Get help with creating, editing & fixing problems with skins
D_Reckoning
Posts: 10
Joined: July 14th, 2010, 10:15 pm

Radian Issue...

Post by D_Reckoning »

Two Threads in a matter of hours, and probably a simple solution (heh, hopefully at least) - This time it's som rather non-functioning math that's got me at my wit's end:

I've got a value in degrees (~277). I want this represented by a "Roundline"-meter, which means I have to convert it to radians (or so I've understood). Problem is... maybe I'm just missing something from lack of sleep, but none of the methods I've tried seems to yield accurate results: I always end up with a result of ~4.84, which means that the meter that's supposed to point mostly to the left, points almost directly upwards (equivalent of ~355+ degrees). Any ideas what I'm doing wrong?

Conversions I've tried:
-(<angle>*Pi)/180
-<angle>*0.0174532925 (google's arbitrary conversion number)

code: (In case I've mucked up something there)

Code: Select all

[MeterMercury]
Meter=Roundline
MeasureName=MercuryFin ;The measure that produces the final radian value.
W=320
H=320
StartAngle=4.7123889
RotationAngle=-6.28319
LineLength=25
LineStart=0
LineColor=#Colour#, 255
AntiAlias=1
User avatar
Alex2539
Rainmeter Sage
Posts: 642
Joined: July 19th, 2009, 5:59 am
Location: Montreal, QC, Canada

Re: Radian Issue...

Post by Alex2539 »

When you set values like StartAngle and RotationAngle, it is true that those values need to be in radians. However, the Roundline does not actually use radians when it gets its values from a meter. Instead it uses a percentage. By default, it assumes the minimum value of a measure is 0 and the maximum value of a measure is 1. If you are getting your values from a Calc measure, you will either need to ensure that the value it is returning is a percentage, or add MinValue and MaxValue to your Calc measure to specify the bounds. This is also how most other meters operate.

Also, given the StartAngle and RotationAngle you've specified, 277 degrees would be pointing to the left, not the right. By default, angle 0 is directly to the right and then the angles increase going clockwise. The StartAngle you've specified (~3*PI/4) would place the 0 angle straight up. Then, the rotation angle you have (~-2*PI) would have it complete the circle, but backwards (ie: counter-clockwise) because of the negative value. So, since 277 is a little more than 3/4 of the way around the circle, starting from the top going counter-clockwise you would end up pointing to the right.

Oh, and that "arbitrary" number Google gave you is just PI/180, so you've really only tried the same thing twice ;).
ImageImageImageImage
D_Reckoning
Posts: 10
Joined: July 14th, 2010, 10:15 pm

Re: Radian Issue...

Post by D_Reckoning »

That's a ton of helpful info, thanks a bunch! :)