Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcello-Sega committed Jan 23, 2022
1 parent 1a3830b commit 089761e
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions pytim/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4

from __future__ import print_function
from abc import ABCMeta, abstractproperty
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.spatial import Delaunay, cKDTree
from scipy.interpolate import LinearNDInterpolator
Expand Down Expand Up @@ -42,34 +42,38 @@ def __init__(self, interface, options=None):
except (TypeError, KeyError):
self._layer = 0

@abstractproperty
@property
@abstractmethod
def interpolation(self, inp):
""" returns interpolated position on the surface """
return utilities.extract_positions(inp)

@abstractproperty
@property
@abstractmethod
def distance(self, inp, *args, **kargs):
""" returns distance from the surface """
positions = utilities.extract_positions(inp)
distance_array = positions[::, 2]
return distance_array

@abstractproperty
@property
@abstractmethod
def triangulation(self):
""" return a scipy.spatial.qhull.Delaunay triangulation
of the surface
"""
return triangulation
return NotImplemented

@abstractproperty
@property
def regular_grid(self):
""" returns the points defining the regular grid in 2 dimensions, and
the elevation values evaluated at the grid points
(like the input of scipy.interpolate.RegularGridInterpolator )
"""
return (x, y), elevations

@abstractproperty
@property
@abstractmethod
def dump(self):
""" save the surface to file """
return True
Expand Down

0 comments on commit 089761e

Please sign in to comment.