Exemple #1
0
        public void AddVertex(int sideIndex, Vertex newVertex)
        {
            int nextIndex = (sideIndex + 1) % this.NumberOfVertices;

            _relations[sideIndex] = new EmptyRelation();
            _InsertVertex(nextIndex, newVertex);
        }
Exemple #2
0
        public bool UnsetRelation(int sideIndex)
        {
            bool res = !(_relations[sideIndex].IsEmpty());

            _relations[sideIndex] = new EmptyRelation();

            return(true);
        }
Exemple #3
0
        public void DeleteVertex(int vertexIndex)
        {
            int indexBefore = ((vertexIndex - 1) + this.NumberOfVertices) % this.NumberOfVertices;

            _relations[indexBefore] = new EmptyRelation();

            _vertices.RemoveAt(vertexIndex);
            _relations.RemoveAt(vertexIndex);
        }
Exemple #4
0
        public void FixRelations()
        {
            for (int i = 0; i < this.NumberOfVertices; ++i)
            {
                if (!_relations[i].IsFixed && !_relations[i].IsEmpty())
                {
                    Relation newRelation = _relations[i].Copy();
                    newRelation.IsFixed = true;

                    _relations[i] = new EmptyRelation();

                    this.SetRelation(i, newRelation);
                }
            }
        }
Exemple #5
0
        public void AddAutomaticRelations()
        {
            for (int i = 0; i < this.NumberOfVertices; ++i)
            {
                if (!_relations[i].IsFixed)
                {
                    FreeVector vSide = new FreeVector(_vertices[i].Location,
                                                      _vertices[(i + 1) % this.NumberOfVertices].Location);

                    if (vSide.IsApproxVertical())
                    {
                        _relations[i] = new VerticalRelation(false);
                    }
                    else if (vSide.IsApproxHorizontal())
                    {
                        _relations[i] = new HorizontalRelation(false);
                    }
                    else
                    {
                        _relations[i] = new EmptyRelation();
                    }
                }
            }
        }