From 33c2aad4f7dd37a0c54b62b944be111caebdf8eb Mon Sep 17 00:00:00 2001 From: cormullion Date: Sun, 11 Dec 2022 14:40:27 +0000 Subject: [PATCH] tidy rotatepoint changes --- CHANGELOG.md | 10 ++++++---- docs/src/howto/geometrytools.md | 32 +++++++++++++++++--------------- src/deprecations.jl | 2 ++ src/point.jl | 12 ++++++++---- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 813ac236..ad1a90c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,16 +1,17 @@ # Changelog -## [v3.6.0] - 2022-12-1? +## [v3.6.0] - 2022-12-11 LaTeX support is still under development. See https://github.com/JuliaGraphics/Cairo.jl/pull/357. ### Added -- the `Base.show(f::IO, ::MIME"image/svg+xml")` method that displays SVGs in notebooks modifies the glyph ids to avoid the familiar "Jupyter cells leak" problem -- `polyclip()` clips one poly with another -- `ispointonleftonline()` used by ↑ - `bezigon()` +- the `Base.show(f::IO, ::MIME"image/svg+xml")` method that displays SVGs in notebooks modifies the glyph ids to avoid the familiar "Jupyter cells leak" problem (described [here](https://github.com/MakieOrg/Makie.jl/issues/952#issuecomment-842413678)) +- `polyclip()` clips one poly with another convex polygon +- `ispointonleftonline()` used by ↑ +- `rotatepoint()` is better name for `rotate_point_around_point()` (thanks @gantz-giraffe !) ### Changed @@ -24,6 +25,7 @@ See https://github.com/JuliaGraphics/Cairo.jl/pull/357. ### Deprecated +- `rotate_point_around_point()` is now `rotatepoint()` # ──────────────────────────────────────────────────────────────────────────────────── ## [v3.5.0] - 2022-07-28 10:15 diff --git a/docs/src/howto/geometrytools.md b/docs/src/howto/geometrytools.md index be560e70..da3efded 100644 --- a/docs/src/howto/geometrytools.md +++ b/docs/src/howto/geometrytools.md @@ -173,35 +173,37 @@ nothing # hide ![angle three points](../assets/figures/anglethreepoints.png) -Functions that help with geometry include: +Other functions that help with geometry include: -- [`distance`](@ref) +- [`distance`](@ref) distance between two points -- [`getnearestpointonline`](@ref) +- [`getnearestpointonline`](@ref) drop perpendicular -- [`pointlinedistance`](@ref) +- [`pointlinedistance`](@ref) distance of point from line between two points -- [`slope`](@ref) +- [`slope`](@ref) angle of line between two points -- [`perpendicular`](@ref) +- [`perpendicular`](@ref) find perpendicular -- [`dotproduct`](@ref) +- [`dotproduct`](@ref) scalar dot product of two points -- [`@polar`](@ref) +- [`@polar`](@ref) convert radius and angle to point -- [`polar`](@ref) +- [`polar`](@ref) convert radius and angle to point -- [`ispointonline`](@ref) +- [`ispointonline`](@ref) true if point lies on line -- [`ispointonpoly`](@ref) +- [`ispointonpoly`](@ref) true if point lies on any edge of polygon -- [`isarcclockwise`](@ref) +- [`isarcclockwise`](@ref) true if arc is clockwise -- [`pointinverse`](@ref) +- [`pointinverse`](@ref) inverse of point with respect to circle -- [`anglethreepoints`](@ref) +- [`anglethreepoints`](@ref) angle formed by two lines defined by three points -- [`determinant3`](@ref) +- [`determinant3`](@ref) find determinant of matrix of 3 points + +- [`rotatepoint`](@ref) rotate point around another by angle ## Triangle centers diff --git a/src/deprecations.jl b/src/deprecations.jl index 57872d1a..1402a673 100644 --- a/src/deprecations.jl +++ b/src/deprecations.jl @@ -3,3 +3,5 @@ using Base: @deprecate @deprecate intersection(pt1::Point, pt2::Point, pt3::Point, pt4::Point) intersectionlines(pt1::Point, pt2::Point, pt3::Point, pt4::Point) @deprecate polytriangulate!(pt) polytriangulate(pt) + +@deprecate rotate_point_around_point(targetpt, pt, angle) rotatepoint(targetpt, pt, angle) diff --git a/src/point.jl b/src/point.jl index 2a2f5c19..97dde8fd 100644 --- a/src/point.jl +++ b/src/point.jl @@ -613,6 +613,7 @@ end rotatepoint(targetpt::Point, originpt::Point, angle) Rotate a target point around another point by an angle specified in radians. + Returns the new point. """ function rotatepoint(targetpt::Point, originpt::Point, angle) @@ -622,13 +623,16 @@ function rotatepoint(targetpt::Point, originpt::Point, angle) y2 = x1 * sin(angle) + y1 * cos(angle) return Point(x2 + originpt.x, y2 + originpt.y) end - + """ - rotatepoint(targetpt::Point, angle) -Rotate a target point around canvas origin by an angle specified in radians. + rotatepoint(targetpt::Point, angle) + +Rotate a target point around the current origin by an angle specified in radians. + Returns the new point. """ - rotatepoint(targetpt::Point, angle) = rotatepoint(targetpt,O,angle) +rotatepoint(targetpt::Point, angle) = rotatepoint(targetpt, O, angle) + """ ispointonleftofline(A::Point, B::Point, C::Point)