Beispiel #1
0
        private static IfcVector IfcVectorDifference(double Mag1, IfcDirection Vec1, double Mag2, IfcDirection Vec2)
        {
            IfcDirection  Res;
            doublewrapper Mag;
            int           nDim;

            Vec1 = IfcNormalise(Vec1);
            Vec2 = IfcNormalise(Vec2);
            nDim = Vec1.DirectionRatios.Items.Length;
            Mag  = 0;
            Res  = new IfcDirection();
            doublewrapper[] temp = new doublewrapper[nDim];
            for (int i = 0; i < nDim; i++)
            {
                temp[i] = 0;
            }
            Res.DirectionRatios = (IfcDirectionDirectionRatios)temp;

            for (int i = 0; i < nDim; i++)
            {
                Res.DirectionRatios[i] = Mag1 * Vec1.DirectionRatios[i] - Mag2 * Vec2.DirectionRatios[i];
                Mag += Res.DirectionRatios[i] * Res.DirectionRatios[i];
            }

            if (Mag > 0)
            {
                return(new IfcVector(Res, Math.Sqrt((double)Mag)));
            }
            else
            {
                return(new IfcVector(Vec1, 0));
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="z"></param>
 public IfcDirection(doublewrapper x, doublewrapper y, doublewrapper z)
 {
     this.DirectionRatios = new IfcDirectionDirectionRatios(new doublewrapper[] { x, y, z });
 }