Ejemplo n.º 1
0
 public static global::glm.Mat4 rotate(global::glm.Quat rotation, global::glm.Mat4 dest)
 {
     unchecked {
         double x2 = (rotation.x + rotation.x);
         double y2 = (rotation.y + rotation.y);
         double z2 = (rotation.z + rotation.z);
         double xx = (rotation.x * x2);
         double xy = (rotation.x * y2);
         double xz = (rotation.x * z2);
         double yy = (rotation.y * y2);
         double yz = (rotation.y * z2);
         double zz = (rotation.z * z2);
         double wx = (rotation.w * x2);
         double wy = (rotation.w * y2);
         double wz = (rotation.w * z2);
         dest._00 = (1 - ((yy + zz)));
         dest._10 = (xy - wz);
         dest._20 = (xz + wy);
         dest._30 = ((double)(0));
         dest._01 = (xy + wz);
         dest._11 = (1 - ((xx + zz)));
         dest._21 = (yz - wx);
         dest._31 = ((double)(0));
         dest._02 = (xz - wy);
         dest._12 = (yz + wx);
         dest._22 = (1 - ((xx + yy)));
         dest._32 = ((double)(0));
         dest._03 = ((double)(0));
         dest._13 = ((double)(0));
         dest._23 = ((double)(0));
         dest._33 = ((double)(1));
         return(dest);
     }
 }
Ejemplo n.º 2
0
 public static global::glm.Quat multiplyScalar(global::glm.Quat a, double s, global::glm.Quat dest)
 {
     dest.x = (a.x * s);
     dest.y = (a.y * s);
     dest.z = (a.z * s);
     dest.w = (a.w * s);
     return(dest);
 }
Ejemplo n.º 3
0
 public static global::glm.Quat copy(global::glm.Quat src, global::glm.Quat dest)
 {
     dest.x = src.x;
     dest.y = src.y;
     dest.z = src.z;
     dest.w = src.w;
     return(dest);
 }
Ejemplo n.º 4
0
 public global::glm.Quat fromQuat(global::glm.Quat q)
 {
     this.x = q.x;
     this.y = q.y;
     this.z = q.z;
     this.w = q.w;
     return(this);
 }
Ejemplo n.º 5
0
 public static global::glm.Quat multiplyScalarOp(global::glm.Quat a, double s)
 {
     global::glm.Quat dest = new global::glm.Quat(default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>));
     dest.x = (a.x * s);
     dest.y = (a.y * s);
     dest.z = (a.z * s);
     dest.w = (a.w * s);
     return(dest);
 }
Ejemplo n.º 6
0
 public static global::glm.Quat conjugate(global::glm.Quat q, global::glm.Quat dest)
 {
     unchecked {
         dest.x = (-1 * q.x);
         dest.y = (-1 * q.y);
         dest.z = (-1 * q.z);
         dest.w = q.w;
         return(dest);
     }
 }
Ejemplo n.º 7
0
 public static global::glm.Quat identity(global::glm.Quat dest)
 {
     unchecked {
         dest.x = ((double)(0));
         dest.y = ((double)(0));
         dest.z = ((double)(0));
         dest.w = ((double)(1));
         return(dest);
     }
 }
Ejemplo n.º 8
0
 public static void __hx_ctor_glm_Quat(global::glm.Quat __hx_this, global::haxe.lang.Null <double> x, global::haxe.lang.Null <double> y, global::haxe.lang.Null <double> z, global::haxe.lang.Null <double> w)
 {
     unchecked {
         double __temp_w40 = ((!(w.hasValue)) ? (((double)(1))) : ((w).@value));
         double __temp_z39 = ((!(z.hasValue)) ? (((double)(0))) : ((z).@value));
         double __temp_y38 = ((!(y.hasValue)) ? (((double)(0))) : ((y).@value));
         double __temp_x37 = ((!(x.hasValue)) ? (((double)(0))) : ((x).@value));
         __hx_this.x = __temp_x37;
         __hx_this.y = __temp_y38;
         __hx_this.z = __temp_z39;
         __hx_this.w = __temp_w40;
     }
 }
Ejemplo n.º 9
0
 public static global::glm.Quat fromEuler(double x, double y, double z, global::glm.Quat dest)
 {
     unchecked {
         double c1 = global::System.Math.Cos(((double)((x / 2))));
         double c2 = global::System.Math.Cos(((double)((y / 2))));
         double c3 = global::System.Math.Cos(((double)((z / 2))));
         double s1 = global::System.Math.Sin(((double)((x / 2))));
         double s2 = global::System.Math.Sin(((double)((y / 2))));
         double s3 = global::System.Math.Sin(((double)((z / 2))));
         dest.x = (((s1 * c2) * c3) + ((c1 * s2) * s3));
         dest.y = (((c1 * s2) * c3) - ((s1 * c2) * s3));
         dest.z = (((c1 * c2) * s3) + ((s1 * s2) * c3));
         dest.w = (((c1 * c2) * c3) - ((s1 * s2) * s3));
         return(dest);
     }
 }
