It is currently March 28th, 2024, 5:02 pm

Atan2 math function

Changes made during the Rainmeter 3.2 beta cycle.
mistic100
Posts: 35
Joined: October 12th, 2014, 5:27 pm

Re: Atan2 math function

Post by mistic100 »

I think you don't really understand what I ask : I (now) know how to draw every line I want, even vertical ones.

I just suggest you update the FIRST example of this thread for future people who would want to do the same thing, and will eventually don't understand why it does not work when X1=X2 because the actual solution is given further in the thread. I know it's only 3 post further but let's be practical and give a actually working guide at the begining.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5382
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA
Contact:

Re: Atan2 math function

Post by eclectic-tech »

We'll have to see if JSMorley will make that change... :x

Sorry for misunderstanding your request, I agree it would be helpful for future readers of this thread... :thumbup:
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Atan2 math function

Post by balala »

If I'm not wrong eclectic-tech, mistic100 is not talking about jsmorley's initial code, but your initial code, with the supposed issue. Am I right mistic100?
If I am, here it is:

Code: Select all

; This skin draws a center red point and draws lines to random secondary points every 3 seconds
; Corrected to use different formula for LineLength and eliminate drawing error
[Rainmeter]
Update=3000
BackgroundMode=2
SkinWidth=312
SkinHeight=180
SolidColor=20,30,40,255

[MeasureCounterX]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=156
HighBound=156

[MeasureCounterY]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=90
HighBound=90

[MeasureCounterX1]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=[MeasureCounterX]
HighBound=[MeasureCounterX]
DynamicVariables=1

[MeasureCounterY1]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=20
HighBound=170

[MeterPointA]
Meter=Image
X=[MeasureCounterX]
Y=[MeasureCounterY]
W=6
H=6
SolidColor=255,0,0,255
DynamicVariables=1

[MeterPointB]
Meter=Image
X=[MeasureCounterX1]
Y=[MeasureCounterY1]
W=6
H=6
SolidColor=191,235,255,255
DynamicVariables=1

[MeterLineAtoB]
Meter=Roundline
X=([MeterPointA:X]+([MeterPointA:W]/2))
Y=([MeterPointA:Y]+([MeterPointA:H]/2))
LineColor=255,255,255,255
LineWidth=2
LineLength=(([MeterPointB:X]-[MeterPointA:X])/Cos(Atan2([MeterPointB:Y]-[MeterPointA:Y], [MeterPointB:X]-[MeterPointA:X])))
StartAngle=Rad(360)
RotationAngle=(Atan2([MeterPointB:Y]-[MeterPointA:Y], [MeterPointB:X]-[MeterPointA:X]))
AntiAlias=1
DynamicVariables=1

[MeterLabel]
Meter=String
MeasureName=MeasureCounterX1
MeasureName2=MeasureCounterY1
FontColor=255,255,255
Text=PointB: ( %1, %2 )
mistic100
Posts: 35
Joined: October 12th, 2014, 5:27 pm

Re: Atan2 math function

Post by mistic100 »

Sorry you are wrong, I am actually talking about @jsmorley code, which is, I repeat, the first thing people see, when reading this thread.

As you said earlier, @eclectic-tech already includes the fix.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Atan2 math function

Post by jsmorley »

eclectic-tech wrote:We'll have to see if JSMorley will make that change... :x

Sorry for misunderstanding your request, I agree it would be helpful for future readers of this thread... :thumbup:
I think I properly fixed the code blocks in the first post of the thread... ;-)
mistic100
Posts: 35
Joined: October 12th, 2014, 5:27 pm

Re: Atan2 math function

Post by mistic100 »

Thanks :thumbup:
Post Reply