I need to represent a planar graph structure, i.e., a division of part of the plane into polygons so that I can easily find a polygon's neighbors etc (like on a map). What is the best library to use? ArcObjects? CGAL (2D arrangements)? Anything else?
I use C++ under Windows.
If you're interested in speed or reliability, stay away from ArcObjects. ArcMap is a neat application, and there's good reasons to write plug-ins for it. But ArcObjects is not a good programming library for general purpose GIS use.
I would look at QGIS and see what they use under the hoods.
You could also look at GEOS. It might have some of the stuff you need
http://trac.osgeo.org/geos/
Actually - after looking at it a bit I think it could definitely suit your needs.
Related
I have a question for which I would like to learn from your experience at this point. I'm interested in implementing image processing algorithms along the way while learning them. Do you recommend me to do that with C++, or move ahead with OpenCV?
My goal is not to learn C++ per se, but to implement the image processing algorithms I learn.
What do you recommend me in this case? I don't want to start for instance with C++ and end up (maybe after a long learning curve) to the point where I have to deal with OpenCV eventually.
OpenCV is just an example, do you recommend it over other libraries for image processing?
Thanks for your recommendations.
OpenCV is the perfect choice.
Don't reinvent the wheel. Don't implement your own limited, faulty image readers. Don't implement your own very basic data structures to store and access images in memory.
OpenCV 3.0 has a considerably clean and nice API. You can use high
level C++ concepts with it. For example, you can work with STL-style
iterators on matrices, which are also templated.
If you want to implement an algorithm yourself, you can work with
the existing OpenCV codebase, maybe take something from there and
change it. OpenCV has a permissive license.
If you feel like bringing GPU acceleration on board, OpenCV has it
nicely integrated and you can start right away on a high level.
OpenCV is the de-facto standard in image processing and computer
vision with C++. If you want to work with others in the field,
chances are high that you are on common ground with OpenCV.
I'm working in C++ with large voxel grids in a scientific context and I'm trying to decide, which library to use. Only a fraction of the voxel grid holds values - but might be several per voxel (e.g. struct), which are determined by raytracing. I'm not trying to render anything, but I have to determine the potential number of rays passing though the entire target area, thus an awful lot of ray-box computations will have to be caluculated and preferebly very fast...
So far, I found
OpenVDB http://www.openvdb.org/
Field3d http://sites.google.com/site/field3d/
The latter appeals a bit more, because it seems simpler/easier to use.
My question is: Which of them would be more suited if put to use in tasks, which are not aimed at rendering/visualization? Which one is faster/better when computing a lot of ray-box-intersections (no viewpoint-dependent culling possible)? Suggestions, anyone?
In any case, I want to use an existing C++ library and not write a kdTree/Octree etc. myself. Don't have the time for inventing the wheel anew.
I would advise
OpenSceneGraph
Ogre3D
VTK
I have personally used the first two. However, VTK is also a popular alternative. All three of them support voxel based rendering.
Is there a pathfinding algorithm also suited for real 3D environments e.g. real Buildings with multiple stairs etc. A C++ library or open implementation would be splendid ;-)
One solution I saw was Djikstra but I wonder whether there is something more optimal.
Normal A* would not work better then Djikstra since the distance heuristic does not work well (Position one floor above destination).
Another solution that I'm currently pondering is the mapping of the 3d environment on a 2d graph. So if there is some available C++ implementation/library going this way it would be helpful too.
If the path has to take into account the ability to navigate through obstacles (i.e. the movement is that of some entity with known volume in space), then I'd recommend looking into the literature on robot motion planning. The notion of a configuration space allows you to handle changes in pose in order to deal with obstacles. See the classic textbook by Jean-Claude Latombe
For simpler scenarios, you can probably make do with path planning algorithms used in first person computer games, which are similar to Dijkstra, A* (example)
For an approximation algorithm you can easily map the 3d to a 1d curve and traverse an octree with a gray code. That way you can reorder each path. I don't know if there is a guarantee to be within the optimum solution but it must be better then any heuristic method.
I always hear the relationship between collision detection and the different space partitioning techniques. Do any physics libraries contain common data structures like maybe a frustum class or anything that would make it easier to implement octrees, quadtrees, etc?
I would look at CGAL, the Computational Geometry Algorithms Library. You can find an overview of what it offers in this list of packages. I'm not sure about frustum, quadtrees or octrees specifically, but it does have spatial indexing implementations.
Does anyone have some useful beginner tutorials and code snippets for playing with basic geometric shapes and geometric proofs in code?
In particular something with the ability to easily create functions and recursively draw them on the screen. Additional requirements, but not absolute, support for Objective-C and basic window drawing routines for OS X and Cocoa.
A specific question how would one write a test to validate that a shape is in fact a square, triangle, etc. The idea being that you could draw a bunch of shapes, fit them together and test and analyze the emergent shape that arises from the set of sub shapes.
This is not a homework question. I am not in school. Just wanted to experiment with drawing code and geometry. And looking for an accessible way to play and experiment with shapes and geometry programming.
I am open to Java and Processing, or Actionscript/Haxe and Flash but would also like to use Objective C and Xcode to build projects as well.
What I am looking for are some clear tutorials to get me started down the path.
Some specific applications include clear examples of how to display for example parts of a Cantor Set, Mandelbrot Set, Julia set, etc...
One aside, I was reading on Wikipedia about the "Russell's Paradox". And the wiki article stated:
Let us call a set "abnormal" if it is
a member of itself, and "normal"
otherwise. For example, take the set
of all squares. That set is not itself
a square, and therefore is not a
member of the set of all squares. So
it is "normal". On the other hand, if
we take the complementary set that
contains all non-squares, that set is
itself not a square and so should be
one of its own members. It is
"abnormal".
The point about squares seems intuitively wrong to me. All the squares added together seem to imply a larger square. Obviously I get the larger paradox about sets. But what I am curious about is playing around with shapes in code and analyzing them empirically in code. So for example a potential routine might be draw four squares, put them together with no space between them, and analyze the dimensions and properties of the new shape that they make.
Perhaps even allowing free hand drawing with a mouse. But for now just drawing in code is fine.
If you're willing to use C++ I would recommend two libraries:
boost::GGL generic geometry library handles lots of geometric primitives such as polygons, lines, points, and so forth. It's still pretty new, but I have a feeling that it's going to be huge when it's officially added into boost.
CGAL, the Computational Geometry Algorithms Library: this thing is huge, and will do almost anything you'll ever need for geometry programming. It has very nice bindings for Qt as well if you're interested in doing some graphical stuff.
I guess OpenGL might not be the best starting point for this. It's quite low-level, and you will have to fight with unexpected behavior and actual driver issues. If you emphasize the "playing" part, go for Processing. It's a programming environment specifically designed to play with computer graphics.
However, if you really want to take the shape testing path, an in-depth study of computer vision algorithms in inevitable. On the other hand, if you just want to compare your shapes to a reference image, without rotation, scaling, or other distortions, the Visual Difference Predictor library might help you.
I highly recommend NeHe for any beginner OpenGL programmer, once you complete the first few tutorials you should be able to have fun with geometry any way you want.
Hope that helps