Ejemplo n.º 10
0
 public static global::glm.Quat invert(global::glm.Quat q, global::glm.Quat dest)
 {
     unchecked {
         double x        = q.x;
         double y        = q.y;
         double z        = q.z;
         double w        = q.w;
         double d        = ((((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w));
         double oneOverD = (((d < global::glm.GLM.EPSILON)) ? (((double)(0))) : ((1 / d)));
         dest.x = (-(x) * oneOverD);
         dest.y = (-(y) * oneOverD);
         dest.z = (-(z) * oneOverD);
         dest.w = (w * oneOverD);
         return(dest);
     }
 }
Ejemplo n.º 11
0
        public static global::glm.Quat lerp(global::glm.Quat a, global::glm.Quat b, double t, global::glm.Quat dest)
        {
            double a1 = a.x;

            dest.x = (a1 + (t * ((b.x - a1))));
            double a2 = a.y;

            dest.y = (a2 + (t * ((b.y - a2))));
            double a3 = a.z;

            dest.z = (a3 + (t * ((b.z - a3))));
            double a4 = a.w;

            dest.w = (a4 + (t * ((b.w - a4))));
            return(dest);
        }
Ejemplo n.º 12
0
 public static global::glm.Quat newFromEuler(double x, double y, double z)
 {
     unchecked {
         global::glm.Quat dest = new global::glm.Quat(default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>));
         double           c1   = global::System.Math.Cos(((double)((x / 2))));
         double           c2   = global::System.Math.Cos(((double)((y / 2))));
         double           c3   = global::System.Math.Cos(((double)((z / 2))));
         double           s1   = global::System.Math.Sin(((double)((x / 2))));
         double           s2   = global::System.Math.Sin(((double)((y / 2))));
         double           s3   = global::System.Math.Sin(((double)((z / 2))));
         dest.x = (((s1 * c2) * c3) + ((c1 * s2) * s3));
         dest.y = (((c1 * s2) * c3) - ((s1 * c2) * s3));
         dest.z = (((c1 * c2) * s3) + ((s1 * s2) * c3));
         dest.w = (((c1 * c2) * c3) - ((s1 * s2) * s3));
         return(dest);
     }
 }
Ejemplo n.º 13
0
        public static global::glm.Quat normalize(global::glm.Quat q, global::glm.Quat dest)
        {
            unchecked {
                double length = global::System.Math.Sqrt(((double)(((((q.x * q.x) + (q.y * q.y)) + (q.z * q.z)) + (q.w * q.w)))));
                double mult   = ((double)(0));
                if ((length >= global::glm.GLM.EPSILON))
                {
                    mult = (1 / length);
                }

                dest.x = (q.x * mult);
                dest.y = (q.y * mult);
                dest.z = (q.z * mult);
                dest.w = (q.w * mult);
                return(dest);
            }
        }
Ejemplo n.º 14
0
        public static global::glm.Quat multiplyQuats(global::glm.Quat a, global::glm.Quat b, global::glm.Quat dest)
        {
            double ax  = a.x;
            double ay  = a.y;
            double az  = a.z;
            double aw  = a.w;
            double bx  = b.x;
            double @by = b.y;
            double bz  = b.z;
            double bw  = b.w;

            dest.x = ((((ax * bw) + (aw * bx)) + (ay * bz)) - (az * @by));
            dest.y = ((((ay * bw) + (aw * @by)) + (az * bx)) - (ax * bz));
            dest.z = ((((az * bw) + (aw * bz)) + (ax * @by)) - (ay * bx));
            dest.w = ((((aw * bw) - (ax * bx)) - (ay * @by)) - (az * bz));
            return(dest);
        }
Ejemplo n.º 15
0
 public global::glm.Quat inverted()
 {
     unchecked {
         global::glm.Quat dest     = new global::glm.Quat(default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>));
         double           x        = this.x;
         double           y        = this.y;
         double           z        = this.z;
         double           w        = this.w;
         double           d        = ((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z)) + (this.w * this.w));
         double           oneOverD = (((d < global::glm.GLM.EPSILON)) ? (((double)(0))) : ((1 / d)));
         dest.x = (-(x) * oneOverD);
         dest.y = (-(y) * oneOverD);
         dest.z = (-(z) * oneOverD);
         dest.w = (w * oneOverD);
         return(dest);
     }
 }
Ejemplo n.º 16
0
        public static global::glm.Quat multiplyQuatsOp(global::glm.Quat a, global::glm.Quat b)
        {
            global::glm.Quat dest = new global::glm.Quat(default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>));
            double           ax   = a.x;
            double           ay   = a.y;
            double           az   = a.z;
            double           aw   = a.w;
            double           bx   = b.x;
            double           @by  = b.y;
            double           bz   = b.z;
            double           bw   = b.w;

            dest.x = ((((ax * bw) + (aw * bx)) + (ay * bz)) - (az * @by));
            dest.y = ((((ay * bw) + (aw * @by)) + (az * bx)) - (ax * bz));
            dest.z = ((((az * bw) + (aw * bz)) + (ax * @by)) - (ay * bx));
            dest.w = ((((aw * bw) - (ax * bx)) - (ay * @by)) - (az * bz));
            return(dest);
        }
