It is currently September 8th, 2024, 4:37 am

SOLVED: Calc for Analemma

Get help with creating, editing & fixing problems with skins
User avatar
Hagart
Posts: 14
Joined: October 18th, 2023, 11:44 am

SOLVED: Calc for Analemma

Post by Hagart »

Hallo Team

I am searching for a solution to calculate the analemma during the year. Is there a posibility to do that with a calc, so i can get the plus and minus in minutes depending on the date of the year?

Thanks in advance.

https://www.imghippo.com/i/VR1g21719223075.png
Last edited by Hagart on June 28th, 2024, 9:43 am, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Calc for Analemma

Post by Yincognito »

Hagart wrote: June 24th, 2024, 10:01 am Hallo Team

I am searching for a solution to calculate the analemma during the year. Is there a posibility to do that with a calc, so i can get the plus and minus in minutes depending on the date of the year?

Thanks in advance.

https://www.imghippo.com/i/VR1g21719223075.png
The short answer is yes, but you will have to properly compute the equation of time and solar declination (probably among other things) at various times during the year:
https://en.m.wikipedia.org/wiki/Analemma
https://www.sciencedirect.com/science/article/pii/S0960148121004031?via%3Dihub
and optionally put the shape into a 3D perspective using MagickMeter afterwards:
https://github.com/khanhas/MagickMeter/wiki/Effects#perspective

The above goes if you want to do it yourself in plain Rainmeter, which provides all the needed math functions to do it:
https://docs.rainmeter.net/manual/formulas/

Alternatively, you can go the easier way and find some Javascript code already doing it, and then display the result in a local webpage embedded in the skin, via the WebView plugin (this will have some minor but solvable drawbacks in terms of skin control):
https://forum.rainmeter.net/viewtopic.php?t=39233

Or, even easier, find a site that ideally outputs it as either a set of coordinates that you can be retrieved by WebParser, or, even better, as an image, which you can then either plot or display in Rainmeter:
https://docs.rainmeter.net/manual/meters/shape/#Path
https://docs.rainmeter.net/manual/measures/webparser/
https://docs.rainmeter.net/manual/meters/image/

It won't be easy, depending on the route you'll take and your Rainmeter ability, but once you have the coordinates of the plot computed or the proper image, the rest is much easier and it's something we can help and advise on. Not sure if a skin tackling this already exists, but you could try and see if you can find one as well, if you don't want to put much effort into it. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16499
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Calc for Analemma

Post by balala »

Hagart wrote: June 24th, 2024, 10:01 am I am searching for a solution to calculate the analemma during the year. Is there a posibility to do that with a calc, so i can get the plus and minus in minutes depending on the date of the year?
Even if I'm not sure at the moment, unlike Yincognito I doubt it can be done by a single Calc measure. Most probably a lua script will be needed. Not sure, but this is my guess...
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Calc for Analemma

Post by Yincognito »

balala wrote: June 24th, 2024, 2:16 pmunlike Yincognito I doubt it can be done by a single Calc measure
Just to clarify, I didn't mean that all of it can be done in a single Calc measure, I meant that it can be done using Calc measures (among other things), in plain Rainmeter. I actually did compute the solar declination and the equation of time like that two years ago, for the plain Rainmeter version of my rotating Earth skin:
Rotating 3D Earth.jpg
Obviously, some serious math in enough Calc measures, some SysInfo measures for daylight savings and a bunch of Time measures were needed to get to that point, hence the "it won't be easy" part, but it worked, was visible in the Earth's rotation and the subsolar point I was displaying, and was tested on various other sites including NASA ones. If you're curious, the almost exact equivalent, but in Javascript, is present in my Earth skin released on the forum.

That being said, I wasn't drawing analemmas (and never intended to do it) so I don't know if those computation parts are suited for this scenario.
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16499
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Calc for Analemma

Post by balala »

Yincognito wrote: June 24th, 2024, 6:15 pm Just to clarify, I didn't mean that all of it can be done in a single Calc measure, I meant that it can be done using Calc measures (among other things), in plain Rainmeter. I actually did compute the solar declination and the equation of time like that two years ago, for the plain Rainmeter version of my rotating Earth skin:
Rotating 3D Earth.jpg
Obviously, some serious math in enough Calc measures, some SysInfo measures for daylight savings and a bunch of Time measures were needed to get to that point, hence the "it won't be easy" part, but it worked, was visible in the Earth's rotation and the subsolar point I was displaying, and was tested on various other sites including NASA ones. If you're curious, the almost exact equivalent, but in Javascript, is present in my Earth skin released on the forum.
Still not sure it can be done in any number of Calc measures. Don't say it can't be, just that I'm not sure it can. Deeper researches needed...
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Calc for Analemma

