Tetrahedron

LazySets.TetrahedronModule.TetrahedronType
Tetrahedron{N, VN<:AbstractVector{N}, VT<:AbstractVector{VN}} <: AbstractPolytope{N}

Type that represents a tetrahedron in vertex representation.

Fields

  • vertices – list of vertices

Examples

A tetrahedron can be constructed by passing the list of vertices. The following builds the tetrahedron with edge length 2 from the wikipedia page Tetrahedron:

julia> vertices = [[1, 0, -1/sqrt(2)], [-1, 0, -1/sqrt(2)], [0, 1, 1/sqrt(2)], [0, -1, 1/sqrt(2)]];

julia> T = Tetrahedron(vertices);

julia> dim(T)
3

julia> zeros(3) ∈ T
true

julia> σ(ones(3), T)
3-element Vector{Float64}:
 0.0
 1.0
 0.7071067811865475
source

Operations

Base.:∈Method
∈(x::AbstractVector, T::Tetrahedron)

Check whether a given point is contained in a tetrahedron.

Input

  • x – point/vector
  • P – tetrahedron in vertex representation

Output

true iff $x ∈ P$.

Algorithm

For each plane of the tetrahedron, we check if the point x is on the same side as the remaining vertex. We need to check this for each plane [1].

[1] https://stackoverflow.com/questions/25179693/how-to-check-whether-the-point-is-in-the-tetrahedron-or-not

source
LazySets.API.σMethod
σ(d::AbstractVector, T::Tetrahedron)

Return a support vector of a tetrahedron in a given direction.

Input

  • d – direction
  • T – tetrahedron

Output

A support vector in the given direction.

Algorithm

Currently falls back to the VPolytope implementation.

source