Exemple #1
0
 public void set3DPoint(POINT3D P, double x, double y, double z)
 {
     P.x = x;
     P.y = y;
     P.z = z;
     P.w = 1;
 }
Exemple #2
0
        public void calcUVN()
        {
            object  obj1    = UnitVector(VPN.x, VPN.y, VPN.z);
            POINT3D tpoint2 = new POINT3D();

            nUnitVectorVPN = obj1 != null ? (POINT3D)obj1 : tpoint2;


            object  obj    = UnitVector(VUP.x, VUP.y, VUP.z);
            POINT3D tpoint = new POINT3D();

            upUnitVectorVUP = obj != null ? (POINT3D)obj : tpoint;


            double  num = DotProduct(nUnitVectorVPN, upUnitVectorVUP);
            POINT3D P   = new POINT3D();

            set3DPoint(P, upUnitVectorVUP.x - num * nUnitVectorVPN.x, upUnitVectorVUP.y - num * nUnitVectorVPN.y, upUnitVectorVUP.z - num * nUnitVectorVPN.z);

            object obj2 = UnitVector(P.x, P.y, P.z);

            vUnitVectorUP = obj2 != null ? (POINT3D)obj2 : tpoint;

            u = CrossProduct(vUnitVectorUP, nUnitVectorVPN);
        }
Exemple #3
0
        public object UnitVector(double x, double y, double z)
        {
            double  num = Math.Sqrt(x * x + y * y + z * z);
            POINT3D P   = new POINT3D();

            set3DPoint(P, x / num, y / num, z / num);
            return((object)P);
        }
Exemple #4
0
        public POINT3D CrossProduct(POINT3D v1, POINT3D v2)
        {
            POINT3D tpoint = new POINT3D();

            tpoint.x = v1.y * v2.z - v1.z * v2.y;
            tpoint.y = v1.z * v2.x - v1.x * v2.z;
            tpoint.z = v1.x * v2.y - v1.y * v2.x;
            return(tpoint);
        }
Exemple #5
0
 public double DotProduct(POINT3D v1, POINT3D v2)
 {
     return(v1.x * v2.x + v1.y * v2.y + v1.z * v2.z);
 }