public void AddVertex(int sideIndex, Vertex newVertex) { int nextIndex = (sideIndex + 1) % this.NumberOfVertices; _relations[sideIndex] = new EmptyRelation(); _InsertVertex(nextIndex, newVertex); }
public bool UnsetRelation(int sideIndex) { bool res = !(_relations[sideIndex].IsEmpty()); _relations[sideIndex] = new EmptyRelation(); return(true); }
public void DeleteVertex(int vertexIndex) { int indexBefore = ((vertexIndex - 1) + this.NumberOfVertices) % this.NumberOfVertices; _relations[indexBefore] = new EmptyRelation(); _vertices.RemoveAt(vertexIndex); _relations.RemoveAt(vertexIndex); }
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); } } }
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(); } } } }