Return unit vector of a point with positive coordinates.
540219
def abs_unit(self):
        """"""
        s = self.x * self.x + self.y * self.y
        if s < 1e-5:
            return Point(0,0)
        s = math.sqrt(s)
        return Point(abs(self.x) / s, abs(self.y) / s)
205489
def convert_point(self, point):
        '''
        
        '''
        return self.container.convert_point(Vector(point) + self.pos)
310428
def normalize_vector(vector):
    
    v = np.divide(vector, np.linalg.norm(vector))
    return np.round(v, decimals=4)
294042
def C(self):
        '''
        

        '''
        try:
            return self._C
        except AttributeError:
            pass
        self._C = Point(0, 1)
        return self._C
1088628
def from_polar(degrees, magnitude):
        """"""
        vec = Vector2()
        vec.X = math.cos(math.radians(degrees)) * magnitude

        # Negate because y in screen coordinates points down, oppisite from what is
        # expected in traditional mathematics.
        vec.Y = -math.sin(math.radians(degrees)) * magnitude
        return vec
803346
def distances(self, points):
        """"""
        return [math.acos(self._pos3d.dot(p.vector)) for p in points]
207880
def _call(self, x):
        """"""
        x_norm = self.pointwise_norm(x).ufuncs.max()

        if x_norm > 1:
            return np.inf
        else:
            return 0
108666
def bearing_to(self, point):
        '''
        
        '''
        delta_long = point.long_radians - self.long_radians
        y = sin(delta_long) * cos(point.lat_radians)
        x = (
            cos(self.lat_radians) * sin(point.lat_radians) -
            sin(self.lat_radians) * cos(point.lat_radians) * cos(delta_long)
        )
        radians = math.atan2(y, x)
        return Bearing.from_radians(radians)
580610
def for_point(cls, point, zoom):
        """"""
        latitude, longitude = point.latitude_longitude
        return cls.for_latitude_longitude(latitude=latitude, longitude=longitude, zoom=zoom)
1271192
def __basis0(self, xi):
        """"""
        return np.where(np.all([self.knot_vector[:-1] <=  xi,
                                xi < self.knot_vector[1:]],axis=0), 1.0, 0.0)
274981
function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
       return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
              (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
              (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
   }
41904
public Vector2f positiveX(Vector2f dir) {
        float s = m00 * m11 - m01 * m10;
        s = 1.0f / s;
        dir.x =  m11 * s;
        dir.y = -m01 * s;
        return dir.normalize(dir);
    }
827462
def major_axis(points):
    
    U, S, V = np.linalg.svd(points)
    axis = util.unitize(np.dot(S, V))
    return axis
643665
public Vector3d positiveY(Vector3d dest) {
        dest.x = m12 * m20 - m10 * m22;
        dest.y = m00 * m22 - m02 * m20;
        dest.z = m02 * m10 - m00 * m12;
        return dest.normalize(dest);
    }
783735
def vector(x, y=None, z=0.0):
    
    if y is None:  # assume x is already [x,y,z]
        return np.array(x, dtype=np.float64)
    return np.array([x, y, z], dtype=np.float64)
665545
def D(self):
        '''
        
        '''
        return Point(self.minX, self.maxY, self.origin.z)
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