コード例 #1
0
 private Contact ToContact(ContactElement contact)
 {
     return(new Contact
     {
         Company = contact.Company,
         Email = contact.Email,
         GivenName = contact.GivenName,
         Phone = contact.Phone,
         SurName = contact.SurName,
         Type = contact.Type
     });
 }
コード例 #2
0
ファイル: Slice.cs プロジェクト: mvelayati/TVGL
 private static int FindNextContactElement(List<ContactElement> contacts, ContactElement current,
     out Vertex connectingVertex)
 {
     // there are six cases to handle: A=ThroughFace (abbreviated as face below), ThroughVertex (vertex), CoincidentEdge (edge)
     // current contact element --> next contact element
     // 1. vertex --> face
     // 2. edge --> edge
     // 3. edge --> face
     // 4. face --> face
     // 5. face --> vertex
     // 6. face --> edge
     if (current is ThroughVertexContactElement)
     {
         // from a ThroughVertex, it only make sense that you could go to ThroughFace
         for (int i = 0; i < contacts.Count; i++)
         {
             var ce = contacts[i];
             if (ce is ThroughFaceContactElement && ce.SplitFaceNegative == current.SplitFacePositive)
             {
                 connectingVertex = ce.StartVertex;
                 return i;
             }
         }
         connectingVertex = null;
         return -1;
     }
     else if (current is CoincidentEdgeContactElement)
     {
         // from a Coincident Edge, the valid options are another CoincidentEdge or ThroughFace.
         // It doesn't make sense that you could go to a ThroughVertex (redundant with this)
         for (int i = 0; i < contacts.Count; i++)
         {
             var ce = contacts[i];
             if ((ce is CoincidentEdgeContactElement &&
                  ((CoincidentEdgeContactElement)ce).StartVertex ==
                  ((CoincidentEdgeContactElement)current).EndVertex)
                 || (ce is ThroughFaceContactElement
                     &&
                     ((ThroughFaceContactElement)ce).SplitFaceNegative.OtherVertex(
                         ((ThroughFaceContactElement)ce).SplitEdge) ==
                     ((CoincidentEdgeContactElement)current).EndVertex))
             {
                 connectingVertex = ce.StartVertex;
                 return i;
             }
         }
         connectingVertex = null;
         return -1;
     }
     // finally from ThroughFace, you can go to any of the other three.
     for (int i = 0; i < contacts.Count; i++)
     {
         var ce = contacts[i];
         if ((ce is CoincidentEdgeContactElement &&
             current.SplitFacePositive.OtherVertex(((ThroughFaceContactElement)current).SplitEdge) ==
             ((CoincidentEdgeContactElement)ce).StartVertex)
         ||
         (!(ce is CoincidentEdgeContactElement) && ce.SplitFaceNegative == current.SplitFacePositive))
         {
             connectingVertex = ce.StartVertex;
             return i;
         }
     }
     connectingVertex = null;
     return -1;
 }
コード例 #3
0
ファイル: Slice.cs プロジェクト: mvelayati/TVGL
 private static int FindPrevContactElement(List<ContactElement> contacts, ContactElement current,
     out Vertex connectingVertex)
 {
     // this is the same as "FindNextContactElement" except it works backwards. Some subtle differences
     // in the queries between the two functions
     if (current is ThroughVertexContactElement)
     {
         for (int i = 0; i < contacts.Count; i++)
         {
             var ce = contacts[i];
             if (ce is ThroughFaceContactElement && ce.SplitFacePositive == current.SplitFaceNegative)
             {
                 connectingVertex = ce.StartVertex;
                 return i;
             }
         }
         connectingVertex = null;
         return -1;
     }
     else if (current is CoincidentEdgeContactElement)
     {
         for (int i = 0; i < contacts.Count; i++)
         {
             var ce = contacts[i];
             if (ce is CoincidentEdgeContactElement &&
                 ((CoincidentEdgeContactElement)ce).EndVertex ==
                 ((CoincidentEdgeContactElement)current).StartVertex)
             {
                 connectingVertex = ((CoincidentEdgeContactElement)ce).EndVertex;
                 return i;
             }
             else if (ce is ThroughFaceContactElement
                      &&
                      ((ThroughFaceContactElement)ce).SplitFacePositive.OtherVertex(
                          ((ThroughFaceContactElement)ce).SplitEdge) ==
                      ((CoincidentEdgeContactElement)current).EndVertex)
             {
                 connectingVertex = ce.StartVertex;
                 return i;
             }
         }
         connectingVertex = null;
         return -1;
     }
     for (int i = 0; i < contacts.Count; i++)
     {
         var ce = contacts[i];
         if ((ce is CoincidentEdgeContactElement &&
             current.SplitFacePositive.OtherVertex(((ThroughFaceContactElement)current).SplitEdge) ==
             ((CoincidentEdgeContactElement)ce).EndVertex)
         ||
         (!(ce is CoincidentEdgeContactElement) && ce.SplitFacePositive == current.SplitFaceNegative))
         {
             connectingVertex = ce.StartVertex;
             return i;
         }
     }
     connectingVertex = null;
     return -1;
 }
コード例 #4
0
 private Contact ToContact(ContactElement contact)
 {
     return new Contact
     {
         Company = contact.Company,
         Email = contact.Email,
         GivenName = contact.GivenName,
         Phone = contact.Phone,
         SurName = contact.SurName,
         Type = contact.Type
     };
 }