A vectorized drawing editor with geometric shapes support needs operations involving the algebra of regions induced by shapes. LibreOffice has: Merge (i.e. Union) Subtract Intersect as well as an odd Combine operation, whose logic is: "Define a new shape whose counter is the bounding rectangle of the union of the selected shapes; and for every region in the algebra induced by the selected shapes, make it opaque in the color of the first selected shape if the number of shapes containing this region is odd, or transparent if the number of containing shapes is even." ... weird, but I guess that might come in handy. However, LO is lacking the operation which can be used to achieve the effect of any of the other four! This is the "Fragment" operation, which exposes the full induced algebra: Defining a separate object for every one of the regions induced by the selected shapes. So, if my shapes are: +------+ | | | | | +--+----+ | | | | +---+--+ + | | +-------+ The result of the operation would be three shapes: The top-left angle, the bottom-right angle, and the middle rectangle - each with a nice contour - and lets say, the fill of the topmost shape covering them (so if there is no transparency, you only get some added counters). Naturally, with this atomic sets of the algebra you can construct any set you like (at least if we ignore contours) in the algebra, including the union, intersection, difference, the XOR-ish Combine operation etc. So please add it.
Mark the two objects together and create two copies of the pair. With first pair do "Subtract", with second pair do "Intersect". In third pair put front object back and do "Subtract". I do not think, that such "Fragment" operation is so often requested, that a special command is necessary.
(In reply to Regina Henschel from comment #1) > I do not think, that such "Fragment" operation is so often requested, that a > special command is necessary. As opposed to XOR-combine? Come on.... > Mark the two objects together and create two copies of the pair. With first > pair do "Subtract", with second pair do "Intersect". In third pair put front > object back and do "Subtract". This won't even work as described, because the overlapping copies will prevent me from making the right selections. But if I do move the shape copies out of the way, I will then need to move the operated-on shapes back, and make sure they line up perfectly - which also means having to write down the exact coordinates. And that might not even be possible, since the shape properties limits the accuracy of coordinate entry. And I haven't even mentioned the need to make sure that where I move the copy, it's all clear so that I don't drag other shapes back by mistake... So, that's not even effectively a solution - and if it were, it would require a inordinate amount of effort. Also, let's also look at MS Visio's shape operations: https://youtu.be/jPocgphVUyE?si=-eVvBj9dFkxLip-K&t=76 Union, Combine, Fragment, Intersect, Subtract guess which one we're missing? :-(
(In reply to Eyal Rozenberg from comment #2) > (In reply to Regina Henschel from comment #1) > > Mark the two objects together and create two copies of the pair. With first > > pair do "Subtract", with second pair do "Intersect". In third pair put front > > object back and do "Subtract". > > This won't even work as described, because the overlapping copies will > prevent me from making the right selections. Of cause you need to move them away. After Ctrl+V the pair is still marked and can be quickly moved away. But if I do move the shape > copies out of the way, I will then need to move the operated-on shapes back, > and make sure they line up perfectly - which also means having to write down > the exact coordinates. You can enable the option "snap to object point" and drag them together. And that might not even be possible, since the shape > properties limits the accuracy of coordinate entry. And I haven't even > mentioned the need to make sure that where I move the copy, it's all clear > so that I don't drag other shapes back by mistake... You know that you can edit objects outside the page? > > So, that's not even effectively a solution - and if it were, it would > require a inordinate amount of effort. > > > Also, let's also look at MS Visio's shape operations: > > https://youtu.be/jPocgphVUyE?si=-eVvBj9dFkxLip-K&t=76 > > Union, Combine, Fragment, Intersect, Subtract > > guess which one we're missing? :-( How often do you need it? The effort is 1 minute. If others agree with you that it is a desirable feature, it is an enhancement request not a bug.
You could also put the couple of commands into a macro. (In reply to Regina Henschel from comment #1) > I do not think, that such "Fragment" operation is so often requested, that a > special command is necessary. +1
I was about to argue the details, but this whole method doesn't even work. Suppose you take a square, copy it, rotate the copy by 45 degrees, and take the fragmentation. The number of regions is now 9, not 3. How would you address this? (In reply to Regina Henschel from comment #3) > The effort is 1 minute. Let's grant that for the moment (even though it can't even be done at all in the general case, it seems). So, 1 minute for 3 regions, or 20 seconds per region. Let's even say it's much lower - just 5 seconds per region, since I'm kind of quick and experienced. Or 15 seconds in total. Easy peasy. Now I have, say, 10 shapes selected. How many regions are there in the fragmentation? You saw my example above. It's not even as low as 2^10! It's probably something like the product of all numbers of edges of the shapes, perhaps minus 1? So, 10 rectangles - maybe... 3^10 or so. How much time would that take me to do manually? (In reply to Heiko Tietze from comment #4) > You could also put the couple of commands into a macro. Really? Please sketch out the code for that macro. For the general case of N shapes of course.
I admit that a solution for more than two shapes with the UI is too complex. A solution using macros is also complex because the required methods from basegfx are not available in macros but only the .uno commands can be used if you do not want to emulate the methods from basegfx as macro methods. Problems with the intersect and subtract .uno commands are: the shapes need to be inserted in a page, they relay on z-order, they work with a marked objects collection on the view. So I now think, it is a valid feature request. (In reply to Eyal Rozenberg from comment #5) > Really? Please sketch out the code for that macro. For the general case of N > shapes of course. An algorithm looks straight forward to me in principle, but details are complex: Copy first shape from collection into result vector. for each shape in collection starting with second shape do prepare temp vector current shape = next shape from collection. for each shape of result vector do subtract current shape from result vector shape and add this subtraction to temp vector. for each shape of result vector do subtract result vector shape from current shape and add this subtraction to temp vector. for each shape of result vector do intersect current shape with result vector shape and add this intersection to temp vector. replace result vector with temp vector. next return result vector
(In reply to Regina Henschel from comment #6) > An algorithm looks straight forward to me in principle, but details are > complex: Yes, that's what I meant to get Heiko to say... we can't expect users, even advanced users, to do tricky macro programming to that degree.
It seems a valid request to me. Same at comment 6. Let's mark it NEW
(In reply to Telesto from comment #8) > It seems a valid request to me. Same at comment 6. Let's mark it NEW I disagree that this is merely an enhancement, because given that we have shape-algebraic ops, this one is necessary. But - I'll let it go...