It is currently October 26th, 2021, 12:23 pm

[solved] Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Help with creating, editing & fixing problems with skins
User avatar
CodeCode
Posts: 708
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by CodeCode »

Yep. The code covers more than it is showing, but that is a thing that my own understanding will be required to fix, or make more readable.

So, I understand that you can only go by what makes sense to you.

I did manage to get a fairly decent rendition working like how I was hoping. So you guy's efforts were not in vain.

Thanks heaps for taking the time to bolster my understanding with better code parts for me to work with.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by Yincognito »

CodeCode wrote: August 26th, 2021, 7:49 amwith the min/max values being -35/120 respectively, for fahrenheit and min/max for celsius be -38/60 respectively
I guess that's part of the problem, as -38C is -36.4F and 60C is 140F. In other words the C and F intervals don't match. While it's probably possible to correlate them, I believe it's a bit pointless to do so, since literally for every thermometer (or any other measurement tool - like tapelines - for that matter) out there the bounds of the measured interval more or less match between different measurement units, for the same reason: consistency.
Image
User avatar
CodeCode
Posts: 708
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by CodeCode »

The only correlation i was seeking was for the freezing point be at the same location e.g. left center. Even though all of the examples start at the lower middle. I dont understand sin cos very well (not at all), so peeling the math onion wasnt happening. What I did was to match the lowest part and was able to see the start point match. the scale is of course different so fahrenheit and celsius definitely do not match as the temperature value changes. And as I said that was fine - preferred actually to denote said difference visually. if they match that just makes no sense. so with a rational top end and a verily realistic minimum, i have the values looking correct.
My only hurdle at this point is to have a simple way of showing the different location of zero since that changes on the circle. but for now i think it looks good the way i have it since according to the two different min.max scales, the marker seems located relatively sensibly. 8-)
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 708
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by CodeCode »

By the way, what do you guys think of my code drawn chromatic circle? I had to do it in 4 different arcs to get the good color spread. I in favour of well done score that as a win! :bow: :rofl:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by Yincognito »

CodeCode wrote: August 26th, 2021, 7:49 amThe thing I am struggling with is your variable MinMaxAngle is considering the full 360 for the max to rotate into, where my goal is only to use a 270 degree arc with, the aforementioned left side being both zero for celsius and 32 for fahrenheit, and the bottom center to be the max.
Well, I understood things the wrong way, since you'd actually be using the whole 360° circle arc, where the 270° part would only be from 0°C (at left center) to TMax°C (center bottom), but that had the benefit of adjusting things to work with partial "valid" arcs, through the AllCAngle variable (i.e. the total interval between TMin°C and TMax°C, in circle °). Anyway, what you envision is not impossible, but would involve either using a different arc length for a negative temp unit compared to a positive one, or changing the TMax°C and TMax°C to suit the arc length of the negative and positive temp intervals. The explanation is simple:

- you say that from 0°C to TMax°C you'd like a 270° arc (left center to center bottom) on the circle, therefore...
- what's left for the TMin°C to 0°C would be the remaining 90° arc (center bottom to left center) on the circle...
- but then, the total interval from TMin°C (-38°C) to TMax°C (60°C) in Celsius units is 98°C, meaning that when applied on the circle, the negative Celsius temps would take an arc of roughly (38/98)*360 = 140°, while the positive Celsius temps would take an arc of roughly (60/98)*360 = 220°

So, basically, the ratio between your expected 90° and 270° arcs will never be the same as the real 140° and 220° arcs corresponding to the TMin°C and TMax°C (i.e. -38°C and 60°C, respectively). To replicate the desired arc lengths would require, as I said, either changing TMin°C and TMax°C to something like -25°C and 75°C, -20°C and 60°C, -35°C and 105°C, or -40°C and 120°C (same 1/3 ratio like the expected arc lengths), or using different length arcs for negative temp units compared to positive temp units.

That being said, that's what 0°C to left center yields for the [-38°C ... 60°C] interval (notice how TMin°C & TMax°C are not at 270° compared to the 0°C, but about 50° less):

Code: Select all

[Variables]
Radius=97
MinC=-38
MaxC=60
AllCAngle=360
MinCAngle=40.4082
MaxCAngle=(#MinCAngle#+#AllCAngle#)
ZeroCAngle=(#MinCAngle#+Abs(#MinC#)/(Abs(#MinC#)+Abs(#MaxC#))*#AllCAngle#)

[Rainmeter]
Update=25
DynamicWindowSize=1
AccurateText=1

---Measures---

[TempC]
Measure=Loop
StartValue=#MinC#
EndValue=#MaxC#
Increment=1
MinValue=#MinC#
MaxValue=#MaxC#
DynamicVariables=1

[TempF]
Measure=Calc
Formula=(TempC*9/5+32)
MinValue=(#MinC#*9/5+32)
MaxValue=(#MaxC#*9/5+32)
DynamicVariables=1

---Meters---

[TempCircle]
Meter=Shape
X=3
Y=3
DynamicVariables=1
Shape=Ellipse 97,97,97,97 | Fill Color 0,0,0,1 | StrokeWidth 6 | Stroke Color 255,255,0,255
Shape2=Arc (#Radius#+#Radius#*Cos(Rad(#MinCAngle#-0.1))),(#Radius#+#Radius#*Sin(Rad(#MinCAngle#-0.1))), (#Radius#+#Radius#*Cos(Rad(#MinCAngle#+0.1))),(#Radius#+#Radius#*Sin(Rad(#MinCAngle#+0.1))), #Radius#, #Radius# | StrokeWidth 6 | Stroke Color 0,0,0,255 | StrokeStartCap Square | StrokeEndCap Square
Shape3=Arc (#Radius#+#Radius#*Cos(Rad(#MaxCAngle#-0.1))),(#Radius#+#Radius#*Sin(Rad(#MaxCAngle#-0.1))), (#Radius#+#Radius#*Cos(Rad(#MaxCAngle#+0.1))),(#Radius#+#Radius#*Sin(Rad(#MaxCAngle#+0.1))), #Radius#, #Radius# | StrokeWidth 6 | Stroke Color 128,128,128,255 | StrokeStartCap Square | StrokeEndCap Square
Shape4=Arc (#Radius#+#Radius#*Cos(Rad(#ZeroCAngle#-0.1))),(#Radius#+#Radius#*Sin(Rad(#ZeroCAngle#-0.1))), (#Radius#+#Radius#*Cos(Rad(#ZeroCAngle#+0.1))),(#Radius#+#Radius#*Sin(Rad(#ZeroCAngle#+0.1))), #Radius#, #Radius# | StrokeWidth 6 | Stroke Color 64,64,64,255 | StrokeStartCap Square | StrokeEndCap Square
Shape5=Arc (#Radius#+#Radius#*Cos(Rad(#MinCAngle#+#AllCAngle#*[TempC:%]/100-0.3))),(#Radius#+#Radius#*Sin(Rad(#MinCAngle#+#AllCAngle#*[TempC:%]/100-0.3))), (#Radius#+#Radius#*Cos(Rad(#MinCAngle#+#AllCAngle#*[TempC:%]/100+0.3))),(#Radius#+#Radius#*Sin(Rad(#MinCAngle#+#AllCAngle#*[TempC:%]/100+0.3))), #Radius#, #Radius# | StrokeWidth 6 | Stroke Color 0,0,255,255 | StrokeStartCap Round | StrokeEndCap Round
Shape6=Arc (#Radius#+#Radius#*Cos(Rad(#MinCAngle#+#AllCAngle#*[TempF:%]/100-0.2))),(#Radius#+#Radius#*Sin(Rad(#MinCAngle#+#AllCAngle#*[TempF:%]/100-0.2))), (#Radius#+#Radius#*Cos(Rad(#MinCAngle#+#AllCAngle#*[TempF:%]/100+0.2))),(#Radius#+#Radius#*Sin(Rad(#MinCAngle#+#AllCAngle#*[TempF:%]/100+0.2))), #Radius#, #Radius# | StrokeWidth 4 | Stroke Color 255,0,0,255 | StrokeStartCap Round | StrokeEndCap Round
LeftMouseUpAction=[!TogglePauseMeasure TempC]
DynamicVariables=1

[TempText]
Meter=String
X=100r
Y=100r
FontFace=Consolas
FontColor=255,255,255,255
FontSize=16
AntiAlias=1
StringAlign=CenterCenter
MeasureName=TempC
MeasureName2=TempF
NumOfDecimals=0
Text="Temperature#CRLF#%1°C#CRLF#%2°F"
DynamicVariables=1
Temp -38C to 60C.jpg
and this is what an interval of [-35°C ... 105°C] looks like:

Code: Select all

MinC=-35
MaxC=105
AllCAngle=360
MinCAngle=90
Temp -35C to 105C.jpg
or, for just a 270° total valid circle interval (see how TMin and TMax are separated below), and [-40°C ... 80°C] temp interval (can be any negative-positive interval with a 1/2 ratio, like [-30°C ... 60°C], since 90° on the circle are negative temps and 180° are positive ones):

Code: Select all

MinC=-40
MaxC=80
AllCAngle=270
MinCAngle=90
Temp -40C to 80C, 270 degrees total arc.jpg
The above goes for Fahrenheit as well - I wouldn't even bother to consider different negative and positive unit lengths on the circle, that just feels so wrong. In your skin you only need to get the C temp and have a Calc measure to convert it to F (or viceversa, but the measures would have to be swapped / adjusted acordingly), and the desired Shapes - I let the the hiding / showing meters in your care, as you know best how you want it to look and behave.
You do not have the required permissions to view the files attached to this post.
User avatar
CodeCode
Posts: 708
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by CodeCode »

Aw, yea. I realised that the sectional value/s were not logical.

So in my saying that a decent min and max, albeit different for C and F, I found a happy medium where the marker looks relatively placed correctly. Since the arc visual is not a literal translation like the marked thermometer would be, the version i am going to settle for, however minutely inexact, looks good. SO without making this too complex by being stubborn about OCD values (a joke on me), I am happy with all of the examples and the outcome I was able to produce.

The main thing I takeaway from this is another way to get a percentage value with a new equation form.

Secondarily is that my goofy weather skin "looks good" to me.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 708
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by CodeCode »

Just so I can say:
My best option in view of my aesthetic was to make zero degrees the same for both scales, but anywhere else on the gradient will not reflect identical positioning of the marker arc. The functionality is pretty cool, but that's what "I" "think".
Choosing the preferred format or switching between the two for no reason, i think makes this skin fun to use.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by Yincognito »

CodeCode wrote: August 26th, 2021, 2:14 pmSo in my saying that a decent min and max, albeit different for C and F, I found a happy medium where the marker looks relatively placed correctly. Since the arc visual is not a literal translation like the marked thermometer would be, the version i am going to settle for, however minutely inexact, looks good. SO without making this too complex by being stubborn about OCD values (a joke on me), I am happy with all of the examples and the outcome I was able to produce.
Oh, ok - if you're happy with the result, then case closed, it's all settled and good. :thumbup:
CodeCode wrote: August 26th, 2021, 1:10 pmThe only correlation i was seeking was for the freezing point be at the same location e.g. left center. My only hurdle at this point is to have a simple way of showing the different location of zero since that changes on the circle. but for now i think it looks good the way i have it since according to the two different min.max scales, the marker seems located relatively sensibly. 8-)
Yeah, that's probably on me, as it felt natural that the reference point when setting angles and such would be the minimum (and not the 0) temperature location, since, after all, that's where the "arcs" / "interval" begins. Setting the 0 angle as the reference point is easy though, it's just a matter of deriving the Min and Max temp angles from the 0 temp one:

Code: Select all

ZeroCAngle=180
MinCAngle=(#ZeroCAngle#-Abs(#MinC#)/(Abs(#MinC#)+Abs(#MaxC#))*#AllCAngle#)
MaxCAngle=(#MinCAngle#+#AllCAngle#)
This positions the 0 degree C (aka 32 degrees F) at the left center of the circle (i.e. 180 circle degrees from the 0 degree on a Shape circle, which is at right center of the circle). That's all it takes, nothing else.
CodeCode wrote: August 26th, 2021, 1:10 pmI dont understand sin cos very well (not at all), so peeling the math onion wasnt happening.
This wasn't really about Sin() and Cos(), as that part was covered by death.crafter when helping with the arc marker, but rather a matter of converting temperature degrees into circle degrees, according to your needs. Sin() and Cos() are really simple: multiplying Cos() with the radius gives the horizontal offset (from the circle's center) of your point on the circle, while doing the same for Sin() gives the similar vertical offset...
SinCos.png
You do not have the required permissions to view the files attached to this post.
User avatar
CodeCode
Posts: 708
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by CodeCode »

Yincognito wrote: August 26th, 2021, 4:49 pm Oh, ok - if you're happy with the result, then case closed, it's all settled and good. :thumbup:
...
This wasn't really about Sin() and Cos(), as that part was covered by death.crafter when helping with the arc marker, but rather a matter of converting temperature degrees into circle degrees, according to your needs. Sin() and Cos() are really simple:
SinCos.png
Cool visual. Thanks. I have actually been reading up on these thing, but teaching myself math is slow going. The written explanation is much harder to interpret - well depending how much space you are expecting to occupy in so doing. :P
You do not have the required permissions to view the files attached to this post.
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
Yincognito
Rainmeter Sage
Posts: 4071
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Using Arc For Two Different Scales (F & C) Fahrenheit Is Showing Incorrectly

Post by Yincognito »

CodeCode wrote: August 26th, 2021, 4:57 pm Cool visual. Thanks. I have actually been reading up on these thing, but teaching myself math is slow going. The written explanation is much harder to interpret - well depending how much space you are expecting to occupy in so doing. :P
Yeah, visually it's easier to get it - like they say, an image is worth a thousand words... although in this case there were just a few:
Yincognito wrote: August 26th, 2021, 4:49 pmmultiplying Cos() with the radius gives the horizontal offset (from the circle's center) of your point on the circle, while doing the same for Sin() gives the similar vertical offset
This image is partly my Photoshop edit of the original here.