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