Пример #1
0
 public void AddFace(Face face)
 {
     if (Faces.Contains(face))
     {
         throw new InvalidOperationException("Edge allready contains face!");
     }
     Faces.Add(face);
 }
Пример #2
0
        public HashSet <PolygonalFace> GetAdjacentFaces()
        {
            var adjacentFaces = new HashSet <PolygonalFace>(); //use a hash to avoid duplicates

            foreach (var edge in OuterEdges)
            {
                if (Faces.Contains(edge.OwnedFace))
                {
                    adjacentFaces.Add(edge.OtherFace);
                }
                else
                {
                    adjacentFaces.Add(edge.OwnedFace);
                }
            }
            return(adjacentFaces);
        }
Пример #3
0
 /// <summary>
 /// Determines whether [is new member of] [the specified face].
 /// </summary>
 /// <param name="face">The face.</param>
 /// <returns><c>true</c> if [is new member of] [the specified face]; otherwise, <c>false</c>.</returns>
 public override bool IsNewMemberOf(PolygonalFace face)
 {
     if (Tolerance.IsPracticallySame(0.0))
     {
         Tolerance = Constants.ErrorForFaceInSurface;
     }
     if (Faces.Contains(face))
     {
         return(false);
     }
     if (!face.Normal.Dot(Normal).IsPracticallySame(1.0, Tolerance))
     {
         return(false);
     }
     //Return true if all the vertices are within the tolerance
     //Note that the Dot term and distance to origin, must have the same sign,
     //so there is no additional need moth absolute value methods.
     return(face.Vertices.All(v => Normal.Dot(v.Coordinates).IsPracticallySame(DistanceToOrigin, Tolerance)));
 }
Пример #4
0
 /// <summary>
 ///     Determines whether [is new member of] [the specified face].
 /// </summary>
 /// <param name="face">The face.</param>
 /// <returns><c>true</c> if [is new member of] [the specified face]; otherwise, <c>false</c>.</returns>
 public override bool IsNewMemberOf(PolygonalFace face)
 {
     if (Faces.Contains(face))
     {
         return(false);
     }
     if (Math.Abs(face.Normal.dotProduct(Axis, 3)) > Constants.ErrorForFaceInSurface)
     {
         return(false);
     }
     foreach (var v in face.Vertices)
     {
         if (Math.Abs(MiscFunctions.DistancePointToLine(v.Position, Anchor, Axis) - Radius) >
             Constants.ErrorForFaceInSurface * Radius)
         {
             return(false);
         }
     }
     return(true);
 }
Пример #5
0
 /// <summary>
 ///     Checks if the face is a member of the sphere
 /// </summary>
 /// <param name="face">The face.</param>
 /// <returns>Boolean.</returns>
 public override bool IsNewMemberOf(PolygonalFace face)
 {
     if (Faces.Contains(face))
     {
         return(false);
     }
     if (Math.Abs(face.Normal.dotProduct(face.Center.subtract(Center, 3)) - 1) >
         Constants.ErrorForFaceInSurface)
     {
         return(false);
     }
     foreach (var v in face.Vertices)
     {
         if (Math.Abs(MiscFunctions.DistancePointToPoint(v.Position, Center) - Radius) >
             Constants.ErrorForFaceInSurface * Radius)
         {
             return(false);
         }
     }
     return(true);
 }
Пример #6
0
 /// <summary>
 ///     Checks if the face is a member of the sphere
 /// </summary>
 /// <param name="face">The face.</param>
 /// <returns>Boolean.</returns>
 public override bool IsNewMemberOf(PolygonalFace face)
 {
     if (Faces.Contains(face))
     {
         return(false);
     }
     if (Math.Abs(face.Normal.Dot(face.Center - Center) - 1) >
         Constants.ErrorForFaceInSurface)
     {
         return(false);
     }
     foreach (var v in face.Vertices)
     {
         if (Math.Abs(v.Coordinates.Distance(Center) - Radius) >
             Constants.ErrorForFaceInSurface * Radius)
         {
             return(false);
         }
     }
     return(true);
 }
 /// <summary>
 /// Determines whether two faces are adjacent.
 /// </summary>
 /// <param name="face">The other face to test.</param>
 /// <returns><c>true</c> if <paramref name="face" /> and this are adjacent; otherwise, <c>false</c>.</returns>
 public Boolean IsAdjacent(IFace face)
 {
     return(Faces.Contains(face));
 }