Ejemplo n.º 17
0
        public global::glm.Quat multiplied(global::glm.Quat q)
        {
            global::glm.Quat dest = new global::glm.Quat(default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>), default(global::haxe.lang.Null <double>));
            double           ax   = this.x;
            double           ay   = this.y;
            double           az   = this.z;
            double           aw   = this.w;
            double           bx   = q.x;
            double           @by  = q.y;
            double           bz   = q.z;
            double           bw   = q.w;

            dest.x = ((((ax * bw) + (aw * bx)) + (ay * bz)) - (az * @by));
            dest.y = ((((ay * bw) + (aw * @by)) + (az * bx)) - (ax * bz));
            dest.z = ((((az * bw) + (aw * bz)) + (ax * @by)) - (ay * bx));
            dest.w = ((((aw * bw) - (ax * bx)) - (ay * @by)) - (az * bz));
            return(dest);
        }
Ejemplo n.º 18
0
        public static global::glm.Quat slerp(global::glm.Quat a, global::glm.Quat b, double t, global::glm.Quat dest)
        {
            unchecked {
                double bx       = b.x;
                double @by      = b.y;
                double bz       = b.z;
                double bw       = b.w;
                double cosTheta = ((((a.x * b.x) + (a.y * b.y)) + (a.z * b.z)) + (a.w * b.w));
                if ((cosTheta < 0))
                {
                    cosTheta = -(cosTheta);
                    bx       = -(bx);
                    @by      = -(@by);
                    bz       = -(bz);
                    bw       = -(bw);
                }

                if ((cosTheta > (1 - global::glm.GLM.EPSILON)))
                {
                    double a1 = a.x;
                    dest.x = (a1 + (t * ((b.x - a1))));
                    double a2 = a.y;
                    dest.y = (a2 + (t * ((b.y - a2))));
                    double a3 = a.z;
                    dest.z = (a3 + (t * ((b.z - a3))));
                    double a4 = a.w;
                    dest.w = (a4 + (t * ((b.w - a4))));
                    return(dest);
                }
                else
                {
                    double angle = global::System.Math.Acos(((double)(cosTheta)));
                    double sa    = (1 / global::System.Math.Sin(((double)(angle))));
                    double i     = global::System.Math.Sin(((double)((((1 - t)) * angle))));
                    double j     = global::System.Math.Sin(((double)((t * angle))));
                    dest.x = ((((i * a.x) + (j * bx))) * sa);
                    dest.y = ((((i * a.y) + (j * @by))) * sa);
                    dest.z = ((((i * a.z) + (j * bz))) * sa);
                    dest.w = ((((i * a.w) + (j * bw))) * sa);
                    return(dest);
                }
            }
        }
Ejemplo n.º 19
0
        public static global::glm.Vec3 rotateVec3(global::glm.Quat q, global::glm.Vec3 v, global::glm.Vec3 dest)
        {
            double num12 = (q.x + q.x);
            double num2  = (q.y + q.y);
            double num   = (q.z + q.z);
            double num11 = (q.w * num12);
            double num10 = (q.w * num2);
            double num9  = (q.w * num);
            double num8  = (q.x * num12);
            double num7  = (q.x * num2);
            double num6  = (q.x * num);
            double num5  = (q.y * num2);
            double num4  = (q.y * num);
            double num3  = (q.z * num);
            double num15 = (((v.x * (((1.0 - num5) - num3))) + (v.y * ((num7 - num9)))) + (v.z * ((num6 + num10))));
            double num14 = (((v.x * ((num7 + num9))) + (v.y * (((1.0 - num8) - num3)))) + (v.z * ((num4 - num11))));
            double num13 = (((v.x * ((num6 - num10))) + (v.y * ((num4 + num11)))) + (v.z * (((1.0 - num8) - num5))));

            dest.x = num15;
            dest.y = num14;
            dest.z = num13;
            return(dest);
        }
Ejemplo n.º 20
0
        public static global::glm.Quat axisAngle(global::glm.Vec3 axis, double angle, global::glm.Quat dest)
        {
            angle *= 0.5;
            double s = global::System.Math.Sin(((double)(angle)));

            dest.x = (s * axis.x);
            dest.y = (s * axis.y);
            dest.z = (s * axis.z);
            dest.w = global::System.Math.Cos(((double)(angle)));
            return(dest);
        }
Ejemplo n.º 21
0
 public static double dot(global::glm.Quat a, global::glm.Quat b)
 {
     return((((a.x * b.x) + (a.y * b.y)) + (a.z * b.z)) + (a.w * b.w));
 }
Ejemplo n.º 22
0
 public bool @equals(global::glm.Quat b)
 {
     return(!((((((global::System.Math.Abs(((double)((this.x - b.x)))) >= global::glm.GLM.EPSILON) || (global::System.Math.Abs(((double)((this.y - b.y)))) >= global::glm.GLM.EPSILON)) || (global::System.Math.Abs(((double)((this.z - b.z)))) >= global::glm.GLM.EPSILON)) || (global::System.Math.Abs(((double)((this.w - b.w)))) >= global::glm.GLM.EPSILON)))));
 }