Beispiel #1
0
 def initgrid(self, **kwargs):
     # parse options
     grid = kwargs.get("grid", "radial")
     if grid == "radial":
         ctn_points = int(
             np.round(np.sqrt(kwargs.get("npoints", 1800)) / 0.280269786))
         # calc grid
         self.xg = 0
         self.yg = 0
         for rho in np.linspace(0, 1,
                                int(np.round(ctn_points / 2 / np.pi))):
             theta = np.linspace(0, 360,
                                 int(np.round(ctn_points * rho + 1)))[:-1]
             self.xg = np.hstack((self.xg, rho * sind(theta)))
             self.yg = np.hstack((self.yg, rho * cosd(theta)))
     elif grid == "ortho":
         n = int(
             np.round(
                 np.sqrt(kwargs.get("npoints", 1800) - 4) / 0.8685725142))
         x, y = np.meshgrid(np.linspace(-1, 1, n), np.linspace(-1, 1, n))
         d2 = (x**2 + y**2) <= 1
         self.xg = np.hstack((0, 1, 0, -1, x[d2]))
         self.yg = np.hstack((1, 0, -1, 0, y[d2]))
     else:
         raise TypeError("Wrong grid type!")
     self.dcgrid = l2v(*getldd(self.xg, self.yg)).T
     self.n = self.dcgrid.shape[0]
     self.values = np.zeros(self.n, dtype=np.float)
     self.triang = self._buildtrig_workaround(self.xg, self.yg)
Beispiel #2
0
 def format_coord(self, x, y):
     if np.hypot(x, y) > 1:
         return ""
     else:
         v = Vec3(*getldd(x, y))
         return repr(v.asfol) + " " + repr(v.aslin)
Beispiel #3
0
 def getlins(self):
     """get Group of Lin by mouse"""
     pts = plt.ginput(0, mouse_add=1, mouse_pop=2, mouse_stop=3)
     return Group([Lin(*getldd(x, y)) for x, y in pts])
Beispiel #4
0
 def getlin(self):
     """get Lin by mouse click"""
     x, y = plt.ginput(1)[0]
     return Lin(*getldd(x, y))
Beispiel #5
0
 def getlin(self):
     """Get Lin instance by mouse click."""
     x, y = plt.ginput(1)[0]
     return Lin(*getldd(x, y))
Beispiel #6
0
 def format_coord(self, x, y):
     if np.hypot(x, y) > 1:
         return ""
     else:
         v = Vec3(*getldd(x, y))
         return repr(v.asfol) + " " + repr(v.aslin)
Beispiel #7
0
 def getlins(self):
     """get Group of Lin by mouse"""
     pts = plt.ginput(0, mouse_add=1, mouse_pop=2, mouse_stop=3)
     return Group([Lin(*getldd(x, y)) for x, y in pts])
Beispiel #8
0
 def getlin(self):
     """get Lin by mouse click"""
     x, y = plt.ginput(1)[0]
     return Lin(*getldd(x, y))