Starting point for learning CAD/CAE file formats? - c++

We are developing some stress and strain analysis software at university. Now it's time to move from rectangles and boxes and spheres to some real models. But I still have little idea where to start.
In our software we are going to build mesh and then make calculations, but how do I import solid bodies from CAD/CAE software?
1) How CAD/CAE models are organised? How solid bodies are represented? What are the possibilities of DWG, DXF, IGES, STEP formats? There is e.g. a complete DXF reference, but it's too difficult for me to understand without knowing basic concepts.
2) Are there C++ libraries to import solid bodies from CAD/CAE file formats? Won't it be too difficult to build a complete model to be able to import comprehensive file?

To import solid bodies you first need to export them from the CAD system. Most CAD system datafiles are propriety (unless they've all moved over to XML in the few years I've been out of the industry!). DWG is Autodesk's file format and they don't (well didn't) encourage people to read it directly. They did offer a file reading/writing library if memory serves, but I don't know what the state of that is now. DXF, IGES and STEP are all data transfer formats.
DXF is owned by Autodesk but is published so other companies can use it to read and write models. The DXF reference is complicated, but is just a reference - you need to know the concepts before you can understand what it represents.
Solid models can be represented in a number of ways, either by Constructional Solid Geometry (CSG) where the shape is made up from the addition or subtraction of solid primitives from each other, or by Boundary Representation (B-Rep) where the edges are stored, or by triangulated faces (as used by 3D Studio MAX, WPF and many others) and so on. The particular format will depend on what the modeller is designed to do.
There are libraries and tools for reading the various file formats. I don't know which ones are still active as it's 5+ years since I was heavily involved in 3D graphics. You'd be better off searching for the current crop yourself. I'd recommend starting with Wikipedia - it will have some articles on 3D graphics and there should be plenty of links to further reading and tools/libraries.
Once you have a reader you'll need to convert the data to your internal format - not a trivial task. You might be better off adopting an existing format. One of my jobs was the reading of models from various sources into my company's data structure. My task was greatly helped by the fact that the modellers we supported came with API's that let us read the model meshes directly and from there it was a relatively straightforward (but never easy) task to convert their mesh into ours. There were always edge cases and nuances of the format that caused headaches. These were multiplied several times over if we had to read the file format ourselves - such as for DXF or VRML.

The most common way solid models are represented in current 3D CAD software (CATIA, Pro/Engineer/Solidworks/NX) is through Boundary Representation (B-REP).
However, most of libraries to import such CAD data are proprietary. Some libraries come directly from geometric modelers (such as ACIS with Interop, Parasolid, or Granite), other are from small software companies specialized on the CAD data translation market.
On the open source side, maybe have look at the OpenCascade kernel. This kernel have been open sourced (mostly), and it have some STEP import and meshing functionalities.

Your best bet is to work with an existing open source CAD system, such as BRL-CAD, that includes support for numerous importers and exporters.
Your intuition that learning a given format would be difficult to understand and implement support for is quite true, particularly when dealing with solid geometry formats intended for analysis purposes. Preserving solidity with topological guarantees is important for producing valid analyses, but rarely addressed by simple mesh formats.
In particular for the two prevalent international standards (IGES and STEP), they are excessively complex to support as they can contain the same solid geometry encoded in numerous ways. Consider a simple sphere example. That sphere could be encoded as a simple point and radius (with no explicit surface information, an implicit form common with CSG usage), it could be a polygonal mesh (lossy BREP facets mesh format), it could be a spline surface (BREP NURBS), it could be volumetric (think CT scan data), and more. Focusing on any one of those involves various tradeoffs (simplicity, solidity, analytic guarantees, flexibility, etc).
As mentioned regarding BRL-CAD, it's a large open source solid modeling system that has a lot of functionality in many areas you could leverage, about a dozen libraries of functionality and more than 400 succinct tools (two dozen or so being geometry converters). Even if it doesn't do exactly what you need, you have the source code and can contribute improvements back and collaborate with an existing community to help implement what you need.

Upon re-reading your question, let me completely change my answer. If you all need is meshes, then just use a simple mesh-based format.
OBJ is simple, good, and very standard. Conversion from many CAD formats to OBJ requires a tessellator/mesher, which you don't want to be writing anyway, just get a seat of a CAD package to do the translation. Moi or Rhino are low-cost, and support many formats.

I regularly work with a piece of commercial software for electromagnetic simulations that uses the ACIS modeling kernel and components from Simmetrix. While I can't personally attest to the ease of using those libraries, they do seem to work as advertised and could save you a lot of work. They may not be available on suitable terms for academic use, but they do seem to be designed to do exactly what you want.

As for i know, all of CAD/CAE softwarea support IGES, STEP etc file formats for geometry and ideas, anysis etc for mesh data. Most of time, we find that iges does not contain topological information. But the development of STEP(Standard for the Exchange of Product) started in 1984 as a successor of IGES.The initial plan was that "STEP shall be based on one single, complete, implementation-independent Product Information Model, which shall be the Master Record of the integrated topical and application information models". We have some libraries to read and write these file format. But as i wrote code to read and write geometries as well as mesh, reading or writing these file formats is not difficult, but alot boring.

Related

The best way to export 3d mesh animation in order to use it in OpenGL

Suppose that I have a 3d model with animation in, say, Blender. I need to export this model to some file and then use it in OpenGL app, i.e. without hardcoding animations, but reading them from file. What format is the best solution?
OpenGL doesn't support any format directly, but the classic OBJ file format lines up very well with drawing with vertex arrays. Basically, OBJ lists all vertices independently of the geometry. This way, several objects can share the same points. All kinds of groupings are also possible.
Also, it is one of the earliest formats to support a wide range of spline curves & surfaces, including Bezier, B-Splines & NURBS.
A basic decription can be found here:
http://en.wikipedia.org/wiki/Wavefront_.obj_file
The complete OBJ spec can be found here:
http://www.martinreddy.net/gfx/3d/OBJ.spec
It's not as modern as WebGL, but it's simple, human readable and widely supported.
What format is the best solution?
OpenGL doesn't care about file formats. So feel free to choose whatever suits your needs best. Due to the rise of WebGL I started dumping whole Blender scenes into collections of JSON formated files.

Image processing Basics

I am planning to do a project on Image Processing, my knowledge in this subject in general is low. My Preferred Language is C++.
Can the members out here give me:
A Brief idea of What Image Processing is?
What books should i consult [ please keep in mind i am a beginner and am ONLY interested in making a college Project ]
What libraries can i use? [ I know about Boost/OpenCV etc. I would like to know what simplest and can get my project done quickly - its a minor project ]
Apart from the above 3 points, anything which i should know if be told to me will be of good help. Thanks in Advance.
I would suggest reading a good book. Image processing is not a programming field - it's an engineering field and it involves mathematics and signal processing knowledge and intuition. The Gonzalez and Woods Image Processing is quite good and doesn't require a vast knowledge of signal processing before you start reading it. The bottom line is you don't learn image processing like you learn a new programming language; you learn it like a completely new subject that just happens to involve coding. To break this up into answers to your questions,
Image processing is a discipline of digital signal processing which is itself at an intersection of computer science and applied mathematics. It involves pixel-based image operations for purposes of image enhancement (color and contrast correction, denoising, deblurring), visual effects (spatial distortion, morphing, color-substitution), artificial vision (feature extraction, texture segmentation, pattern identification, spatial perception). There are also many narrowly applied areas of image processing such as RADAR image processing, medical image processing, etc.
The book I mentioned above is really a great read. If it's a bit pricey for you, I always find it useful going to Amazon and searching for an inexpensive older edition used book on the subject with a five star rating. Never failed me yet. Beware of getting books that are too old though.
There are plenty of libraries for the task, Boost/CImg are some of them, and it really depends on the platform you're coding for. However, I would think that an image processing project would not involve any libraries, instead you would be writing image processing filters and other operators yourself -- that's the essence of it. You would very likely use algorithm libraries though for faster computation. A project in image processing is not a software project; rather, it's an engineering project and using a library would kill the purpose completely. That is in my humble opinion, of course.
Answer to 3.: CImg might be a good choice to start quickly.
Modifying the image data in such a way to get the desired effect (for example, change a colour image into black and white image).
Very broad question, and the answer depends on what you want to do.
Take a look into GraphickMagick or ImageMagick.
Image processing is a lot about math, and is particular matrix manipulations and in more advanced processing, Fourrier transformation.
image processing is at its basic definition, image manipulation, whatever the manipulations are (either color manipulation, feature extractions, enhancements, ... ). Image processing is different than computer graphics (2d and 3d)
I would assume visit your local college library, they should have existing reference for image processing, algorithms and all that jazz. You have to decide (with your college professor/adviser) what part of image processing you want to explore.
Have a look at the ImageMagick libraries (among others), it offer a good package to start learning about image processing; source code is available).
Max.
Altough old, I trink Digital Image Processing by K. Pratt is a good choice to start (to get a gist of common techniques), but imho you shouldn't learn with C++; a high level language with good image processing toolbox (like MATLAB) is far better to try algorithms (whic sometimes need heavy use of complex numerical methods).

