예제 #1
0
        private void SetSelectedEdge(int edge)
        {
            Path path;

            if (_selectedEdge >= 0 && _edges.TryGetValue(_selectedEdge, out path))
            {
                path.Stroke          = Brushes.Red;
                path.StrokeThickness = 1;
            }

            _selectedEdge = edge;
            if (_selectedEdge >= 0 && _edges.TryGetValue(_selectedEdge, out path))
            {
                path.Stroke          = Brushes.Black;
                path.StrokeThickness = 2;
            }
        }
예제 #2
0
        /// <summary>
        /// Updates the <see cref="SubdivisionFace"/> keys in the specified dictionaries after the
        /// specified <see cref="SubdivisionEdge"/> has been split.</summary>
        /// <param name="edge">
        /// The <see cref="SubdivisionEdge"/> whose splitting resulted in the current <see
        /// cref="SplitEdgeResult"/>.</param>
        /// <param name="edgeToFace1">
        /// An <see cref="Int32Dictionary{T}"/> that maps the keys of any existing half-edges to the
        /// keys of the incident bounded <see cref="Subdivision.Faces"/> of the corresponding <see
        /// cref="Subdivision.Edges"/> in a first <see cref="Subdivision"/>.</param>
        /// <param name="edgeToFace2">
        /// An <see cref="Int32Dictionary{T}"/> that maps the keys of any existing half-edges to the
        /// keys of the incident bounded <see cref="Subdivision.Faces"/> of the corresponding <see
        /// cref="Subdivision.Edges"/> in a second <see cref="Subdivision"/>.</param>
        /// <remarks>
        /// <b>UpdateFaces</b> ensures that the mapping between original and intersected faces
        /// established by the <see cref="Subdivision.Intersection"/> algorithm is kept up-to-date
        /// when edge splitting results in a valid <see cref="CreatedEdge"/>.</remarks>

        public void UpdateFaces(SubdivisionEdge edge,
                                Int32Dictionary <Int32> edgeToFace1, Int32Dictionary <Int32> edgeToFace2)
        {
            if (CreatedEdge == null)
            {
                return;
            }
            int face;

            if (edgeToFace1.TryGetValue(edge._key, out face))
            {
                Debug.Assert(face != 0);
                edgeToFace1.Add(CreatedEdge._key, face);
            }

            if (edgeToFace2.TryGetValue(edge._key, out face))
            {
                Debug.Assert(face != 0);
                edgeToFace2.Add(CreatedEdge._key, face);
            }
        }