Binary operations and Simple Solver - c++

I'm making a small demo to suggest Qt and OSG at my company to make some things easier to everyone working with me. But I need to do it rather quickly. I need a library for 2D and 3D binary operations on 2D and 3D geometry that will give a result mesh that can draw in OSG at the output. I also need a simple solver and mesher with which I could just define temperature on a tetrahedras within a mesh or nodes within a geometry and view a solution with OSG. I don't make solvers, I work with UI and some inner routines thus I need these libraries or something I can make a demo of a simple CAE software based on Qt and OSG. Can you suggest something?

Related

Simple 3D scene visualisation data format

My PhD project revoles around simulating the paths of photons through objects of different optical properties. My code has classes which create ccd images etc, but it would be much more useful to be able to create a simple rendering of the 3D objects and the paths the photons take through them.
I've written an opengl system for viewing such a scene, but it would be much better if I could use something much more lightweight where I could simply specify the vertices of an object, and then a photon path as a list of connected vertices.
Exporting all the data and then visualising it in another program isn't ideal, as things like mesh transformations need to be taken into account, and I'd rather avoid exporting several new mesh objects just to import them all into another program.
What I essentially need is to be able to create the three dimensional equivalent of a svg image. Does such a '3D scene' file format with a simple visualiser exist?
I write in C++ on MacOS, though I'd prefer to avoid using a visualisation library. I appreciate that what I'm asking for is rather niece and picky, but that's why I'm asking the internet as someone might have come across a similar need for such a tool.

C++ library for mesh to mesh intersection: what is available?

I need to calculate volume intersection and penetration depth between 3D triangular meshes (e.g. in .obj format), but I am quite new to computational geometry.
In a previous post (Mesh to mesh intersections) and from my google search, I found a few C++ libraries which might be appropriate to do the job:
CGAL
PQP
libigl
SWIFT
Though, I am not sure which one could be the most appropriate for a beginner. Any suggestion?
libigl as of version 1.1 has robust mesh boolean operations in igl/boolean/mesh_boolean.h. This uses either an implementation using CGAL's exact arithmetic kernel or a wrapper of cork (another option for you).
For now, libigl also contains a patched version of cork in libigl/external/cork, which greatly improves robustness.
While implementing libigl's boolean ops, I found that cork is faster but does not always produce the correct result (specifically, it fails to resolve all intersections).
Libigl, using CGAL as a backend, is the most robust and still fast compared to converting a mesh to CGAL's Nef_polyhedron, conducting CSG operations and converting back to a mesh. This final conversion would be possible only if the result is manifold. Instead, libigl only uses CGAL for exact triangle-triangle intersection and 2D meshing. Correct, non-manifold output is no problem.
Libigl's interface is very simple and familiar to users of Eigen. For example, to find the intersection between a solid mesh with vertices in the rows of VA and triangles indices in the rows of FA and another mesh (VB,FB) and store the output in a new mesh (VC,FC):
#include <igl/boolean/mesh_boolean.h>
...
igl::mesh_boolean(VA,FA,VB,FB,MESH_BOOLEAN_TYPE_UNION,VC,FC);
One additional possibility is to use open-source C++ library MeshLib. It can read and write meshes in Wavefront format (.obj) and robustly perform Boolean operations (intersection, union, difference) on meshes: documentation of the appropriate functions.
As far as I know, Boolean operations in MeshLib are faster than in CGAL and libigl, see video of MeshInspector application based on MeshLib.

how to draw pool table pockets opengl c++

hey
i am creating a pool table simulator in opengl written in c++
i have the basic table drawn but now i need to add some pockets
i want the pockets to be a basic curve like a C shape
im not quite sure how to do this
i have experimented with trianglefan but iv had no luck
can anyone help please?
also i must add this is part of a university project therefore i will only be using the core opengl and c++....no other tools
thanks in advance
When I use OpenGL, I usually build the models in something like Blender.
Blender is free and allows export to WaveFront obj - an easy format to read in to your program. Or you can use the simple text WaveFront obj with a little scripted editing will produce a list of vertices that you can use in arrays for vertex buffer objects.
I couldn't imagine trying to build objects for a 3D scene using only discrete values and discrete math like (I think?) you're describing.
Do you have access to glu.lib?
http://en.wikipedia.org/wiki/OpenGL_Utility_Library
http://www.opengl.org/resources/faq/technical/glu.htm
That would easily make cylinders or NURBS curves for the pockets. Sample use of it is here: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=18
There is also lots of code from the "Graphics Gems" series available - you can dig through the early books for something suitable if GLU isn't an option.
http://www.graphicsgems.org/
Start with a cube and slice off the bottom corners. Refine as necessary.

Open Source C++ game engine math libraries?

I'm looking for a free to use game engine math library. Specifically I'd like a good matrix and vector implementation. And everything needed to move objects in 3D space. Does anyone know any good ones? I'm targeting OpenGL. I'd like to write them myself but don't have the time.
I'd recommend OpenGL Mathematics (GLM)
Though if you want physics with your math you could go with Bullet Physics Library
Finally if you want an entire engine i'd go with OGRE
You might want to consider Blitz++.
Besides Ogre 3D, there's also Crystal Space. Here's an article that compares the two.
If you want an entire 3D engine (which of course would contain the 3d maths you need) see Ogre 3D (LGPL)
Take a look here
https://sourceforge.net/projects/mg3d/
It is an opensource engine that has all former OpenGL transformation routines. The implementation here is very straightforward and clear. And it is very easy to include the module with the routines in your project.
I have good work with Open Dynamics Engine is Full and Stable Physics Engine,
the ode in a BSD License, and have some functions for Matrix Manipulation, Quaternion and rotations.

Recommendations for C++ 3d vector/matrix library with targeted camera

I am writing a very simple 3d particle software rendering system, but I am only really interested in coding the particle system and the rasterizer, so what I am looking for, is the easiest way to go from 3d particle coordinates, through camera, to screen coordinates, but with features like variable FOV, and targeted (look at) camera.
Any additional features such as distance from point to point, bounding volumes etc. would be a bonus, but ease of use is more important to me than features.
The only license requirement is that it's free (as in beer).
You probably want a scenegraph library. Many C++ scene graph libraries exist. OpenScenegraph is popular, Coin3D (free for non-commercial use) is an implementation of the OpenInventor spec, any of them would probably fit your need as it doesn't sound like you need any cutting-edge support. There is also Panda3D, which I've heard is good if you're into Python.
You could do all of this in a straight low-level toolkit like OpenGL but without prior experience it takes a lot longer to get a handle on using OpenGL than any of the scenegraph libraries.
When choosing a scenegraph library it will probably just come down to personal preference as to which API you prefer.
Viewing is done with elementary transformations, the same way that model transformations are done. If you want some convenience functions like gluLookAt() in GLU, then I don't know, but it would be really easy to make your own.
If you do want to make your own Look At function etc. then I can recommend eigen which is a really easy to use linear algebra library for C++.
If you're trying to just focus on the rendering portion of a particle system, I'd go with an established 3D rendering library.
Given your description, you could consider trying to just add your particle rasterization to one or both of the software renderers in Irrlicht. One other advantage of this would be that you could compare your results to the DX/OGL particle effect renderers that already exist. All of the plumbing/camera management/etc would be done for you.
You may also want to have a look at the Armadillo C++ library