Utility Functions
Xtallography.acos_ — Function
acos_(x::Real; atol::Real=√eps(1.0)) -> Float64Compute the arccos of x with a tolerance for values of x that are slightly outside of the mathematical domain [-1, 1].
When the value of x is approximately equal to 1, acos_(x) returns 0; when the value of x is approximately equal to -1, acos_(x) returns π.
Return values
- arccos of
x
Examples
julia> acos_(0.5) ≈ π / 3
true
julia> acos_(1 + eps(1.0)) == 0
true
julia> acos_(-1 - eps(1.0)) == π
trueXtallography.asin_ — Function
asin_(x::Real; atol::Real=√eps(1.0)) -> Float64Compute the arcsin of x with a tolerance for values of x that are slightly outside of the mathematical domain [-1, 1].
When the value of x is approximately equal to 1, asin_(x) returns π / 2; when the value of x is approximately equal to -1, asin_(x) returns -π / 2.
Return values
- arcsin of
x
Examples
julia> asin_(0.5) ≈ π / 6
true
julia> asin_(1 + eps(1.0)) == π / 2
true
julia> asin_(-1 - eps(1.0)) == -π / 2
trueXtallography.is_basis — Function
is_basis(v1::Vector{Real}, v2::Vector{Real}, v3::Vector{Real}) -> BoolDetermine if the vectors v1, v2, and v3 are a basis for a three-dimensional lattice (i.e., v1, v2, and v3 are linearly independent).
Return values
trueifv1,v2, andv3are a basis;falseotherwise
Examples
julia> is_basis([1, 0, 0], [1, 1, 0], [1, 0, 1])
true
julia> is_basis([1, 0, 0], [1, 1, 0], [1, -1, 0])
falseXtallography.surface_area — Method
surface_area(v1::Vector{Real}, v2::Vector{Real}, v3::Vector{Real}) -> Float64Compute the surface area of the parallelipiped defined by the vectors v1, v2, and v3.
Return values
- surface area of the parallelipiped defined by
v1,v2, andv3
Examples
julia> surface_area([1, 0, 0], [1, 1, 0], [1, 0, 1])
7.464101615137754Xtallography.volume — Method
volume(v1::Vector{Real}, v2::Vector{Real}, v3::Vector{Real}) -> Float64Compute the volume of the parallelipiped defined by the vectors v1, v2, and v3.
Return values
- volume of the parallelipiped defined by
v1,v2, andv3
Examples
julia> volume([1, 0, 0], [1, 1, 0], [1, 0, 2])
2.0