0

For a university project I need to implement a computer graphics paper that has been relased a couple of years ago. At one point, I need to triangulate the results I get from my simulation. I guess its easier to explain what I need looking at a picture contained within the paper:

Let's say I already have got all the information it takes to reconstruct the contour lines that you can see in the second thumbnail. Using those I need to do some triangulation using those siluettes as constrains. I have searched the internet for triangulation libraries like CGAL, VTK, Triangle, Triangle++, ... but I always ended up throwing my hands up in horror. I am not a good programmer and it seems impossible to me to get into one of those APIs before the deadline of this project passes.

I would appreciate any kind of help like code snipplets, tips, etc...

I know that the algorithms need segments (pairs of points) as input, so let's say I have got one std::vector containing all pairs of points defining the siluette as well as the left and right side of the rectangle.

Can you somehow give me a code snipplet for i.e. CGAL that I could use for my purpose? First of all I just want to achieve the state of the third thumbnail. Lateron I will have to do some displacement within the "cracks" and finally write the information into a VBO for OpenGL rendering.


I have started working it out with CGAL. One simple problem still drives me crazy:

It is possible to attach informations (like ints) to points before adding them up to the triangulator object. I do this since I need on the one hand an int-flag that I use lateron to define my texture coordinates and on the other hand an index which I use so that I can create a indexed VBO. http://doc.cgal.org/latest/Triangulation_2/Triangulation_2_2info_insert_with_pair_iterator_2_8cpp-example.html

But instead of points I only want to insert constraint-edges. If I insert both CGAL returns strange results since points have been fed into two times (once as point and once as point of a constrained edge). http://doc.cgal.org/latest/Triangulation_2/Triangulation_2_2constrained_8cpp-example.html

Is it possible to connect in the same way as with points information to "Constraints" so that I can only use this function cdt.insert_constraint( Point(j,0), Point(j,6)); before I iterate over the resulting faces?

Lateron when I loop over the triangles I need some way to access the int-flags that I defined before. Like this but not on acutal points but the "ends" defined by the constraint edges:

for(CDT::Finite_faces_iterator fit = m_cdt.finite_faces_begin(); fit != m_cdt.finite_faces_end(); ++fit, ++k) {

    int j = k*3;
    for(int i=0; i < 3; i++) {

        indices[j+i] = fit->vertex(i)->info().first;
    }
}
user1118321
  • 25,567
  • 4
  • 55
  • 86
  • Did you go through the examples and demos that come with these libraries to check if there isn't one that does what you want (possibly reading the input from a file)? – Marc Glisse Jan 11 '14 at 15:00
  • Looking at screens, you may as well simplify your task and just split surface into rectangles, cut the contours (boolean subtraction) and triangulate resulting strips. – Kromster Jan 13 '14 at 09:34
  • I started to play around with CGAL since it offers constrained delaunay triangulation. I still have some problems that need to be figured out but things are getting more discrete. I will try to keep you guys updated. – HesselKRaymond Jan 13 '14 at 18:15
  • Probably it would be better to post follow up questions separately (and link to them here) – Dror Jan 14 '14 at 14:55
  • OK. Will do so tomorrow if I can't come up with something by myself. – HesselKRaymond Jan 14 '14 at 22:21
  • OK. Replaced the last edit of my post through some proper extension of the first question. – HesselKRaymond Jan 15 '14 at 16:44
  • Second part of the question got solved: http://stackoverflow.com/questions/21186485/cgal-2d-constrained-delaunay-triangulation-adding-information-to-constraints – HesselKRaymond Jan 17 '14 at 14:21

0 Answers0