erictuvesson / csg Goto Github PK
View Code? Open in Web Editor NEWCreate geometry objects from boolean operations.
License: MIT License
Create geometry objects from boolean operations.
License: MIT License
It is impossible to test with the veldrid based viewer because of the fact the Veldrid dependency repo is either private or deleted
I would like to add a example project, it should almost work as a editor where we create a shape and display it with a orbital camera.
Looking at using mellinoe/ge.
Maybe we can even turn it into a editor in the future.
Improve the tests making them easier to maintain and benchmark performance and memory usage.
Instead of building the vertices and indices on shape construction we should have a method that returns a cache of it and if there is no cache then we build it. This will make it faster to combine a lot of shapes and use less memory.
This will be a major change from what the code is now, but I think it is the right direction to go.
To change the viewer to be more of an editor, it would be nice to use ImNodes and ImGuizmo.
Which was recently merged into the ImGui.NET project.
ImGuiNET/ImGui.NET#218
Currently waiting on the new projects to be added as NuGet packages.
It seems that union and intersect are swapped around. Union gets the intersection of the two meshes while Intersect gets the Union
Make Vertex immutable, maybe even look into if Polygon can be immutable.
Describe the bug
I'm digging towards a deeper bug. I have a software that performs thousands of CSG operations, I am getting hard exits of the application (no exception or anything) with an access violation error code. When I log each operation, I found the last one it did was a difference (subtract) operation. I extracted the geometry for that operation and tried to manually do a difference operation between these two and I get a stack overflow exception. The geometry is pretty simple. The current CSG library that I am using succeeds this operation. I am looking to change to this CSG library (since it is ~4x faster that our current one).
To Reproduce
string hash1 = "MTAuMDQxNjY3IC0wLjI0MjAyODk4IDAKNDcuOTE2NjY4IDAuNDE2NjY2NjYgMAo0Ny45MTY2NjggLTAuNDE2NjY2NjYgMAoxMC4wNDE2NjcgLTAuNDE2NjY2NjYgMAoxMC4wNDE2NjcgLTAuMjQyMDI4OTggMAo0Ny45MTY2NjggLTAuNDE2NjY2NjYgMAoxMC4wNDE2NjcgMC40MTY2NjY2NiAwCjQ3LjkxNjY2OCAwLjQxNjY2NjY2IDAKMTAuMDQxNjY3IC0wLjI0MjAyODk4IDAKMS44NzUgLTAuNDE2NjY2NyAwCjAgLTAuNDE2NjY2NjYgMAoxLjg3NSAtMC4zODQwNTc5NyAwCjE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Y2NjcKMjUuODc1IDUuNDE2NjY2NSA3LjkxNjY2NwoyNS44NzUgLTQuNTgzMzMzNSAtMC4wODMzMzMyNTQKMjUuODc1IDUuNDE2NjY2NSAtMC4wODMzMzMyNTQKMjUuODc1IC00LjU4MzMzMzUgLTAuMDgzMzMzMjU0CjI1Ljg3NSA1LjQxNjY2NjUgNy45MTY2NjcKMjUuODc1IC00LjU4MzMzMzUgLTAuMDgzMzMzMjU0CjI1Ljg3NSA1LjQxNjY2NjUgLTAuMDgzMzMzMjU0CjM0LjA0MTY2OCAtNC41ODMzMzM1IC0wLjA4MzMzMzI1NAozNC4wNDE2NjggNS40MTY2NjY1IC0wLjA4MzMzMzI1NAozNC4wNDE2NjggLTQuNTgzMzMzNSAtMC4wODMzMzMyNTQKMjUuODc1IDUuNDE2NjY2NSAtMC4wODMzMzMyNTQKMzQuMDQxNjY4IDUuNDE2NjY2NSAtMC4wODMzMzMyNTQKMjUuODc1IDUuNDE2NjY2NSAtMC4wODMzMzMyNTQKMzQuMDQxNjY4IDUuNDE2NjY2NSA3LjkxNjY2NwoyNS44NzUgNS40MTY2NjY1IDcuOTE2NjY3CjM0LjA0MTY2OCA1LjQxNjY2NjUgNy45MTY2NjcKMjUuODc1IDUuNDE2NjY2NSAtMC4wODMzMzMyNTQK";
Code for turning the hash into vertices:
string hash = (Hash from Above)
List<Vector3> vertices = new List<Vector3>();
hash = Encoding.UTF8.GetString(Convert.FromBase64String(hash));
List<string> verts = hash.Split('\n').ToList();
foreach (string s in verts.Where(x => !string.IsNullOrEmpty(x)))
{
string[] pts = s.Split(' ');
float.TryParse(pts[0], out var x);
float.TryParse(pts[1], out var y);
float.TryParse(pts[2], out var z);
vertices.Add(new Vector3(x, y, z));
}
Expected behavior
The red cube should cut out from the purple rectangle
Desktop (please complete the following information):
Please let me know if there is anything else I can provide to help with the debugging of this issue.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.