Skip to content

Commit

Permalink
get docs building again
Browse files Browse the repository at this point in the history
  • Loading branch information
cormullion committed May 11, 2024
1 parent bf45ff4 commit 553d524
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 18 deletions.
41 changes: 36 additions & 5 deletions docs/src/howto/tables-grids.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ end

You often want to position graphics at regular locations on the drawing. The positions can be provided by:

- `Tiler`: a rectangular grid which you specify by enclosing area, and the number of rows and columns
- `Partition`: a rectangular grid which you specify by enclosing area, and the width and height of each cell
- `Grid` a rectangular grid, points supplied on demand
- `Table`: a rectangular grid which you specify by providing row and column numbers, row heights and column widths
- `Tiler`: a rectangular grid iterator which you specify by enclosing area, and the number of rows and columns
- `Partition`: a rectangular grid iterator which you specify by enclosing area, and the width and height of each cell
- `Grid` a rectangular grid iterator, where points are supplied on demand
- `Table`: a rectangular grid iterator which you specify by providing row and column numbers, row heights and column widths

These are types which act as iterators. Their job is to provide you with centerpoints; you'll probably want to use these in combination with the cell's widths and heights.

There are also functions to make hexagonal grids. See [Hexagonal grids](@ref).
There are functions to make hexagonal grids. See [Hexagonal grids](@ref).

There is [EquilateralTriangleGrid](@ref), a grid iterator which generates the vertices for a rectangular grid of equilateral triangles.

## Tiles and partitions

Expand Down Expand Up @@ -490,3 +492,32 @@ for (n, h) in enumerate(hexspiral(hexagon, 10))
end
end # hide
```

## EquilateralTriangleGrid

To create a grid of equilateral triangles, you can use
[`EquilateralTriangleGrid`](@ref). Provide the starting point, the side length,
and the number of rows and columns. The iterator provides a tuple of the
vertices and number for each triangle.

```@example
using Luxor, Colors
@drawsvg begin # hide
background("black")
nrows = 12
ncols = 20
side = 45
startpoint = boxtopleft() + (50, 50)
eqtg = EquilateralTriangleGrid(startpoint, side, nrows, ncols)
for e in eqtg
vertices, trianglenumber = e
sethue(HSB(rescale(trianglenumber, 0, nrows * ncols, 0, 360),
0.7, 0.8))
poly(vertices, :fillpreserve)
sethue("black")
strokepath()
text(string(trianglenumber), halign=:center, polycentroid(vertices))
end
end # hide
```
2 changes: 1 addition & 1 deletion src/basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ rescale(x, (from_min, from_max), (to_min, to_max))
```
Examples
```jldoctest
```julia
julia> rescale(15, 0, 100, 0, 1)
0.15
Expand Down
2 changes: 1 addition & 1 deletion src/colors_styles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Use `sethue()` for changing colors without changing current opacity level.
`sethue()` and `setcolor()` return the three or four values that were used:
```jldoctest
```julia
julia> setcolor(sethue("red")..., .8)
(1.0N0f8, 0.0N0f8, 0.0N0f8, 0.8)
Expand Down
8 changes: 4 additions & 4 deletions src/drawings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ The default drawing is 256 by 256 points.
You don't need `finish()` (the macro calls it), and it's not previewed by `preview()`.
```jldoctest
```julia
julia> m = @imagematrix begin
sethue("red")
box(O, 20, 20, :fill)
Expand Down Expand Up @@ -1561,7 +1561,7 @@ Transparency
The default value for the cells in an image matrix is
transparent black. (Luxor's default color is opaque black.)
```jldoctest
```julia
julia> @imagematrix begin
end 2 2
2×2 reinterpret(ColorTypes.ARGB32, ::Matrix{UInt32}):
Expand All @@ -1572,7 +1572,7 @@ julia> @imagematrix begin
Setting the background to a partially or completely
transparent value may give unexpected results:
```jldoctest
```julia
julia> @imagematrix begin
background(1, 0.5, 0.0, 0.5) # semi-transparent orange
end 2 2
Expand All @@ -1584,7 +1584,7 @@ julia> @imagematrix begin
here the semi-transparent orange color has been partially
applied to the transparent background.
```jldoctest
```julia
julia> @imagematrix begin
sethue(1., 0.5, 0.0)
paint()
Expand Down
2 changes: 1 addition & 1 deletion src/hexagons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ For more information about making hexagons and hexagonal grids, see [Luxor.Hexag
## Example
```jldoctest
```julia
julia> h = HexagonOffsetEvenR(0, 0, 70.0);
julia> hexneighbors(h)
Expand Down
8 changes: 4 additions & 4 deletions src/point.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Base.length(::Point) = 2
Transform a point `pt` by the 3×3 matrix `m`.
```jldoctest
```julia
julia> M = [2 0 0; 0 2 0; 0 0 1]
3×3 Matrix{Int64}:
2 0 0
Expand Down Expand Up @@ -362,7 +362,7 @@ Find angle of a line starting at `pointA` and ending at `pointB`.
Return a value between 0 and 2pi. Value will be relative to the current axes.
```jldoctest
```julia
julia> slope(O, Point(0, 100)) |> rad2deg # y is positive down the page
90.0
Expand Down Expand Up @@ -429,7 +429,7 @@ intersectionlinecircle(p1::Point, p2::Point, cpoint::Point, r) =
Convert a tuple of two numbers to a Point of x, y Cartesian coordinates.
```jldoctest
```julia
julia> @polar 10, pi/4
Point(7.0710678118654755, 7.071067811865475)
```
Expand All @@ -452,7 +452,7 @@ end
Convert a point specified in polar form (radius and angle) to a Point.
```jldoctest
```julia
julia> polar(10, pi/4)
Point(7.0710678118654755, 7.071067811865475)
```
Expand Down
2 changes: 1 addition & 1 deletion src/shapes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ drawn below the positive x-axis.
If you just want the raw points, use keyword argument `vertices=true`, which
returns the array of points. Compare:
```jldoctest
```julia
julia> ngon(0, 0, 4, 4, 0, vertices=true) # returns the polygon's points:
4-element Vector{Point}:
Point(2.4492935982947064e-16, 4.0)
Expand Down
2 changes: 1 addition & 1 deletion src/tiles-grids.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ For a column, set the `xspacing` to 0:
grid = GridRect(O, 0, 40)
To get points from the grid, use `nextgridpoint(g::Grid)`.
```jldoctest
```julia
julia> grid = GridRect(O, 0, 40);
julia> nextgridpoint(grid)
Expand Down

0 comments on commit 553d524

Please sign in to comment.