// convert the 3D scatter plot into a array of Mesh3D object public ArrayList GetMeshes() { int nDotNo = GetDataNo(); if (nDotNo == 0) { return(null); } ArrayList meshs = new ArrayList(); int nVertIndex = 0; for (int i = 0; i < nDotNo; i++) { ScatterPlotItem plotItem = Get(i); int nType = plotItem.shape % Chart3D.SHAPE_NO; float w = plotItem.w; float h = plotItem.h; Mesh3D dot; m_vertices[i].nMinI = nVertIndex; switch (nType) { case (int)SHAPE.BAR: dot = new Bar3D(0, 0, 0, w, w, h); break; case (int)SHAPE.CONE: dot = new Cone3D(w, w, h, 7); break; case (int)SHAPE.CYLINDER: dot = new Cylinder3D(w, w, h, 7); break; case (int)SHAPE.ELLIPSE: dot = new Ellipse3D(w, w, h, 7); break; case (int)SHAPE.PYRAMID: dot = new Pyramid3D(w, w, h); break; default: dot = new Bar3D(0, 0, 0, w, w, h); break; } nVertIndex += dot.GetVertexNo(); m_vertices[i].nMaxI = nVertIndex - 1; TransformMatrix.Transform(dot, new Point3D(plotItem.x, plotItem.y, plotItem.z), plotItem.type, plotItem.rotmatrix); dot.SetColor(plotItem.color); meshs.Add(dot); } AddAxesMeshes(meshs); return(meshs); }
// convert the 3D scatter plot into a array of Mesh3D object public ArrayList GetMeshes() { int nDotNo = GetDataNo(); if (nDotNo == 0) return null; ArrayList meshs = new ArrayList(); int nVertIndex = 0; for (int i = 0; i < nDotNo; i++) { ScatterPlotItem plotItem = Get(i); int nType = plotItem.shape % Chart3D.SHAPE_NO; float w = plotItem.w; float h = plotItem.h; Mesh3D dot; m_vertices[i].nMinI = nVertIndex; switch (nType) { case (int)SHAPE.BAR: dot = new Bar3D(0, 0, 0, w, w, h); break; case (int)SHAPE.CONE: dot = new Cone3D(w, w, h, 7); break; case (int)SHAPE.CYLINDER: dot = new Cylinder3D(w, w, h, 7); break; case (int)SHAPE.ELLIPSE: dot = new Ellipse3D(w, w, h, 7); break; case (int)SHAPE.PYRAMID: dot = new Pyramid3D(w, w, h); break; default: dot = new Bar3D(0, 0, 0, w, w, h); break; } nVertIndex += dot.GetVertexNo(); m_vertices[i].nMaxI = nVertIndex - 1; TransformMatrix.Transform(dot, new Point3D(plotItem.x, plotItem.y, plotItem.z), 0, 0); dot.SetColor(plotItem.color); meshs.Add(dot); } AddAxesMeshes(meshs); return meshs; }
// add the axes mesh to the Mesh3D array // if you are using the projection matrix which is not uniform along all the axess, you need change this function public void AddAxesMeshes(ArrayList meshs) { if (!m_bUseAxes) { return; } float radius = (m_xAxisLength + m_yAxisLength + m_zAxisLength) / (3 * m_axisLengthWidthRatio); Mesh3D xAxisCylinder = new Cylinder3D(radius, radius, m_xAxisLength, 6); xAxisCylinder.SetColor(m_axisColor); TransformMatrix.Transform(xAxisCylinder, new Point3D(m_xAxisCenter + m_xAxisLength / 2, m_yAxisCenter, m_zAxisCenter), 0, 90); meshs.Add(xAxisCylinder); Mesh3D xAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); xAxisCone.SetColor(m_axisColor); TransformMatrix.Transform(xAxisCone, new Point3D(m_xAxisCenter + m_xAxisLength, m_yAxisCenter, m_zAxisCenter), 0, 90); meshs.Add(xAxisCone); Mesh3D yAxisCylinder = new Cylinder3D(radius, radius, m_yAxisLength, 6); yAxisCylinder.SetColor(m_axisColor); TransformMatrix.Transform(yAxisCylinder, new Point3D(m_xAxisCenter, m_yAxisCenter + m_yAxisLength / 2, m_zAxisCenter), 90, 90); meshs.Add(yAxisCylinder); Mesh3D yAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); yAxisCone.SetColor(m_axisColor); TransformMatrix.Transform(yAxisCone, new Point3D(m_xAxisCenter, m_yAxisCenter + m_yAxisLength, m_zAxisCenter), 90, 90); meshs.Add(yAxisCone); Mesh3D zAxisCylinder = new Cylinder3D(radius, radius, m_zAxisLength, 6); zAxisCylinder.SetColor(m_axisColor); TransformMatrix.Transform(zAxisCylinder, new Point3D(m_xAxisCenter, m_yAxisCenter, m_zAxisCenter + m_zAxisLength / 2), 0, 0); meshs.Add(zAxisCylinder); Mesh3D zAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); zAxisCone.SetColor(m_axisColor); TransformMatrix.Transform(zAxisCone, new Point3D(m_xAxisCenter, m_yAxisCenter, m_zAxisCenter + m_zAxisLength), 0, 0); meshs.Add(zAxisCone); }
// add the axes mesh to the Mesh3D array // if you are using the projection matrix which is not uniform along all the axess, you need change this function public void AddAxesMeshes(ArrayList meshs) { if (!_mBUseAxes) { return; } var radius = (_mXAxisLength + _mYAxisLength + _mZAxisLength) / (3 * m_axisLengthWidthRatio); Mesh3D xAxisCylinder = new Cylinder3D(radius, radius, _mXAxisLength, 6); xAxisCylinder.SetColor(MAxisColor); TransformMatrix.Transform(xAxisCylinder, new Point3D(_mXAxisCenter + _mXAxisLength / 2, _mYAxisCenter, _mZAxisCenter), 0, 90); meshs.Add(xAxisCylinder); Mesh3D xAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); xAxisCone.SetColor(MAxisColor); TransformMatrix.Transform(xAxisCone, new Point3D(_mXAxisCenter + _mXAxisLength, _mYAxisCenter, _mZAxisCenter), 0, 90); meshs.Add(xAxisCone); Mesh3D yAxisCylinder = new Cylinder3D(radius, radius, _mYAxisLength, 6); yAxisCylinder.SetColor(MAxisColor); TransformMatrix.Transform(yAxisCylinder, new Point3D(_mXAxisCenter, _mYAxisCenter + _mYAxisLength / 2, _mZAxisCenter), 90, 90); meshs.Add(yAxisCylinder); Mesh3D yAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); yAxisCone.SetColor(MAxisColor); TransformMatrix.Transform(yAxisCone, new Point3D(_mXAxisCenter, _mYAxisCenter + _mYAxisLength, _mZAxisCenter), 90, 90); meshs.Add(yAxisCone); Mesh3D zAxisCylinder = new Cylinder3D(radius, radius, _mZAxisLength, 6); zAxisCylinder.SetColor(MAxisColor); TransformMatrix.Transform(zAxisCylinder, new Point3D(_mXAxisCenter, _mYAxisCenter, _mZAxisCenter + _mZAxisLength / 2), 0, 0); meshs.Add(zAxisCylinder); Mesh3D zAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); zAxisCone.SetColor(MAxisColor); TransformMatrix.Transform(zAxisCone, new Point3D(_mXAxisCenter, _mYAxisCenter, _mZAxisCenter + _mZAxisLength), 0, 0); meshs.Add(zAxisCone); }
public void AddAxesMeshes(List <Mesh3D> meshs) { if (_bUseAxes) { var radius = (_xAxisLength + _yAxisLength + _zAxisLength) / (3 * _axisLengthWidthRatio); var xAxisCylinder = new Cylinder3D(radius, radius, _xAxisLength, 6); xAxisCylinder.SetColor(_axisColor); TransformMatrix.Transform(xAxisCylinder, new Point3D(_xAxisCenter + _xAxisLength / 2, _yAxisCenter, _zAxisCenter), 0, 90); meshs.Add(xAxisCylinder); var xAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); xAxisCone.SetColor(_axisColor); TransformMatrix.Transform(xAxisCone, new Point3D(_xAxisCenter + _xAxisLength, _yAxisCenter, _zAxisCenter), 0, 90); meshs.Add(xAxisCone); var yAxisCylinder = new Cylinder3D(radius, radius, _yAxisLength, 6); yAxisCylinder.SetColor(_axisColor); TransformMatrix.Transform(yAxisCylinder, new Point3D(_xAxisCenter, _yAxisCenter + _yAxisLength / 2, _zAxisCenter), 90, 90); meshs.Add(yAxisCylinder); var yAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); yAxisCone.SetColor(_axisColor); TransformMatrix.Transform(yAxisCone, new Point3D(_xAxisCenter, _yAxisCenter + _yAxisLength, _zAxisCenter), 90, 90); meshs.Add(yAxisCone); var zAxisCylinder = new Cylinder3D(radius, radius, _zAxisLength, 6); zAxisCylinder.SetColor(_axisColor); TransformMatrix.Transform(zAxisCylinder, new Point3D(_xAxisCenter, _yAxisCenter, _zAxisCenter + _zAxisLength / 2), 0, 0); meshs.Add(zAxisCylinder); var zAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); zAxisCone.SetColor(_axisColor); TransformMatrix.Transform(zAxisCone, new Point3D(_xAxisCenter, _yAxisCenter, _zAxisCenter + _zAxisLength), 0, 0); meshs.Add(zAxisCone); } }
// add the axes mesh to the Mesh3D array // if you are using the projection matrix which is not uniform along all the axess, you need change this function public void AddAxesMeshes(ArrayList meshs) { if (!m_bUseAxes) return; float radius = (m_xAxisLength+m_yAxisLength+m_zAxisLength) / (3*m_axisLengthWidthRatio); Mesh3D xAxisCylinder = new Cylinder3D(radius, radius, m_xAxisLength, 6); xAxisCylinder.SetColor(m_axisColor); TransformMatrix.Transform(xAxisCylinder, new Point3D( m_xAxisCenter + m_xAxisLength / 2, m_yAxisCenter, m_zAxisCenter), 0, 90); meshs.Add(xAxisCylinder); Mesh3D xAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); xAxisCone.SetColor(m_axisColor); TransformMatrix.Transform(xAxisCone, new Point3D(m_xAxisCenter + m_xAxisLength, m_yAxisCenter, m_zAxisCenter), 0, 90); meshs.Add(xAxisCone); Mesh3D yAxisCylinder = new Cylinder3D(radius, radius, m_yAxisLength, 6); yAxisCylinder.SetColor(m_axisColor); TransformMatrix.Transform(yAxisCylinder, new Point3D(m_xAxisCenter , m_yAxisCenter+ m_yAxisLength / 2, m_zAxisCenter), 90, 90); meshs.Add(yAxisCylinder); Mesh3D yAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); yAxisCone.SetColor(m_axisColor); TransformMatrix.Transform(yAxisCone, new Point3D(m_xAxisCenter, m_yAxisCenter + m_yAxisLength, m_zAxisCenter), 90, 90); meshs.Add(yAxisCone); Mesh3D zAxisCylinder = new Cylinder3D(radius, radius, m_zAxisLength, 6); zAxisCylinder.SetColor(m_axisColor); TransformMatrix.Transform(zAxisCylinder, new Point3D(m_xAxisCenter , m_yAxisCenter, m_zAxisCenter + m_zAxisLength / 2), 0, 0); meshs.Add(zAxisCylinder); Mesh3D zAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6); zAxisCone.SetColor(m_axisColor); TransformMatrix.Transform(zAxisCone, new Point3D(m_xAxisCenter, m_yAxisCenter, m_zAxisCenter + m_zAxisLength), 0, 0); meshs.Add(zAxisCone); }
// convert the 3D scatter plot into a array of Mesh3D object public ArrayList GetMeshes() { var nDotNo = GetDataNo(); if (nDotNo == 0) { return(null); } var meshs = new ArrayList(); var nVertIndex = 0; for (var i = 0; i < nDotNo; i++) { var plotItem = Get(i); if (plotItem == null) { continue; } var nType = plotItem.shape % ShapeNo; var w = plotItem.w; var h = plotItem.h; Mesh3D dot; MVertices[i].nMinI = nVertIndex; switch (nType) { case (int)Shape.Bar: dot = new Bar3D(0, 0, 0, w, w, h); break; case (int)Shape.Cone: dot = new Cone3D(w, w, h, 7); break; case (int)Shape.Cylinder: dot = new Cylinder3D(w, w, h, 7); break; case (int)Shape.Ellipse: dot = new Ellipse3D(w, w, h, 7); break; case (int)Shape.Pyramid: dot = new Pyramid3D(w, w, h); break; default: dot = new Bar3D(0, 0, 0, w, w, h); break; } nVertIndex += dot.GetVertexNo(); MVertices[i].nMaxI = nVertIndex - 1; TransformMatrix.Transform(dot, new Point3D(plotItem.x, plotItem.y, plotItem.z), 0, 0); dot.SetColor(plotItem.color); meshs.Add(dot); } AddAxesMeshes(meshs); return(meshs); }