Example #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(Vertices.Aggregate(27, (current, v) => current + 13 * current + v.GetHashCode()));
     }
 }
Example #2
0
            public override string ToString()
            {
                var verticesToString = Vertices.Aggregate("[", (s, v) => s + "(" + v + "), ", s => s.Substring(0, s.Length - 2) + "]");

                return
                    ($"{nameof(AxisX)}: {AxisX}, {nameof(AxisY)}: {AxisY}, {nameof(Vertices)}: {verticesToString}, {nameof(ExpectedProjectionMin)}: {ExpectedProjectionMin}, {nameof(ExpectedProjectionMax)}: {ExpectedProjectionMax}");
            }
Example #3
0
 /// <summary>
 ///     Serves as a hash function for a particular type. <see cref="GetHashCode" /> is suitable for use
 ///     in hashing algorithms and data structures like a hash table.
 /// </summary>
 /// <returns>A hash code for the current <see cref="GetHashCode" />.</returns>
 public override int GetHashCode()
 {
     return(Vertices.Aggregate(0, (current, t) => current ^ t.GetHashCode()));
 }
Example #4
0
 /// <summary>
 /// Returns the origin of this polygon.
 /// </summary>
 /// <returns></returns>
 public Coordinate GetOrigin()
 {
     return(Vertices.Aggregate(Coordinate.Zero, (x, y) => x + y) / Vertices.Count);
 }