Transforms surface potential to polar radius
434647
def pot_to_rpole_aligned(pot, sma, q, F, d, component=1):
    
    q = q_for_component(q, component=component)
    Phi = pot_for_component(pot, q, component=component)
    logger.debug("libphobe.roche_pole(q={}, F={}, d={}, Omega={})".format(q, F, d, pot))
    return libphoebe.roche_pole(q, F, d, pot) * sma
334605
function (from, to, options) {
		var center = this.center,
			startAngleRad = this.startAngleRad,
			fullRadius = center[2] / 2,
			radii = [
				pick(options.outerRadius, '100%'),
				options.innerRadius,
				pick(options.thickness, 10)
			],
			percentRegex = /%$/,
			start,
			end,
			open,
			isCircular = this.isCircular, // X axis in a polar chart
			ret;
			
		// Polygonal plot bands
		if (this.options.gridLineInterpolation === 'polygon') {
			ret = this.getPlotLinePath(from).concat(this.getPlotLinePath(to, true));
		
		// Circular grid bands
		} else {

			// Keep within bounds
			from = Math.max(from, this.min);
			to = Math.min(to, this.max);
			
			// Plot bands on Y axis (radial axis) - inner and outer radius depend on to and from
			if (!isCircular) {
				radii[0] = this.translate(from);
				radii[1] = this.translate(to);
			}
			
			// Convert percentages to pixel values
			radii = map(radii, function (radius) {
				if (percentRegex.test(radius)) {
					radius = (pInt(radius, 10) * fullRadius) / 100;
				}
				return radius;
			});
			
			// Handle full circle
			if (options.shape === 'circle' || !isCircular) {
				start = -Math.PI / 2;
				end = Math.PI * 1.5;
				open = true;
			} else {
				start = startAngleRad + this.translate(from);
				end = startAngleRad + this.translate(to);
			}
		
		
			ret = this.chart.renderer.symbols.arc(
				this.left + center[0],
				this.top + center[1],
				radii[0],
				radii[0],
				{
					start: Math.min(start, end), // Math is for reversed yAxis (#3606)
					end: Math.max(start, end),
					innerR: pick(radii[1], radii[0] - radii[2]),
					open: open
				}
			);
		}

		return ret;
	}
161453
def get_transformation(self, coordinates):
        """"""
        atom1, atom2, atom3, atom4 = self.hinge_atoms
        a = coordinates[atom1] - coordinates[atom2]
        a /= np.linalg.norm(a)
        b = coordinates[atom3] - coordinates[atom4]
        b /= np.linalg.norm(b)
        direction = 0.5*(a+b)
        direction *= np.random.uniform(-self.max_amplitude, self.max_amplitude)
        result = Translation(direction)
        return result
1048977
def cart2spher(x, y, z):
    """"""
    hxy = np.hypot(x, y)
    r = np.hypot(hxy, z)
    theta = np.arctan2(z, hxy)
    phi = np.arctan2(y, x)
    return r, theta, phi
458987
def spherical(cls, mag, theta, phi=0):
        ''''''
        return cls(
            mag * math.sin(phi) * math.cos(theta),  # X
            mag * math.sin(phi) * math.sin(theta),  # Y
            mag * math.cos(phi)  # Z
        )
1293319
def K(self, r, R, kwargs):
        
        u = r / R
        if np.min(u) < 1:
            raise ValueError("3d radius is smaller than projected radius! Does not make sense.")

        if self._type == 'const_wrong':
            beta = kwargs['beta']
            k = 1./2. * u**(2*beta - 1.) * ((3./2 - beta) * np.sqrt(np.pi) * special.gamma(beta - 1./2)/special.gamma(beta)
                        + beta * self._B(x=1./u**2, a=beta+1./2, b=1./2) - self._B(x=1./u**2, a=beta-1./2, b=1./2))
        elif self._type == 'const':
            beta = kwargs['beta']
            k = np.sqrt(1 - 1./u**2) / (1. - 2*beta) + np.sqrt(np.pi)/2 * special.gamma(beta - 1./2)/special.gamma(beta)\
                * (3./2 - beta) * u**(2*beta - 1.) * (1 - special.betainc(beta+1./2, 1./2, 1./u**2))
        elif self._type == 'isotropic':
            k = np.sqrt(1 - 1./u**2)
        elif self._type == 'radial':
            k = np.pi/4 * u - 1./2 * np.sqrt(1 - 1./u**2) - u/2. * np.arcsin(1./u)
        elif self._type == 'OsipkovMerritt':
            r_ani = kwargs['r_ani']
            ua = r_ani / R
            k = (ua**2 + 1./2) / (ua**2 + 1)**(3./2) * (u**2 + ua**2) / u * np.arctan(np.sqrt((u**2 - 1) / (ua**2 + 1))) \
                - 1./2/(ua**2 + 1) * np.sqrt(1 -1./u**2)
        elif self._type == 'Colin':
            r_ani = kwargs['r_ani']
            ua = r_ani / R
            if ua == 1:
                k = (1 + 1./u) * np.arccosh(u) - 1./6 * (8./u + 7) * np.sqrt((u-1.)/(u+1.))
            else:
                k = 0.5 / (ua**2 - 1) * np.sqrt(1 - 1./u**2) + (1. + ua/u) * np.cosh(u) - np.sign(ua - 1) * ua * \
                            (ua**2 - 0.5) / np.abs(ua**2-1)**(3./2) * (1. + ua/u) * np.arccosh((ua*u + 1)/(u + ua))
        else:
            raise ValueError('anisotropy type %s not supported!' % self._type)
        return k
