Пример #1
0
        // 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 (!UseAxes)
            {
                return;
            }

            var radius = (m_xAxisLength + m_yAxisLength + m_zAxisLength) / (3 * m_axisLengthWidthRatio);

            Mesh3D xAxisCylinder = new Cylinder3D(radius, radius, m_xAxisLength, 6);

            xAxisCylinder.SetColor(m_axisXColor);
            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_axisXColor);
            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_axisYColor);
            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_axisYColor);
            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_axisZColor);
            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_axisZColor);
            TransformMatrix.Transform(zAxisCone,
                                      new Point3D(m_xAxisCenter, m_yAxisCenter, m_zAxisCenter + m_zAxisLength), 0, 0);
            meshs.Add(zAxisCone);
        }
Пример #2
0
        private void AddAxesLabelsMeshes(ArrayList meshs)
        {
            var radius = (m_xAxisLength + m_yAxisLength + m_zAxisLength) / (3 * m_axisLengthWidthRatio);

            Mesh3D xAxisCylinder = new Cylinder3D(radius, radius, m_xAxisLength / 10, 6);

            xAxisCylinder.SetColor(m_axisXColor);
            TransformMatrix.Transform(xAxisCylinder,
                                      new Point3D(m_xAxisCenter / 15 + m_xAxisLength / 10 / 2, m_yAxisCenter / 15, m_zAxisCenter / 15), 0, 90);
            meshs.Add(xAxisCylinder);

            Mesh3D xAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6);

            xAxisCone.SetColor(m_axisXColor);
            TransformMatrix.Transform(xAxisCone,
                                      new Point3D(m_xAxisCenter / 15 + m_xAxisLength / 10, m_yAxisCenter / 15, m_zAxisCenter / 15), 0, 90);
            meshs.Add(xAxisCone);

            Mesh3D yAxisCylinder = new Cylinder3D(radius, radius, m_yAxisLength / 10, 6);

            yAxisCylinder.SetColor(m_axisYColor);
            TransformMatrix.Transform(yAxisCylinder,
                                      new Point3D(m_xAxisCenter / 15, m_yAxisCenter / 15 + m_yAxisLength / 10 / 2, m_zAxisCenter / 15), 90, 90);
            meshs.Add(yAxisCylinder);

            Mesh3D yAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6);

            yAxisCone.SetColor(m_axisYColor);
            TransformMatrix.Transform(yAxisCone,
                                      new Point3D(m_xAxisCenter / 15, m_yAxisCenter / 15 + m_yAxisLength / 10, m_zAxisCenter / 15), 90, 90);
            meshs.Add(yAxisCone);

            Mesh3D zAxisCylinder = new Cylinder3D(radius, radius, m_zAxisLength / 10, 6);

            zAxisCylinder.SetColor(m_axisZColor);
            TransformMatrix.Transform(zAxisCylinder,
                                      new Point3D(m_xAxisCenter / 15, m_yAxisCenter / 15, m_zAxisCenter / 15 + m_zAxisLength / 10 / 2), 0, 0);
            meshs.Add(zAxisCylinder);

            Mesh3D zAxisCone = new Cone3D(2 * radius, 2 * radius, radius * 5, 6);

            zAxisCone.SetColor(m_axisZColor);
            TransformMatrix.Transform(zAxisCone,
                                      new Point3D(m_xAxisCenter / 15, m_yAxisCenter / 15, m_zAxisCenter / 15 + m_zAxisLength / 10), 0, 0);
            meshs.Add(zAxisCone);
        }