Return the cross product of this vector and *rhs*.
169934
def cross(self, rhs):
    

    return Vector(
      self.y * rhs.z - self.z * rhs.y,
      self.z * rhs.x - self.x * rhs.z,
      self.x * rhs.y - self.y * rhs.x)
1252899
def from_two_vectors(self, vec1, vec2):
        ''''''
        angle = vec1.angle(vec2)
        cross = vec1 % vec2
        if cross.length() == 0:
            # the two vectors are colinear
            return self.from_euler(0,0,angle)
        cross.normalize()
        return self.from_axis_angle(cross, angle)
970610
def cross_product (x1, y1, x2, y2, x3, y3):
    
    return (x2 - x1) * (y3 - y1) - (x3 - x1) * (y2 - y1)
536187
def get(self):
        
        x = self.coords('cross_v')[0]
        y = self.coords('cross_h')[1]
        xp = min(x, self.bg.width() - 1)
        yp = min(y, self.bg.height() - 1)
        try:
            r, g, b = self.bg.get(round2(xp), round2(yp))
        except ValueError:
            r, g, b = self.bg.get(round2(xp), round2(yp)).split()
            r, g, b = int(r), int(g), int(b)
        hexa = rgb_to_hexa(r, g, b)
        h = self.get_hue()
        s = round2((1 - float(y) / self.winfo_height()) * 100)
        v = round2(100 * float(x) / self.winfo_width())
        return (r, g, b), (h, s, v), hexa
1111140
def unit(self):
        """"""
        return Vector(
            (self.x / self.magnitude()),
            (self.y / self.magnitude()),
            (self.z / self.magnitude())
        )
1152500
def cross_index(values, index):
    
    lengths = [len(v) for v in values]
    length = np.product(lengths)
    if index >= length:
        raise IndexError('Index %d out of bounds for cross-product of size %d'
                         % (index, length))
    indexes = []
    for i in range(1, len(values))[::-1]:
        p = np.product(lengths[-i:])
        indexes.append(index//p)
        index -= indexes[-1] * p
    indexes.append(index)
    return tuple(v[i] for v, i in zip(values, indexes))
735537
public static int crossQuad (float x1, float y1, float cx, float cy, float x2, float y2,
                                 float x, float y) {
        // LEFT/RIGHT/UP/EMPTY
        if ((x < x1 && x < cx && x < x2) || (x > x1 && x > cx && x > x2)
                || (y > y1 && y > cy && y > y2) || (x1 == cx && cx == x2)) {
            return 0;
        }

        // DOWN
        if (y < y1 && y < cy && y < y2 && x != x1 && x != x2) {
            if (x1 < x2) {
                return x1 < x && x < x2 ? 1 : 0;
            }
            return x2 < x && x < x1 ? -1 : 0;
        }

        // INSIDE
        QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2);
        float px = x - x1, py = y - y1;
        float[] res = new float[3];
        int rc = c.solvePoint(res, px);
        return c.cross(res, rc, py, py);
    }
635127
function getter_THREE_Vector4(inst) {
	return [
		inst.x,
		inst.y,
		inst.z,
		inst.w];
}
145072
def _get_f1rx(self, C, r_x, r_1):
        
        rxr1 = r_x / r_1
        return C["h1"] + (C["h2"] * rxr1) + (C["h3"] * (rxr1 ** 2.))
113101
private static double getPlaneAngle(float[] v1, float[] v2, float[] v3, float[] u1, float[] u2, float[] u3) {
		float[] cross1 = Vector.crossProduct(new float[] { v2[0] - v1[0], v2[1] - v1[1], v2[2] - v1[2] }, new float[] { v3[0] - v1[0], v3[1] - v1[1], v3[2] - v1[2] });
		float[] cross2 = Vector.crossProduct(new float[] { u2[0] - u1[0], u2[1] - u1[1], u2[2] - u1[2] }, new float[] { u3[0] - u1[0], u3[1] - u1[1], u3[2] - u1[2] });

		float num = Vector.dot(cross1, cross2);
		float den = Vector.length(cross1) * Vector.length(cross2);

		float a = num / den;
		if (a > 1) {
			a = 1;
		}
		if (a < -1) {
			a = -1;
		}
		double result = Math.acos(a);

		return result;
	}
658643
def _crossProduct( self, ls ):
        """"""
        p = ls[0]
        ds = []
        if len(ls) == 1:
            # last parameter, convert range to a dict
            for i in self._parameters[p]:
                dp = dict()
                dp[p] = i
                ds.append(dp)
        else:
            # for other parameters, create a dict combining each value in
            # the range to a copy of the dict of other parameters
            ps = self._crossProduct(ls[1:])
            for i in self._parameters[p]:
                for d in ps:
                    dp = d.copy()
                    dp[p] = i
                    ds.append(dp)

        # return the complete parameter space
        return ds
1232933
def get_psd_product(self, vector, dtype=None):
    
    # For convenience, think of x as [\alpha, \beta]
    if dtype is None:
      dtype = self.nn_dtype
    vector = tf.cast(vector, self.nn_dtype)
    alpha = tf.reshape(vector[0], shape=[1, 1])
    beta = vector[1:]
    # Computing the product of matrix_h with beta part of vector
    # At first layer, h is simply diagonal
    h_beta = self.get_h_product(beta)

    # Constructing final result using vector_g
    result = tf.concat(
        [
            alpha * self.nu + tf.reduce_sum(tf.multiply(beta, self.vector_g)),
            tf.multiply(alpha, self.vector_g) + h_beta
        ],
        axis=0)
    return tf.cast(result, dtype)
177961
def normalize(self):
        """"""
        vlength = self.length()

        #Make sure the length isn't 0
        if vlength > 0:
            self.x /= vlength
            self.y /= vlength
            self.z /= vlength
        else:
            return Vector3(0, 0, 0)
226736
function cross(a, b){
    var ax = x(a), ay = y(a), az = z(a);
    var bx = y(a), by = y(b), bz = z(b);
    return Vector3(
      ay*bz-az*by,
      az*bx-bz*ax,
      ax*by-ay*bx);
  }
444702
def get_vec_lr(self):
        """"""

        return self.width * self.cos_a(), -self.width * self.sin_a()
47864
def triangle_normal(tri):
    
    vec1 = vector_generate(tri.vertices[0].data, tri.vertices[1].data)
    vec2 = vector_generate(tri.vertices[1].data, tri.vertices[2].data)
    return vector_cross(vec1, vec2)
1261454
def crosscorr(self, signal, lag=0):
        
        from scipy.linalg import norm

        s = asarray(signal)
        s = s - mean(s)
        s = s / norm(s)

        if size(s) != size(self.index):
            raise Exception('Size of signal to cross correlate with, %g, '
                            'does not match size of series' % size(s))

        # created a matrix with lagged signals
        if lag is not 0:
            shifts = range(-lag, lag+1)
            d = len(s)
            m = len(shifts)
            sshifted = zeros((m, d))
            for i in range(0, len(shifts)):
                tmp = roll(s, shifts[i])
                if shifts[i] < 0:
                    tmp[(d+shifts[i]):] = 0
                if shifts[i] > 0:
                    tmp[:shifts[i]] = 0
                sshifted[i, :] = tmp
            s = sshifted
        else:
            shifts = [0]

        def get(y, s):
            y = y - mean(y)
            n = norm(y)
            if n == 0:
                b = zeros((s.shape[0],))
            else:
                y /= n
                b = dot(s, y)
            return b

        return self.map(lambda x: get(x, s), index=shifts)