Weather visualization from csv data files

I'm preparing for a project related to weather visualization. I have some .csv files (100 rows, 120 colums) that contain weather data measured in my country where each cell represents a point with some specific values e.g. temperature or wind speed. Those files may be perceived as sets of points of latitude and longitude that covers my whole country (in fact the values are measured every 5 miles). I'd like to transformed the data and put the values on maps to make some weather visualizations, both 2d and 3d, especially heatmaps or hightmaps. I'm wondering which technology is the best for that. I was thinking of openGL, but all the textures mapping and drawing operations seem a bit difficult to me (but maybe they're not). I'm also considering making Java applets but there are many Java graphics libraries and I don't know wich one is the best for my requirements. Maybe all those things are possible to do in XNA, whcih would be great, because I'm programming mainly in C#. I'd be glad if some more experienced programmers could recommend me an appropriate language and libraries. What would you use to make the work easy and efficient?
OpenGL is just the pencil and paper for program to draw things with. While it certainly is possible to use OpenGL for this, I strongly suggest using an off the shelf visualization tool, like Origin, Matlab Visualization, visualization modules of R, etc.
If you're more looking in the direction of a visualization programming toolkit, have a look at VTK http://www.vtk.org/
But naked OpenGL for that task: Only recommendable if you "speak OpenGL fluently".

