-
Notifications
You must be signed in to change notification settings - Fork 59
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
Polygon subtraction #2
Comments
Hey, thanks for the good words! I'm all happy if people find this useful as well! Let me give you a more detailed answer below.
|
Awesome, thanks for the quick reply! All i had to do was to change this: Into: So if you wanted a general function for doing all these kinds of operations you could change the function Super simple, thanks again! |
Boolean operations are done using Clipper, a great open source freeware library for clipping and offsetting lines and polygons. So far I only incorporated union, but you can easily extend the library to make extension methods doing different types of clipping operations. See In this library, only |
You can nicely arrange the extensions into an extension class like below. using System;
using UnityEngine;
namespace EPPZ.Geometry
{
public static class Polygon_Extensions
{
public Polygon IntersectionPolygon(this Polygon _this)
{ ... }
public Polygon DifferencePolygon(this Polygon _this)
{ ... }
public Polygon XORPolygon(this Polygon _this)
{ ... }
}
} |
i can't open example scene in unity 2018.3.6. |
Great stuff you got here! Just one question, you mention in the description that you can perform subtraction. Is it possible to subtract one polygon from another as shown in the picture below? So far i have only managed to do an XOR.
Thanks!
The text was updated successfully, but these errors were encountered: