| 978 | } |
| 979 | |
| 980 | XY TriContourGenerator::interp(int point1, |
| 981 | int point2, |
| 982 | const double& level) const |
| 983 | { |
| 984 | assert(point1 >= 0 && point1 < _triangulation.get_npoints() && |
| 985 | "Point index 1 out of bounds."); |
| 986 | assert(point2 >= 0 && point2 < _triangulation.get_npoints() && |
| 987 | "Point index 2 out of bounds."); |
| 988 | assert(point1 != point2 && "Identical points"); |
| 989 | double fraction = (get_z(point2) - level) / (get_z(point2) - get_z(point1)); |
| 990 | return _triangulation.get_point_coords(point1)*fraction + |
| 991 | _triangulation.get_point_coords(point2)*(1.0 - fraction); |
| 992 | } |
| 993 | |
| 994 | |
| 995 | |