Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-place translation and rotation / preserving the representations #246

Open
anicusan opened this issue Mar 10, 2021 · 1 comment
Open
Assignees

Comments

@anicusan
Copy link

In its current implementation, the translate function creates a new object for the translated polyhedron. In cases where a large number of translations are applied, this quickly becomes an unnecessary copy.

Can we implement an in-place version translate!(p::Polyhedron, v) that does not create a new object when the translation is applied? As an extension to my previous issue #245 , can we implement an in-place version of the hypothetical rotate function too?

One final point that is closely related to the translate function - this code from the source:

function translate(p::Polyhedron, v)
    if hrepiscomputed(p)
        htranslate(p, v)
    else
        vtranslate(p, v)
    end
end

When a translation is applied to a Polyhedron that has both the H- and the V-representations computed, the V-representation is lost, incurring an expensive recomputation step needed every time translate is used. Can we preserve both representations? Thinking of the implementation, this would need to use the in-place version of translate for each representation, respectively.

@blegat blegat self-assigned this May 27, 2021
@blegat
Copy link
Member

blegat commented May 27, 2021

That should be possible indeed. There is in fact even a quite elegant way to do this now with https://github.com/jump-dev/MutableArithmetics.jl. I'l try to do it today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants