예제 #1
0
 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);
 }
예제 #2
0
 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)));
 }
예제 #3
0
 public virtual void copyFrom(AsVector3D sourceVector3D)
 {
     x = sourceVector3D.x;
     y = sourceVector3D.y;
     z = sourceVector3D.z;
     w = sourceVector3D.w;
 }
예제 #4
0
        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));
        }
예제 #5
0
        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));
        }
예제 #6
0
 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));
 }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
        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));
        }
예제 #10
0
 public virtual AsVector3D _add(AsVector3D a)
 {
     return(new AsVector3D(x + a.x, y + a.y, z + a.z));
 }
예제 #11
0
 public virtual bool nearEquals(AsVector3D toCompare, float tolerance)
 {
     return(nearEquals(toCompare, tolerance, false));
 }
예제 #12
0
 public virtual void incrementBy(AsVector3D a)
 {
     x = x + a.x;
     y = y + a.y;
     z = z + a.z;
 }
예제 #13
0
 public virtual bool equals(AsVector3D toCompare, bool allFour)
 {
     return(x == toCompare.x && y == toCompare.y && z == toCompare.z && (!allFour || w == toCompare.w));
 }
예제 #14
0
 public virtual AsVector3D subtract(AsVector3D a)
 {
     return new AsVector3D(x - a.x, y - a.y, z - a.z);
 }
예제 #15
0
 public void prependRotation(float degrees, AsVector3D axis)
 {
     prependRotation(degrees, axis, null);
 }
예제 #16
0
 public virtual bool equals(AsVector3D toCompare, bool allFour)
 {
     return ((((x == toCompare.x) && (y == toCompare.y)) && (z == toCompare.z)) && (!(allFour) || (w == toCompare.w)));
 }
예제 #17
0
 public virtual AsVector3D _add(AsVector3D a)
 {
     return new AsVector3D((x + a.x), (y + a.y), (z + a.z));
 }
예제 #18
0
 public virtual AsVector3D subtract(AsVector3D a)
 {
     return new AsVector3D((x - a.x), (y - a.y), (z - a.z));
 }
예제 #19
0
 public virtual bool nearEquals(AsVector3D toCompare, float tolerance)
 {
     return nearEquals(toCompare, tolerance, false);
 }
예제 #20
0
 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)));
 }
예제 #21
0
 public virtual void incrementBy(AsVector3D a)
 {
     x = (x + a.x);
     y = (y + a.y);
     z = (z + a.z);
 }
예제 #22
0
 public virtual bool equals(AsVector3D toCompare)
 {
     return equals(toCompare, false);
 }
예제 #23
0
 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);
 }
예제 #24
0
 public virtual void decrementBy(AsVector3D a)
 {
     x = x - a.x;
     y = y - a.y;
     z = z - a.z;
 }
예제 #25
0
 public virtual void decrementBy(AsVector3D a)
 {
     x = (x - a.x);
     y = (y - a.y);
     z = (z - a.z);
 }
예제 #26
0
 public virtual void incrementBy(AsVector3D a)
 {
     x = x + a.x;
     y = y + a.y;
     z = z + a.z;
 }
예제 #27
0
 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);
 }
예제 #28
0
 public virtual AsVector3D _add(AsVector3D a)
 {
     return new AsVector3D(x + a.x, y + a.y, z + a.z);
 }
예제 #29
0
 public virtual void copyFrom(AsVector3D sourceVector3D)
 {
     x = sourceVector3D.x;
     y = sourceVector3D.y;
     z = sourceVector3D.z;
     w = sourceVector3D.w;
 }
예제 #30
0
 public virtual float dotProduct(AsVector3D a)
 {
     return(x * a.x + y * a.y + z * a.z);
 }
예제 #31
0
 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);
 }
예제 #32
0
 public virtual bool equals(AsVector3D toCompare)
 {
     return(equals(toCompare, false));
 }
예제 #33
0
 public void copyColumnTo(uint column, AsVector3D vector3D)
 {
     throw new AsNotImplementedError();
 }
예제 #34
0
 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));
 }
예제 #35
0
 public void copyColumnTo(uint column, AsVector3D vector3D)
 {
     throw new AsNotImplementedError();
 }
예제 #36
0
 public virtual AsVector3D subtract(AsVector3D a)
 {
     return(new AsVector3D(x - a.x, y - a.y, z - a.z));
 }
예제 #37
0
 public void copyColumnTo(uint column, AsVector3D vector3D)
 {
     throw new NotImplementedException();
 }
예제 #38
0
 public void pointAt(AsVector3D pos, AsVector3D at, AsVector3D up)
 {
     throw new AsNotImplementedError();
 }
예제 #39
0
 public void pointAt(AsVector3D pos)
 {
     pointAt(pos, null, null);
 }
예제 #40
0
 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));
 }
예제 #41
0
 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);
 }
예제 #42
0
 public void copyRowTo(uint row, AsVector3D vector3D)
 {
     throw new AsNotImplementedError();
 }
예제 #43
0
 public virtual float dotProduct(AsVector3D a)
 {
     return (((x * a.x) + (y * a.y)) + (z * a.z));
 }
예제 #44
0
 public void copyRowTo(uint row, AsVector3D vector3D)
 {
     throw new AsNotImplementedError();
 }
예제 #45
0
 public void copyColumnTo(uint column, AsVector3D vector3D)
 {
     throw new NotImplementedException();
 }
예제 #46
0
 public void copyRowTo(uint row, AsVector3D vector3D)
 {
     throw new NotImplementedException();
 }
예제 #47
0
 public void copyRowTo(uint row, AsVector3D vector3D)
 {
     throw new NotImplementedException();
 }
예제 #48
0
 public void pointAt(AsVector3D pos, AsVector3D at)
 {
     pointAt(pos, at, null);
 }
예제 #49
0
 public void pointAt(AsVector3D pos, AsVector3D at, AsVector3D up)
 {
     throw new AsNotImplementedError();
 }
예제 #50
0
 public void prependRotation(float degrees, AsVector3D axis)
 {
     prependRotation(degrees, axis, null);
 }
예제 #51
0
 public void pointAt(AsVector3D pos, AsVector3D at)
 {
     pointAt(pos, at, null);
 }
예제 #52
0
 public void pointAt(AsVector3D pos)
 {
     pointAt(pos, null, null);
 }
예제 #53
0
 public virtual bool equals(AsVector3D toCompare, bool allFour)
 {
     return x == toCompare.x && y == toCompare.y && z == toCompare.z && (!allFour || w == toCompare.w);
 }