Shapes and domains
Shapes are used to define the shape of particles, and to define containers (or configurations) where all particles are placed. It is also used in plotting.
MultipleScattering.Shape — Type
Abstract idea which defines the external boundary of object.
MultipleScattering.Shape — Method
Shape(shape::Shape; addtodimensions = 0.0, vector_translation = zeros(...), kws...)Alter the shape depending on the keywords.
Base.issubset — Method
issubset(shape1, shape2)::BoolReturns true if shape1 is entirely contained within shape2, false otherwise (also works with particles).
MultipleScattering.:≅ — Method
iscongruent(p1::Shape, p2::Shape)::Bool
≅(p1::Shape, p2::Shape)::BoolTrue if shapes are the same but in different positions (origins), standard mathematical definition.
MultipleScattering.boundary_functions — Function
boundary_functions(shape::Shape)::NTuple{Dim,Function}Returns Tuple of Dim Functions which define outer boundary of shape when given boundary coordinate t∈[0,1]
MultipleScattering.boundary_points — Function
Returns a set of points on the boundary of a 3D shape.
MultipleScattering.boundary_points — Function
Returns a set of points on the boundary of a 2D shape.
MultipleScattering.bounding_box — Method
Returns box which completely encloses the shapes
MultipleScattering.check_boundary_coord_range — Method
Generic helper function which tests if boundary coordinate is between 0 and 1
MultipleScattering.congruent — Function
congruent(s::Shape, x)::ShapeCreate shape congruent to s but with origin at x
MultipleScattering.iscongruent — Method
iscongruent(p1::Shape, p2::Shape)::Bool
≅(p1::Shape, p2::Shape)::BoolTrue if shapes are the same but in different positions (origins), standard mathematical definition.
MultipleScattering.name — Function
name(shape::Shape)::StringName of a shape
MultipleScattering.number_type — Method
number_type(shape::Shape)::DataTypeNumber type which is used to describe shape, defaults to the eltype of the origin vector.
MultipleScattering.origin — Method
origin(shape::Shape)::SVectorOrigin of shape, typically the center
MultipleScattering.outer_radius — Function
outer_radius(shape::Shape)The radius of a circle which completely contains the shape
MultipleScattering.points_in_shape — Method
points_in_shape(Shape; resolution = 20, xres = resolution, yres = resolution,
exclude_region = EmptyShape(region), kws...)returns (x_vec, region_inds) where x_vec is a vector of points that cover a box which bounds Shape, and region_inds is an array of linear indices such that x_vec[region_inds] are points contained Shape. For 3D we use zres instead of yres.
MultipleScattering.volume — Function
volume(shape::Shape)Volume of a shape
MultipleScattering.AbstractSphere — Type
All abstract spheres will have an origin and a radius
MultipleScattering.Helmholtz — Type
Helmholtz([origin=zeros(),] radius, aperture)A Shape which represents a general 2D Helmholtz resonator.
MultipleScattering.IsotropicHelmholtz — Type
IsotropicHelmholtz([origin=zeros(),] radius, aperture)A Shape which represents a 2D thin-walled isotropic Helmholtz resonator.
MultipleScattering.Sphere — Type
Sphere([origin=zeros(),] radius)A Shape where boundary is a fixed distance from the origin. In 2D this is a circle, in 3D the usual sphere, and in higher dimensions if difficult to visualise.
MultipleScattering.Halfspace — Type
Halfspace(normal::AbstractVector{T} [, origin::AbstractVector{T}=zeros()])A halfspace defined by all the points $\mathbf x$ that satify $(\mathbf x - \mathbf o) \cdot \mathbf n < 0$ where $\mathbf n$ is the unit normal and $\mathbf o$ is the origin.
MultipleScattering.Plate — Type
Plate(normal::AbstractVector{T}, width::T, [, origin::AbstractVector{T}=zeros()])A plate defined by all the points $\mathbf x$ that satify $|(\mathbf x - \mathbf o) \cdot \mathbf n| < w /2$ where $\mathbf n$ is the unit normal, $\mathbf o$ is the origin, and $w$ is the width.
MultipleScattering.Box — Type
Box([origin::AbstractVector{T}=zeros(),] dimensions::AbstractVector{T})A Box for 2D and 3D with axis aligned sides, defined by dimensions and origin (at the center).
MultipleScattering.Box — Method
Box(points::Vector{v} where v <: AbstractVector)A Box for any dimension with axis aligned sides, that is a minimal cover for the points.
MultipleScattering.bottomleft — Method
Return SVector with the coordinates of the bottom left of a rectangle
MultipleScattering.corners — Method
Returns a vector of SVector with the coordinates of the corners of the box
MultipleScattering.topright — Method
Return SVector with the coordinates of the top right of a rectangle
MultipleScattering.EmptyShape — Type
EmptyShape{Dim}An empty shape with no points.
MultipleScattering.Polygon — Type
Polygon(boundary_points::Vector; interior_points = [mean(boundary_points)])A Shape defined by a set of points on the boundary boundary_points. The boundary_points should be ordered such that consecutive points are connected by edges of the polygon. The interior_points are a set of points that lie within the polygon. To determine whether a point is inside the polygon, see in(x::AbstractVector, poly::Polygon).
Base.issubset — Method
issubset(box::Box, poly::Polygon)Returns true if the corners of the box are contained within polygon, false otherwise.
MultipleScattering.TimeOfFlightPlaneWaveToPoint — Type
A shape which contains all particles,$x > x_0$, necessary to simulate a plane-wave scattering from an infinite medium, for a reciever at the focal point, for time $t < D / c$, where $c$ is the sound speed of the background medium, and $D$ is some chosen focal distance. The plane-wave travels towards the positive direction of the $x$ axis.
More precisely, if the focal point is at $(x_f,y_f)$ then the interior of the shape is defined as $(y - y_f)^2 < (D + x_0)^2 - x_f^2 - 2(D + x_0 - x_f)x$ and $x > min(x_0, x_f)$ where $D$ is the focal distance.
MultipleScattering.TimeOfFlightPointWaveToPoint — Type
A shape where anything inside could cause a disturbance at the listener position from a point source wavefront starting at the listener. Also everything inside has a positive x coordinate. It is equivalent to a segment of a circle.
More precisely, if the listener is at (lx,ly) then the interior of the shape is defined as sqrt((x-lx)^2+(y-ly)^2)<time and x>0