4

The use case is to do some visualization based on some given input. To do this I'm looking for a library that's easy to incorporate in my application. This application will be written in .NET so C# or JavaScript based libraries are both valid options. The library needs to be able to

  • Draw a cylinder based on at least a radius
  • Draw an object subtracting a cylinder shape
  • Rotate these objects in 3D space
  • Create a flat view of the result (no 3D view necessary)

Then I have to figure out how I can visualize the intersection and gaps of various objects.

Most experience I have is with management information systems (although I once did some things with blender3d and a 3d engine). It would be nice if the library is simple, Easy to learn, open-source, and/or well documented.

2

Edited: You can use three.js in C# with SharpKit. Read more about that here.

I can't fulfill your requirements. You need both of C# and JavaScript libraries. But, I can only give you a JavaScript library. I hope you can make this as the alternative one.


I would suggest using three.js.

three.js is JavaScript 3D Library. The aim of the project is to create a lightweight 3D library with a very low level of complexity — in other words, for dummies. The library provides <canvas>, <svg>, CSS3D and WebGL renderers. Taken from this source.

What three.js can do? Based on your requirement, it has answer:

  • Draw a cylinder based on at least a radius, you can make a cylinder geometry. There is one up to eight arguments to take. (an example is given here).
  • Draw an object subtracting a cylinder shape, you can do this with additional library. The library is called as csg.js. Tutorial and the result are given.
  • Rotate these objects in 3D space, you can do it with rotation or using some mathematics functions, like matrix and soon. There is tutorial out there.
  • Create a flat view of the result (no 3D view necessary), it's about camera.

If you have enough time, please read this full documentation here.

Like I said before, I hope this library is what you need. I have no idea about C#. I am pretty sure that somebody will answer about it soon, though.

  • Thanks, I only need one of the two. When I'm going with the JS option I'll integrate it in an asp.net web application. No JS <-> C# tricks necessary. – Jogai Jul 13 '15 at 7:22
  • OK. Ah, you're right, you can embed JavaScript into ASP.NET application. I missed about that. – meisyal Jul 13 '15 at 8:57
2

I think OpenSCAD might fit the bill.

It isn't actually a library, but more like a compiler; it takes a scene definition file, parses it, loads it, and displays it. See the about page if you really want a library.

Your requirements can mostly be found on the cheat sheet.

  • draw a cylinder: ✔ use the cylinder command
  • draw an object subtracting a cylinder shape: ✔ use the difference operator
  • rotate these objects in 3D space: ✔ use rotate
  • create a flat view of the result: ✔ you can do a 3D-to-2D projection; also, while I'm not familiar with the software, I'd be very surprised indeed if you couldn't get an orthographic view of your model

OpenJSCad looks to be very similar, but is an interactive web application.

  • Both seem nice Cad solutions, but aren't libraries. – Jogai Jul 11 '15 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.