returns 0,..3 depending on which side pt lies.
489513
int _envelopeSide(Point2D pt) {

		if (isEmpty())
			return -1;

		double boundaryDist = _boundaryDistance(pt);
		double height = ymax - ymin;
		double width = xmax - xmin;

		if (boundaryDist < height)
			return 0;

		if ((boundaryDist -= height) < width)
			return 1;

		return boundaryDist - width < height ? 2 : 3;
	}
627315
function (rotation) {
		var ret, 
			angle = (pick(rotation, 0) - (this.side * 90) + 720) % 360;

		if (angle > 15 && angle < 165) {
			ret = 'right';
		} else if (angle > 195 && angle < 345) {
			ret = 'left';
		} else {
			ret = 'center';
		}
		return ret;
	}
489470
def _sin(x):
    ''''''
    return 0. if np.isclose(np.mod(x, np.pi), 0.) else np.sin(x)
951337
def lnprior(x):
    """"""
    per, t0, b = x
    if b < -1 or b > 1:
        return -np.inf
    elif per < 7 or per > 10:
        return -np.inf
    elif t0 < 1978 or t0 > 1979:
        return -np.inf
    else:
        return 0.
1352254
def a(self):
        '''
        

        '''
        a = Point(self.center)

        if self.xAxisIsMajor:
            a.x += self.majorRadius
        else:
            a.y += self.majorRadius
        return a
1276182
function ( t, p0, p1, p2, p3 ) {

		return - 3 * p0 * ( 1 - t ) * ( 1 - t )  +
			3 * p1 * ( 1 - t ) * ( 1 - t ) - 6 * t * p1 * ( 1 - t ) +
			6 * t *  p2 * ( 1 - t ) - 3 * t * t * p2 +
			3 * t * t * p3;

	}
415596
function ptsub(q, n) {
        var eps;

        if (n === 1 && q > 0.001 && q < 0.01) {
            eps = 1.0e-4;
        } else if (n === 2 && q < 0.0001) {
            eps = 1.0e-4;
        } else if (n === 1 && q < 0.001) {
            eps = 1.0e-2;
        } else {
            eps = 1.0e-5;
        }

        s = 10000.0;
        w = 0.0;
        while (true) {
            w = w + s;

            if (s <= eps) { return w; }
            if ((qe = 2.0 - p_t(n, w) * 2.0 - q) === 0.0) { return w; }
            if (qe < 0.0) {
                w = w - s;
                s = s / 10.0;
            }
        }
    }
1066532
function( v ) {
			v = +v;
			if ( isNaN( v ) ) return +0;
			if ( v === 0 || !isFinite( v ) ) return v;
			return ( v < 0 ? -1 : 1 ) * abs( floor( v ) );
		}
1072176
def _fwhm_side_lineal(uu, vv):
    ''''''
    res1, = np.nonzero(vv < 0)
    if len(res1) == 0:
        return 0, 1  # error, no negative value
    else:
        # first value
        i2 = res1[0]
        i1 = i2 - 1
        dx = uu[i2] - uu[i1]
        dy = vv[i2] - vv[i1]
        r12 = uu[i1] - vv[i1] * dx / dy
        return r12, 0
305302
def getBottomRight(self):
        
        return (float(self.get_cx()) + float(self.get_rx()), float(self.get_cy()) - float(self.get_ry()))
1133519
def is_point_in_rect(self, pt_x, pt_y):
        

        x_min, x_max, y_min, y_max = self.get_bbox()

        return x_min <= pt_x <= x_max and y_min <= pt_y <= y_max
1247191
def pt_relative(pt=(0.0, 0.0), shift=[0.0, 0.0], angle=[0.0]):
    '''
    '''
    assert isinstance(pt, tuple)
    l_pt = len(pt)
    assert l_pt > 1
    for i in pt:
        assert isinstance(i, float)
    assert isinstance(shift, list)
    l_sh = len(shift)
    assert l_sh == l_pt
    for i in shift:
        assert isinstance(i, float)
    assert isinstance(angle, list)
    l_angle = len(angle)
    assert l_angle == l_pt-1
    for i in angle:
        assert isinstance(i, float)
        assert abs(i) <= 2*pi

    return pt_rotate(pt_shift(pt, shift), angle, pt)
81880
def cbrt (x):
  """"""
  if x >= 0: 
    return   math.pow(x     , 1.0 / 3.0)
  else:
    return - math.pow(abs(x), 1.0 / 3.0)
234160
def midpoint(self) -> float:
        
        return (self.bid + self.ask) / 2 if self.hasBidAsk() else nan
247571
function backEaseInOut (p) {
    var f;
    if(p < 0.5) {
        f = 2 * p;
        return 0.5 * (f * f * f - f * Math.sin(f * Math.PI));
    } else {
        f = (1 - (2*p - 1));
        return 0.5 * (1 - (f * f * f - f * Math.sin(f * Math.PI))) + 0.5;
    }
}
351798
def _left_zero_blocks(self, r):
    """"""
    if not self._include_off_diagonal:
      return r
    elif not self._upper:
      return 0
    elif self._include_diagonal:
      return r
    else:
      return r + 1
992930
def _get_pos(self):
        
        if self._canvas.height >= self._max_height:
            return 0
        else:
            return self._canvas.start_line / (self._max_height - self._canvas.height + 1)