Git Product home page Git Product logo

cgaldotnet's Introduction

Welcome to CGALDotNet.

The Geometry Kernel.

The Polygon Kernel.

The Triangulation Kernel

The Arrangements Kernel

The Polyhedra Kernel

Some common geomerty objects are referrenced in a seperate project so they can come under a different license.

Work in progress. Only 64 bit windows binarys provided.

Examples in Unity can be found in this repository.

A page on the Unity forums can be found here.

cgaldotnet's People

Contributors

scrawk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cgaldotnet's Issues

Triangulation of PolygonWithHole2

I tried to triangulate a polygon having holes, but only the main polygon is triangulated. Am I missing something or this is actually not possible?

Performance of GetPoints

To create a Polygon from a list of points and faces is really fast. But retrieving back the points is really slow. Right now it's faster to export an PLY and run a compiled C++ script to read that file, run the code, write back a PLY file and load it back into the software. Our goal is to remove the time of writing/reading by using this library.

The GetPoints function takes about 10 seconds to run. Whereas GetTriangleIncides is instant. 36017 vertices and 222258 indices.

Any idea on how to get the points fast?

Wrong result from CGALIntersections.Intersection?

My test:

var s1 = new Segment2d(0, 0, 1, 1);
var s2 = new Segment2d(0, 1, 1, 0);
var i = CGALIntersections.Intersection(s1, s2);

Expecting to find a point intersection at coordinates 0.5,0.5 but instead i.Type is SEGMENT2 and i.Segment is A=0,0 B=0,0.

Big chunks of CGAL seem to be under the GPL

Core is LGPL: https://www.cgal.org/license.html

But lots of modules are GPL: https://doc.cgal.org/latest/Manual/packages.html

I'm wondering if you've got any insight into this that I've missed. I was hoping to use CGALDotNet in an Apache and MIT licenced project. I might have managed that by sticking to the LGPL parts (although I understand that makes Android builds problemmatic due to packaging).

However - GPL surely rules out any usage in non-GPL open source. And doesn't that mean CGALDotNet itself needs to be GPL as you're wrapping some of the GPL CGAL modules?

I'm not expecting but holding out a small hope you know a workaround for this as I'd love to use CGALDotNet.

version of dependency

Such amazing work!

I am wondering, which version of CGAL and Eigen you depend on, I have tried CGAL5.4, and Eigen 3, but I can't build the CGAL Wrapper project.

Skeleton with Holes

Edited for clarity:
I have a polygon (array of Vector2s) and an array of polygons that represent interior holes. After I create the PolygonWithHoles2 instance using the outermost polygon, I then use the AddHole method for each of the holes. I would expect an interior skeleton generated using the PolygonWithHoles2 instance to respect the previously added holes. However, the resulting skeleton remains the same as though no holes had been added at all. I've attached images demonstrating this (Input polygons/holes depicted in red, generated lines depicted in pink). How do you create a skeleton with interior holes? Below is my code:

`
////Get the instance to the offset algorithm.
var instance = PolygonOffset2.Instance;

        var polygon = new Polygon2<EIK>(args.Lines.First().Points.Select(p => new Point2d(p.X, p.Y)).ToArray());
        if (polygon.IsClockWise) {
            args.Lines.First().Points.Reverse();
            polygon = new Polygon2<EIK>(args.Lines.First().Points.Select(p => new Point2d(p.X, p.Y)).ToArray());
        }

        var polygonWithHoles = new PolygonWithHoles2<EIK>(polygon);
        foreach (var hole in args.Lines.Skip(1)) {
            var polygonHole = new Polygon2<EIK>(hole.Points.Select(p => new Point2d(p.X, p.Y)).ToArray());

            if (polygonHole.IsCounterClockWise) {
                hole.Points.Reverse();
                polygonHole = new Polygon2<EIK>(hole.Points.Select(p => new Point2d(p.X, p.Y)).ToArray());
            }
            polygonWithHoles.AddHole(polygonHole);
        }

        //The skeleton is return as a array of segments.
        var skeleton = new List<Segment2d>();
        instance.CheckInput = true;
        instance.CreateInteriorSkeleton(polygonWithHoles, false, skeleton);

        foreach (var segment in skeleton) {
            Utils.AddToBmp(bmp, new Vector2[] { 
                new Vector2((float)segment.A.x, (float)segment.A.y), 
                new Vector2((float)segment.B.x, (float)segment.B.y) 
            }, Color.HotPink);

WEIRD_Ring
Square_Ring
Polyline

        }

`

