cocos creator vector

/**
        !#in
        Constructor
        see {{#crossLink "cc/vec2:method"}}cc.v2{{/crossLink}} or {{#crossLink "cc/p:method"}}cc.p{{/crossLink}}
        ! #zh
        Constructor, you can view {{#crossLink "cc / vec2: method"}} cc.v2 {{/ crossLink}} or {{#crossLink "cc / p: method"}} cc.p {{/ crossLink}}
        @param x x
        @param y y 
        */
        constructor(x?: number, y?: number);        
        x: number;      
        y: number;      
        /**
        !#en clone a Vec2 object
        ! #zh Clone a Vec2 object 
        */
        clone(): Vec2;      
        /**
        !#en Sets vector with another's value
        ! #zh Set the vector value.
        @param newValue! #en new value to set.! #zh The new value to be set 
        */
        set(newValue: Vec2): Vec2;      
        /**
        !#en Check whether two vector equal
        ! #zh Whether the current vector is equal to the specified vector.
        @param other other 
        */
        equals(other: Vec2): boolean;       
        /**
        !#en Check whether two vector equal with some degree of variance.
        ! #zh
        Approximately determine whether the two points are equal. <br/>
        Determine whether the two vectors are within the specified value range. If it is, return true, otherwise return false.
        @param other other
        @param variance variance 
        */
        fuzzyEquals(other: Vec2, variance: number): boolean;        
        /**
        !#en Transform to string with vector informations
        ! #zh Convert to a string that is easy to read. 
        */
        toString(): string;     
        /**
        !#en Calculate linear interpolation result between this vector and another one with given ratio
        ! #zh Linear interpolation.
        @param to to
        @param ratio the interpolation coefficient
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created 
        */
        lerp(to: Vec2, ratio: number, out?: Vec2): Vec2;        
        /**
        !#en Clamp the vector between from float and to float.
        ! #zh
        Returns the vector after the specified restricted area. <br/>
        If the vector is greater than max_inclusive, max_inclusive is returned. <br/>
        If the vector is less than min_inclusive, min_inclusive is returned. <br/>
        Otherwise, return to itself.
        @param min_inclusive min_inclusive
        @param max_inclusive max_inclusive
        
        @example 
        ```js
        var min_inclusive = cc.v2(0, 0);
        var max_inclusive = cc.v2(20, 20);
        var v1 = cc.v2(20, 20).clampf(min_inclusive, max_inclusive); // Vec2 {x: 20, y: 20};
        var v2 = cc.v2(0, 0).clampf(min_inclusive, max_inclusive);   // Vec2 {x: 0, y: 0};
        var v3 = cc.v2(10, 10).clampf(min_inclusive, max_inclusive); // Vec2 {x: 10, y: 10};
        ``` 
        */
        clampf(min_inclusive: Vec2, max_inclusive: Vec2): Vec2;     
        /**
        !#en Adds this vector. If you want to save result to another vector, use add() instead.
        ! #zh Vector addition. If you want to save the result to another vector, use add () instead.
        @param vector vector
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.addSelf(cc.v2(5, 5));// return Vec2 {x: 15, y: 15};
        ``` 
        */
        addSelf(vector: Vec2): Vec2;        
        /**
        !#en Adds two vectors, and returns the new result.
        ! #zh Vector addition and return new result.
        @param vector vector
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.add(cc.v2(5, 5));      // return Vec2 {x: 15, y: 15};
        var v1;
        v.add(cc.v2(5, 5), v1);  // return Vec2 {x: 15, y: 15};
        ``` 
        */
        add(vector: Vec2, out?: Vec2): Vec2;        
        /**
        !#en Subtracts one vector from this. If you want to save result to another vector, use sub() instead.
        ! #zh Vector subtraction. If you want to save the result to another vector, use sub () instead.
        @param vector vector
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.subSelf(cc.v2(5, 5));// return Vec2 {x: 5, y: 5};
        ``` 
        */
        subSelf(vector: Vec2): Vec2;        
        /**
        !#en Subtracts one vector from this, and returns the new result.
        ! #zh Vector subtraction and return new result.
        @param vector vector
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.sub(cc.v2(5, 5));      // return Vec2 {x: 5, y: 5};
        var v1;
        v.sub(cc.v2(5, 5), v1);  // return Vec2 {x: 5, y: 5};
        ``` 
        */
        sub(vector: Vec2, out?: Vec2): Vec2;        
        /**
        !#en Multiplies this by a number. If you want to save result to another vector, use mul() instead.
        ! #zh Zoom the current vector. If you want to save the result to another vector, use mul () instead.
        @param num num
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.mulSelf(5);// return Vec2 {x: 50, y: 50};
        ``` 
        */
        mulSelf (num: number): Vec2;     
        /**
        !#en Multiplies by a number, and returns the new result.
        ! #zh Scale the vector and return the new result.
        @param num num
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.mul(5);      // return Vec2 {x: 50, y: 50};
        var v1;
        v.mul(5, v1);  // return Vec2 {x: 50, y: 50};
        ``` 
        */
        mul(num: number, out?: Vec2): Vec2;     
        /**
        !#en Multiplies two vectors.
        ! #zh Multiply the components.
        @param vector vector
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.scaleSelf(cc.v2(5, 5));// return Vec2 {x: 50, y: 50};
        ``` 
        */
        scaleSelf(vector: Vec2): Vec2;      
        /**
        !#en Multiplies two vectors, and returns the new result.
        ! #zh Multiply the components and return a new result.
        @param vector vector
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.scale(cc.v2(5, 5));      // return Vec2 {x: 50, y: 50};
        var v1;
        v.scale(cc.v2(5, 5), v1);  // return Vec2 {x: 50, y: 50};
        ``` 
        */
        scale(vector: Vec2, out?: Vec2): Vec2;      
        /**
        !#en Divides by a number. If you want to save result to another vector, use div() instead.
        ! #zh Vector division. If you want to save the result to another vector, use div () instead.
        @param num num
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.divSelf(5); // return Vec2 {x: 2, y: 2};
        ``` 
        */
        divSelf(num: number): Vec2;     
        /**
        !#en Divides by a number, and returns the new result.
        ! #zh Vector division and return new result.
        @param num num
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.div(5);      // return Vec2 {x: 2, y: 2};
        var v1;
        v.div(5, v1);  // return Vec2 {x: 2, y: 2};
        ``` 
        */
        div(num: number, out?: Vec2): Vec2;     
        /**
        !#en Negates the components. If you want to save result to another vector, use neg() instead.
        ! #zh Vector inversion. If you want to save the result to another vector, use neg () instead.
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.negSelf(); // return Vec2 {x: -10, y: -10};
        ``` 
        */
        negSelf(): Vec2;        
        /**
        !#en Negates the components, and returns the new result.
        ! #zh Returns the new vector after negation.
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        var v1;
        v.neg(v1);  // return Vec2 {x: -10, y: -10};
        ``` 
        */
        neg(out?: Vec2): Vec2;      
        /**
        !#en Dot product
        ! #zh Dot product the current vector with the specified vector.
        @param vector vector
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.dot(cc.v2(5, 5)); // return 100;
        ``` 
        */
        dot(vector?: Vec2): number;     
        /**
        !#en Cross product
        ! #zh Crosses the current vector with the specified vector.
        @param vector vector
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.cross(cc.v2(5, 5)); // return 0;
        ``` 
        */
        cross(vector?: Vec2): number;       
        /**
        !#en Returns the length of this vector.
        ! #zh Returns the length of this vector.
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.mag(); // return 14.142135623730951;
        ``` 
        */
        mag(): number;      
        /**
        !#en Returns the squared length of this vector.
        ! #zh Returns the square of the length of this vector.
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.magSqr (); // return 200;
        ``` 
        */
        magSqr(): number;       
        /**
        !#en Make the length of this vector to 1.
        ! #zh Normalize the vector so that the length of this vector is 1.
        
        @example 
        ```js
        var v = cc.v2(10, 10);
        v.normalizeSelf(); // return Vec2 {x: 0.7071067811865475, y: 0.7071067811865475};
        ``` 
        */
        normalizeSelf(): Vec2;      
        /**
        !#in
        Returns this vector with a magnitude of 1.<br/>
        <br/>
        Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use normalizeSelf function.
        ! #zh
        Returns the normalized vector. <br/>
        <br/>
        Note that the current vector is unchanged and a new normalized vector is returned. If you want to normalize the current vector, use the normalizeSelf function.
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created 
        */
        normalize(out?: Vec2): Vec2;        
        /**
        !#en Get angle in radian between this and vector.
        ! #zh The radian of the angle.
        @param vector vector 
        */
        angle(vector: Vec2): number;        
        /**
        !#en Get angle in radian between this and vector with direction.
        ! #zh The radian of the angle with direction.
        @param vector vector 
        */
        signAngle(vector: Vec2): number;        
        /**
        ! #en rotate
        ! #zh Returns the new vector rotated by a given radian.
        @param radians radians
        @param out optional, the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created 
        */
        rotate(radians: number, out?: Vec2): Vec2;      
        /**
        !#en rotate self
        ! #zh Rotate the vector by the specified radian.
        @param radians radians 
        */
        rotateSelf(radians: number): Vec2;      
        /**
        !#en Calculates the projection of the current vector over the given vector.
        ! #zh Returns the projection vector of the current vector on the specified vector.
        @param vector vector
        
        @example 
        ```js
        var v1 = cc.v2 (20, 20);
        var v2 = cc.v2 (5, 5);
        v1.project(v2); // Vec2 {x: 20, y: 20};
        ``` 
        */
        project(vector: Vec2): Vec2;        
        /**
        Transforms the vec2 with a mat4. 3rd vector component is implicitly '0', 4th vector component is implicitly '1'
        @param m matrix to transform with
        @param out the receiving vector, you can pass the same vec2 to save result to itself, if not provided, a new vec2 will be created 
        */
        transformMat4(m: Mat4, out?: Vec2): Vec2;       
        /** !#en return a Vec2 object with x = 1 and y = 1.
        ! #zh New Vec2 object. * /
        static ONE: Vec2;       
        /** !#en return a Vec2 object with x = 0 and y = 0.
        ! #zh returns a Vec2 object with x = 0 and y = 0. * /
        static ZERO: Vec2;      
        /** !#en return a Vec2 object with x = 0 and y = 1.
        ! #zh returns Vec2 objects with x = 0 and y = 1. * /
        static UP: Vec2;        
        /** !#en return a Vec2 object with x = 1 and y = 0.
        ! #zh returns a Vec2 object with x = 1 and y = 0. * /
        static RIGHT: Vec2; 

Guess you like

Origin www.cnblogs.com/sdycxxl2010/p/12714039.html