Page 3 of 3

Re: Atan2 math function

Posted: October 3rd, 2016, 7:20 pm
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.

Re: Atan2 math function

Posted: October 3rd, 2016, 7:23 pm
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:

Re: Atan2 math function

Posted: October 3rd, 2016, 7:25 pm
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 )

Re: Atan2 math function

Posted: October 3rd, 2016, 7:35 pm
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.

Re: Atan2 math function

Posted: October 3rd, 2016, 9:35 pm
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... ;-)

Re: Atan2 math function

Posted: October 3rd, 2016, 9:38 pm
by mistic100
Thanks :thumbup: