Translate mesh for z-direction

        :param float d: Amount to translate
174490
def translate_z(self, d):
        
        mat = numpy.array([
            [1, 0, 0, 0],
            [0, 1, 0, 0],
            [0, 0, 1, 0],
            [0, 0, d, 1]
        ])
        self.vectors = self.vectors.dot(mat)
        return self
635589
@Override
	protected void doTransform(ITransformable.Translate transformable, float comp)
	{
		float fromX = reversed ? this.toX : this.fromX;
		float toX = reversed ? this.fromX : this.toX;
		float fromY = reversed ? this.toY : this.fromY;
		float toY = reversed ? this.fromY : this.toY;
		float fromZ = reversed ? this.toZ : this.fromZ;
		float toZ = reversed ? this.fromZ : this.toZ;

		transformable.translate(fromX + (toX - fromX) * comp, fromY + (toY - fromY) * comp, fromZ + (toZ - fromZ) * comp);
	}
1041941
def dxdy(line):
    
    x0, y0, x1, y1 = line
    dx = float(x1 - x0)
    dy = float(y1 - y0)
    f = hypot(dx, dy)
    return dx / f, dy / f
1357632
def _translate_div(self, oprnd1, oprnd2, oprnd3):
        
        assert oprnd1.size and oprnd2.size and oprnd3.size
        assert oprnd1.size == oprnd2.size

        op1_var = self._translate_src_oprnd(oprnd1)
        op2_var = self._translate_src_oprnd(oprnd2)
        op3_var, op3_var_constrs = self._translate_dst_oprnd(oprnd3)

        if oprnd3.size > oprnd1.size:
            op1_var_zx = smtfunction.zero_extend(op1_var, oprnd3.size)
            op2_var_zx = smtfunction.zero_extend(op2_var, oprnd3.size)

            result = op1_var_zx.udiv(op2_var_zx)
        elif oprnd3.size < oprnd1.size:
            result = smtfunction.extract(op1_var.udiv(op2_var), 0, oprnd3.size)
        else:
            result = op1_var.udiv(op2_var)

        return [op3_var == result] + op3_var_constrs
1348966
function translateDigit(d)
{
	if (d >= CP_0 && d <= CP_9) {
		/* '0' to '9' -> 0 to 9 */
		return (d - PI_CONV_DEC);
	} else if (d >= CP_A && d <= CP_Z) {
		/* 'A' - 'Z' -> 10 to 35 */
		return (d - PI_CONV_UC);
	} else if (d >= CP_a && d <= CP_z) {
		/* 'a' - 'z' -> 10 to 35 */
		return (d - PI_CONV_LC);
	} else {
		/* Invalid character code */
		return (-1);
	}
}
1162252
private void extractTransform( DMatrixRMaj U , DMatrixRMaj V , DMatrixRMaj S ,
								   Se3_F64 se , boolean optionA , boolean optionB )
	{
		DMatrixRMaj R = se.getR();
		Vector3D_F64 T = se.getT();

		// extract rotation
		if( optionA )
			CommonOps_DDRM.mult(U,Rz,temp);
		else
			CommonOps_DDRM.multTransB(U,Rz,temp);
		CommonOps_DDRM.multTransB(temp,V,R);

		// extract screw symmetric translation matrix
		if( optionB )
			CommonOps_DDRM.multTransB(U,Rz,temp);
		else
			CommonOps_DDRM.mult(U,Rz,temp);
		CommonOps_DDRM.mult(temp,S,temp2);
		CommonOps_DDRM.multTransB(temp2,U,temp);

		T.x = temp.get(2,1);
		T.y = temp.get(0,2);
		T.z = temp.get(1,0);
	}
1036762
def rotate2d(self, theta, origin=None, axis='z', radians=False):
        '''
        
        '''

        origin = Point._convert(origin)

        delta = self - origin

        p = Point(origin)

        if not radians:
            theta = math.radians(theta)

        cosT = math.cos(theta)
        sinT = math.sin(theta)

        if axis == 'z':
            p.x += (cosT * delta.x) - (sinT * delta.y)
            p.y += (sinT * delta.x) + (cosT * delta.y)
            return p

        if axis == 'y':
            p.z += (cosT * delta.z) - (sinT * delta.x)
            p.x += (sinT * delta.z) + (cosT * delta.x)
            return p

        if axis == 'x':
            p.y += (cosT * delta.y) - (sinT * delta.z)
            p.z += (sinT * delta.y) + (cosT * delta.z)
            return p

        raise KeyError('unknown axis {}, expecting x, y or z'.format(axis))
1206435
def translate(x, y, z)
      @x += x.to_f
      @y += y.to_f
      @z += z.to_f
    end
550668
public void translate(float x, float y) {
		checkPush();

		predraw();
		GL.glTranslatef(x, y, 0);
		postdraw();
	}
690137
def transform_to_3d(points,normal,z=0):
    """"""
    d = np.cross(normal, (0, 0, 1))
    M = rotation_matrix(d)
    transformed_points = M.dot(points.T).T + z
    return transformed_points
