Skip to content

Commit

Permalink
update docs/tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cormullion committed Apr 6, 2021
1 parent 778a651 commit 604e6f9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## [v2.11.0] - forthcoming 2021-03...
## [v2.11.0] - 2021-04-06

### Added

Expand All @@ -11,6 +11,7 @@
- CI now ci.yml rather than travis
- texttrack() switch to textoutlines()
- beziersegmentangles() bug fixed
- bug in isarcclockwise() fixed (thanks @johannes-fischer!)

### Removed

Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ test = ["Test"]
julia = "1.3"
Cairo = "0.7, 0.8, 1.0"
Colors = "0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 1.0"
FileIO = "1.0, 1.1, 1.2, 1.3, 1.4"
ImageMagick = "0.7, 1.0, 1.1"
FileIO = "1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6"
ImageMagick = "0.7, 1.0, 1.1, 1.2"
Juno = "0.7, 0.8"
QuartzImageIO = "0.6, 0.7"
Rsvg = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion docs/src/livegraphics.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ A _snapshot_ is a view of the current Luxor drawing in its current state, before

You can take a snapshot only for drawings created using the `:rec` (recording) format.

The following composite image shows a Julia set at different resolutions. The `snapshot()` call saves the current drawing for a few different values of the `stepby` parameter.
The following code exports a series of snapshots made with `snapshot()`, showing the state of the computation for different values of the `stepby` parameter. (This image is a composite of all the snapshots.)

![juliaset](assets/figures/julia-set-set.png)

Expand Down
2 changes: 2 additions & 0 deletions src/curves.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Find the radius and center point for three points lying on a circle.
returns `(centerpoint, radius)` of a circle.
If there's no such circle, the function returns `(Point(0, 0), 0)`.
If two of the points are the same, use `circle(pt1, pt2)` instead.
"""
function center3pts(p1::Point, p2::Point, p3::Point)
norm2(p::Point) = (p.x)^2+(p.y)^2
Expand Down
20 changes: 19 additions & 1 deletion test/triangles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function triangle_tests(fname)
background("white")
fontsize(10)

panes = Tiler(500, 500, 1, 2)
panes = Tiler(500, 500, 2, 2)

@layer begin
translate(first(panes[1]))
Expand Down Expand Up @@ -44,13 +44,31 @@ function triangle_tests(fname)
center = trianglecenter(tri2...)
circumcenter = trianglecircumcenter(tri2...)
circle.((orthocenter, incenter, center, circumcenter), 2, :fill)
label.(["orthocenter", "incenter", "center", "circumcenter"], :e, (orthocenter, incenter, center, circumcenter))

# all centers lie on the same vetical line
@test isapprox(orthocenter.x, incenter.x)
@test isapprox(orthocenter.x, center.x)
@test isapprox(orthocenter.x, circumcenter.x)
end

@layer begin
translate(first(panes[3]))
# arbitrary
tri3 = ngon(O + (50, 50), 160, 4, π/3, vertices=true)[1:3]
prettypoly(tri3, :stroke, close=true)

orthocenter = triangleorthocenter(tri3...)
incenter = triangleincenter(tri3...)
center = trianglecenter(tri3...)
circumcenter = trianglecircumcenter(tri3...)
circle.((orthocenter, incenter, center, circumcenter), 2, :fill)
label.(("orthocenter", "incenter", "center", "circumcenter"), :N, (orthocenter + (0, 5), incenter + (0, 15), center + (0, 20), circumcenter))
# some are inside, some are outside
@test isinside(incenter, tri3)
@test isinside(center, tri3)
end

@test finish() == true
println("...finished test: output in $(fname)")
end
Expand Down

0 comments on commit 604e6f9

Please sign in to comment.