Skip to content

Commit

Permalink
Modifications for registers (#123)
Browse files Browse the repository at this point in the history
* Modifications for registers

* workadound not needed anymore
  • Loading branch information
ldemailly authored Sep 20, 2024
1 parent 790d446 commit dfaf1dc
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 38 deletions.
55 changes: 26 additions & 29 deletions discord.gr
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ func walk(f, a) {
}(f,a,0)
}

// Convert to string
func str(x) {sprintf("%v", x)}

// Apply a function to each element of an array.
func apply(f, a) {
if (len(a)==0) {
Expand Down Expand Up @@ -251,9 +248,9 @@ msgId=""

// With angle as an int modulo 360 input, this gets memoized.
func ycbcr(angle) {
angle = PI * angle / 180.
a = PI * angle / 180.
// Y Cb Cr
[190, 128 + 120*sin(angle), 128 + 120*cos(angle)]
[190, 128 + 120*sin(a), 128 + 120*cos(a)]
}

func Butterfly() {
Expand Down Expand Up @@ -294,37 +291,37 @@ func circleQuadrant(img, x, y, rx, ry, color, thickness) {

func quadrant(img, x, y, rx, ry, thickness) {
sign = sign
x = round(x)+.5 // semi magic adjustment that makes the bezier circle and trueCircle match
y = round(y)+.5
xx := round(x)+.5 // semi magic adjustment that makes the bezier circle and trueCircle match
yy := round(y)+.5
a := 1.00005519
b := 0.55342686
c := 0.99873585
thickness = thickness / 2.
ythickness := thickness
thickness2 = thickness / 2.
ythickness := thickness2
if sign(rx) != sign(ry) {
ythickness = -thickness
ythickness = -thickness2
}
p0x := x + rx*a - thickness
p0y := y
p0x := xx + rx*a - thickness2
p0y := yy
image.move_to(img, p0x, p0y)
image.line_to(img, p0x+2*thickness, p0y)
rx = rx + thickness
ry = ry + ythickness
p2x := x + rx*b
p2y := y + ry*c
p1x := x + rx*c
p1y := y + ry*b
p3x := x
p3y := y + ry*a
image.line_to(img, p0x+thickness, p0y)
rxx := rx + thickness2
ryy := ry + ythickness
p2x := xx + rxx*b
p2y := yy + ryy*c
p1x := xx + rxx*c
p1y := yy + ryy*b
p3x := xx
p3y := yy + ryy*a
image.cube_to(img, p1x, p1y, p2x, p2y, p3x, p3y)
rx = rx - 2*thickness
ry = ry - 2*ythickness
p3y := y + ry*a
image.line_to(img, x, p3y)
p2x := x + rx*b
p2y := y + ry*c
p1x := x + rx*c
p1y := y + ry*b
rxx = rxx - thickness
ryy = ryy - 2*ythickness
p3y := yy + ryy*a
image.line_to(img, xx, p3y)
p2x := xx + rxx*b
p2y := yy + ryy*c
p1x := xx + rxx*c
p1y := yy + ryy*b
image.cube_to(img, p2x, p2y, p1x, p1y, p0x, p0y)
// image.line_to(img, x, y) // covered by close_path in draw
}
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ require (
fortio.org/scli v1.15.2
fortio.org/version v1.0.4
github.com/bwmarrin/discordgo v0.28.1
grol.io/grol v0.73.0
grol.io/grol v0.74.0
)

// replace grol.io/grol => ../grol

require (
fortio.org/dflag v1.7.2 // indirect
fortio.org/safecast v0.1.1 // indirect
fortio.org/safecast v1.0.0 // indirect
fortio.org/sets v1.2.0 // indirect
fortio.org/struct2env v0.4.1 // indirect
fortio.org/term v0.23.0-fortio-6 // indirect
fortio.org/terminal v0.9.1 // indirect
fortio.org/terminal v0.9.2 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/kortschak/goroutine v1.1.2 // indirect
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ fortio.org/dflag v1.7.2 h1:lUhXFvDlw4CJj/q7hPv/TC+n/wVoQylzQO6bUg5GQa0=
fortio.org/dflag v1.7.2/go.mod h1:6yO/NIgrWfQH195WbHJ3Y45SCx11ffivQjfx2C/FS1U=
fortio.org/log v1.16.0 h1:GhU8/9NkYZmEIzvTN/DTMedDAStLJraWUUVUA2EbNDc=
fortio.org/log v1.16.0/go.mod h1:t58Spg9njjymvRioh5F6qKGSupEsnMjXLGWIS1i3khE=
fortio.org/safecast v0.1.1 h1:lKSckzBVCbeJXTNUiAvBdplYUafEHM9BahrP46WgPEQ=
fortio.org/safecast v0.1.1/go.mod h1:xZmcPk3vi4kuUFf+tq4SvnlVdwViqf6ZSZl91Jr9Jdg=
fortio.org/safecast v1.0.0 h1:dr3131WPX8iS1pTf76+39WeXbTrerDYLvi9s7Oi3wiY=
fortio.org/safecast v1.0.0/go.mod h1:xZmcPk3vi4kuUFf+tq4SvnlVdwViqf6ZSZl91Jr9Jdg=
fortio.org/scli v1.15.2 h1:vWXt4QOViXNWy4Gdm7d2FDfptzWD00QiWzYAM/IUF7c=
fortio.org/scli v1.15.2/go.mod h1:XvY2JglgCeeZOIc5CrfBTtcsxkVV8xmGL5ykAcBjEHI=
fortio.org/sets v1.2.0 h1:FBfC7R2xrOJtkcioUbY6WqEzdujuBoZRbSdp1fYF4Kk=
Expand All @@ -16,8 +16,8 @@ fortio.org/struct2env v0.4.1 h1:rJludAMO5eBvpWplWEQNqoVDFZr4RWMQX7RUapgZyc0=
fortio.org/struct2env v0.4.1/go.mod h1:lENUe70UwA1zDUCX+8AsO663QCFqYaprk5lnPhjD410=
fortio.org/term v0.23.0-fortio-6 h1:pKrUX0tKOxyEhkhLV50oJYucTVx94rzFrXc24lIuLvk=
fortio.org/term v0.23.0-fortio-6/go.mod h1:7buBfn81wEJUGWiVjFNiUE/vxWs5FdM9c7PyZpZRS30=
fortio.org/terminal v0.9.1 h1:4MHLoInn+xIpyRxb8z2F25PcUZ96+S0b7z4kYQzvsJc=
fortio.org/terminal v0.9.1/go.mod h1:2cTqXEFMyWSgV2RI2O/iq6O8Wbd/BPiQwk1vRbuEwlc=
fortio.org/terminal v0.9.2 h1:YIRkNvb7tFn/pWDWegOgQTe5nbDtNqzx525o43zs9WY=
fortio.org/terminal v0.9.2/go.mod h1:y4fOHGfFFWpSbpJfAFuEwPTkVElj07qPOdyJj8KvYHU=
fortio.org/version v1.0.4 h1:FWUMpJ+hVTNc4RhvvOJzb0xesrlRmG/a+D6bjbQ4+5U=
fortio.org/version v1.0.4/go.mod h1:2JQp9Ax+tm6QKiGuzR5nJY63kFeANcgrZ0osoQFDVm0=
github.com/bwmarrin/discordgo v0.28.1 h1:gXsuo2GBO7NbR6uqmrrBDplPUx2T3nzu775q/Rd1aG4=
Expand Down Expand Up @@ -47,5 +47,5 @@ golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
grol.io/grol v0.73.0 h1:E7eRXNAjvAn7kmXkjULZEdH+Tz0YtL5Kr0i1pwv2cP0=
grol.io/grol v0.73.0/go.mod h1:/GJfeRWCiXMBJ2G30H++PUG8gpTFrfOB3frPQY+qrDE=
grol.io/grol v0.74.0 h1:XwM4QhGMkw6irUF8jYAoRmTdhdBwh4fp2xJlPaftP5U=
grol.io/grol v0.74.0/go.mod h1:9t2+O07pKPQOhbZP03jejz9QGQp1AwZCDKZZPiX/oWg=

0 comments on commit dfaf1dc

Please sign in to comment.