コード例 #1
0
        public override bool Run(FeatureContext context)
        {
            const float len  = 100.0f;
            const int   nDim = 50;

            float[] pointBuffer = new float[nDim * nDim * nDim * 3];
            float[] colorBuffer = new float[nDim * nDim * nDim * 3];
            int     idx         = -1;

            for (int ii = 0; ii < nDim; ++ii)
            {
                for (int jj = 0; jj < nDim; ++jj)
                {
                    for (int kk = 0; kk < nDim; ++kk)
                    {
                        ++idx;
                        pointBuffer[idx * 3]     = ii * len;
                        pointBuffer[idx * 3 + 1] = jj * len;
                        pointBuffer[idx * 3 + 2] = kk * len;

                        colorBuffer[idx * 3]     = ((float)ii) / ((float)nDim);
                        colorBuffer[idx * 3 + 1] = ((float)jj) / ((float)nDim);
                        colorBuffer[idx * 3 + 2] = ((float)kk) / ((float)nDim);
                    }
                }
            }

            PointStyle pointStyle = new PointStyle();

            //pointStyle.SetPointSize(4.0f);
            pointStyle.SetMarker("cross");

            PointCloudNode pcn = new PointCloudNode();

            pcn.SetPointStyle(pointStyle);
            pcn.SetPoints(pointBuffer);
            pcn.SetColors(colorBuffer);
            pcn.ComputeBBox();
            AABox   bbox = pcn.GetBBox();
            Vector3 pt   = bbox.MinPt;

            context.ShowSceneNode(pcn);


            return(true);
        }
コード例 #2
0
        private void largePointsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const float len  = 100.0f;
            const int   nDim = 50;

            float[] pointBuffer = new float[nDim * nDim * nDim * 3];
            int     idx         = -1;

            for (int ii = 0; ii < nDim; ++ii)
            {
                for (int jj = 0; jj < nDim; ++jj)
                {
                    for (int kk = 0; kk < nDim; ++kk)
                    {
                        ++idx;
                        pointBuffer[idx * 3]     = ii * len;
                        pointBuffer[idx * 3 + 1] = jj * len;
                        pointBuffer[idx * 3 + 2] = kk * len;
                    }
                }
            }

            PointStyle pointStyle = new PointStyle();

            pointStyle.SetPointSize(4.0f);
            pointStyle.SetColor(new ColorValue(0.0f, 0.0f, 0.0f));

            PointCloudNode pcn = new PointCloudNode();

            pcn.SetPointStyle(pointStyle);
            pcn.SetPoints(pointBuffer);
            pcn.ComputeBBox();

            renderView.SceneManager.AddNode(pcn);

            renderView.RequestDraw();
        }
コード例 #3
0
ファイル: FormMain.cs プロジェクト: xazk027/anycadnetsdkpro
        private void largePointsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const float len = 100.0f;
            const int nDim = 50;
            float[] pointBuffer = new float[nDim * nDim * nDim * 3];
            float[] colorBuffer = new float[nDim*nDim*nDim*3];
            int idx = -1;
            for (int ii = 0; ii < nDim; ++ii)
                for (int jj = 0; jj < nDim; ++jj)
                    for (int kk = 0; kk < nDim; ++kk)
                    {
                        ++idx;
                        pointBuffer[idx * 3] = ii * len;
                        pointBuffer[idx * 3 + 1] = jj * len;
                        pointBuffer[idx * 3 + 2] = kk * len;

                        colorBuffer[idx*3] = ((float)ii)/((float)nDim);
                        colorBuffer[idx*3 + 1] = ((float)jj)/((float)nDim);
                        colorBuffer[idx * 3 + 2] = ((float)kk) / ((float)nDim);
                    }

            PointStyle pointStyle = new PointStyle();
            pointStyle.SetPointSize(4.0f);

            PointCloudNode pcn = new PointCloudNode();
            pcn.SetPointStyle(pointStyle);
            pcn.SetPoints(pointBuffer);
            pcn.SetColors(colorBuffer);
            pcn.ComputeBBox();
            AABox bbox = pcn.GetBBox();
            Vector3 pt = bbox.MinPt;
            renderView.SceneManager.AddNode(pcn);

            renderView.RequestDraw();
        }