/// <summary> /// Constructor used by <c>Ring.Create</c>. /// </summary> /// <param name="edge">The dividers that define the perimeter of the ring</param> protected Ring(RingMetrics metrics, List <Face> edge) : base(metrics) { m_Edge = new IDivider[edge.Count]; m_Flag = 0; for (int i = 0; i < m_Edge.Length; i++) { Face face = edge[i]; IDivider d = face.Divider; // Check for a divider that's already marked as being totally built. if (Topology.IsBuilt(d)) { throw new Exception("Polygon - Wrong build status for component divider"); } // Remember the divider and update polygon geometry m_Edge[i] = d; if (face.IsLeft) { d.Left = this; } else { d.Right = this; } } }
/// <summary> /// Sets flag bit(s) /// </summary> /// <param name="flag">The flag bit(s) to set</param> /// <param name="setting">True to set, false to clear</param> protected void SetFlag(RingFlag flag, bool setting) { if (setting) { m_Flag |= flag; } else { m_Flag &= (~flag); } }
/// <summary> /// Is a flag bit set? /// </summary> /// <param name="flag">The flag(s) to check for (may be a combination of more /// than one flag)</param> /// <returns>True if any of the supplied flag bits are set</returns> protected bool IsFlagSet(RingFlag flag) { return((m_Flag & flag) != 0); }