rikrd / geomerative

Geomerative is a library for Processing. It extends 2D geometry operations to facilitate generative geometry. Includes a TrueType font and an SVG interpreters. This library exposes the shapes (such as vector drawings or typographies) in a more approchable way. Geomerative makes it easy to access the contours, the control points and the curve points, making it easy to develop generative typography and geometry pieces in Processing.
http://www.ricardmarxer.com/geomerative
GNU General Public License v3.0
176 stars 29 forks source link

shape compounding distortion #5

Open Enteleform opened 7 years ago

Enteleform commented 7 years ago

I'm in the process of using Geomerative to draft some laser cutting templates.  Initially I was using Adobe Illustrator's shape compounding after rendering; but I just implemented Geomerative's union & xor functions into the project and noticed that there are various inaccuracies in the resulting output.

Here's a comparison: xor demo

If you zoom in you'll notice that the left & right examples have precise, flat edges on all of the cutouts & notches, but the center example has arbitrary distortion and would be unusable for precision fitting.

rikrd commented 7 years ago

Yes, this is an issue of the binary operation implementation. It can only act on polygons. So the shapes must be polygonized before running it. In your example: are some of the shapes made of Beziers? There are other libs out there that are capable of acting directly on other shapes (paper.js, Adobe Illustrator). This could be implemented in Geomerative but I don't have the expertise to do it, pull requests would be welcome.

Enteleform commented 7 years ago

Ok, thanks for confirming the cause of the issue.  I'll stick with post-render compounding in Adobe for now.

 

In your example: are some of the shapes made of Beziers?

Yes, the top 2 outer shapes in each example are made with a rounded rectangle generator I made using RPath's addLineTo, addBezierTo, & toShape functions.