Function reference

Intersection between simplices

Simplices.simplexintersectionMethod
  simplexintersection(s1::Array{Float64, 2}, s2::Array{Float64, 2};
    tolerance::Float64 = 1/10^10) -> Float64

Computes the volume of intersection between two n-dimensional simplices by boundary triangulation. The simplices s1 and s2 are arrays of size (dim, dim+1), where each column is a vertex.

Note: the returned volume is not corrected. It should be divided by factorial(dim) to obtain the true volume.

How are intersections computed?

Intersections are computed as follows:

  • Find minimal set of points generating the intersection volume. These points form a convex polytope Pᵢ.
  • Triangulate the faces of Pᵢ into simplices.
  • Combine each boundary simplex with an interior point in Pᵢ. The set of all such combinations form a triangulation of Pᵢ.
  • Calculate the volume of each simplex in the resulting triangulation. The sum of these volumes is the volume of the intersection.
source

Generating points inside/outside simplex

Simplices.insidepointsMethod
insidepoints(npts::Int, parentsimplex::AbstractArray{T, 2}) where {T<:Number}

Generates npts points that located inside parentsimplex.

source
Simplices.outsidepointMethod
outsidepoint(parentsimplex::AbstractArray{T, 2}) where {T<:Number}

Generate a single point that is guaranteed to lie outside parentsimplex.

source
Simplices.outsidepointsMethod
outsidepoints(npts::Int, parentsimplex::AbstractArray{T, 2}) where T <: Number

Generates npts points that located outside parentsimplex.

source
Simplices.childsimplexMethod
childsimplex(parentsimplex::AbstractArray{T, 2}) where {T<:Number} -> Array{Float64, 2}

Generates a random simplex which is entirely contained within parentsimplex, which is a (dim+1)-by-dim array.

source

Generating simplices that intersect

There are many ways simplices possibly can intersect, but they all boil down to three cases: 1) there is no intersection, 2) they intersect along a common vertex or boundary, or 3) the intersection is more complex. The following functions generate simplices that either share at least one vertex, or simplices that intersect in nontrivial ways (i.e. intersection is not along a vertex or an edge).

Simplices.simplices_sharing_verticesMethod
simplices_sharing_vertices(dim::Int) -> Array{Float64, 2}

Genereate a set of non-trivially intersecting dim-dimensional simplices (i.e. they don't intersect along boundaries or vertices only).

source
Simplices.nontrivially_intersecting_simplicesMethod
nontrivially_intersecting_simplices(dim::Int) -> Array{Float64, 2}

Genereate a set of non-trivially intersecting dim-dimensional simplices (i.e. they don't intersect along boundaries or vertices only).

source

Properties of simplices

Simplices.orientationMethod
orientation(simplex::AbstractArray{T, 2}) where {T<:Number} -> Float64

Compute orientation of a simplex, represented by a Array{Float64, 2} of size (dim+1)-by-dim.

source
Simplices.volumeMethod
volume(simplex::AbstractArray{T, 2}) where {T<:Number} -> Float64

Compute the volume of a simplex, represented by a Array{Float64, 2} of size (dim+1)-by-dim.

source
Simplices.radiusMethod
radius(s::AbstractArray{T, 2}) where {T<:Number} -> Float64

Compute radius of a simplex s, represented by a Array{Float64, 2} of size (dim+1)-by-dim.

source
Simplices.radiusMethod
radius(simplex::Array{T, 2}, centroid::Array{T, 2}) where {T<:Number}

Compute radius of a simplex ((dim+1)-by-dim sized Array{Float64, 2} given its centroid (1-by-dim sized Array{Float64, 2}).

source
Simplices.centroidMethod
centroid(simplex::AbstractArray{Float64, 2}) where {T<:Number} -> Array{Float64, 2}

Computes the centroid of a simplex given by (dim+1)-by-dim array, where each row is a vertex. Returns the centroid as a vertex (a 1-by-dim two-dimensional array).

source