Skip to content

Commit

Permalink
more comments fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeybelkov committed Dec 25, 2023
1 parent 28cf83c commit 1b7578d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion imops/cpp/interp2d/delaunator/delaunator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ inline bool counterclockwise(const Point& p0, const Point& p1, const Point& p2)
Point v0 = Point::vector(p0, p1);
Point v1 = Point::vector(p0, p2);
double det = Point::determinant(v0, v1);
double dist = v0.magnitude2() + v1.magnitude2();
if (det == 0)
return false;
double dist = v0.magnitude2() + v1.magnitude2();
double reldet = std::abs(dist / det);
if (reldet > 1e14)
return false;
Expand Down Expand Up @@ -127,6 +127,8 @@ inline Point circumcenter(
//ABELL - This is suspect for div-by-0.
const double d = dx * ey - dy * ex;

assert(("Divide by zero exception", d == 0.0));

const double x = ax + (ey * bl - dy * cl) * 0.5 / d;
const double y = ay + (dx * cl - ex * bl) * 0.5 / d;

Expand Down
1 change: 1 addition & 0 deletions imops/cpp/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <cassert>
#include <iostream>
#include <stdexcept>
#include "interp2d/interpolator.h"
Expand Down
6 changes: 6 additions & 0 deletions imops/interp2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def __init__(

if not isinstance(points, np.ndarray):
raise ValueError(f'Wrong type of `points` argument, expected np.ndarray. Got {type(points)}')

if not isinstance(self.values, np.ndarray):

This comment has been minimized.

Copy link
@vovaf709

vovaf709 Dec 26, 2023

Collaborator

What if values is None?

raise ValueError(f'Wrong type of `values` argument, expected np.ndarray. Got {type(self.values)}')

if self.values.ndim > 1:
raise ValueError(f'Wrong shape of `values` argument, expected ndim=1. Got shape {self.values.shape}')

super().__init__(points, num_threads, triangles)
self.kdtree = KDTree(data=points, **kwargs)
Expand Down

0 comments on commit 1b7578d

Please sign in to comment.