CGALDotNet outside of Unityu

Hi,
CGALDotNet works like a charm in Unity, but now I need to use it in a standard C# winform project.
Problem is, at the first instruction that uses CGALDotNet:

using CGALDotNet;
using CGALDotNetGeometry;
(...)
List<Point2d> points = new List<Point2d>(); // First CGALDotNet use in the program

the program throws a "System.IO.FileNotFoundException : Could not find file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies".
I manually added a reference to the system.runtime.dll file that is used in a Unity project and spent a lot of time trying and searching, but could not find a solution.
Any ideas?

Support for Spliting Mesh in 2 parts and close opening

You have done a very good and hard job by converting all those functionality from CGAL to .net, as .net lacks good library for Meshing, etc.
My question is does this library supports split mesh by normal and a point , and also close the newly generated side ?
I am looking for some library which supports these functionalities with good performance. Currently I have tried Helix and Gradientspace library for the same.

PolygonVisibility.ComputeVisibility AccessViolationException

I tryed the method PolygonVisibility.ComputeVisibility , but encountered a AccessViolationException error bug.

Here is my code:

var points = new Point2d[]
{
  new Point2d(0, 0),
  new Point2d(5, 0),
  new Point2d(5, 5),
  new Point2d(0, 5),
};

var poly = new Polygon2<EEK>(points);
var pv = new PolygonVisibility<EEK>();

var pt = new Point2d(0, 0);
Polygon2<EEK> result;
pv.ComputeVisibility(pt, poly, out result);

The error is System.AccessViolationException:“Attempted to read or write protected memory. This is often an indication that other memory is corrupt.” which appeared at pv.ComputeVisibility(pt, poly, out result);

I successfully built binaries for MacOS. May I contribute?

Hi!
I believe that I have successfully created dynamic and static library files for MacOS.
Should I create a pull request with the Xcode project that creates the files?

Should I also upload the .dylib and the .a files?
The .dylib takes about 400MB whereas the .a takes about 2GB.
I built the library files on a M1 chip Mac.

This is the first time that I have done any such thing as building library files...
so I have no idea if the binaries would work on any system but mine.

I think that, at the very least, the Xcode project would compile and build in other systems, because people are able to change the path to the other required libraries and such.

I documented the project configuration, and the modifications I had to make to CGALWrapper so that it would compile in Xcode, in the Notes.txt file in the Xcode project.
I cannot be sure, though, that I did document all modifications. It's possible that I might have forgotten to document some. No idea.

Regards.

Issues using binaries

First off, thank you for making this wrapper. It will really save my project.

Currently I have copied the binaries and referenced the CGALDotNet and the CGALDotNetWrapper dll into my project. When I start to use the code Visual Studio is showing me errors. This is the exact error:

'Kan bestand of assembly System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a of een van de afhankelijkheden hiervan niet laden. Het systeem kan het opgegeven bestand niet vinden.'

Translated into English 'Cannot find file or assembly.... or one of its dependencies could not be loaded. Cannot find the given file path`.

Do you have any idea what can create this error? My project is using System.Runtime 4.3.1, and the version 4.2.2.0 cannot be found within NuGet.

Looking forward to you reply.

Benchmark result

Hi @Scrawk,

Great job with porting the CGAL library!

Recently, I conducted some benchmarks of your package compared to my package, BurstTriangulator (and others). The package is targeted for C# (using Unity with the Burst compiler). I wanted to share the results with you. I believe you'll find them interesting, and I think other users may also be interested as well.

Below, you'll find a performance comparison for classic Delaunay triangulation (without refinement or constraints).

image

Best regards,
Andrzej

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.