Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 2ac8b650 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

Check if delaunay map was triangulated before Interpolate was called

parent c2fc3cbe
No related branches found
No related tags found
No related merge requests found
...@@ -222,6 +222,8 @@ namespace TUGraz.VectoCore.Utils ...@@ -222,6 +222,8 @@ namespace TUGraz.VectoCore.Utils
/// null if interpolation has failed.</returns> /// null if interpolation has failed.</returns>
public double? Interpolate(double x, double y) public double? Interpolate(double x, double y)
{ {
if (!_triangles.Any())
throw new VectoException("Interpolation not possible. Call DelaunayMap.Triangulate first.");
x = (x - _minX) / (_maxX - _minX); x = (x - _minX) / (_maxX - _minX);
y = (y - _minY) / (_maxY - _minY); y = (y - _minY) / (_maxY - _minY);
var tr = _triangles.Find(triangle => triangle.IsInside(x, y, exact: true)) ?? var tr = _triangles.Find(triangle => triangle.IsInside(x, y, exact: true)) ??
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment