示例#1
0
 public HelixRenderPackage()
 {
     points = InitPointGeometry();
     lines = InitLineGeometry();
     mesh = InitMeshGeometry();
     lineStripVertexCounts = new List<int>();
 }
示例#2
0
 public HelixRenderPackage()
 {
     points = InitPointGeometry();
     lines = InitLineGeometry();
     mesh = InitMeshGeometry();
     lineStripVertexCounts = new List<int>();
     Transform = System.Windows.Media.Media3D.Matrix3D.Identity.ToArray();
 }
示例#3
0
        public void Clear()
        {

            points = null;
            mesh = null;
            lines = null;

            points = InitPointGeometry();
            mesh = InitMeshGeometry();
            lines = InitLineGeometry();

            lineStripVertexCounts.Clear();

            IsSelected = false;
            DisplayLabels = false;
        }
示例#4
0
        /// <summary>
        /// Create the grid
        /// </summary>
        private void DrawGrid()
        {
            Grid = new LineGeometry3D();
            var positions = new Vector3Collection();
            var indices = new IntCollection();
            var colors = new Color4Collection();

            for(var i= 0; i < 10; i += 1)
            {
                for (var j = 0; j < 10; j += 1)
                {
                    DrawGridPatch(positions, indices, colors, -50 + i * 10, -50 + j * 10);
                }
            }

            Grid.Positions = positions;
            Grid.Indices = indices;
            Grid.Colors = colors;

            Axes = new LineGeometry3D();
            var axesPositions = new Vector3Collection();
            var axesIndices = new IntCollection();
            var axesColors = new Color4Collection();

            // Draw the coordinate axes
            axesPositions.Add(new Vector3());
            axesIndices.Add(axesPositions.Count - 1);
            axesPositions.Add(new Vector3(50, 0, 0));
            axesIndices.Add(axesPositions.Count - 1);
            axesColors.Add(SharpDX.Color.Red);
            axesColors.Add(SharpDX.Color.Red);

            axesPositions.Add(new Vector3());
            axesIndices.Add(axesPositions.Count - 1);
            axesPositions.Add(new Vector3(0, 5, 0));
            axesIndices.Add(axesPositions.Count - 1);
            axesColors.Add(SharpDX.Color.Blue);
            axesColors.Add(SharpDX.Color.Blue);

            axesPositions.Add(new Vector3());
            axesIndices.Add(axesPositions.Count - 1);
            axesPositions.Add(new Vector3(0, 0, -50));
            axesIndices.Add(axesPositions.Count - 1);
            axesColors.Add(SharpDX.Color.Green);
            axesColors.Add(SharpDX.Color.Green);

            Axes.Positions = axesPositions;
            Axes.Indices = axesIndices;
            Axes.Colors = axesColors;

        }
示例#5
0
 internal static LineGeometry3D InitLineGeometry()
 {
     var lines = new LineGeometry3D
     {
         Positions = new Vector3Collection(),
         Indices = new IntCollection(),
         Colors = new Color4Collection()
     };
     
     return lines;
 }
示例#6
0
        private void CreateWireFrameModels(IFCItem item, Vector3 center)
        {
            while (item != null) {
                if (item.ifcID != IntPtr.Zero && item.noVerticesForWireFrame != 0 && item.noPrimitivesForWireFrame != 0) {
                    var geo = new LineGeometry3D();
                    geo.Positions=new Vector3Collection();
                    geo.Indices=new IntCollection();
                    var points = new Vector3Collection();
                    if (item.verticesForWireFrame != null) {
                        for (int i = 0; i < item.noVerticesForWireFrame; i++) {
                            points.Add(new Vector3((item.verticesForWireFrame[3 * i + 0] - center.X), (item.verticesForWireFrame[3 * i + 1] - center.Y), (item.verticesForWireFrame[3 * i + 2] - center.Z)));
                            geo.Positions.Add(new Vector3((item.verticesForWireFrame[3 * i + 0] - center.X), (item.verticesForWireFrame[3 * i + 1] - center.Y), (item.verticesForWireFrame[3 * i + 2] - center.Z)));
                        }
                    }

                    if (item.indicesForWireFrameLineParts != null) {
                        for (int i = 0; i < item.noPrimitivesForWireFrame; i++) {
                            var idx = item.indicesForWireFrameLineParts[2 * i + 0];
                            geo.Indices.Add(idx);
                            idx = item.indicesForWireFrameLineParts[2 * i + 1];
                            geo.Indices.Add(idx);
                        }
                    } else {
                        for (int i = 0, count = points.Count; i < count; i++) {
                            geo.Indices.Add(i);
                            geo.Indices.Add((i + 1) % count);
                        }
                    }

                    LineGeometryModel3D line = new LineGeometryModel3D();
                    line.Geometry = geo;
                    line.Color = _defaultLineColor;
                    line.Thickness = 0.5;
                    item.Wireframe = line;

                    line.Tag = item.ifcType + ":" + item.ifcID;
                    model.Add(line);
                }

                CreateFaceModels(item.child, center);
                item = item.next;
            }
        }
示例#7
0
        public void Clear()
        {

            points = null;
            mesh = null;
            lines = null;

            points = InitPointGeometry();
            mesh = InitMeshGeometry();
            lines = InitLineGeometry();

            lineStripVertexCounts.Clear();

            Transform = System.Windows.Media.Media3D.Matrix3D.Identity.ToArray();

            IsSelected = false;
            DisplayLabels = false;

            colors = null;
        }