Post by Yincognito »

balala wrote: June 24th, 2024, 7:26 pm Still not sure it can be done in any number of Calc measures. Don't say it can't be, just that I'm not sure it can. Deeper researches needed...
Yeah, the computations of these values for say a certain moment in time can definitely be done, but for computing all values for like an entire year through FOR loops, a Lua script is indeed more suited. Displaying the said graph / path in Rainmeter will be a bit challenging since you'd typically have around 365 points in that path.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Hagart
Posts: 14
Joined: October 18th, 2023, 11:44 am

Re: Calc for Analemma

Post by Hagart »

Thank you both for your help. I managed the problem with two shapes and a calc:

Code: Select all

;--------SONNENANALEMMABAHN---------

[EkliptikSchiefe]
Meter=Shape
Shape=Ellipse #Z#,#Z#,1 | StrokeWidth 1 | Stroke Color #Nichts# | Fill Color #Nichts#
X=((100*#Scale#)*COS(([ThetaSonnenBahn]*2)+(PI/2)))
Y=((100*#Scale#)*SIN(([ThetaSonnenBahn]*2)+(PI/2)))
DynamicVariables=1
UpdateDivider=1

[Exzentrizität]
Meter=Shape
Shape=Ellipse #Z#,#Z#,1 | StrokeWidth 1 | Stroke Color #Nichts# | Fill Color #Nichts#
X=((74*#Scale#)*COS([ThetaSonnenBahn]+(PI*0.39)))
Y=((74*#Scale#)*SIN([ThetaSonnenBahn]+(PI*0.39)))
DynamicVariables=1
UpdateDivider=1

[AnalemmaRechner]
Measure=Calc
Formula=(([EkliptikSchiefe:X]+[Exzentrizität:X])/10)
DynamicVariables=1
UpdateDivider=1
From the first shape i take the X-position that goes in two times a year from minus to plus and from the second shape i take the X-position that goes one time a year from minus to plus. Both uses the cycle "[ThetaSonnenBahn]" that is also based on a shape that goes one time a year from plus to minus.

The calc at the end merges both values together, so i get a value in minutes.

Thank you very much, greetings from Switzerland.
User avatar
balala
Rainmeter Sage
Posts: 16499
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Calc for Analemma

Post by balala »

Hagart wrote: June 28th, 2024, 9:22 am I managed the problem with two shapes and a calc:
Not quite. The [ThetaSonnenBahn] measure is not posted, but that's another than [AnalemmaRechner].

Additional tip: even if not forbidden, I recommend not to use letters with diacritics (like ä in the name of the [Exzentrizität] meter). Once again: this is not forbidden, can be freely used, however if you publish your skin, might create some problems.
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Calc for Analemma

Post by Yincognito »

Hagart wrote: June 28th, 2024, 9:22 am Thank you both for your help. I managed the problem with two shapes and a calc:

Code: Select all

;--------SONNENANALEMMABAHN---------

[EkliptikSchiefe]
Meter=Shape
Shape=Ellipse #Z#,#Z#,1 | StrokeWidth 1 | Stroke Color #Nichts# | Fill Color #Nichts#
X=((100*#Scale#)*COS(([ThetaSonnenBahn]*2)+(PI/2)))
Y=((100*#Scale#)*SIN(([ThetaSonnenBahn]*2)+(PI/2)))
DynamicVariables=1
UpdateDivider=1

[Exzentrizität]
Meter=Shape
Shape=Ellipse #Z#,#Z#,1 | StrokeWidth 1 | Stroke Color #Nichts# | Fill Color #Nichts#
X=((74*#Scale#)*COS([ThetaSonnenBahn]+(PI*0.39)))
Y=((74*#Scale#)*SIN([ThetaSonnenBahn]+(PI*0.39)))
DynamicVariables=1
UpdateDivider=1

[AnalemmaRechner]
Measure=Calc
Formula=(([EkliptikSchiefe:X]+[Exzentrizität:X])/10)
DynamicVariables=1
UpdateDivider=1
From the first shape i take the X-position that goes in two times a year from minus to plus and from the second shape i take the X-position that goes one time a year from minus to plus. Both uses the cycle "[ThetaSonnenBahn]" that is also based on a shape that goes one time a year from plus to minus.

The calc at the end merges both values together, so i get a value in minutes.

Thank you very much, greetings from Switzerland.
You're welcome, we're glad to help and see you ended up with a satisfying result. Not sure it's that simple as you wrote it, but of course that depends on what your objective was. Feel free to improve it if needed, or test it against others online to verify the results you got. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth