Subject: CGAL users discussion list
List archive
- From: Joern Ungermann <>
- To:
- Subject: [cgal-discuss] strange behaviour of 2d natural neighbour interpolation
- Date: Mon, 16 Nov 2015 05:46:46 -0800 (PST)
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=None ; spf=None
- Ironport-phdr: 9a23:LVf9exU2UChYtT8hQA2fWADjGrrV8LGtZVwlr6E/grcLSJyIuqrYZhKDt8tkgFKBZ4jH8fUM07OQ6PC9HzFfqsvd+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq8CVPloD2Wb1SIgxBSv1hD2ZjtMRj4pmJ/R54TryiVwMRd5rw3h1L0mYhRf265T41pdi9yNNp6BprJYYAu3MVv9mHPkBVHxmaDhtpZ6jiR6WRgSG4j4QU34djwFTKwnD9hDzGJnr4QXgse8o+i6XJ8u+cLY7VC6n5qFtAEvqzjoBODMj9WjRjOR+nudZvR+lphd/hYLZNtLGfMFid7/QKIpJDVFKWdxcAncZWo4=
Hi,
I am trying to use the 2-d delaunay triangulation to interpolate some
irregular dataset, which is much denser in one dimension than in the other.
The resulting weights and coordinates from the
natrual_neighbour_coordinates_2 routine are kind of surprising to me. I
modified the example from the documentation to demonstrate my problem:
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/natural_neighbor_coordinates_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Delaunay_triangulation_2<K>
Delaunay_triangulation;
typedef std::vector< std::pair< K::Point_2, K::FT > >
Point_coordinate_vector;
int main()
{
Delaunay_triangulation dt;
int ch = 200;
for (int y=0 ; y<20 ; y++)
for (int x=0 ; x<3 * ch ; x += ch)
dt.insert(K::Point_2(x,y));
//coordinate computation
K::Point_2 p(ch * 1.2, 10);
Point_coordinate_vector coords;
CGAL::Triple<
std::back_insert_iterator<Point_coordinate_vector>,
K::FT, bool> result =
CGAL::natural_neighbor_coordinates_2(dt, p,
std::back_inserter(coords));
if(!result.third){
std::cout << "The coordinate computation was not successful."
<< std::endl;
std::cout << "The point (" <<p << ") lies outside the convex hull."
<< std::endl;
}
K::FT norm = result.second;
std::cout << "Coordinate computation successful." << std::endl;
std::cout << "Normalization factor: " <<norm << std::endl;
std::cout << "done" << std::endl;
for (auto& x : coords) {
std::cout << x.first[0] << " " << x.first[1] << " " << x.second / norm
<< "\n";
}
return 0;
}
This is quite similar to my actual gridding, where the y-coordinate is
semi-random and there is some minor variation in the x-coordinate.
The example gives the largest weights to the topmost and bottommost points
in the columns to the right and left of the point, whereas I expected the
largest weight for the horizontally neighbouring points.
The Voronoi cell for the interpolant is humongous as adding the point
(1.2*200,10) to the Triangulation basically connects it to all points of the
columns to its left and right. However, the original Voronoi cells of the
bottommost (and topmost) points do not intersect with the humongous Voronoi
cell, so I expected a weight of zero...
I could do some coordinate transformations, obviously, to "fix" this, but I
wonder whether the given behaviour of CGAL is correct.
Best regards,
Joern
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/strange-behaviour-of-2d-natural-neighbour-interpolation-tp4661342.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] strange behaviour of 2d natural neighbour interpolation, Joern Ungermann, 11/16/2015
Archive powered by MHonArc 2.6.18.