コード例 #1
0
 def draw(self, offset, tmin=0., tmax=1., num_points=1000, **kwargs):
     """
     """
     kwargs.setdefault('color', 'black')
     t = np.linspace(tmin, tmax, num_points)
     x, y = interpolate.splev(t, self.tck)
     plt.plot(x + offset.x, y + offset.y, **kwargs)
コード例 #2
0
 def test_body_accuracy(self):
     """
     """
     blueprint('Music Man Axis body accuracy', 'A1')
     offset = Point(-200., -50.)
     plt.plot(self.xb + offset.x, self.yb + offset.y, 'o')
     body = Body()
     body.draw(offset)
コード例 #3
0
 def test_head_accuracy(self):
     """
     """
     blueprint('Music Man Axis head accuracy', 'A4')
     offset = Point(-60., 0.)
     plt.plot(self.xh + offset.x, self.yh + offset.y, 'o')
     head = Head()
     head.draw_top(offset)
コード例 #4
0
ファイル: geometry2.py プロジェクト: lucabaldini/metalute
    def _draw(self, offset, **kwargs):
        """Overloaded method.

        This could be likely improved, possibly with axline(), that is only
        supported in matplotlib 3.3 and later.
        """
        x1, y1 = (self.start_point + offset).xy()
        x2, y2 = (self.end_point + offset).xy()
        plt.plot((x1, x2), (y1, y2), '-', **kwargs)
コード例 #5
0
 def test_accuracy(self):
     """
     """
     blueprint('Fender Stratocaster accuracy', 'A4')
     x, y, xh, yh = self.load_data()
     offset = Point(-80., 0.)
     plt.plot(x + offset.x, y + offset.y, 'o')
     head = FenderStratocasterContour()
     head.draw(offset)
コード例 #6
0
ファイル: geometry.py プロジェクト: lucabaldini/metalute
 def draw(self, offset, ha: str = 'left', va: str = 'bottom', **kwargs):
     """Draw method.
     """
     kwargs.setdefault('color', 'black')
     kwargs.setdefault('markersize', 4.)
     x = self.x + offset.x
     y = self.y + offset.y
     plt.plot(x, y, 'o', **kwargs)
     if self.name is not None:
         kwargs.pop('markersize')
         plt.text(x, y, ' {}'.format(self.name), ha=ha, va=va, **kwargs)
コード例 #7
0
 def draw_contour(self,
                  offset,
                  border=-15.,
                  tmin=0.,
                  tmax=1.,
                  num_points=1000,
                  **kwargs):
     """
     """
     kwargs.setdefault('color', 'black')
     x, y = self.calculate_contour(offset, border, tmin, tmax, num_points)
     plt.plot(x, y, **kwargs)
コード例 #8
0
def test_draw(offset):
    """
    """
    blueprint(f'EJ #1{offset}', 'A3', orientation='Portrait')
    #body = Body()
    #body.draw(offset)

    x = np.array([
        0., 15., 50., 125., 200., 230., 250., 280., 300., 325., 350., 370.,
        385., 400., 405., 395., 384., 380.5, 379., 383., 393., 375., 354.,
        340., 320., 305., 298.7, 315., 334.7, 325.8, 310., 266., 230., 200.,
        120., 50., 10.
    ])
    y = np.array([
        0., 80., 131., 160., 141.5, 124.3, 113.3, 106.4, 107.4, 115., 123.,
        125.7, 123., 110.3, 90., 68., 57., 50., 42., 28., 10., -13.2, -27.5,
        -28.58, -30.5, -40.5, -60., -90, -108.7, -122.5, -127.4, -115.1,
        -116.2, -136., -159.4, -131., -69.
    ])
    s = ParametricSpline(x, y)
    s.draw(offset)
    #s.draw_points(offset)

    #scale = 1.05
    #s1 = ParametricSpline(x * scale, y * scale)
    #s1.draw(offset - Point(8., 0.))

    h1 = 52.
    h2 = 25.
    w1 = 75.
    x, y = s.calculate_contour(offset, tmin=0., tmax=0.5)
    mask = abs(y - offset.y) > h1
    x = x[mask]
    y = y[mask]
    plt.plot(x, y, color='black')
    plt.hlines(h1 + offset.y, x[0], x[-1])

    x, y = s.calculate_contour(offset, tmin=0.5, tmax=1.)
    mask = np.logical_and(abs(y - offset.y) > h1, x - offset.x < 317.)
    x = x[mask]
    y = y[mask]
    plt.plot(x, y, color='black')
    plt.hlines(-h1 + offset.y, x[0], x[-1])

    p0 = Point(-50., 0.)
    l = Line(p0, p0.move(500., 0.))
    l.draw(offset)

    p1 = Point(200., -200.)
    l = Line(p1, p1.vmove(400.))
    l.draw(offset)
コード例 #9
0
ファイル: geometry.py プロジェクト: lucabaldini/metalute
 def draw(self,
          offset,
          num_points: int = 250,
          construction: bool = True,
          **kwargs):
     """Overloaded method.
     """
     kwargs.setdefault('color', 'black')
     x0, y0 = (self.center + offset).xy()
     phi = np.linspace(self.start_phi, self.end_phi, num_points)
     r = self.radius(phi)
     x = x0 + r * np.cos(np.radians(phi))
     y = y0 + r * np.sin(np.radians(phi))
     plt.plot(x, y, **kwargs)
コード例 #10
0
 def draw_points(self, offset, **kwargs):
     """
     """
     kwargs.setdefault('color', 'orange')
     plt.plot(self.x + offset.x, self.y + offset.y, 'x', **kwargs)
コード例 #11
0
ファイル: geometry2.py プロジェクト: lucabaldini/metalute
 def _draw(self, offset, **kwargs):
     """Overloaded method.
     """
     kwargs.setdefault('markersize', 4.)
     plt.plot(self.x + offset.x, self.y + offset.y, 'o', **kwargs)