コード例 #1
0
        void SetColors(Plot3dAxis axes, WpfColor[] colors)
        {
            var nv     = _3dChart.GetDataNo();
            var offset = axes.Minimum;
            var norm   = axes.Maximum - offset;

            for (var i = 0; i < nv; i++)
            {
                var vert  = _3dChart[i];
                var h     = (vert.Z - offset) / norm;
                var index = Math.Max(Math.Min((Int32)Math.Floor(h * colors.Length), colors.Length - 1), 0);
                _3dChart[i].Color = colors[index].Convert();
            }
        }
コード例 #2
0
        public void plotAnalytic(Plate p)
        {
            int nXNo = p.U.GetLength(0);
            int nYNo = p.U.GetLength(1);

            //Устанавливаем сетку
            m_3dChart = new UniformSurfaceChart3D();
            ((UniformSurfaceChart3D)m_3dChart).SetGrid(nXNo, nYNo, 0, (float)p.a, 0, (float)p.b, p.solutionU);
            m_3dChart.GetDataRange();

            int    nVertNo = m_3dChart.GetDataNo();
            double zMin    = p.MinZ;
            double zMax    = p.MaxZ;

            for (int i = 0; i < nVertNo; i++)
            {
                Vertex3D vert = m_3dChart[i];
                double   h    = (vert.z - zMin) / (zMax - zMin);

                Color color = WPFChart3D.TextureMapping.PseudoColor(h);
                m_3dChart[i].color = color;
            }


            ArrayList meshs = ((UniformSurfaceChart3D)m_3dChart).GetMeshes();

            // 5. display vertex no and triangle no of this surface chart
            UpdateModelSizeInfo(meshs);

            // 6. Set the model display of surface chart
            WPFChart3D.Model3D model3d      = new WPFChart3D.Model3D();
            Material           backMaterial = new DiffuseMaterial(new SolidColorBrush(Colors.Gray));

            m_nChartModelIndex = model3d.UpdateModel(meshs, backMaterial, m_nChartModelIndex, this.mainViewport);

            // 7. set projection matrix, so the data is in the display region
            float xMin = m_3dChart.XMin();
            float xMax = m_3dChart.XMax();

            m_transformMatrix.CalculateProjectionMatrix(xMin, xMax, xMin, xMax, zMin, zMax, 0.5);
            TransformChart();
        }