Normalizes a point/vector

    Args:
        p ([float, float]): x and y coordinates
    Returns:
        float
541100
def normalize(p):
    
    l = math.sqrt(p[0]**2 + p[1]**2)
    return [0.0, 0.0] if l == 0 else [p[0]/l, p[1]/l]
1235813
def normalize(self, df=None, norm_type='zscore', axis='row', keep_orig=False):
    '''
    
    '''
    normalize_fun.run_norm(self, df, norm_type, axis, keep_orig)
40600
def normalize_bbox(coords, ymax, scaler=2):
    
    return [
        coords[0] * scaler,
        ymax - (coords[3] * scaler),
        coords[2] * scaler,
        ymax - (coords[1] * scaler),
    ]
1358822
def point_line_distance(p, l_p, l_v):
    '''
    '''
    l_v = normalize(l_v)
    u = p - l_p
    return np.linalg.norm(u - np.dot(u, l_v) * l_v)
719006
def normalize_vector(v):
    
    norm = np.linalg.norm(v)
    return v/norm if not norm == 0 else v
1155807
function(p, t) {

            var x = this.x;
            var y = this.y;
            return new Point((1 - t) * x + t * p.x, (1 - t) * y + t * p.y);
        }
1041283
def rotate_point(self, p):
        
        # Prepare 
        p = Quaternion(0, p[0], p[1], p[2], False)  # Do not normalize!
        q1 = self.normalize()
        q2 = self.inverse()
        # Apply rotation
        r = (q1*p)*q2
        # Make point and return        
        return r.x, r.y, r.z
360893
public Vector2f normalize(float length, Vector2f dest) {
        float invLength = (float) (1.0 / Math.sqrt(x * x + y * y)) * length;
        dest.x = x * invLength;
        dest.y = y * invLength;
        return dest;
    }
374355
public static float pointSegDistSq (float px, float py,
                                        float x1, float y1, float x2, float y2) {
        // A = (x2 - x1, y2 - y1)
        // P = (px - x1, py - y1)
        x2 -= x1; // A = (x2, y2)
        y2 -= y1;
        px -= x1; // P = (px, py)
        py -= y1;
        float dist;
        if (px * x2 + py * y2 <= 0.0) { // P*A
            dist = px * px + py * py;
        } else {
            px = x2 - px; // P = A - P = (x2 - px, y2 - py)
            py = y2 - py;
            if (px * x2 + py * y2 <= 0.0) { // P*A
                dist = px * px + py * py;
            } else {
                dist = px * y2 - py * x2;
                dist = dist * dist / (x2 * x2 + y2 * y2); // pxA/|A|
            }
        }
        if (dist < 0) {
            dist = 0;
        }
        return dist;
    }
1305828
def greaterequal(x, y):
    
    x = BigFloat._implicit_convert(x)
    y = BigFloat._implicit_convert(y)
    return mpfr.mpfr_greaterequal_p(x, y)
968195
def average_points_dist(p0, p_list):
    
    return np.mean(list(point_dist(p0, p1) for p1 in p_list))
26448
def normalize(v, axis=None, eps=1e-10):
  """"""
  return v / max(anorm(v, axis=axis, keepdims=True), eps)
818633
def _normalize(self):
        
        # Get length
        L = self.norm()
        if not L:
            raise ValueError('Quaternion cannot have 0-length.')
        # Correct
        self.w /= L
        self.x /= L
        self.y /= L
        self.z /= L
1091508
def getP2(self):
        
        return Point(self.center[0] + self.radius,
                     self.center[1] + self.radius)
1127282
def _set_params(self, p):
        
        if self.force_norm:
            params = [value.n for key, value in p.items()]
        else:
            params = [value for key, value in p.items()]
        return params
218184
function(p) {
        var v = this.b.sub(this.a);
        var t = p.sub(this.a).dot(v) / v.magSquared();
        // Check to see if t is beyond the extents of the line segment
        if (t < 0.0) {
            return this.a.copy();
        } else if (t > 1.0) {
            return this.b.copy();
        }
        // Return the point between 'a' and 'b'
        return this.a.add(v.scaleSelf(t));
    }
879891
def lpnormalization(attrs, inputs, proto_obj):
    """"""
    new_attrs = translation_utils._fix_attribute_names(attrs, {'p': 'ord'})
    axis = int(attrs.get("axis", -1))
    new_attrs.update(axis=axis)
    return 'norm', new_attrs, inputs