Skip to content

Commit

Permalink
Merge pull request #168 from JuliaPolyhedra/bl/doc_tranlate
Browse files Browse the repository at this point in the history
Add doc for translate
  • Loading branch information
blegat authored May 9, 2019
2 parents 8a0d39a + 4442d35 commit 3b289dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/src/utilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ intersect
intersect!
convexhull
convexhull!
translate
```

## Volume
Expand Down
15 changes: 15 additions & 0 deletions src/repelemop.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ function vtranslate(p::VRep{T}, v::Union{AbstractVector{S}}) where {S, T}
similar(p, d, Tout, vmap(f, d, Tout, p)...)
end

"""
translate(p::Polyhedra.Rep, v::AbstractVector)
Computes translation of the polyhedron `p` with the vector `v`.
That is, computes
```math
\\{\\, x + v \\mid x \\in p \\,\\}.
```
By default, if the H-representation, it simply translates every hyperplanes and halfspace,
otherwise, it translates every points of the V-representation.
That is, this operation can be achieved both in the H-representation and V-representation
hence does not trigger any representation conversion.
"""
function translate end

translate(p::HRep, v) = htranslate(p, v)
translate(p::VRep, v) = vtranslate(p, v)
function translate(p::Polyhedron, v)
Expand Down

0 comments on commit 3b289dd

Please sign in to comment.