Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Hatches from intersection #184

Open
mattiafedrigotti opened this issue Apr 20, 2020 · 5 comments
Open

Hatches from intersection #184

mattiafedrigotti opened this issue Apr 20, 2020 · 5 comments
Labels

Comments

@mattiafedrigotti
Copy link

Sorry, but i have not found an answer in the issues.
Is possibile to draw an hatch from a intersection of bounadries? If I specify multiple boundaries for an hatches, how can I invert the selected area for the hatch?
Thankyou.

@haplokuon
Copy link
Owner

When you have several boundaries that intersect each other, the hatch pattern will only be drawn where there is an odd number of superposition. This is the default behavior, to achieve any other result it is required to calculate the intersection, difference, or union; and that is not implemented.

I have somewhere, I will need to find it, some code that I programmed long time ago as an exercise to solve boolean operations, I did it from the description of a book that I do not remember at the moment. I could publish it but you will need to keep in mind that, it works only for polygons and triangle meshes, it is slow, and some glitches might appear for very small segments and triangles.

@mattiafedrigotti
Copy link
Author

mattiafedrigotti commented Apr 22, 2020

Thanks for your answer.
I need only consider a even number of superposition > 0. Can I do this in your code?
Alternatively can I cut external lines to a boundary?

@haplokuon
Copy link
Owner

haplokuon commented Apr 23, 2020

If you have two different intersecting boundaries and you want the hatch only in the intersection area, that intersection needs to be calculated, and this is something that the library doesn't do. The current implementation only consider cases of non overlapping boundaries, if the overlap the behavior will be as I explained in my previous post, there is no wary around that. If they do the result might not be what you expect it will depend on how the boundaries are defined, if they are part of the same HatchBoundaryPath, or different ones and its order.

The boundary data of a hatch in a case (overlapping boundaries) like this, will have only one boundary that reference two entities (in the case that the intersection shapes are two polylines) and an internal edge data that defines the intersection. For non associative hatches the referenced entities do not appear in the internal data of Hatch entity, just the edges.

For your second question is the same problem, a line that you want to make to cut a hatch will be part of that same boundary and the intersection still needs to be calculated.

@mattiafedrigotti
Copy link
Author

Can I insert a seed Point for selecting the boundaries intersection (code 98 in the dxf file)? This can be helpful.
Thank you very much.

@haplokuon
Copy link
Owner

That will not work. The Hatch entity must contain the information of its perimeter that is defined by the edges of the boundary path.

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

No branches or pull requests

2 participants