Cos() публичный статический Метод

public static Cos ( float a ) : float
a float
Результат float
Пример #1
0
        public Vector RotateScaleAndAdd(float angle, float scale, Vector add)
        {
            float sina = FloatMath.Sin(angle), cosa = FloatMath.Cos(angle);

            return(new Vector((x * cosa - y * sina) * scale + add.x,
                              (x * sina + y * cosa) * scale + add.y));
        }
Пример #2
0
        /**
         * Inverse transforms a point as specified, storing the result in the point provided.
         * @return a reference to the result vector, for chaining.
         */
        public static Vector InverseTransform(float x, float y, float sx, float sy, float rotation)
        {
            float sinnega = FloatMath.Sin(-rotation), cosnega = FloatMath.Cos(-rotation);
            float nx = (x * cosnega - y * sinnega); // unrotate
            float ny = (x * sinnega + y * cosnega);

            return(new Vector(nx / sx, ny / sy)); // unscale
        }
Пример #3
0
        /** Creates an affine transform from the supplied scale, rotation and translation. */
        public AffineTransform(float scaleX, float scaleY, float angle, float tx, float ty)
        {
            float sina = FloatMath.Sin(angle), cosa = FloatMath.Cos(angle);

            this.m00 = cosa * scaleX; this.m01 = sina * scaleY;
            this.m10 = -sina * scaleX; this.m11 = cosa * scaleY;
            this.Tx  = tx;            this.Ty = ty;
        }
Пример #4
0
        /** Inverse transforms a point as specified, storing the result in the point provided.
         * @return a reference to the result point, for chaining. */
        public static Point InverseTransform(float x, float y, float sx, float sy, float rotation,
                                             float tx, float ty)
        {
            x -= tx; y -= ty;                       // untranslate
            float sinnega = FloatMath.Sin(-rotation), cosnega = FloatMath.Cos(-rotation);
            float nx = (x * cosnega - y * sinnega); // unrotate
            float ny = (x * sinnega + y * cosnega);

            return(new Point(nx / sx, ny / sy)); // unscale
        }
Пример #5
0
        public Transform Rotate(float angle)
        {
            float otx = this.Tx, oty = this.Ty;

            if (otx != 0 || oty != 0)
            {
                float sina = FloatMath.Sin(angle);
                float cosa = FloatMath.Cos(angle);
                this.Tx = otx * cosa - oty * sina;
                this.Ty = otx * sina + oty * cosa;
            }
            this.Rotation += angle;
            return(this);
        }
Пример #6
0
        public Transform PreConcatenate(Transform other)
        {
            if (this.Generality < other.Generality)
            {
                return(other.Concatenate(this));
            }

            float sina = FloatMath.Sin(other.Rotation), cosa = FloatMath.Cos(other.Rotation);
            float ntx       = (Tx * cosa - Ty * sina) * other.ScaleX + other.Tx;
            float nty       = (Tx * sina + Ty * cosa) * other.ScaleY + other.Ty;
            float nrotation = MathUtil.NormalizeAngle(other.Rotation + this.Rotation);
            float nscaleX   = other.ScaleX * this.ScaleX;
            float nscaleY   = other.ScaleY * this.ScaleY;

            return(new NonUniformTransform(nscaleX, nscaleY, nrotation, ntx, nty));
        }
Пример #7
0
 /**
  * Transforms a vector as specified.
  */
 public static Vector Transform(float x, float y, float sx, float sy, float rotation)
 {
     return(Transform(x, y, sx, sy, FloatMath.Sin(rotation), FloatMath.Cos(rotation)));
 }
Пример #8
0
        public Transform Rotate(float angle)
        {
            float sina = FloatMath.Sin(angle), cosa = FloatMath.Cos(angle);

            return(Transforms.Multiply(cosa, sina, -sina, cosa, 0, 0, this, this));
        }
Пример #9
0
 /** Transforms a point as specified, storing the result in the point provided.
  * @return a reference to the result point, for chaining. */
 public static Point Transform(float x, float y, float sx, float sy, float rotation,
                               float tx, float ty)
 {
     return(Transform(x, y, sx, sy, FloatMath.Sin(rotation), FloatMath.Cos(rotation), tx, ty));
 }
Пример #10
0
        public Vector Rotate(float angle)
        {
            float sina = FloatMath.Sin(angle), cosa = FloatMath.Cos(angle);

            return(new Vector(x * cosa - y * sina, x * sina + y * cosa));
        }
Пример #11
0
        public Point Rotate(float angle)
        {
            float sina = FloatMath.Sin(angle), cosa = FloatMath.Cos(angle);

            return(new Point(x * cosa - y * sina, x * sina + y * cosa));
        }