Geometry
To filter particles in a particular volume, such as a cube, a sphere, or a cylinder, geometries can be used. This package provides a variety of different geometries for multiple dimensions, including the following:
- Hyperrectangle
- Hypersphere
- Cylinder (standing cylinder aligned with the z axis and arbitrary orientation)
CosmoParticles.AbstractCosmoGeometry — Typeabstract type AbstractCosmoGeometry endAbstract type for (multi-dimensional) geometry volumes, particularly for filtering with filter.
Any subtypes of AbstractCosmoGeometry have to implement the following methods:
CosmoParticles.geometry_enclosing_corners — Functiongeometry_enclosing_corners(geo::AbstractCosmoGeometry)Return the lower left and upper right corners of the enclosing box of the geometry as a tuple of vectors.
The enclosing box is not necessarily the tightest fitting box.
This is not exported.
CosmoParticles.geometry_enclosing_center — Functiongeometry_enclosing_center(geo::AbstractCosmoGeometry)Return the center of the enclosing box of the geometry as a vector.
This is not exported.
CosmoParticles.mask_in — Functionmask_in(pos::AbstractMatrix{<:Number}, geo::AbstractCosmoGeometry)Return the BitArray mask of the positions ($\mathrm{dims} × N$) located within the geometry.
Calls mask_in! by default.
This is not exported.
CosmoParticles.CosmoHyperrectangle — Typestruct CosmoHyperrectangle{T,N} <: AbstractCosmoGeometry where {T<:Number}
lowerleft::Vector{T}
upperright::Vector{T}
endN-dimensional hyperrectangle aligned with the coordinate system axes given by its lower left and upper right corners.
The dimensions of space are given by N.
CosmoParticles.CosmoCuboid — TypeCosmoCuboid{T} = CosmoHyperrectangle{T,3}Alias for a 3D CosmoHyperrectangle.
CosmoParticles.CosmoRectangle — TypeCosmoRectangle{T} = CosmoHyperrectangle{T,2}Alias for a 2D CosmoHyperrectangle.
CosmoParticles.CosmoHypercube — FunctionCosmoHypercube(center::AbstractVector{<:Number}, radius::Number)Return a cubic CosmoCuboid centered around center, with equal sidelengths.
CosmoParticles.CosmoCube — FunctionCosmoCube(center::AbstractVector{<:Number}, radius::Number)Return a cubic CosmoCuboid centered around center, with equal sidelengths.
CosmoParticles.CosmoSquare — FunctionCosmoSquare(center::AbstractVector{<:Number}, radius::Number)Return a square CosmoRectangle centered around center, with equal sidelengths.
CosmoParticles.CosmoHypersphere — Typestruct CosmoHypersphere{T,N} <: AbstractCosmoGeometry where {T<:Number}
center::Vector{T}
radius::T
endN-dimensional hypersphere given by its center and radius.
If different types are passed to the constructor, the types will be promoted without throwing an error.
CosmoParticles.CosmoHypersphere — MethodCosmoHypersphere(N::Integer, radius::T)Returns an N-dimensional hypersphere around the origin.
CosmoParticles.CosmoSphere — TypeCosmoSphere{T} = CosmoHypersphere{T,3}Alias for a 2D CosmoHypersphere.
CosmoParticles.CosmoSphere — MethodCosmoSphere(radius::T)Returns a sphere around the origin.
CosmoParticles.CosmoCircle — TypeCosmoCircle{T} = CosmoHypersphere{T,2}Alias for a 2D CosmoHypersphere.
CosmoParticles.CosmoCircle — MethodCosmoCircle(radius::T)Returns a circle around the origin.
CosmoParticles.CosmoCylinder — Typestruct CosmoCylinder{T} <: AbstractCosmoGeometry where {T<:Number}
startpos::Vector{T}
endpos::Vector{T}
radius::T
endCylinder given by its end points startpos and endpos and radius.
If different types are passed to the constructor, the types will be promoted without throwing an error.
CosmoParticles.CosmoCylinder — MethodCosmoCylinder(c::CosmoStandingCylinder)Create a cylinder from a standing cylinder.
CosmoParticles.CosmoStandingCylinder — Typestruct CosmoStandingCylinder{T} <: AbstractCosmoGeometry where {T<:Number}
center::Vector{T}
height::T
radius::T
endStanding cylinder given by its center, height, and radius.
Standing means that the cylinder is oriented such that its axis is aligned with the z axis. If different types are passed to the constructor, the types will be promoted without throwing an error.
CosmoParticles.CosmoStandingCylinder — MethodCosmoStandingCylinder(c::CosmoCylinder)Create a standing cylinder from a cylinder.
The end positions of the cylinder have to have the same x and y coordinates.