public static float distance(AsVector3D pt1, AsVector3D pt2)
 {
     float dx = pt1.x - pt2.x;
     float dy = pt1.y - pt2.y;
     float dz = pt1.z - pt2.z;
     return AsMath.sqrt(dx * dx + dy * dy + dz * dz);
 }
 public static float distance(AsVector3D pt1, AsVector3D pt2)
 {
     float dx = (pt1.x - pt2.x);
     float dy = (pt1.y - pt2.y);
     float dz = (pt1.z - pt2.z);
     return AsMath.sqrt((((dx * dx) + (dy * dy)) + (dz * dz)));
 }
 public virtual void copyFrom(AsVector3D sourceVector3D)
 {
     x = sourceVector3D.x;
     y = sourceVector3D.y;
     z = sourceVector3D.z;
     w = sourceVector3D.w;
 }
        public AsVector3D transformVector(AsVector3D v)
        {
            float nx = v.x * internalMatrix.M11 + v.y * internalMatrix.M21 + v.z * internalMatrix.M31 + internalMatrix.M41;
            float ny = v.x * internalMatrix.M12 + v.y * internalMatrix.M22 + v.z * internalMatrix.M32 + internalMatrix.M42;
            float nz = v.x * internalMatrix.M13 + v.y * internalMatrix.M23 + v.z * internalMatrix.M33 + internalMatrix.M43;

            return(new AsVector3D(nx, ny, nz));
        }
        public static float distance(AsVector3D pt1, AsVector3D pt2)
        {
            float dx = pt1.x - pt2.x;
            float dy = pt1.y - pt2.y;
            float dz = pt1.z - pt2.z;

            return(AsMath.sqrt(dx * dx + dy * dy + dz * dz));
        }
 public static float angleBetween(AsVector3D a, AsVector3D b)
 {
     float aLen = a.getLength();
     if(epsilonEquals(aLen, 0))
     {
         throw new AsArgumentError();
     }
     float bLen = b.getLength();
     if(epsilonEquals(bLen, 0))
     {
         throw new AsArgumentError();
     }
     float dotProd = (((a.x * b.x) + (a.y * b.y)) + (a.z * b.z));
     if(epsilonEquals(dotProd, 0))
     {
         return (0.5f * AsMath.PI);
     }
     return AsMath.acos(((dotProd / aLen) / bLen));
 }
        public void appendRotation(float degrees, AsVector3D axis, AsVector3D pivotPoint)
        {
            bool hasPivot = ((pivotPoint != null) && (((pivotPoint.x != 0.0f) || (pivotPoint.y != 0.0f)) || (pivotPoint.z != 0.0f)));

            if (hasPivot)
            {
                appendTranslation(-pivotPoint.x, -pivotPoint.y, -pivotPoint.z);
            }

            float radians = ((0.0055555555555556f * degrees) * AsMath.PI);
            float ax      = axis.x;
            float ay      = axis.y;
            float az      = axis.z;

            if ((((ax == 0.0f) && (ay == 0.0f)) && (az == 1.0f)))
            {
                appendRotationZ(radians);
            }
            else
            {
                if ((((ax == 0.0f) && (ay == 1.0f)) && (az == 0.0f)))
                {
                    appendRotationY(radians);
                }
                else
                {
                    if ((((ax == 1.0f) && (ay == 0.0f)) && (az == 0.0f)))
                    {
                        appendRotationX(radians);
                    }
                    else
                    {
                        throw new AsNotImplementedError();
                    }
                }
            }
            if (hasPivot)
            {
                appendTranslation(pivotPoint.x, pivotPoint.y, pivotPoint.z);
            }
        }
        public void appendRotation(float degrees, AsVector3D axis, AsVector3D pivotPoint)
        {
            bool hasPivot = ((pivotPoint != null) && (((pivotPoint.x != 0.0f) || (pivotPoint.y != 0.0f)) || (pivotPoint.z != 0.0f)));
            if (hasPivot)
            {
                appendTranslation(-pivotPoint.x, -pivotPoint.y, -pivotPoint.z);
            }

            float radians = ((0.0055555555555556f * degrees) * AsMath.PI);
            float ax = axis.x;
            float ay = axis.y;
            float az = axis.z;
            if ((((ax == 0.0f) && (ay == 0.0f)) && (az == 1.0f)))
            {
                appendRotationZ(radians);
            }
            else
            {
                if ((((ax == 0.0f) && (ay == 1.0f)) && (az == 0.0f)))
                {
                    appendRotationY(radians);
                }
                else
                {
                    if ((((ax == 1.0f) && (ay == 0.0f)) && (az == 0.0f)))
                    {
                        appendRotationX(radians);
                    }
                    else
                    {
                        throw new AsNotImplementedError();
                    }
                }
            }
            if (hasPivot)
            {
                appendTranslation(pivotPoint.x, pivotPoint.y, pivotPoint.z);
            }
        }
        public static float angleBetween(AsVector3D a, AsVector3D b)
        {
            float aLen = a.getLength();

            if (epsilonEquals(aLen, 0))
            {
                throw new AsArgumentError();
            }
            float bLen = b.getLength();

            if (epsilonEquals(bLen, 0))
            {
                throw new AsArgumentError();
            }
            float dotProd = a.x * b.x + a.y * b.y + a.z * b.z;

            if (epsilonEquals(dotProd, 0))
            {
                return(0.5f * AsMath.PI);
            }
            return(AsMath.acos(dotProd / aLen / bLen));
        }
 public virtual AsVector3D _add(AsVector3D a)
 {
     return(new AsVector3D(x + a.x, y + a.y, z + a.z));
 }
 public virtual bool nearEquals(AsVector3D toCompare, float tolerance)
 {
     return(nearEquals(toCompare, tolerance, false));
 }
 public virtual void incrementBy(AsVector3D a)
 {
     x = x + a.x;
     y = y + a.y;
     z = z + a.z;
 }
 public virtual bool equals(AsVector3D toCompare, bool allFour)
 {
     return(x == toCompare.x && y == toCompare.y && z == toCompare.z && (!allFour || w == toCompare.w));
 }
 public virtual AsVector3D subtract(AsVector3D a)
 {
     return new AsVector3D(x - a.x, y - a.y, z - a.z);
 }
 public void prependRotation(float degrees, AsVector3D axis)
 {
     prependRotation(degrees, axis, null);
 }
 public virtual bool equals(AsVector3D toCompare, bool allFour)
 {
     return ((((x == toCompare.x) && (y == toCompare.y)) && (z == toCompare.z)) && (!(allFour) || (w == toCompare.w)));
 }
 public virtual AsVector3D _add(AsVector3D a)
 {
     return new AsVector3D((x + a.x), (y + a.y), (z + a.z));
 }
 public virtual AsVector3D subtract(AsVector3D a)
 {
     return new AsVector3D((x - a.x), (y - a.y), (z - a.z));
 }
 public virtual bool nearEquals(AsVector3D toCompare, float tolerance)
 {
     return nearEquals(toCompare, tolerance, false);
 }
 public virtual bool nearEquals(AsVector3D toCompare, float tolerance, bool allFour)
 {
     return ((((AsMath.abs((x - toCompare.x)) <= tolerance) && (AsMath.abs((y - toCompare.y)) <= tolerance)) && (AsMath.abs((z - toCompare.z)) <= tolerance)) && (!(allFour) || (AsMath.abs((w - toCompare.w)) <= tolerance)));
 }
 public virtual void incrementBy(AsVector3D a)
 {
     x = (x + a.x);
     y = (y + a.y);
     z = (z + a.z);
 }
 public virtual bool equals(AsVector3D toCompare)
 {
     return equals(toCompare, false);
 }
 public virtual bool nearEquals(AsVector3D toCompare, float tolerance, bool allFour)
 {
     return AsMath.abs(x - toCompare.x) <= tolerance && AsMath.abs(y - toCompare.y) <= tolerance && AsMath.abs(z - toCompare.z) <= tolerance && (!allFour || AsMath.abs(w - toCompare.w) <= tolerance);
 }
 public virtual void decrementBy(AsVector3D a)
 {
     x = x - a.x;
     y = y - a.y;
     z = z - a.z;
 }
 public virtual void decrementBy(AsVector3D a)
 {
     x = (x - a.x);
     y = (y - a.y);
     z = (z - a.z);
 }
 public virtual void incrementBy(AsVector3D a)
 {
     x = x + a.x;
     y = y + a.y;
     z = z + a.z;
 }
 public virtual AsVector3D crossProduct(AsVector3D a)
 {
     return new AsVector3D(y * a.z - z * a.y, z * a.x - x * a.z, x * a.y - y * a.x, 1);
 }
 public virtual AsVector3D _add(AsVector3D a)
 {
     return new AsVector3D(x + a.x, y + a.y, z + a.z);
 }
 public virtual void copyFrom(AsVector3D sourceVector3D)
 {
     x = sourceVector3D.x;
     y = sourceVector3D.y;
     z = sourceVector3D.z;
     w = sourceVector3D.w;
 }
 public virtual float dotProduct(AsVector3D a)
 {
     return(x * a.x + y * a.y + z * a.z);
 }
 public virtual AsVector3D crossProduct(AsVector3D a)
 {
     return new AsVector3D(((y * a.z) - (z * a.y)), ((z * a.x) - (x * a.z)), ((x * a.y) - (y * a.x)), 1);
 }
 public virtual bool equals(AsVector3D toCompare)
 {
     return(equals(toCompare, false));
 }
Example #33
0
 public void copyColumnTo(uint column, AsVector3D vector3D)
 {
     throw new AsNotImplementedError();
 }
 public virtual bool nearEquals(AsVector3D toCompare, float tolerance, bool allFour)
 {
     return(AsMath.abs(x - toCompare.x) <= tolerance && AsMath.abs(y - toCompare.y) <= tolerance && AsMath.abs(z - toCompare.z) <= tolerance && (!allFour || AsMath.abs(w - toCompare.w) <= tolerance));
 }
Example #35
0
 public void copyColumnTo(uint column, AsVector3D vector3D)
 {
     throw new AsNotImplementedError();
 }
 public virtual AsVector3D subtract(AsVector3D a)
 {
     return(new AsVector3D(x - a.x, y - a.y, z - a.z));
 }
 public void copyColumnTo(uint column, AsVector3D vector3D)
 {
     throw new NotImplementedException();
 }
 public void pointAt(AsVector3D pos, AsVector3D at, AsVector3D up)
 {
     throw new AsNotImplementedError();
 }
 public void pointAt(AsVector3D pos)
 {
     pointAt(pos, null, null);
 }
 public virtual AsVector3D crossProduct(AsVector3D a)
 {
     return(new AsVector3D(y * a.z - z * a.y, z * a.x - x * a.z, x * a.y - y * a.x, 1));
 }
 public AsVector3D transformVector(AsVector3D v)
 {
     float nx = v.x * internalMatrix.M11 + v.y * internalMatrix.M21 + v.z * internalMatrix.M31 + internalMatrix.M41;
     float ny = v.x * internalMatrix.M12 + v.y * internalMatrix.M22 + v.z * internalMatrix.M32 + internalMatrix.M42;
     float nz = v.x * internalMatrix.M13 + v.y * internalMatrix.M23 + v.z * internalMatrix.M33 + internalMatrix.M43;
     return new AsVector3D(nx, ny, nz);
 }
Example #42
0
 public void copyRowTo(uint row, AsVector3D vector3D)
 {
     throw new AsNotImplementedError();
 }
 public virtual float dotProduct(AsVector3D a)
 {
     return (((x * a.x) + (y * a.y)) + (z * a.z));
 }
Example #44
0
 public void copyRowTo(uint row, AsVector3D vector3D)
 {
     throw new AsNotImplementedError();
 }
 public void copyColumnTo(uint column, AsVector3D vector3D)
 {
     throw new NotImplementedException();
 }
 public void copyRowTo(uint row, AsVector3D vector3D)
 {
     throw new NotImplementedException();
 }
 public void copyRowTo(uint row, AsVector3D vector3D)
 {
     throw new NotImplementedException();
 }
 public void pointAt(AsVector3D pos, AsVector3D at)
 {
     pointAt(pos, at, null);
 }
 public void pointAt(AsVector3D pos, AsVector3D at, AsVector3D up)
 {
     throw new AsNotImplementedError();
 }
 public void prependRotation(float degrees, AsVector3D axis)
 {
     prependRotation(degrees, axis, null);
 }
 public void pointAt(AsVector3D pos, AsVector3D at)
 {
     pointAt(pos, at, null);
 }
 public void pointAt(AsVector3D pos)
 {
     pointAt(pos, null, null);
 }
 public virtual bool equals(AsVector3D toCompare, bool allFour)
 {
     return x == toCompare.x && y == toCompare.y && z == toCompare.z && (!allFour || w == toCompare.w);
 }