Skip to content

Commit

Permalink
Merge pull request #4 from ajkeller34/ajk/staticvector
Browse files Browse the repository at this point in the history
Some minor tweaks
  • Loading branch information
arlk authored Jul 5, 2019
2 parents d1c62e9 + 4e9e44e commit 3670cb1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/proximity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ julia> minimum_distance(p, q, dir)
"""
function minimum_distance(p::Any, q::Any, init_dir::SVector{D, T}; max_iter=100, atol::T=sqrt(eps(T))*oneunit(T)) where {D, T}
collision, dir, psimplex, qsimplex, sz = gjk(p, q, init_dir, max_iter, atol, minimum_distance_cond)
return collision ? 0.0 : norm(dir)
return collision ? zero(eltype(dir)) : norm(dir)
end

"""
Expand Down Expand Up @@ -144,7 +144,7 @@ function tolerance_verification_cond(dir::SVector, collision::Bool, tv)
tv > norm(dir) ? true : collision
end

@generated function check_degeneracy(simplex::SMatrix{N, M, T}, s::SVector{N, T}, sz::Vararg{Int, 1}) where {N, M, T}
@generated function check_degeneracy(simplex::SMatrix{N, M, T}, s::StaticVector{N, T}, sz::Vararg{Int, 1}) where {N, M, T}
exprs = :(false)
for i = 1:M
exprs = :($i > sz[1] ? $exprs : ($exprs || norm(simplex[:, $i] - s) eps($T)*oneunit($T)))
Expand Down
4 changes: 2 additions & 2 deletions src/simplex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function proj(u::AbstractVector, v::AbstractVector)
(u v)/(u u)*u
end

@generated function insertcolumn(s::SVector{N, T}) where {N, T}
@generated function insertcolumn(s::StaticVector{N, T}) where {N, T}
S = (N, N+1)
exprs = Array{Expr}(undef, S)
itr = [1:n for n = S]
Expand All @@ -22,7 +22,7 @@ end
end
end

@generated function insertcolumn(simplex::SMatrix{N, M, T}, s::SVector{N, T}, idx::Vararg{Int, 1}) where {N, M, T}
@generated function insertcolumn(simplex::SMatrix{N, M, T}, s::StaticVector{N, T}, idx::Vararg{Int, 1}) where {N, M, T}
S = (N, M)
exprs = Array{Expr}(undef, S)
itr = [1:n for n = S]
Expand Down

0 comments on commit 3670cb1

Please sign in to comment.