Translates a conic by a vector
488902
def translate(conic, vector):
        
        # Translation matrix
        T = N.identity(len(conic))
        T[:-1,-1] = -vector
        return conic.transform(T)
278933
def grid_from_coordinate_transform(numPix, Mpix2coord, ra_at_xy_0, dec_at_xy_0):
    
    a = np.arange(numPix)
    matrix = np.dstack(np.meshgrid(a, a)).reshape(-1, 2)
    x_grid = matrix[:, 0]
    y_grid = matrix[:, 1]
    ra_grid = x_grid * Mpix2coord[0, 0] + y_grid * Mpix2coord[0, 1] + ra_at_xy_0
    dec_grid = x_grid * Mpix2coord[1, 0] + y_grid * Mpix2coord[1, 1] + dec_at_xy_0
    return ra_grid, dec_grid
118157
def repmat(x, r, c):
    '''
    
    '''
    if sps.issparse(x):
        row = sps.hstack([x for _ in range(c)])
        return sps.vstack([row for _ in range(r)], format=x.format)
    else: return np.matlib.repmat(x, r, c)
418532
function generateTranslate(x, y, z, scale) {
        return 'translate' + (has3d ? '3d(' : '(') + x + 'px,' + y + (has3d ? 'px,' + z + 'px)' : 'px)') + 'scale(' + scale + ')';
    }
73173
public void translate(Vector3f t) {
		this.m03 += t.getX();
		this.m13 += t.getY();
		this.m23 += t.getZ();
	}
814551
function sphereVoxels(cx, cy, cz, r, col){
    return function(cons, nil){
      sphere(cx, cy, cz, r)(function(x, y, z, res){
        return cons(x, y, z, col, res);
      }, nil);
    };
  }
1297356
def translate(translationAmt):
        """"""
        if not isinstance(translationAmt, Vector3):
            raise ValueError("translationAmt must be a Vector3")

        ma4 = Matrix4((1, 0, 0, translationAmt.x),
                      (0, 1, 0, translationAmt.y),
                      (0, 0, 1, translationAmt.z),
                      (0, 0, 0, 1))
        return ma4
464672
def norm_vec(vector):
    """"""
    assert len(vector) == 3
    v = np.array(vector)
    return v/np.sqrt(np.sum(v**2))
1231741
public void translateRectangle(Rectangle rect, float dx, float dy) {
		float width = rect.getWidth();
		float height = rect.getHeight();
		rect.setLeft(rect.getLeft() + dx);
		rect.setBottom(rect.getBottom() + dy);
		rect.setRight(rect.getLeft() + dx + width);
		rect.setTop(rect.getBottom() + dy + height);
	}
76382
def translate_v3(vec, amount):
    """"""

    return Vec3(vec.x+amount, vec.y+amount, vec.z+amount)
566833
function parseTransforms(value) {
  return value
    .match(/(rotate|translate|scale|skewX|skewY|matrix)\s*\(([^)]*)\)\s*/g)
    .map(transform => transform.match(/[\w.-]+/g));
}
1354365
def apply_translation(self, offset):
        
        # work on 2D and 3D paths
        dimension = self.vertices.shape[1]
        # make sure offset is correct length and type
        offset = np.array(
            offset, dtype=np.float64).reshape(dimension)
        # create a homogenous transform
        matrix = np.eye(dimension + 1)
        # apply the offset
        matrix[:dimension, dimension] = offset

        self.apply_transform(matrix)
949978
def translate_detector(self, vector):
        """"""
        vector = np.array(vector, dtype=float)
        self.pmts.pos_x += vector[0]
        self.pmts.pos_y += vector[1]
        self.pmts.pos_z += vector[2]
        self.reset_caches()
748627
def translate_array(trans_vec,vec_array):

    '''
    '''

    return map ( lambda x,m=trans_vec:add(m,x),vec_array )
762492
def translate(curve, z0):
    """"""
    if isinstance(curve, Path):
        return Path(*[translate(seg, z0) for seg in curve])
    elif is_bezier_segment(curve):
        return bpoints2bezier([bpt + z0 for bpt in curve.bpoints()])
    elif isinstance(curve, Arc):
        new_start = curve.start + z0
        new_end = curve.end + z0
        return Arc(new_start, radius=curve.radius, rotation=curve.rotation,
                   large_arc=curve.large_arc, sweep=curve.sweep, end=new_end)
    else:
        raise TypeError("Input `curve` should be a Path, Line, "
                        "QuadraticBezier, CubicBezier, or Arc object.")
1285258
def rotate_around_vector_v3(v, angle_rad, norm_vec):
    
    cos_val = math.cos(angle_rad)
    sin_val = math.sin(angle_rad)
    ## (v * cosVal) +
    ## ((normVec * v) * (1.0 - cosVal)) * normVec +
    ## (v ^ normVec) * sinVal)
    #line1: scaleV3(v,cosVal)
    #line2: dotV3( scaleV3( dotV3(normVec,v), 1.0-cosVal), normVec)
    #line3: scaleV3( crossV3( v,normVec), sinVal)
    #a = scaleV3(v,cosVal)
    #b = scaleV3( normVec, dotV3(normVec,v) * (1.0-cosVal))
    #c = scaleV3( crossV3( v,normVec), sinVal)
    return add_v3(
        add_v3(scale_v3(v, cos_val),
               scale_v3(norm_vec, dot_v3(norm_vec, v) * (1.0 - cos_val))),
        scale_v3(cross_v3(v, norm_vec), sin_val)
    )
1094124
def cart2spol(X):
    
    x,y,z,vx,vy,vz=X
    r=np.sqrt(x*x+y*y+z*z)
    p=np.arctan2(y,x)
    t=np.arccos(z/r)
    vr=(vx*np.cos(p)+vy*np.sin(p))*np.sin(t)+np.cos(t)*vz
    vp=-vx*np.sin(p)+vy*np.cos(p)
    vt=(vx*np.cos(p)+vy*np.sin(p))*np.cos(t)-np.sin(t)*vz
    return np.array([r,p,t,vr,vp,vt])