Skip to content

Commit 455b592

Browse files
authoredSep 30, 2024··
Implement reverse for AbstractParametricCurve and other changes (#195)
1 parent 91dfbe7 commit 455b592

22 files changed

+2976
-2551
lines changed
 

‎NEWS.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 1.6.0
4+
- Feature: Define `reverse` for `AbstractParametricCurve`s, making it easier to reverse the orientation of a curve. See [#195](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/195).
5+
- Bugfix: Fixed an issue with `LineSegment` not returning the exact endpoints at `t=1`, which can be problematic when joining boundary nodes. This has been fixed. See [#195](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/195).
6+
- Bugfix: Introduced `is_linear` to fix issues with boundary enrichment of domains with `LineSegment`s. In particular, `LineSegment`s are no longer enriched. See [#195](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/195).
7+
- Bugfix: `orientation_markers` now uses `uniquetol` instead of `unique` for the final set of markers (it already did it for the intermediate markers). See [#195](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/195).
8+
- Bugfix: For large `Tuple`s, functions like `eval_fnc_at_het_tuple_two_elements` are problematic and allocate more than their non-type-stable counterparts. To get around this, for `Tuple`s of length `N > 32`, the non-type-stable version is used. See [#195](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/195).
9+
310
## 1.5.0
411

512
- Introduced the ability to reconstruct unconstrained triangulations from an existing set of points and triangles using `Triangulation(points, triangles)`. See [#192](https://github.com/JuliaGeometry/DelaunayTriangulation.jl/pull/192)

‎Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DelaunayTriangulation"
22
uuid = "927a84f5-c5f4-47a5-9785-b46e178433df"
33
authors = ["Daniel VandenHeuvel <danj.vandenheuvel@gmail.com>"]
4-
version = "1.5.1"
4+
version = "1.6.0"
55

66
[deps]
77
AdaptivePredicates = "35492f91-a3bd-45ad-95db-fcad7dcfedb7"

‎docs/src/extended/data_structures.md

+37-1
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,45 @@ CatmullRomSpline
130130

131131
```@autodocs
132132
Modules = [DelaunayTriangulation]
133-
Pages = ["data_structures/mesh_refinement/curves.jl"]
133+
Pages = ["data_structures/mesh_refinement/curves/abstract.jl"]
134134
```
135135

136+
```@autodocs
137+
Modules = [DelaunayTriangulation]
138+
Pages = ["data_structures/mesh_refinement/curves/beziercurve.jl"]
139+
```
140+
141+
```@autodocs
142+
Modules = [DelaunayTriangulation]
143+
Pages = ["data_structures/mesh_refinement/curves/bspline.jl"]
144+
```
145+
146+
```@autodocs
147+
Modules = [DelaunayTriangulation]
148+
Pages = ["data_structures/mesh_refinement/curves/catmullromspline.jl"]
149+
```
150+
151+
```@autodocs
152+
Modules = [DelaunayTriangulation]
153+
Pages = ["data_structures/mesh_refinement/curves/circulararc.jl"]
154+
```
155+
156+
```@autodocs
157+
Modules = [DelaunayTriangulation]
158+
Pages = ["data_structures/mesh_refinement/curves/ellipticalarc.jl"]
159+
```
160+
161+
```@autodocs
162+
Modules = [DelaunayTriangulation]
163+
Pages = ["data_structures/mesh_refinement/curves/linesegment.jl"]
164+
```
165+
166+
```@autodocs
167+
Modules = [DelaunayTriangulation]
168+
Pages = ["data_structures/mesh_refinement/curves/piecewiselinear.jl"]
169+
```
170+
171+
136172
## RepresentativeCoordinates
137173

138174
We use a `RepresentativeCoordinates` struct for storing the representative coordinates used for interpreting ghost vertices.

‎src/algorithms/triangulation/check_args.jl

+3-2
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ function Base.showerror(io::IO, err::InconsistentOrientationError)
9696
# Only show this longer message if this part of the boundary could be defined by an AbstractParametricCurve.
9797
# It's hard to detect if the curve is indeed defined by an AbstractParametricCurve since the curve could be defined
9898
# by a combination of multiple AbstractParametricCurves and possibly a PiecewiseLinear part. Thus, the above advice
99-
# might nto be wrong.
99+
# might not be wrong.
100100
str2 = "\nIf this curve is defined by an AbstractParametricCurve, you may instead need to reverse the order of the control points defining" *
101-
" the sections of the curve; the `positive` keyword may also be of interest for CircularArcs and EllipticalArcs."
101+
" the sections of the curve; the `positive` keyword may also be of interest for CircularArcs and EllipticalArcs. Alternatively, for individual" *
102+
" AbstractParametricCurves, note that `reverse` can be used to reverse the orientation of the curve directly instead of the control points."
102103
str *= str2
103104
end
104105
sign = err.should_be_positive ? "positive" : "negative"

‎src/algorithms/triangulation/main.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ For the keyword arguments below, you may like to review the extended help as som
4848
- `recompute_representative_points=true`: Whether to recompute the representative points after the triangulation is computed. This is done using [`compute_representative_points!`](@ref).
4949
- `delete_holes=true`: Whether to delete holes after the triangulation is computed. This is done using [`delete_holes!`](@ref).
5050
- `check_arguments=true`: Whether to check the arguments `points` and `boundary_nodes` are valid. This is done using [`check_args`](@ref).
51-
- `polygonise_n=4096`: Number of points to use for polygonising the boundary when considering the poylgon hierarchy for a curve-bounded domain using [`polygonise`](@ref). See [`triangulate_curve_bounded`](@ref).
51+
- `polygonise_n=4096`: Number of points to use for polygonising the boundary when considering the polygon hierarchy for a curve-bounded domain using [`polygonise`](@ref). See [`triangulate_curve_bounded`](@ref).
5252
- `coarse_n=0`: Number of points to use for initialising a curve-bounded domain. See [`triangulate_curve_bounded`](@ref). (A value of `0` means the number of points is chosen automatically until the diametral circles of all edges are empty.)
5353
5454
# Outputs

‎src/algorithms/triangulation/triangulate_curve_bounded.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function _coarse_discretisation_multiple_sections!(points, boundary_nodes, bound
155155
return nothing
156156
end
157157
function _coarse_discretisation_contiguous!(points, boundary_nodes, boundary_curves, curve_index, m)
158-
is_piecewise_linear(boundary_curves, curve_index) && return nothing
158+
(is_piecewise_linear(boundary_curves, curve_index) || is_linear(boundary_curves, curve_index)) && return nothing
159159
is_while = m == M_INF
160160
for _ in 1:m
161161
nn = num_boundary_edges(boundary_nodes)

‎src/data_structures.jl

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ include("data_structures/trees/polygon_hierarchy.jl")
66
include("data_structures/triangulation/adjacent.jl")
77
include("data_structures/triangulation/adjacent2vertex.jl")
88
include("data_structures/triangulation/graph.jl")
9-
include("data_structures/mesh_refinement/curves.jl")
9+
include("data_structures/mesh_refinement/curves/abstract.jl")
10+
include("data_structures/mesh_refinement/curves/linesegment.jl")
11+
include("data_structures/mesh_refinement/curves/piecewiselinear.jl")
12+
include("data_structures/mesh_refinement/curves/circulararc.jl")
13+
include("data_structures/mesh_refinement/curves/ellipticalarc.jl")
14+
include("data_structures/mesh_refinement/curves/beziercurve.jl")
15+
include("data_structures/mesh_refinement/curves/bspline.jl")
16+
include("data_structures/mesh_refinement/curves/catmullromspline.jl")
1017
include("data_structures/representative_coordinates/representative_coordinates.jl")
1118
include("data_structures/representative_coordinates/cell.jl")
1219
include("data_structures/representative_coordinates/cell_queue.jl")

‎src/data_structures/mesh_refinement/boundary_enricher.jl

+14
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,20 @@ end
730730
return eval_fnc_at_het_tuple_element(is_piecewise_linear, boundary_curves, curve_index)
731731
end
732732

733+
"""
734+
is_linear(enricher::BoundaryEnricher, curve_index) -> Bool
735+
736+
Returns `true` if the `curve_index`th curve in `enricher` is a [`LineSegment`](@ref), and `false` otherwise.
737+
"""
738+
@inline function is_linear(enricher::BoundaryEnricher, curve_index)
739+
boundary_curves = get_boundary_curves(enricher)
740+
return is_linear(boundary_curves, curve_index)
741+
end
742+
@inline function is_linear(boundary_curves::C, curve_index) where {C <: Tuple}
743+
isempty(boundary_curves) && return true
744+
return eval_fnc_at_het_tuple_element(is_linear, boundary_curves, curve_index)
745+
end
746+
733747
"""
734748
get_inverse(enricher::BoundaryEnricher, curve_index, q) -> Float64
735749

0 commit comments

Comments
 (0)
Please sign in to comment.