Example #1
0
        public List <Mesh3D> GetMeshes()
        {
            var meshes      = new List <Mesh3D>();
            var surfaceMesh = new ColorMesh3D();

            surfaceMesh.SetSize(_nGridXNo * _nGridYNo, 2 * (_nGridXNo - 1) * (_nGridYNo - 1));

            for (var i = 0; i < _nGridXNo; i++)
            {
                for (var j = 0; j < _nGridYNo; j++)
                {
                    var nI   = j * _nGridXNo + i;
                    var vert = _vertices[nI];
                    _vertices[nI].MinI = nI;
                    surfaceMesh.SetPoint(nI, new Point3D(vert.X, vert.Y, vert.Z));
                    surfaceMesh.SetColor(nI, vert.Color);
                }
            }

            // set triangle
            var nT = 0;
            var nx = _nGridXNo - 1;
            var ny = _nGridYNo - 1;

            for (var i = 0; i < nx; i++)
            {
                for (var j = 0; j < ny; j++)
                {
                    var i1  = i + 1;
                    var j1  = j + 1;
                    var n00 = j * _nGridXNo + i;
                    var n10 = j * _nGridXNo + i1;
                    var n01 = j1 * _nGridXNo + i;
                    var n11 = j1 * _nGridXNo + i1;

                    surfaceMesh.SetTriangle(nT++, n00, n10, n01);
                    surfaceMesh.SetTriangle(nT++, n01, n10, n11);
                }
            }

            meshes.Add(surfaceMesh);
            return(meshes);
        }
Example #2
0
        // convert the uniform surface chart to a array of Mesh3D (only one element)
        public ArrayList GetMeshes()
        {
            ArrayList   meshes      = new ArrayList();
            ColorMesh3D surfaceMesh = new ColorMesh3D();

            surfaceMesh.SetSize(m_nGridXNo * m_nGridYNo, 2 * (m_nGridXNo - 1) * (m_nGridYNo - 1));

            for (int i = 0; i < m_nGridXNo; i++)
            {
                for (int j = 0; j < m_nGridYNo; j++)
                {
                    int      nI   = j * m_nGridXNo + i;
                    Vertex3D vert = m_vertices[nI];
                    m_vertices[nI].nMinI = nI;
                    surfaceMesh.SetPoint(nI, new Point3D(vert.x, vert.y, vert.z));
                    surfaceMesh.SetColor(nI, vert.color);
                }
            }
            // set triangle
            int nT = 0;

            for (int i = 0; i < m_nGridXNo - 1; i++)
            {
                for (int j = 0; j < m_nGridYNo - 1; j++)
                {
                    int n00 = j * m_nGridXNo + i;
                    int n10 = j * m_nGridXNo + i + 1;
                    int n01 = (j + 1) * m_nGridXNo + i;
                    int n11 = (j + 1) * m_nGridXNo + i + 1;

                    surfaceMesh.SetTriangle(nT, n00, n10, n01);
                    nT++;
                    surfaceMesh.SetTriangle(nT, n01, n10, n11);
                    nT++;
                }
            }
            meshes.Add(surfaceMesh);

            return(meshes);
        }
        // convert the uniform surface chart to a array of Mesh3D (only one element)
        public ArrayList GetMeshes()
        {
            var meshes      = new ArrayList();
            var surfaceMesh = new ColorMesh3D();

            surfaceMesh.SetSize(_mNGridXNo * _mNGridYNo, 2 * (_mNGridXNo - 1) * (_mNGridYNo - 1));

            for (var i = 0; i < _mNGridXNo; i++)
            {
                for (var j = 0; j < _mNGridYNo; j++)
                {
                    var nI   = j * _mNGridXNo + i;
                    var vert = MVertices[nI];
                    MVertices[nI].nMinI = nI;
                    surfaceMesh.SetPoint(nI, new Point3D(vert.x, vert.y, vert.z));
                    surfaceMesh.SetColor(nI, vert.color);
                }
            }
            // set triangle
            var nT = 0;

            for (var i = 0; i < _mNGridXNo - 1; i++)
            {
                for (var j = 0; j < _mNGridYNo - 1; j++)
                {
                    var n00 = j * _mNGridXNo + i;
                    var n10 = j * _mNGridXNo + i + 1;
                    var n01 = (j + 1) * _mNGridXNo + i;
                    var n11 = (j + 1) * _mNGridXNo + i + 1;

                    surfaceMesh.SetTriangle(nT, n00, n10, n01);
                    nT++;
                    surfaceMesh.SetTriangle(nT, n01, n10, n11);
                    nT++;
                }
            }
            meshes.Add(surfaceMesh);

            return(meshes);
        }
Example #4
0
        private int m_nGridXNo, m_nGridYNo; // the grid number on each axis

        #endregion Fields

        #region Methods

        // convert the uniform surface chart to a array of Mesh3D (only one element)
        public ArrayList GetMeshes()
        {
            ArrayList meshes = new ArrayList();
            ColorMesh3D surfaceMesh = new ColorMesh3D();

            surfaceMesh.SetSize(m_nGridXNo * m_nGridYNo, 2 * (m_nGridXNo - 1) * (m_nGridYNo - 1));

            for (int i = 0; i < m_nGridXNo; i++)
            {
                for (int j = 0; j < m_nGridYNo; j++)
                {
                    int nI = j * m_nGridXNo + i;
                    Vertex3D vert = m_vertices[nI];
                    m_vertices[nI].nMinI = nI;
                    surfaceMesh.SetPoint(nI, new Point3D(vert.x, vert.y, vert.z));
                    surfaceMesh.SetColor(nI, vert.color);
                }
            }
            // set triangle
            int nT = 0;
            for (int i = 0; i < m_nGridXNo-1; i++)
            {
                for (int j = 0; j < m_nGridYNo-1; j++)
                {
                    int n00 = j * m_nGridXNo + i;
                    int n10 = j * m_nGridXNo + i + 1;
                    int n01 = (j + 1) * m_nGridXNo + i;
                    int n11 = (j + 1) * m_nGridXNo + i + 1;

                    surfaceMesh.SetTriangle(nT, n00, n10, n01);
                    nT++;
                    surfaceMesh.SetTriangle(nT, n01, n10, n11);
                    nT++;
                }
            }
            meshes.Add(surfaceMesh);

            return meshes;
        }