Skip to content

Commit

Permalink
fix broadcasting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cormullion committed Feb 17, 2024
1 parent 8b88e39 commit 7fa91e1
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 26 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## [v3.9.0] -forthcoming release
## [v4.0] - 2024-02-17

LaTeX support is still under development.
See https://github.com/JuliaGraphics/Cairo.jl/pull/357.
Expand All @@ -22,6 +22,7 @@ See https://github.com/JuliaGraphics/Cairo.jl/pull/357.
- remove @assert statements
- documents now built to https://github.com/JuliaGraphics/LuxorManual
- fixed bug in `box(pt, w, h, cr, :path)` (don't create new path)
- removed some invalid Point methods (#294)

### Removed

Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Luxor"
uuid = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
authors = ["cormullion <[email protected]>"]
version = "3.9.0"
version = "4.0.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand All @@ -27,7 +27,7 @@ LuxorExtLatex = ["LaTeXStrings", "MathTeXEngine"]

[compat]
Cairo = "1.0"
Colors = "0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 1.0"
Colors = "0.11, 0.12"
DataStructures = "0.18"
FFMPEG = "0.4"
FileIO = "1"
Expand Down
3 changes: 2 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Luxor = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
MathTeXEngine = "0a4f8689-d25c-4efe-a92b-7142dfc1aa53"

[compat]
Colors = "0.12"
Documenter = "1"
Images = "0.26"
MathTeXEngine = "0.5"
MathTeXEngine = "0.5.7"
5 changes: 4 additions & 1 deletion docs/src/explanation/pathspolygons.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ d = @drawsvg begin
make_path()
clip()
sethue("green")
rule.(between.(O - (250, 0), O + (250, 0), 0:0.01:1), -π/3)
# -> 3.9
# rule.(between.(O - (250, 0), O + (250, 0), 0:0.01:1), -π/3)
# 4.0
rule.(between.(Ref(O - (250, 0)), Ref(O + (250, 0)), 0:0.01:1), -π/3)
end 800 500
```

Expand Down
12 changes: 8 additions & 4 deletions docs/src/howto/geometrytools.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,17 @@ circle(O, radius + 20, action = :stroke)
points = polycross(O, radius, 7, vertices=true)
poly(points, action = :stroke, close=true)
antipoints = last.(pointinverse.(points, O, radius+20))
antipoints = last.([pointinverse(pt, O, radius + 20) for pt in points])
for (n, pt) in enumerate(zip(points, antipoints))
#antipoints = last.(pointinverse.(points, O, radius+20))
for (n, ptpair) in enumerate(zip(points, antipoints))
pt1, pt2, = ptpair
sethue(HSB(length(points) * n, 0.8, 0.8))
@. circle(pt, distance(O, pt)/6, action = :fill)
circle(pt1, distance(O, pt1)/6, action = :fill)
circle(pt2, distance(O, pt2)/6, action = :fill)
sethue("black")
arrow(pt...)
arrow(pt1, pt2)
end
end 800 500
d # hide
Expand Down
30 changes: 15 additions & 15 deletions docs/src/howto/polygons.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ for (pos, n) in tiles
@layer begin
translate(pos)
p = ngon(Point(0, 0), 80, n, vertices=true)
plist = ngon(Point(0, 0), 80, n, vertices=true)
sethue(cols[n])
poly(p, action = :fill, close=true)
poly(plist, action=:fill, close=true)
sethue("grey10")
poly(p, action = :stroke, close=true)
poly(plist, action=:stroke, close=true)
circle(Point(0, 0), 4, action = :fill)
circle(Point(0, 0), 4, action=:fill)
label.([string(i) for i in 1:n], slope.(O, p), p, offset=5)
label.([string(i) for i in 1:n], slope.(Ref(O), plist), plist, offset=5)
end
end
Expand Down Expand Up @@ -614,7 +614,7 @@ background("white") # hide
setline(2) # hide
setlinejoin("round") # hide
spine = between.(O - (200, 0), O + (200, 0), 0:0.025:1)
spine = between.(Ref(O - (200, 0)), Ref(O + (200, 0)), 0:0.025:1)
sethue("red")
prettypoly(spine, action = :stroke)
Expand Down Expand Up @@ -935,32 +935,32 @@ Drawing(600, 400, "../assets/figures/beziersegmentangles.svg") # hide
background("ivory") # hide
origin() # hide
setline(.5)
setline(0.5)
@layer begin
rule.(O, (0, (π/2)))
rule.(Ref(O), (0, (π / 2)))
end
P = O
Q = O + (200, 0)
sethue("black")
pts = beziersegmentangles(P, Q,
out = deg2rad(60),
in = 2π - deg2rad(45))
out=deg2rad(60),
in=2π - deg2rad(45))
@layer begin
setline(2)
sethue("purple")
drawbezierpath(pts, action = :stroke)
drawbezierpath(pts, action=:stroke)
end
sethue("grey50")
line(O, pts[2], action = :stroke)
line(Q, pts[3], action = :stroke)
line(O, pts[2], action=:stroke)
line(Q, pts[3], action=:stroke)
fontsize(15)
circle.((P, pts[2], pts[3], Q), 5, action = :fill)
label.(("P", "Q"), :ne, (P, Q))
circle.((P, pts[2], pts[3], Q), 5, action=:fill)
label.(("P", "Q"), Ref(:ne), (P, Q))
text("60°", P + (40, 20))
text("135°", Q + (10, 20))
finish() # hide
Expand Down
4 changes: 2 additions & 2 deletions src/bezierpath.jl
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ function brush(pt1, pt2, width = 10;
for j in 1:strokes
shiftedline = [O + (0, 0), O + (0, n)]
if tidystart
shiftedline .+= Point(rand((-width / 2):(width / 2)), 0)
shiftedline .+= Ref(Point(rand((-width/2):(width/2)), 0))
else
shiftedline .+= Point(rand((-width / 2):(width / 2)), rand((-width / 2):(width / 2)))
shiftedline .+= Ref(Point(rand((-width/2):(width/2)), rand((-width/2):(width/2))))
end
pbp = bezierstroke(shiftedline[1],
shiftedline[2],
Expand Down

0 comments on commit 7fa91e1

Please sign in to comment.