- if (VectorIndex != VectorCount - 1) {\r
- Weight[M (VectorIndex, VectorIndex + 1)] = (DefaultType == Vector[VectorIndex].Type) ? 0 : 1;\r
- SetMem (&Weight[M (VectorIndex, VectorIndex + 2)], VectorCount - VectorIndex - 2, MAX_WEIGHT);\r
+ //\r
+ // Set mandatory weight between vectors to MAX_WEIGHT\r
+ //\r
+ SetMem (&Weight[M (VectorIndex, VectorIndex + 1)], VectorCount - VectorIndex - 1, MAX_WEIGHT);\r
+\r
+ // Final result looks like:\r
+ // 00 FF FF FF\r
+ // 00 00 FF FF\r
+ // 00 00 00 FF\r
+ // 00 00 00 00\r
+ }\r
+\r
+ //\r
+ // Set mandatory weight and optional weight for adjacent vertices\r
+ //\r
+ for (VectorIndex = 0; VectorIndex < VectorCount - 1; VectorIndex++) {\r
+ if (Vector[VectorIndex].Type != DefaultType) {\r
+ Weight[M (VectorIndex, VectorIndex + 1)] = 1;\r
+ Weight[O (VectorIndex, VectorIndex + 1)] = 0;\r
+ } else {\r
+ Weight[M (VectorIndex, VectorIndex + 1)] = 0;\r
+ Weight[O (VectorIndex, VectorIndex + 1)] = 1;\r