Utility Functions

Xtallography.acos_Function
acos_(x::Real; atol::Real=√eps(1.0)) -> Float64

Compute 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)) == π
true
source
Xtallography.asin_Function
asin_(x::Real; atol::Real=√eps(1.0)) -> Float64

Compute 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
true
source
Xtallography.is_basisFunction
is_basis(v1::Vector{Real}, v2::Vector{Real}, v3::Vector{Real}) -> Bool

Determine 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

  • true if v1, v2, and v3 are a basis; false otherwise

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])
false
source
Xtallography.surface_areaMethod
surface_area(v1::Vector{Real}, v2::Vector{Real}, v3::Vector{Real}) -> Float64

Compute 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, and v3

Examples

julia> surface_area([1, 0, 0], [1, 1, 0], [1, 0, 1])
7.464101615137754
source
Xtallography.volumeMethod
volume(v1::Vector{Real}, v2::Vector{Real}, v3::Vector{Real}) -> Float64

Compute the volume of the parallelipiped defined by the vectors v1, v2, and v3.

Return values

  • volume of the parallelipiped defined by v1, v2, and v3

Examples

julia> volume([1, 0, 0], [1, 1, 0], [1, 0, 2])
2.0
source