Esempio n. 1
0
        public Rotation(double Angle, Point3D Axis)
		{
            Axis.Normalize();
            mQ0 = Math.Cos(Angle / 2.0);
            Axis.Scale(Math.Sin(Angle / 2.0));
            mQX = Axis.X;
            mQY = Axis.Y;
            mQZ = Axis.Z;
            Normalize();
		}
Esempio n. 2
0
        private void AddCity()
        {
            Point3D city;
            double greyval;

            while(true)
            {
                city = new Point3D( m_rand.NextDouble()-0.5,
                                    m_rand.NextDouble() - 0.5,
                                    m_rand.NextDouble() - 0.5);

                if( city.R > 0.5 ) continue; //go from uniform random cube to uniform random random sphere.

                greyval = GetGreyValue(city);
                m_totalareacount++;
                if( greyval < 0.0 ) //don't add cities to empty spaces
                {
                    m_emptyareacount++;
                    continue;
                }

                if( m_rand.NextDouble() * greyval * greyval > 0.01 )
                    continue;

                break;
            }

            m_SumGreyValues += greyval;

            city.Normalize();
            m_Cities.Add(city);
        }
Esempio n. 3
0
            private Point3D mQ; //center point

            #endregion Fields

            #region Constructors

            public MitreInfo(Point3D P, Point3D Qin, Point3D R, double HalfLineWidth)
            {
                //Mitre info is stored at the surface.
                mbNoMitre = false;
                mbDegenerateForward = false;
                mbDegenerateBackward = false;
                mQ = Qin.Normalized;
                ml = HalfLineWidth / Qin.R;
                double angle = Point3D.DihedralAngle(P, Qin, R);

                if (angle < Math.PI - 0.1 &&
                    angle > 0.1)
                {
                    mA = ((R - Qin).Normalized + (P - Qin).Normalized) / 2.0 + mQ;
                    mA.Normalize();
                    mA -= mQ;
                    mA.R = ml / Math.Sin(angle / 2.0);

                    mB = Point3D.Cross(Qin, Qin - P);
                    mB.R = l;
                    if (Point3D.Dot(mB, Qin - R) < 0) mB = -mB;

                    mC = Point3D.Cross(Qin, Qin - R);
                    mC.R = ml;
                    if (Point3D.Dot(mC, Qin - P) < 0) mC = -mC;

                    mA += mQ;
                    mB += mQ;
                    mC += mQ;
                    mA.Normalize();
                    mB.Normalize();
                    mC.Normalize();
                }
                else
                {
                    mA = Point3D.Cross(Qin, Qin - R);
                    mA.R = ml;
                    mB = -mA;
                    mbNoMitre = true;

                    mA += mQ;
                    mB += mQ;
                    mA.Normalize();
                    mB.Normalize();
                }

                if ((mA - mB).R > (R.Normalized - mQ).R )
                    mbDegenerateForward = true;
                if ((mA - mB).R > (P.Normalized - mQ).R)
                    mbDegenerateBackward = true;
            }