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);

            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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 3
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];
            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();
        }
Exemplo n.º 4
0
        private void curveIntersectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TopoShape ellipseArc = GlobalInstance.BrepTools.MakeEllipseArc(Vector3.ZERO, 100, 50, 0, 90, Vector3.UNIT_Z);
            TopoShape circle = GlobalInstance.BrepTools.MakeCircle(Vector3.ZERO, 60, Vector3.UNIT_Z);

            IntersectionLineCurve intersector = new IntersectionLineCurve();
            intersector.SetCurve(ellipseArc);
            if (intersector.Perform(circle))
            {
                PointStyle ps = new PointStyle();
                ps.SetMarker("plus");
                ps.SetPointSize(10);
                

                int nCount = intersector.GetPointCount();
                for (int ii = 1; ii <= nCount; ++ii)
                {
                    if (intersector.GetSquareDistance(ii) < 0.001)
                    {
                        Vector3 pt = intersector.GetPoint(ii);

                        PointNode pn = new PointNode();
                        pn.SetPoint(pt);
                        pn.SetPointStyle(ps);
                        renderView.ShowSceneNode(pn);
                    }
                }
            }

            renderView.ShowGeometry(ellipseArc, ++shapeId);
            renderView.ShowGeometry(circle, ++shapeId);
            renderView.RequestDraw();
        }
Exemplo n.º 5
0
        private void pointToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PointNode pn = new PointNode();
            pn.SetPoint(new Vector3(100, 100, 100));

            PointStyle ps = new PointStyle();
            ps.SetMarker("plus");
            ps.SetPointSize(10);
            pn.SetPointStyle(ps);

            renderView.ShowSceneNode(pn);
            renderView.RequestDraw();
        }