Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename WindingNumberHorman to WindingNumberHormann #615

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/src/preprocessing/preprocessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Here, ``\Theta_i`` is the *signed* angle between ``\mathbf{c}_i - \mathbf{p}`` a
In 3D, we refer to the solid angle of an *oriented* triangle with respect to ``\mathbf{p}``.

We provide the following methods to calculate ``w(\mathbf{p})``:
- Horman et al. (2001) evaluate the winding number combined with an even-odd rule, but only for 2D polygons (see [WindingNumberHorman](@ref)).
- Hormann et al. (2001) evaluate the winding number combined with an even-odd rule, but only for 2D polygons (see [WindingNumberHormann](@ref)).
- Naive winding: Jacobson et al. (2013) generalized the winding number so that the algorithm can be applied for both 2D and 3D geometries (see [WindingNumberJacobson](@ref)).
- Hierarchical winding: Jacobson et al. (2013) also introduced a fast hierarchical evaluation of the winding number. For further information see the description below.

Expand Down Expand Up @@ -243,7 +243,7 @@ The evaluation then looks as follows.

```@autodocs
Modules = [TrixiParticles]
Pages = [joinpath("preprocessing", "point_in_poly", "winding_number_horman.jl")]
Pages = [joinpath("preprocessing", "point_in_poly", "winding_number_hormann.jl")]
```

```@autodocs
Expand All @@ -260,6 +260,6 @@ Pages = [joinpath("preprocessing", "geometries", "io.jl")]
- Alec Jacobson, Ladislav Kavan, and Olga Sorkine-Hornung "Robust inside-outside segmentation using generalized winding numbers".
In: ACM Transactions on Graphics, 32.4 (2013), pages 1--12.
[doi: 10.1145/2461912.2461916](https://igl.ethz.ch/projects/winding-number/robust-inside-outside-segmentation-using-generalized-winding-numbers-siggraph-2013-jacobson-et-al.pdf)
- Kai Horman, Alexander Agathos "The point in polygon problem for arbitrary polygons".
- Kai Hormann, Alexander Agathos "The point in polygon problem for arbitrary polygons".
In: Computational Geometry, 20.3 (2001), pages 131--144.
[doi: 10.1016/s0925-7721(01)00012-8](https://doi.org/10.1016/S0925-7721(01)00012-8)
2 changes: 1 addition & 1 deletion src/TrixiParticles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export BoundaryMovement
export examples_dir, validation_dir, trixi_include
export trixi2vtk
export RectangularTank, RectangularShape, SphereShape, ComplexShape
export WindingNumberHorman, WindingNumberJacobson
export WindingNumberHormann, WindingNumberJacobson
export VoxelSphere, RoundSphere, reset_wall!, extrude_geometry, load_geometry
export SourceTermDamping
export ShepardKernelCorrection, KernelCorrection, AkinciFreeSurfaceCorrection,
Expand Down
2 changes: 1 addition & 1 deletion src/preprocessing/point_in_poly/point_in_poly.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include("hierarchical_winding.jl")
include("winding_number_horman.jl")
include("winding_number_hormann.jl")
include("winding_number_jacobson.jl")
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"""
WindingNumberHorman()
WindingNumberHormann()

Algorithm for inside-outside segmentation of a complex geometry proposed by [Horman et al. (2001)](@ref references_complex_shape).
Algorithm for inside-outside segmentation of a complex geometry proposed by [Hormann et al. (2001)](@ref references_complex_shape).
It is only supported for 2D geometries.
[`WindingNumberHorman`](@ref) might handle edge cases a bit better, since the winding number is an integer value.
[`WindingNumberHormann`](@ref) might handle edge cases a bit better, since the winding number is an integer value.

!!! warning "Experimental Implementation"
This is an experimental feature and may change in any future releases.
"""
struct WindingNumberHorman end
struct WindingNumberHormann end

# Algorithm 2 from Horman et al. (2001) "The point in polygon problem for arbitrary polygons"
# Algorithm 2 from Hormann et al. (2001) "The point in polygon problem for arbitrary polygons"
# https://doi.org/10.1016/S0925-7721(01)00012-8
function (point_in_poly::WindingNumberHorman)(geometry, points; store_winding_number=false)
function (point_in_poly::WindingNumberHormann)(geometry, points; store_winding_number=false)
(; edge_vertices) = geometry

# We cannot use a `BitVector` here, as writing to a `BitVector` is not thread-safe
Expand Down
8 changes: 4 additions & 4 deletions src/setups/complex_shape.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Sample a complex geometry with particles. Returns an [`InitialCondition`](@ref).
Note that an initial particle grid is generated inside the bounding box of the geometry.
A `point_in_geometry_algorithm` checks if particles are inside the geometry or not.
For more information about the method see [`WindingNumberJacobson`](@ref) or [`WindingNumberHorman`](@ref).
For more information about the method see [`WindingNumberJacobson`](@ref) or [`WindingNumberHormann`](@ref).

# Arguments
- `geometry`: Geometry returned by [`load_geometry`](@ref).
Expand All @@ -30,7 +30,7 @@ For more information about the method see [`WindingNumberJacobson`](@ref) or [`W
will be overwritten when using an initial pressure function in the system.
- `point_in_geometry_algorithm`: Algorithm for sampling the complex geometry with particles.
It basically checks whether a particle is inside an object or not.
For more information see [`WindingNumberJacobson`](@ref) or [`WindingNumberHorman`](@ref)
For more information see [`WindingNumberJacobson`](@ref) or [`WindingNumberHormann`](@ref)
- `grid_offset`: Offset of the initial particle grid of the bounding box of the `geometry`.
- `max_nparticles`: Maximum number of particles in the initial particle grid.
This is only used to avoid accidentally choosing a `particle_spacing`
Expand All @@ -48,8 +48,8 @@ function ComplexShape(geometry::Union{TriangleMesh, Polygon}; particle_spacing,
winding_number_factor=sqrt(eps())),
store_winding_number=false, grid_offset::Real=0.0,
max_nparticles=10^7, pad_initial_particle_grid=2particle_spacing)
if ndims(geometry) == 3 && point_in_geometry_algorithm isa WindingNumberHorman
throw(ArgumentError("`WindingNumberHorman` only supports 2D geometries"))
if ndims(geometry) == 3 && point_in_geometry_algorithm isa WindingNumberHormann
throw(ArgumentError("`WindingNumberHormann` only supports 2D geometries"))
end

if grid_offset < 0.0
Expand Down
6 changes: 3 additions & 3 deletions test/setups/complex_shape.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

@testset verbose=true "2D" begin
@testset verbose=true "Shifted Rectangle" begin
algorithms = [WindingNumberHorman(), WindingNumberJacobson()]
algorithms = [WindingNumberHormann(), WindingNumberJacobson()]
shifts = [-0.5, 0.0, 0.5]
particle_spacings = [0.03, 0.05]

Expand Down Expand Up @@ -39,8 +39,8 @@

@testset verbose=true "Real World Data" begin
files = ["hexagon", "circle", "inverted_open_curve"]
algorithms = [WindingNumberHorman(), WindingNumberJacobson()]
algorithm_names = ["horman", "jacobson"]
algorithms = [WindingNumberHormann(), WindingNumberJacobson()]
algorithm_names = ["hormann", "jacobson"]

@testset verbose=true "Algorithm: $(TrixiParticles.type2string(algorithms[i]))" for i in 1:2
@testset verbose=true "Test File `$(files[j])`" for j in eachindex(files)
Expand Down
Loading