This class stand for user coordinate system
Example #1
0
 /// <summary>
 /// rotate around X axis with default angle
 /// </summary>
 /// <param name="direction">minus or positive angle</param>
 public void RotateX(bool direction)
 {
     if (direction)
     {
         m_currentUCS = m_currentUCS + RotateXUCS;
         UpdateDisplayData(m_currentUCS);
     }
     else
     {
         m_currentUCS = m_currentUCS + RotateAntiXUCS;
         UpdateDisplayData(m_currentUCS);
     }
 }
Example #2
0
 /// <summary>
 /// update data according to current UCS
 /// </summary>
 /// <param name="lc"></param>
 private void UpdateDisplayData(UCS lc)
 {
     m_curves.Clear();
     foreach (List <Vector> iniVectors in m_iniCurves)
     {
         List <Vector> vectors = new List <Vector>();
         m_curves.Add(vectors);
         for (int i = 0; i < iniVectors.Count; i++)
         {
             // transform points to local coordinate system
             vectors.Add(lc.GC2LC(iniVectors[i]));
         }
     }
     // trigger update view event
     if (null != UpdateViewEvent)
     {
         UpdateViewEvent();
     }
 }
Example #3
0
        /// <summary>
        /// static constructor used to initialize static members
        /// </summary>
        static Graphics3DData()
        {
            // initialize small angle
            double angle     = RotateAngle;
            double antiAngle = -RotateAngle;
            double sin       = Math.Sin(angle);
            double cos       = Math.Cos(angle);
            double antiSin   = Math.Sin(antiAngle);
            double antiCos   = Math.Cos(antiAngle);
            // initialize 6 Rotate UCS
            Vector origin = new Vector();

            RotateXUCS =
                new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, cos, sin));
            RotateAntiXUCS =
                new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, antiCos, antiSin));
            RotateYUCS =
                new UCS(origin, new Vector(cos, 0.0, -sin), new Vector(0.0, 1.0, 0.0));
            RotateAntiYUCS =
                new UCS(origin, new Vector(antiCos, 0.0, -antiSin), new Vector(0.0, 1.0, 0.0));
            RotateZUCS =
                new UCS(origin, new Vector(cos, sin, 0.0), new Vector(-sin, cos, 0.0));
            RotateAntiZUCS =
                new UCS(origin, new Vector(antiCos, antiSin, 0.0), new Vector(-antiSin, antiCos, 0.0));

            // initialize 7 special UCS
            SpecialUCSs[(int)ViewDirections.IsoMetric] = new UCS(origin,
                                                                 new Vector(-0.408248290463863, 0.408248290463863, 0.816496580927726),
                                                                 new Vector(0.707106781186548, 0.707106781186548, 0.0));
            SpecialUCSs[(int)ViewDirections.Top] =
                new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, 1.0, 0.0));
            SpecialUCSs[(int)ViewDirections.Front] =
                new UCS(origin, new Vector(-1.0, 0.0, 0.0), new Vector(0.0, 0.0, 1.0));
            SpecialUCSs[(int)ViewDirections.Left] =
                new UCS(origin, new Vector(0.0, -1.0, 0.0), new Vector(0.0, 0.0, 1.0));
            SpecialUCSs[(int)ViewDirections.Right] =
                new UCS(origin, new Vector(0.0, 1.0, 0.0), new Vector(0.0, 0.0, 1.0));
            SpecialUCSs[(int)ViewDirections.Bottom] =
                new UCS(origin, new Vector(-1.0, 0.0, 0.0), new Vector(0.0, 1.0, 0.0));
            SpecialUCSs[(int)ViewDirections.Back] =
                new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, 0.0, 1.0));
        }
Example #4
0
 /// <summary>
 /// change the camera direction to the geometry
 /// </summary>
 /// <param name="viewDirection">camera direction</param>
 public void SetViewDirection(ViewDirections viewDirection)
 {
     m_currentUCS = SpecialUCSs[(int)viewDirection];
     UpdateDisplayData(m_currentUCS);
 }
Example #5
0
        /// <summary>
        /// static constructor used to initialize static members
        /// </summary>
        static Graphics3DData()
        {
            // initialize small angle
            double angle = RotateAngle;
            double antiAngle = -RotateAngle;
            double sin = Math.Sin(angle);
            double cos = Math.Cos(angle);
            double antiSin = Math.Sin(antiAngle);
            double antiCos = Math.Cos(antiAngle);
            // initialize 6 Rotate UCS
            Vector origin = new Vector();
            RotateXUCS =
                new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, cos, sin));
            RotateAntiXUCS =
                new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, antiCos, antiSin));
            RotateYUCS =
                new UCS(origin, new Vector(cos, 0.0, -sin), new Vector(0.0, 1.0, 0.0));
            RotateAntiYUCS =
                new UCS(origin, new Vector(antiCos, 0.0, -antiSin), new Vector(0.0, 1.0, 0.0));
            RotateZUCS =
                new UCS(origin, new Vector(cos, sin, 0.0), new Vector(-sin, cos, 0.0));
            RotateAntiZUCS =
                new UCS(origin, new Vector(antiCos, antiSin, 0.0), new Vector(-antiSin, antiCos, 0.0));

            // initialize 7 special UCS
            SpecialUCSs[(int)ViewDirections.IsoMetric] = new UCS(origin,
                new Vector(-0.408248290463863, 0.408248290463863, 0.816496580927726),
                new Vector(0.707106781186548, 0.707106781186548, 0.0));
            SpecialUCSs[(int)ViewDirections.Top] =
                new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, 1.0, 0.0));
            SpecialUCSs[(int)ViewDirections.Front] =
                new UCS(origin, new Vector(-1.0, 0.0, 0.0), new Vector(0.0, 0.0, 1.0));
            SpecialUCSs[(int)ViewDirections.Left] =
                new UCS(origin, new Vector(0.0, -1.0, 0.0), new Vector(0.0, 0.0, 1.0));
            SpecialUCSs[(int)ViewDirections.Right] =
                new UCS(origin, new Vector(0.0, 1.0, 0.0), new Vector(0.0, 0.0, 1.0));
            SpecialUCSs[(int)ViewDirections.Bottom] =
                new UCS(origin, new Vector(-1.0, 0.0, 0.0), new Vector(0.0, 1.0, 0.0));
            SpecialUCSs[(int)ViewDirections.Back] =
                new UCS(origin, new Vector(1.0, 0.0, 0.0), new Vector(0.0, 0.0, 1.0));
        }
Example #6
0
 /// <summary>
 /// update data according to current UCS
 /// </summary>
 /// <param name="lc"></param>
 private void UpdateDisplayData(UCS lc)
 {
     m_curves.Clear();
     foreach (List<Vector> iniVectors in m_iniCurves)
     {
         List<Vector> vectors = new List<Vector>();
         m_curves.Add(vectors);
         for (int i = 0; i < iniVectors.Count; i++)
         {
             // transform points to local coordinate system
             vectors.Add(lc.GC2LC(iniVectors[i]));
         }
     }
     // trigger update view event
     if (null != UpdateViewEvent)
     {
         UpdateViewEvent();
     }
 }
Example #7
0
 /// <summary>
 /// change the camera direction to the geometry
 /// </summary>
 /// <param name="viewDirection">camera direction</param>
 public void SetViewDirection(ViewDirections viewDirection)
 {
     m_currentUCS = SpecialUCSs[(int)viewDirection];
     UpdateDisplayData(m_currentUCS);
 }
Example #8
0
 /// <summary>
 /// rotate around Z axis with default angle
 /// </summary>
 /// <param name="direction">minus or positive angle</param>
 public void RotateZ(bool direction)
 {
     if (direction)
     {
         m_currentUCS = m_currentUCS + RotateZUCS;
         UpdateDisplayData(m_currentUCS);
     }
     else
     {
         m_currentUCS = m_currentUCS + RotateAntiZUCS;
         UpdateDisplayData(m_currentUCS);
     }
 }