Return a vector orthogonal to the given triangle

       Arguments:
         a, b, c  --  three 3D numpy vectors
973975
def triangle_normal(a, b, c):
    
    normal = np.cross(a - c, b - c)
    norm = np.linalg.norm(normal)
    return normal/norm
1231183
def rot3(theta):
    
    return np.array([
        [np.cos(theta), np.sin(theta), 0],
        [-np.sin(theta), np.cos(theta), 0],
        [0, 0, 1]
    ])
826018
private double calculateAngleBetweenTwoLines(Vector3d a, Vector3d b, Vector3d c, Vector3d d) {
        Vector3d firstLine = new Vector3d();
        firstLine.sub(a, b);
        Vector3d secondLine = new Vector3d();
        secondLine.sub(c, d);
        Vector3d firstVec = new Vector3d(firstLine);
        Vector3d secondVec = new Vector3d(secondLine);
        return firstVec.angle(secondVec);
    }
514454
def reduce_vectors(a, b):
    
    if np.dot(a, b) < 0:
        return reduce_vectors(a, -b)

    if fast_norm(a) > fast_norm(b):
        return reduce_vectors(b, a)

    if fast_norm(b) > fast_norm(np.add(b, a)):
        return reduce_vectors(a, np.add(b, a))

    if fast_norm(b) > fast_norm(np.subtract(b, a)):
        return reduce_vectors(a, np.subtract(b, a))

    return [a, b]
1148986
def triangle(self, params=None, **kwargs):
        
        if params is None:
            params = ['mass_A', 'mass_B', 'mass_C', 
                      'age', 'feh', 'distance', 'AV']

        super(TripleStarModel, self).triangle(params=params, **kwargs)
805651
def _projection(self, a, b, c):
        
        ab = b - a
        ac = c - a
        return a + ((ab*ac).sum() / (ac*ac).sum()) * ac
155763
def to_vec3(self):
        """"""
        vec3 = Vector3()
        vec3.x = self.x
        vec3.y = self.y
        vec3.z = self.z

        if self.w != 0:
            vec3 /= self.w

        return vec3
1002022
def cross(self, vec):
        """"""
        if not isinstance(vec, Vector3Array):
            raise TypeError('Cross product operand must be a Vector3Array')
        if self.nV != 1 and vec.nV != 1 and self.nV != vec.nV:
            raise ValueError('Cross product operands must have the same '
                             'number of elements.')
        return Vector3Array(np.cross(self, vec))
297166
def nmap(a, b, c, d, curvefn=None, normfn=None):
    
    if not curvefn:
        curvefn = lambda x: x

    def map(n):
        r = 1.0 * (n - a) / (b - a)
        out = curvefn(r) * (d - c) + c
        if not normfn:
            return out
        return normfn(out)
    return map
111666
def unit_vector(self):
        """"""
        x = -math.cos(self.rpitch) * math.sin(self.ryaw)
        y = -math.sin(self.rpitch)
        z = math.cos(self.rpitch) * math.cos(self.ryaw)
        return Vector3(x, y, z)
403717
function d3_geom_hullCCW(i1, i2, i3, v) {
  var t, a, b, c, d, e, f;
  t = v[i1]; a = t[0]; b = t[1];
  t = v[i2]; c = t[0]; d = t[1];
  t = v[i3]; e = t[0]; f = t[1];
  return ((f-b)*(c-a) - (d-b)*(e-a)) > 0;
}
128721
def get_xyz_tri(self, xcoord, x, ycoord, y, u, v):
        """"""
        return self.get_xyz_2d(xcoord, x, ycoord, y, u, v)
163164
def vectors(self, array):
        
        if array.ndim != 2:
            raise AssertionError('vector array must be a 2-dimensional array')
        elif array.shape[1] != 3:
            raise RuntimeError('vector array must be 3D')
        elif array.shape[0] != self.n_points:
            raise RuntimeError('Number of vectors be the same as the number of points')

        self.point_arrays[DEFAULT_VECTOR_KEY] = array
        self.active_vectors_name = DEFAULT_VECTOR_KEY
241378
def dot_product(p1, p2, o=(0, 0)):
    
    v1 = vector(o, p1)
    v2 = vector(o, p2)
    return v1[0] * v2[0] + v1[1] * v2[1]
738010
def triangle(self, x1, y1, x2, y2, x3, y3, color):
        
        self.context.set_source_rgb(*color)
        self.context.move_to(self.tx(x1), self.ty(y1))
        self.context.line_to(self.tx(x2), self.ty(y2))
        self.context.line_to(self.tx(x3), self.ty(y3))
        self.context.line_to(self.tx(x1), self.ty(y1))
        self.context.fill()
527934
def point(u, v)
      Util3D.check_arg_type(::Numeric, u)
      Util3D.check_arg_type(::Numeric, v)
      return base_point + u_vector*u + v_vector*v
    end
28120
def trisolve(U, b, uplo='U', transa='N', alpha=1., inplace=False):
    
    if inplace:
        x = b
    else:
        x = b.copy('F')
    if U.shape[0] == 0:
        raise ValueError('Attempted to solve zero-rank triangular system')
    dtrsm_wrap(a=U, b=x, side='L', uplo=uplo, transa=transa, alpha=alpha)
    return x