Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit 44f7d58

Browse files
committed
Refactoring
1 parent a332131 commit 44f7d58

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

src/processes.jl

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,40 @@ or piecewise constant over a `Domain`.
7979
"""
8080
struct ConstantIntensity <: PointPatternAlgo end
8181

82-
struct UnionSampling <: PointPatternAlgo end
83-
8482
#-----------------
8583
# IMPLEMENTATIONS
8684
#-----------------
8785

8886
include("processes/binomial.jl")
8987
include("processes/poisson.jl")
90-
include("processes/union.jl")
88+
89+
# ----------------
90+
# UNION PROCESSES
91+
# ----------------
92+
93+
"""
94+
UnionProcess(p₁, p₂)
95+
96+
Union (or superposition) of spatial point processes `p₁` and `p₂`.
97+
"""
98+
struct UnionProcess{P₁<:PointProcess,P₂<:PointProcess} <: PointProcess
99+
p₁::P₁
100+
p₂::P₂
101+
end
102+
103+
"""
104+
p₁ ∪ p₂
105+
106+
Return the union of point processes `p₁` and `p₂`.
107+
"""
108+
Base.union(p₁::PointProcess, p₂::PointProcess) = UnionProcess(p₁, p₂)
109+
110+
ishomogeneous(p::UnionProcess) = ishomogeneous(p.p₁) && ishomogeneous(p.p₂)
111+
112+
default_sampling_algorithm(::UnionProcess, ::Any) = nothing
113+
114+
function rand_single(rng::Random.AbstractRNG, p::UnionProcess, g, ::Nothing)
115+
pp₁ = rand(rng, p.p₁, g)
116+
pp₂ = rand(rng, p.p₂, g)
117+
PointSet([coordinates.(pp₁); coordinates.(pp₂)])
118+
end

src/processes/union.jl

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)