_TITLE "Double Eclipse: Gear mod Ashish mod again by B+ started 2018-05-23" 'QB64 version 2017 1106/82 (the day before they switched to version 1.2)
sq = 20
nt1 = 16
r1 = gearRadius(nt1, sq)
nt2 = nt1 * 2
r2 = gearRadius(nt2, sq)
iA2 = pi / nt2
gear 600, 300, nt1, sq, rao, k1&
gear 600 - r1 - r2 - sq, 300, nt2, sq, -.5 * rao - iA2, k2&
rao = rao + .001
gearRadius
= .5 * sqtooth
/ SIN(.5 * pi
/ nteeth
)
radius
= .5 * sqtooth
/ SIN(.5 * pi
/ nteeth
) 'FOR ra = 0 TO 2 * pi STEP 2 * pi / nteeth
' x2 = x + (radius + sqtooth) * COS(ra + raOffset)
' y2 = y + (radius + sqtooth) * SIN(ra + raOffset)
' thic x, y, x2, y2, sqtooth, K
'NEXT
angOff = .25
FOR ra
= pi
/ nteeth
TO 2 * pi
STEP 2 * pi
/ nteeth
x1
= COS(ra
- (angOff
/ 2) + raOffset
) * (radius
* .8) + x
y1
= SIN(ra
- (angOff
/ 2) + raOffset
) * (radius
* .8) + y
x2
= COS(ra
+ (angOff
/ 2) + raOffset
) * (radius
* .8) + x
y2
= SIN(ra
+ (angOff
/ 2) + raOffset
) * (radius
* .8) + y
x3
= COS(ra
+ raOffset
) * (radius
* 1.15) + x
y3
= SIN(ra
+ raOffset
) * (radius
* 1.15) + y
filltri x1, y1, x2, y2, x3, y3, K
'to speed things up and reduce blicking just do a circle fill x, y already set and pen color too
'FOR ra = pi / nteeth TO 2 * pi STEP 2 * pi / nteeth
' x2 = x + radius * COS(ra + raOffset)
' y2 = y + radius * SIN(ra + raOffset)
' thic x, y, x2, y2, sqtooth, K
'NEXT
'COLOR _RGB32(155, 70, 35)
'fcirc x, y, .9 * radius
'K1 = _RGB(0, 0, 0)
'COLOR K1
'fcirc x, y, bhr
'thic x, y, x + (bhr + sqtooth) * COS(raOffset), y + (bhr + sqtooth) * SIN(raOffset), sqtooth, K1
t2 = thick / 2
x3
= x1
+ t2
* COS(a
+ _PI(.5)) y3
= y1
+ t2
* SIN(a
+ _PI(.5)) x4
= x1
+ t2
* COS(a
- _PI(.5)) y4
= y1
+ t2
* SIN(a
- _PI(.5)) x5
= x2
+ t2
* COS(a
+ _PI(.5)) y5
= y2
+ t2
* SIN(a
+ _PI(.5)) x6
= x2
+ t2
* COS(a
- _PI(.5)) y6
= y2
+ t2
* SIN(a
- _PI(.5)) filltri x6, y6, x4, y4, x3, y3, K
filltri x3, y3, x5, y5, x6, y6, K
'Steve McNeil's copied from his forum note: Radius is too common a name
RadiusError = -subRadius
X = subRadius
Y = 0
' Draw the middle span here so we don't draw it twice in the main loop,
' which would be a problem with blending turned on.
LINE (CX
- X
, CY
)-(CX
+ X
, CY
), , BF
RadiusError = RadiusError + Y * 2 + 1
LINE (CX
- Y
, CY
- X
)-(CX
+ Y
, CY
- X
), , BF
LINE (CX
- Y
, CY
+ X
)-(CX
+ Y
, CY
+ X
), , BF
X = X - 1
RadiusError = RadiusError - X * 2
Y = Y + 1
LINE (CX
- X
, CY
- Y
)-(CX
+ X
, CY
- Y
), , BF
LINE (CX
- X
, CY
+ Y
)-(CX
+ X
, CY
+ Y
), , BF
' found at [abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]: http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=14425.0