Skip to content

Commit

Permalink
Implement reverse for AbstractParametricCurve and other changes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielVandH authored Sep 30, 2024
1 parent 91dfbe7 commit 455b592
Show file tree
Hide file tree
Showing 22 changed files with 2,976 additions and 2,551 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.6.0
- 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).
- 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).
- 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).
- 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).
- 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).

## 1.5.0

- 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)
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DelaunayTriangulation"
uuid = "927a84f5-c5f4-47a5-9785-b46e178433df"
authors = ["Daniel VandenHeuvel <danj.vandenheuvel@gmail.com>"]
version = "1.5.1"
version = "1.6.0"

[deps]
AdaptivePredicates = "35492f91-a3bd-45ad-95db-fcad7dcfedb7"
Expand Down
38 changes: 37 additions & 1 deletion docs/src/extended/data_structures.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,45 @@ CatmullRomSpline

```@autodocs
Modules = [DelaunayTriangulation]
Pages = ["data_structures/mesh_refinement/curves.jl"]
Pages = ["data_structures/mesh_refinement/curves/abstract.jl"]
```

```@autodocs
Modules = [DelaunayTriangulation]
Pages = ["data_structures/mesh_refinement/curves/beziercurve.jl"]
```

```@autodocs
Modules = [DelaunayTriangulation]
Pages = ["data_structures/mesh_refinement/curves/bspline.jl"]
```

```@autodocs
Modules = [DelaunayTriangulation]
Pages = ["data_structures/mesh_refinement/curves/catmullromspline.jl"]
```

```@autodocs
Modules = [DelaunayTriangulation]
Pages = ["data_structures/mesh_refinement/curves/circulararc.jl"]
```

```@autodocs
Modules = [DelaunayTriangulation]
Pages = ["data_structures/mesh_refinement/curves/ellipticalarc.jl"]
```

```@autodocs
Modules = [DelaunayTriangulation]
Pages = ["data_structures/mesh_refinement/curves/linesegment.jl"]
```

```@autodocs
Modules = [DelaunayTriangulation]
Pages = ["data_structures/mesh_refinement/curves/piecewiselinear.jl"]
```


## RepresentativeCoordinates

We use a `RepresentativeCoordinates` struct for storing the representative coordinates used for interpreting ghost vertices.
Expand Down
5 changes: 3 additions & 2 deletions src/algorithms/triangulation/check_args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ function Base.showerror(io::IO, err::InconsistentOrientationError)
# Only show this longer message if this part of the boundary could be defined by an AbstractParametricCurve.
# It's hard to detect if the curve is indeed defined by an AbstractParametricCurve since the curve could be defined
# by a combination of multiple AbstractParametricCurves and possibly a PiecewiseLinear part. Thus, the above advice
# might nto be wrong.
# might not be wrong.
str2 = "\nIf this curve is defined by an AbstractParametricCurve, you may instead need to reverse the order of the control points defining" *
" the sections of the curve; the `positive` keyword may also be of interest for CircularArcs and EllipticalArcs."
" the sections of the curve; the `positive` keyword may also be of interest for CircularArcs and EllipticalArcs. Alternatively, for individual" *
" AbstractParametricCurves, note that `reverse` can be used to reverse the orientation of the curve directly instead of the control points."
str *= str2
end
sign = err.should_be_positive ? "positive" : "negative"
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/triangulation/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ For the keyword arguments below, you may like to review the extended help as som
- `recompute_representative_points=true`: Whether to recompute the representative points after the triangulation is computed. This is done using [`compute_representative_points!`](@ref).
- `delete_holes=true`: Whether to delete holes after the triangulation is computed. This is done using [`delete_holes!`](@ref).
- `check_arguments=true`: Whether to check the arguments `points` and `boundary_nodes` are valid. This is done using [`check_args`](@ref).
- `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).
- `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).
- `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.)
# Outputs
Expand Down
2 changes: 1 addition & 1 deletion src/algorithms/triangulation/triangulate_curve_bounded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function _coarse_discretisation_multiple_sections!(points, boundary_nodes, bound
return nothing
end
function _coarse_discretisation_contiguous!(points, boundary_nodes, boundary_curves, curve_index, m)
is_piecewise_linear(boundary_curves, curve_index) && return nothing
(is_piecewise_linear(boundary_curves, curve_index) || is_linear(boundary_curves, curve_index)) && return nothing
is_while = m == M_INF
for _ in 1:m
nn = num_boundary_edges(boundary_nodes)
Expand Down
9 changes: 8 additions & 1 deletion src/data_structures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ include("data_structures/trees/polygon_hierarchy.jl")
include("data_structures/triangulation/adjacent.jl")
include("data_structures/triangulation/adjacent2vertex.jl")
include("data_structures/triangulation/graph.jl")
include("data_structures/mesh_refinement/curves.jl")
include("data_structures/mesh_refinement/curves/abstract.jl")
include("data_structures/mesh_refinement/curves/linesegment.jl")
include("data_structures/mesh_refinement/curves/piecewiselinear.jl")
include("data_structures/mesh_refinement/curves/circulararc.jl")
include("data_structures/mesh_refinement/curves/ellipticalarc.jl")
include("data_structures/mesh_refinement/curves/beziercurve.jl")
include("data_structures/mesh_refinement/curves/bspline.jl")
include("data_structures/mesh_refinement/curves/catmullromspline.jl")
include("data_structures/representative_coordinates/representative_coordinates.jl")
include("data_structures/representative_coordinates/cell.jl")
include("data_structures/representative_coordinates/cell_queue.jl")
Expand Down
14 changes: 14 additions & 0 deletions src/data_structures/mesh_refinement/boundary_enricher.jl
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,20 @@ end
return eval_fnc_at_het_tuple_element(is_piecewise_linear, boundary_curves, curve_index)
end

"""
is_linear(enricher::BoundaryEnricher, curve_index) -> Bool
Returns `true` if the `curve_index`th curve in `enricher` is a [`LineSegment`](@ref), and `false` otherwise.
"""
@inline function is_linear(enricher::BoundaryEnricher, curve_index)
boundary_curves = get_boundary_curves(enricher)
return is_linear(boundary_curves, curve_index)
end
@inline function is_linear(boundary_curves::C, curve_index) where {C <: Tuple}
isempty(boundary_curves) && return true
return eval_fnc_at_het_tuple_element(is_linear, boundary_curves, curve_index)
end

"""
get_inverse(enricher::BoundaryEnricher, curve_index, q) -> Float64
Expand Down
Loading

0 comments on commit 455b592

Please sign in to comment.