545143
function (meshes, applyWorldTransform) {

        if (! meshes.length) {
            return;
        }

        var templateMesh = meshes[0];
        var templateGeo = templateMesh.geometry;
        var material = templateMesh.material;

        var geometry = new Geometry({
            dynamic: false
        });
        geometry.boundingBox = new BoundingBox();

        var attributeNames = templateGeo.getEnabledAttributes();

        for (var i = 0; i < attributeNames.length; i++) {
            var name = attributeNames[i];
            var attr = templateGeo.attributes[name];
            // Extend custom attributes
            if (!geometry.attributes[name]) {
                geometry.attributes[name] = attr.clone(false);
            }
        }

        var inverseTransposeMatrix = mat4.create();
        // Initialize the array data and merge bounding box
        var nVertex = 0;
        var nFace = 0;
        for (var k = 0; k < meshes.length; k++) {
            var currentGeo = meshes[k].geometry;
            if (currentGeo.boundingBox) {
                currentGeo.boundingBox.applyTransform(applyWorldTransform ? meshes[k].worldTransform : meshes[k].localTransform);
                geometry.boundingBox.union(currentGeo.boundingBox);
            }
            nVertex += currentGeo.vertexCount;
            nFace += currentGeo.triangleCount;
        }
        for (var n = 0; n < attributeNames.length; n++) {
            var name = attributeNames[n];
            var attrib = geometry.attributes[name];
            attrib.init(nVertex);
        }
        if (nVertex >= 0xffff) {
            geometry.indices = new Uint32Array(nFace * 3);
        }
        else {
            geometry.indices = new Uint16Array(nFace * 3);
        }

        var vertexOffset = 0;
        var indicesOffset = 0;
        var useIndices = templateGeo.isUseIndices();

        for (var mm = 0; mm < meshes.length; mm++) {
            var mesh = meshes[mm];
            var currentGeo = mesh.geometry;

            var nVertex = currentGeo.vertexCount;

            var matrix = applyWorldTransform ? mesh.worldTransform.array : mesh.localTransform.array;
            mat4.invert(inverseTransposeMatrix, matrix);
            mat4.transpose(inverseTransposeMatrix, inverseTransposeMatrix);

            for (var nn = 0; nn < attributeNames.length; nn++) {
                var name = attributeNames[nn];
                var currentAttr = currentGeo.attributes[name];
                var targetAttr = geometry.attributes[name];
                // Skip the unused attributes;
                if (!currentAttr.value.length) {
                    continue;
                }
                var len = currentAttr.value.length;
                var size = currentAttr.size;
                var offset = vertexOffset * size;
                var count = len / size;
                for (var i = 0; i < len; i++) {
                    targetAttr.value[offset + i] = currentAttr.value[i];
                }
                // Transform position, normal and tangent
                if (name === 'position') {
                    vec3.forEach(targetAttr.value, size, offset, count, vec3.transformMat4, matrix);
                }
                else if (name === 'normal' || name === 'tangent') {
                    vec3.forEach(targetAttr.value, size, offset, count, vec3.transformMat4, inverseTransposeMatrix);
                }
            }

            if (useIndices) {
                var len = currentGeo.indices.length;
                for (var i = 0; i < len; i++) {
                    geometry.indices[i + indicesOffset] = currentGeo.indices[i] + vertexOffset;
                }
                indicesOffset += len;
            }

            vertexOffset += nVertex;
        }

        return new Mesh({
            material: material,
            geometry: geometry
        });
    }
489260
private static float computeTranslation(float viewSize, float drawableSize, float currentTranslation, float delta) {
		final float sideFreeSpace = (viewSize - drawableSize) / 2F;

		if(sideFreeSpace > 0) {
			return sideFreeSpace - currentTranslation;
		} else if(currentTranslation + delta > 0) {
			return -currentTranslation;
		} else if(currentTranslation + delta < viewSize - drawableSize) {
			return viewSize - drawableSize - currentTranslation;
		}

		return delta;
	}
807906
public void translate(float x, float y, float z) {
        NativeTransform.translate(getNative(), x, y, z);
    }
17815
def __moveLineOrCol(self, line, d):
        
        nl = [c for c in line if c != 0]
        if d == Board.UP or d == Board.LEFT:
            return nl + [0] * (self.__size - len(nl))
        return [0] * (self.__size - len(nl)) + nl
765473
public Translation from(float x, float y, float z)
	{
		fromX = x;
		fromY = y;
		fromZ = z;
		return this;
	}
611382
def downsample_trace(mesh, tol=1.0):
    
    idx = _find_turning_points(mesh, tol)
    if mesh.depths is not None:
        return numpy.column_stack([mesh.lons[0, idx],
                                   mesh.lats[0, idx],
                                   mesh.depths[0, idx]])
    else:
        return numpy.column_stack([mesh.lons[0, idx], mesh.lats[0, idx]])
1009234
def translate(surf, center, direction):
    
    normx = np.array(direction)/np.linalg.norm(direction)
    normz = np.cross(normx, [0, 1.0, 0.0000001])
    normz /= np.linalg.norm(normz)
    normy = np.cross(normz, normx)

    trans = np.zeros((4, 4))
    trans[:3, 0] = normx
    trans[:3, 1] = normy
    trans[:3, 2] = normz
    trans[3, 3] = 1

    surf.transform(trans)
    surf.points += np.array(center)