GGAL Polyline simplification - cgal

I need to simplify a terrain with polylines (contour lines). some of them are closed like a polygon but some of them are open like a simple polyline (line with vertices). I used the example of terrain simplification as start point but it works ok only on closed polylines (polygons). On opens polylines it is closing the polyline, joining the last point with the first and adding all intersections of that last segment with others polylines in the terrain. I have searched on the documentation and on net for a explanation of that and how to avoid it, but I had no success. Does anyone know how to solve this ? is it an error on the CGAL? since terrain lines cannot intersept each other...
Any help will be appreciated,
the example I used:
https://doc.cgal.org/latest/Polyline_simplification_2/Polyline_simplification_2_2simplify_terrain_8cpp-example.html
Thank you

Related

How to deal with non-manifold vertices for 3d printing

I am working on modeling a shape for 3d printing, but I'm running into a problem with it having non-manifold vertices. I've ensured that the faces are oriented properly, but it still says these vertices are non-manifold. Anyone have ideas?
Figured it out. The fact that I was trying to make the long top, outside, and bottom piece one single face was the problem. The vertices where the center section met the inside of the outer part of the design were being overlapped by the edge from the single long face. Instead, I added the vertices (points in red) in that spot, at the top, and in both places on the mirror side of the shape. After that I recreated the faces between the new vertices, checked for manifold vertices, and got none.

ggplot2 circles have low quality edges

I have a problem with the filled circles I create with ggplot2. I have tried everything but I still cannot solve this problem. Regardless of what type of plot I make (including maps), the filled circles always have their edges like shown in the picture below. I tried adjusting (when ggsaving) height, width and ppi but none helped. Does anybody know how I can solve this? Thanks in advance. The symbol type here is 19 but the same thing happens with all kinds of circle shapes.

problems with CGAL AABB tree

I am using CGAL's AABB tree to perform point-location queries for my project. I have a cartesian grid in 3D and a surface immersed inside the grid. I need to find which elements of the grid are outside/inside/cut by the surface. For this, I cast a Ray and find the number of intersections for each corner of the cell and check if they are inside or outside.
This works fine as long as the corners of the grid do not coincide with nodes on the surface. But, I get rubbish results when the corner points of the cell coincide with nodes on the surface. One such scenario is shown in Erroneous result from CGAL.
I tried using Simple_cartesian<double> and Exact_predicates_inexact_constructions_kernel but the situation did not improve.
It seems that CGAL is so sensitive to floating point operations.
How can solve this issue?
Without seeing the code you wrote it is hard to say where the problem is. However the class Side_of_triangle_mesh seems to be exactly what you need.

draw outline for some connected lines

I have some lines that are connected at various points. I want to draw the outline of these lines and I also want to deal with the extra lines at the connection points.
I have seen two similar questions in this website: Here and here
I have handled the normal cases by offsetting the Centerlines and then changing the start and end points of the lines.
but I haven't been able to deal with special cases when the points are near each other.
Unfortunately, my reputation is low I couldn't post images to explain this better.
I'm coding in Visual Basic .net and I'm writing for Autocad, but any advice will be very useful to me.
most problem cases are solved by translation vectors intersection check
black is the original line/curve whatever ...
gray is translation vector (normal to black and size = outline distance)
blue is outline
if the translation vectors not intersect then it is most likely all OK but if they do then just do something like this:
cut off these points from outline
or create some singular point from these intersections
it is more tricky but can avoid some problem cases from bullet #1
Also sometimes help if there is bigger density of control points
Hope it helps a little...

Triangle rendering issue in directX

I am working with directX 9. I have a problem while rendering triangles using drawprimitive.
The problem is - When I am rendering the whole object made of several triangles, the triangle having all points on a single line shows gap in a whole closed object. I am showing the image below. The white dashed line is the problem.
you have try to order the all points in the object and then go to draw ,You can easily find the problem when draw like this.I think problem in precision varying.Try to check that..
Regards
Ratty