Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm developing an application with C++ and i need to convert raster data (DEM) to Triangulated Irregular network (TIN), any library suggested ?
I tryed with arcGIS but I need Code in c++
I am not sure whether there are existing C++ libraries that already implements this conversion.
But this can give you a rough idea of what would have to be implemented if this was to be done from scratch in C++ (with the STL and the CGAL library):
convert your raster data into a triangulated grid of elevated
points (each DEM sample becomes a TIN vertex with x/y/z coordinates and the 4 neighboring samples in the DEM are connected via 2 TIN triangles). That's the easy part. Obviously this is a TIN, except that it's not irregular at all and probably contains too many samples.
remove redundant vertices from the TIN (one by one), and re-triangulate the hole that was just created. Repeat until satisfied. That's the difficult part. First, you need to have some criterion to measure how redundant a TIN vertex is (some measure of local flatness of the TIN for instance). The vertices should be ordered according to this criterion (read this as use a priority queue to order the vertices with this measure as the priority). When the most redundant vertex is removed, the corresponding hole has to be triangulated (you need to find the vertices along the border of the hole and triangulate the polygon) and the measure of redundancy of the neighboring vertices has to be updated. Finally, you obviously need to decide to stop this process at some point (have a minimum allowed redundancy).
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I have a set of points, each with an x and y coordinates. I would like to find the 4 of these points that are closest to together (if plotted all the points would be at different locations, but 4 of these points are always closer to each other, and I want to be able to identify which of the points these four are programmatically ). How do I go about doing this? I'm told it has to do with k-means or nearest-neighbors, but from my search results so far, I don't see how I could get it to work for my case since I'm finding the proximity of the points relative to each other and not to some fixed point. Any suggestions as to what topic/algorithm to look into, or code snippets will be much appreciated.
I thought an image of the exact problem might help. So these 8 points are contained in a vector, and I'd like to be able to identify which four are the ones clustered on the right.
Thanks in advance.
A brute force method would be to select every possible selection of four points (every permutation) and calculate e.g.:
1) the area enclosed by the points,
2) the perimeter of the convex hull of the points,
3) ...
and you'll find your four points by getting the minimum of the values calculated by 1), 2) or 3).
Build a Delaunay Triangulation graph in nlog(n) complexity, there will be less than 2n edges to go over in order to find the four shortest ones.
you could try poly2tri.
You'd want to go over the edges like this: choose an edge, go three times to the shortest connected edge, and sum the edge lengths. save the vertices and the length sum of the minimal edge sum encountered thus far, and exhaust all the possible shortest neighbouring length combinations.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I've recently begun development on a project that requires me to visualize graphs, and I am looking for a decent algorithm to tackle this problem.
The graphs I'm drawing model data flow, so a reasonable drawing could be left-to-right or top-to-bottom. They are, of course, directed and mostly acyclic -- that is, there might be a few backwards edges, but these would be a small proportion and I would be happy to remove these before calculating vertex positions if having a DAG as input would substantially improve runtime.
I'm using C++ and Qt for this project and am already very familiar with the Elastic Nodes and the Diagram Scene examples Qt provides. If anyone has seen KCacheGrind, what I'm trying to do is similar to its call graph visualization.
My current attempts have included an original algorithm that assigns each node to a layer based on its minimum distance from the root and then tries to position the nodes inside each layer in such a way that edge crossings are minimized. I was unable to implement the last part of that correctly, and I believe the problem to be NP-Hard.
What I'm looking for is guidance as to what kinds of algorithms have been used to efficiently solve this problem in the past.
I'd suggest using QGraphicsScene to implement directed acyclic graph. Also please check these links to help you out with implementation:
https://github.com/qknight/automate
http://invalidmagic.wordpress.com/2009/12/10/qgraphicsscene-used-as-a-qabstractitemmodel/
http://socnetv.sourceforge.net/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I'm looking at a physical problem on an hexagonal 2d lattice. It's now a geometrical problem, only a subset of the edges of the lattice are of interest, I'm given this set. I should then restrict myself to the closed curves that I can compose with these edges. From these polygons I'd like to extract information such as their diameters (maximal distance between two of its points)) and their fractal dimension.
I still don't see how to it from the raw initial data (unordered array of edges) and so I'd like to know if there are packages/library that could help me. From drawing each one of these edges they could return the closed loops they form and after that, analyzing each of these polygons individually.
Thank you.
You can use the box-counting algorithm to compute the fractal dimension:http://en.m.wikipedia.org/wiki/Minkowski%E2%80%93Bouligand_dimension.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm looking for a C++ library to triangulate arbitrary 3D meshes. Preferably open-source but at the very least free for commercial use (so CGAL is pretty much out of the question).
I looked at GTS, but it's written in C (is C compatible with C++?), it's old, and the binaries are for Debian platforms (I need Windows binaries or source that can be compiled in VC++ 2008).
Any help would be much appreciated.
Additionally:
If it's possible to use a 2D polygon triangulation library such as polypartition or poly2tri by triangulating each face separately, I can guarantee every face stays on its own plane (every face is flat and all the vertices are on the same plane) and has no holes. I'm not sure how I would go about translating the 3D rotation of the face to 2D space; I assume you would need to use the face's normals. I'm also not sure whether the generated 2D vertices could easily be merged back into the 3D mesh if you were to triangulate each face separately.
I worked it out myself. Turns out the library that generated the mesh that needed triangulating, Carve, isn't necessarily free for commercial use, so I had to find an alternative. I found Boost (I didn't realise it had these kinds of functions), which has the perfect license for me, is free, of high quality, and seems to have the functions I need. So...hooray!
Check out umeshu.
It's under the MIT license.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I have a system of mono-disperse spheres inside a cubic box. I am studying the volume distribution inside the sample, after tessellating it with either Voronoi and Delaunay tessellations. I am interested on some properties which should not depend on the tessellation.
Currently, I am comparing with the values obtained from Voronoi and Delaunay. I would like to know if you are familiar with another space partition approach (It is important that the final sum of the individual cells add up to the total volume, and the cells should be disjoint). Furthermore, in case you know another kind of tessellation, do you also know a library which already implements it, preferable in C/C++ or python?
Some variations, like Laguerre partitions, coincide with my current Voronoi approach since the spheres are mono-disperse. Another candidate will be the Centroidal Voronoi tessellation, although I have not found yet a library to do that (although it could lead to evenly spaced cells which does not reflect the disorder inside the system, which is not desirable).
Thanks in advance for your kind help.