Beispiel #1
0
 /// <summary>
 /// The contour segment joining vertices A and B moving from A to B.  The constructed segment will
 /// map the arguemnt A to either this.A or this.B and map the argument B to the other member
 /// this.A or this.B such that dZ_dSinAB less or equal 0.0.  Thus, the segment A-->B is always
 /// compatible with a clockwise polygon (where Z is larger inside the polygon) and where A.Next is B
 /// and B.Prev is A.
 /// </summary>
 /// <param name="A">The starting vertex.</param>
 /// <param name="B">The ending vertex.</param>
 public ContourSegment(IsoContours Parent, ContourVertex A, ContourVertex B)
 {
     this.Parent = Parent;
     dx          = B.x - A.x;
     dy          = B.y - A.y;
     ds          = Math.Sqrt(dx * dx + dy * dy);
     dx_ds       = dx / ds;
     dy_ds       = dy / ds;
     dZ_dx       = 0.5 * (A.dZ_dx + B.dZ_dx);
     dZ_dy       = 0.5 * (A.dZ_dy + B.dZ_dy);
     dZ_dCosAB   = dZ_dx * dx_ds + dZ_dy * dy_ds;
     dZ_dSinAB   = -dZ_dx * dy_ds + dZ_dy * dx_ds;
     if (dZ_dSinAB <= 0.0)
     {
         this.A = A;
         this.B = B;
     }
     else
     {
         this.A    = B;
         this.B    = A;
         dx        = -dx;
         dy        = -dy;
         dx_ds     = -dx_ds;
         dy_ds     = -dy_ds;
         dZ_dx     = -dZ_dx;
         dZ_dy     = -dZ_dy;
         dZ_dCosAB = -dZ_dCosAB;
         dZ_dSinAB = -dZ_dSinAB;
     }
     this.Affinity = (1.0 + (A.dZ_dx * B.dZ_dx + A.dZ_dy * B.dZ_dy) / (A.dZ_dGradient * B.dZ_dGradient)) / ds;
     //this.Affinity = 1.0/ds;
 }
Beispiel #2
0
 public ContourVertex(IsoContours Parent)
 {
     this.Parent = Parent;
 }