526909
def _JRAxiIntegrand(r,E,L,pot):
    """"""
    return nu.sqrt(2.*(E-potentialAxi(r,pot))-L**2./r**2.)
615012
function createSphereFromRenderableShape(params, physicsJob) {
  const radius = params.radius || vec3.length(params.scale) / Math.sqrt(3);
  return new Sphere(0, 0, 0, radius, params.isStationary, physicsJob);
}
677585
function polarToCartesian(radius, pathRadius, angleInDegrees) {
    var /** @type {?} */ angleInRadians = (angleInDegrees - 90) * DEGREE_IN_RADIANS;
    return (radius + (pathRadius * Math.cos(angleInRadians))) +
        ',' + (radius + (pathRadius * Math.sin(angleInRadians)));
}
1052238
def from_polar(self, r, theta, h):
        
        center = self.size() / 2.0
        r = r * center['x']

        return center + Vector(r * math.cos(theta),
                               r * math.sin(theta),
                               center['z'] * h)
1340837
def get_transformation(self, coordinates):
        """"""
        atom1, atom2 = self.hinge_atoms
        center = coordinates[atom1]
        axis = coordinates[atom1] - coordinates[atom2]
        axis /= np.linalg.norm(axis)
        angle = np.random.uniform(-self.max_amplitude, self.max_amplitude)
        return Complete.about_axis(center, angle, axis)
1057321
def surface_evaluate_barycentric(surface, point):
    """"""
    if NO_IMAGES:
        return

    ax = surface.plot(256)
    ax.plot(
        point[0, :], point[1, :], color="black", linestyle="None", marker="o"
    )
    ax.axis("scaled")
    ax.set_xlim(-0.125, 1.125)
    ax.set_ylim(-0.125, 1.125)
    save_image(ax.figure, "surface_evaluate_barycentric.png")
2600
def get_transformation(self, coordinates):
        """"""
        atom1, atom2, atom3 = self.hinge_atoms
        center = coordinates[atom2]
        a = coordinates[atom1] - coordinates[atom2]
        b = coordinates[atom3] - coordinates[atom2]
        axis = np.cross(a, b)
        norm = np.linalg.norm(axis)
        if norm < 1e-5:
            # We suppose that atom3 is part of the affected atoms
            axis = random_orthonormal(a)
        else:
            axis /= np.linalg.norm(axis)
        angle = np.random.uniform(-self.max_amplitude, self.max_amplitude)
        return Complete.about_axis(center, angle, axis)
238649
function reShape(object, radius, orientation, options, slicer) {
  options = options || {};
  var b = object.getBounds();
  // var s = util.size(b);
  var ar = Math.abs(radius);
  var si = util.sliceParams(orientation, radius, b);

  if (si.axis !== "z")
    throw new Error(
      'util.reShape error: CAG._toPlanePolytons only uses the "z" axis.  You must use the "z" axis for now.'
    );

  var cutplane = CSG$1.OrthoNormalBasis.GetCartesian(
    si.orthoNormalCartesian[0],
    si.orthoNormalCartesian[1]
  ).translate(si.cutDelta);

  var slice = object.sectionCut(cutplane);

  var first = util.axisApply(si.axis, function() {
    return si.positive ? 0 : ar;
  });

  var last = util.axisApply(si.axis, function() {
    return si.positive ? ar : 0;
  });

  var plane = si.positive ? cutplane.plane : cutplane.plane.flipped();

  var slices = slicer(first, last, slice);

  var delta = util
    .slices2poly(
      slices,
      Object.assign(options, {
        si: si
      }),
      si.axis
    )
    .color(options.color);

  var remainder = object.cutByPlane(plane);
  return union([
    options.unionOriginal ? object : remainder,
    delta.translate(si.moveDelta)
  ]);
}
794863
def rotate(p, rad, o=(0, 0)):
    
    v = vector(o, p)
    fx = lambda x, y, d: x * cos(d) - y * sin(d)
    fy = lambda x, y, d: x * sin(d) + y * cos(d)
    rv = fx(v[0], v[1], rad), fy(v[0], v[1], rad)
    return translate(rv, o)
635184
function alterneigh(radius, i, b, g, r) {
    var lo = Math.abs(i - radius);
    var hi = Math.min(i + radius, netsize);

    var j = i + 1;
    var k = i - 1;
    var m = 1;

    var p, a;
    while ((j < hi) || (k > lo)) {
      a = radpower[m++];

      if (j < hi) {
        p = network[j++];
        p[0] -= (a * (p[0] - b)) / alpharadbias;
        p[1] -= (a * (p[1] - g)) / alpharadbias;
        p[2] -= (a * (p[2] - r)) / alpharadbias;
      }

      if (k > lo) {
        p = network[k--];
        p[0] -= (a * (p[0] - b)) / alpharadbias;
        p[1] -= (a * (p[1] - g)) / alpharadbias;
        p[2] -= (a * (p[2] - r)) / alpharadbias;
      }
    }
  }
784751
def beta_r(self, r, kwargs):
        
        if self._type == 'const':
            return self.const_beta(kwargs)
        elif self._type == 'OsipkovMerritt':
            return self.ospikov_meritt(r, kwargs)
        elif self._type == 'Colin':
            return self.colin(r, kwargs)
        elif self._type == 'isotropic':
            return self.isotropic()
        elif self._type == 'radial':
            return self.radial()
        else:
            raise ValueError('anisotropy type %s not supported!' % self._type)