Example #1
0
 /// <summary>Determines whether or not this instance is the same as the <paramref name="other"/> instance.</summary>
 /// <param name="other">The <see cref="Facet"/> to which to compare.</param>
 public bool Equals(Facet?other)
 {
     return
         (other != null &&
          Object.Equals(Normal, other.Normal) &&
          Vertices.Count == other.Vertices.Count &&
          Vertices.All((i, o) => Object.Equals(o, other.Vertices[i])));
 }
Example #2
0
        public bool Contains(Vertices polygon)
        {
            var allPointsInPolygon = polygon.All(point => IsPointInPolygonOrEdge(this, point)) && IsPointInPolygonOrEdge(this, polygon.GetCentroid());

            if (!allPointsInPolygon)
            {
                return(false);
            }
            return(GetArea() >= polygon.GetArea());
        }
Example #3
0
        /// <summary>
        /// Checks that all the points in this polygon are valid.
        /// </summary>
        /// <returns>True if the polygon is valid</returns>
        public bool IsValid()
        {
            if (Vertices.Count < 3)
            {
                return(false);
            }
            var plane = Plane;

            return(Vertices.All(x => plane.OnPlane(x) == 0));
        }
Example #4
0
 public bool HasEulerianCircuit()
 {
     if (IsDirected)
     {
         return(IsConnected() && Vertices.All(vertex => GetInDegree(vertex) == GetOutDegree(vertex)));
     }
     else
     {
         return(IsConnected() && Vertices.All(vertex => GetDegree(vertex) % 2 == 0));
     }
 }
 public bool IsProper() => Vertices.All(AreAllRelationshipsProper);
Example #6
0
    public override bool Equals(object obj)
    {
        var triangle = obj as Triangle;

        return(triangle != null && Vertices.All(vertex => triangle.Vertices.Contains(vertex)));
    }
Example #7
0
 /// <summary>
 /// Checks that all the points in this polygon are valid.
 /// </summary>
 /// <returns>True if the plane is valid</returns>
 public bool IsValid()
 {
     return(Vertices.All(x => Plane.OnPlane(x) == 0));
 }
Example #8
0
        // TODO: Add error messages to IsXxx method, so that users see where the problem is.

        /// <summary>
        /// Gets a value indicating whether the tags of all components in the mesh are equal to the
        /// given tag value.
        /// </summary>
        /// <param name="tag">The reference tag value.</param>
        /// <returns>
        /// <see langword="true"/> if the tags of all components are equal to <paramref name="tag"/>;
        /// otherwise, <see langword="false"/>.
        /// </returns>
        public bool AreTagsEqualTo(int tag)
        {
            return(Vertices.All(vertex => vertex.Tag == tag) &&
                   Edges.All(edge => edge.Tag == tag) &&
                   Faces.All(face => face.Tag == tag));
        }
Example #9
0
 /// <summary>
 /// Indicates whenever current graph has Eulerian circuit.
 /// </summary>
 public bool HasEulerianCircuit()
 {
     return(Vertices.All(x => x.OutDegree() == x.InDegree()));
 }