Author Topic: Trim away all hidden/unseen overlaps.  (Read 977 times)

May 22, 2018, 04:53:08 AM
Read 977 times

matnicholas

  • Sr. Newbie

  • Offline
  • **

  • 3
Hi guys,

I am looking for a quick and easy way to trim away all hidden overlaps.

Simple example: imagine I have two circles that overlap. A green on top of a blue. I want to chop away the unseen part of blue so it essentially becomes a crescent.

Advanced example: imagine I have imported a png and performed "Trace Bitmap..." with "multple scana -> colours 8 -> scans". It creates something that looks identical to the original. However if I move one of the paths I can see extra parts below the other paths. I want to chop away all these unseen bits of the paths.

Reason: I am importing SVGs into the Unity game engine, which isn't commonly done. Our art is created as a png. Then traced by Inkscape. However, on importing into Unity I can see a huge amount of polygons (the more there are the more resources you need to use it). In Unity I can see that there is a lot of duplication of surfaces, so take the simple example above, there are polygons for two complete circles, rather than polygons for a green circle and blue crescent.

So I am looking for a quick and easy way to just trim excess unseen areas.

Thanks,
Mat
« Last Edit: May 23, 2018, 06:21:32 AM by matnicholas »
  • 0.92
  • Windows 10.

May 22, 2018, 12:21:49 PM
Reply #1

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Hi.

The problem you described isn't so easy. There are two main ways to go.
First, if you want to have *exact* matching objects, vector wise. As if the paths were drawn as a result of multiple boolean operations.
There is no automated way to do that I know of. Heard illustrator has a fairly better tool for that, and know of a similar function in a cad program.

The other route is, dealing with the visual appearance -like as you mentioned, using a raster copy to start with.
The result won't be an exact but a fairly good approximation the best, although there are more options here.
Using the trace bitmap as the base of the process, it's good to know how it works. It uses the luminance level of the selected raster image.
For that reason, drawing with distinctive lightness values can be a good start.
Then, if more scans are used, each resulting path is stacked atop eachother with the same edges represented here and there.
It could be avoided if only one scan is used at a time. Which also means you'd need separate raster copies with only the desired parts filled with the darkest tone.

Even if the original source is a raster image, some filtering may be possible to separate one colour.
And if someone knows how, probably it could be automated via an extension. However I'm not familiar with that part.

Can you share a simple example we could test the process?

May 22, 2018, 06:42:21 PM
Reply #2

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
There's an option for 'trace bitmap' to not stack scans - wouldn't that already do what you need? (just remove the check mark)
« Last Edit: May 23, 2018, 07:13:38 AM by Moini, Reason: fix vocabulary »

May 22, 2018, 08:40:08 PM
Reply #3

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Yes, disabling that option "Stack Scans" does exactly what you want.  In my opinion, it needs a better name.

In the past, perhaps distant pass, it did exactly what it implies.  Disabling it would tile all the different scans on the canvas - i.e. not stacked.  I don't know when it got it's current magical behavior, but it certainly needs a more appropriate name!

Maybe that name change would require a bug report?  I'll make one.

Edit
Haha, looks like I already did that!

https://bugs.launchpad.net/inkscape/+bug/1692550
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

May 23, 2018, 06:20:07 AM
Reply #4

matnicholas

  • Sr. Newbie

  • Offline
  • **

  • 3
Awesome. Thanks guys. Unchecking "Stack scans" was perfect.
  • 0.92
  • Windows 10.