Possible datasets for testing path finding algorithms

I'm doing some work on pathfinding.
So far I have tested my code on scenes composed of 2D cells.
I've also created a simple 3d scene to test my work on as well.
I'd like to test my work on some 3d scenes .. but it is time consuming to create them.
Does anyone know of any scene datasets that I could use to test my pathfinding algorithms on?
To get a better answer, you really need to specify the dimensionality of the configuration spaces that you want to consider. You aren't going to be tackling protein folding and docking problems (200+ degrees of freedom) with discrete graph searches. Even a relatively small planning problems (in terms of academic problems), of about 6 degrees of freedom can quickly become intractable.
Most of the best examples for planning tend to be published in research papers first, and then make their way into more general use. Some of the best work tends to be published in IEEE journals, or at the Intelligent Robots and Systems (IROS) and International Conference on Robotics and Automation (ICRA) conferences. It may also be worth using the bibliography of a well known reference in the field, such as "Motion Planning" by LaValle as a starting point for further research (available in bibtex here)
Mark Overmars work in the computational geometry and planning communities have made some of the problems considered in his publications very recognizable. It is worth checking if any his current grad students and collaborators have any data sets available at the moment.
If you're happy to still be doing some work in 2d, and to manually convert an image to geometric data, Kris Beevers website has a number of worked examples for a range of planners in 2d work spaces.
The Motion Strategy Library contains a number of classical motion planning problems for use in 2d and 3d workspaces, with varying dimensionality of configuration space depending on the problem. It includes:
L sections into a birdcage
trailers
multiple trailers
mazes
kinematic chains
non-holonomic cars
A more recent implementation of an academic motion planning library is The Open Motion Planning Library developed by the Kavraki lab. Because of licensing, I haven't checked personally, but I assume that they ship some examples and tests with their project.
A number of significantly more complex kinodynamic motion planning examples are now publicly available as part of the OpenRAVE project. Their gallery is eye opening.
when I need big 3D datasets, I usually use attractors or other dynamical series. You simply have to iterate as many time as you want and it will generate a nice set of 3D data.
Try this 'Peter de Jong Attractor':
Xn+1 = sin(a Yn) - cos(b Xn)
Yn+1 = sin(c Xn) - cos(d Yn)
Where (for example): a = 1.4, b = -2.3, c = 2.4, d = -2.1

Recommendations for a free GIS library supporting raster images

I'm quite new to the whole field of GIS, and I'm about to make a small program that essentially overlays GPS tracks on a map together with some other annotations. I primarily need to allow scanned (thus raster) maps (although it would be nice to support proper map formats and something like OpenStreetmap in the long run).
My first exploratory program uses Qt's graphics view framework and overlays the GPS points by simply projecting them onto the tangent plane to the WGS84 ellipsoid at a calibration point. This gives half-decent accuracy, and actually looks good. But then I started wondering. To get the accuracy I need (i.e. remove the "half" in "half-decent"), I have to correct for the map projection. While the math is not a problem in itself, supporting many map projection feels like needless work. Even though a few projections would probably be enough, I started thinking about just using something like the PROJ.4 library to do my projections. But then, why not take it all the way? Perhaps I might aswell use a full-blown map library such as Mapnik (edit: Quantum GIS also looks very nice), which will probably pay off when I start to want even more fancy annotations or some other symptom of featuritis.
So, finally, to the question: What would you do? Would you use a full-blown map library? If so, which one? Again, it's important that it supports using (and zooming in and out with) raster maps and has pretty overlay features. Or would you just keep it simple, and go with Qt's own graphics view framework together with something like PROJ.4 to handle the map projections? I appreciate any feedback!
Some technicalities: I'm writing in C++ with a Qt-based GUI, so I'd prefer something that plays relatively nicely with those. Also, the library must be free software (as in FOSS), and at least decently cross-platform (GNU/Linux, Windows and Mac, at least).
Edit: OK, it seems I didn't do quite enough research before asking this question. Both Quantum GIS and Mapnik seem very well suited for my purpose. The former especially so since it's based on Qt.
See GDAL www.gdal.org for a solid background library for raster formats and manipulation, and it incorporates PROJ.4 for transformations.
QGIS relies on GDAL for some data import, amongst other things.