コード例 #1
0
ファイル: AxisGrid.cs プロジェクト: foman/Plotter3D
 private void UpdateDashLine(AxisGrid.AxisDash axisDash, int horTicksCnt, int verTicksCnt)
 {
     if (horTicksCnt >= 2 && verTicksCnt >= 2)
     {
         double scrnLength = this.GetScreenLength(axisDash.HP0, axisDash.HP1);
         double cnt        = Math.Floor(scrnLength / (double)(verTicksCnt - 1) / _dashGap) * (double)(verTicksCnt - 1);
         if (cnt < 1000.0)
         {
             double portion = cnt / (double)axisDash.HDashCount;
             if (portion < 0.8 || portion > 1.2)
             {
                 axisDash.HDashCount = (int)cnt;
             }
         }
         scrnLength = this.GetScreenLength(axisDash.VP0, axisDash.VP1);
         cnt        = Math.Floor(scrnLength / (double)(horTicksCnt - 1) / _dashGap) * (double)(horTicksCnt - 1);
         if (cnt < 1000.0)
         {
             double portion = cnt / (double)axisDash.VDashCount;
             if (portion < 0.8 || portion > 1.2)
             {
                 axisDash.VDashCount = (int)cnt;
             }
         }
     }
 }
コード例 #2
0
ファイル: AxisGrid.cs プロジェクト: foman/Plotter3D
        private void CreateDashLine(AxisGrid.AxisDash axisdash, List <TickInfo> horTicks, List <TickInfo> verTicks)
        {
            Point3DCollection dashPnts    = new Point3DCollection();
            double            hGap        = _length / (double)axisdash.HDashCount;
            double            vGap        = _length / (double)axisdash.VDashCount;
            Vector3D          hV          = hGap * axisdash.HVector;
            Vector3D          vV          = vGap * axisdash.VVector;
            Point3D           originalPnt = new Point3D(0.0, 0.0, 0.0);

            for (int i = 1; i < horTicks.Count - 1; i++)
            {
                for (int j = 0; j <= axisdash.HDashCount; j++)
                {
                    dashPnts.Add(originalPnt + hV * (double)j + horTicks[i].AxisValue * axisdash.VVector);
                }
            }
            for (int i = 1; i < verTicks.Count - 1; i++)
            {
                for (int j = 0; j <= axisdash.VDashCount; j++)
                {
                    dashPnts.Add(originalPnt + vV * (double)j + verTicks[i].AxisValue * axisdash.HVector);
                }
            }
            axisdash.Points3D.Color  = Colors.Blue;
            axisdash.Points3D.Points = dashPnts;
        }