72 int oldCount = oldPoints.Count();
73 int newCount = newPoints.Count();
78 array<int> removedIndices = {};
79 array<int> relatedIndices = {};
83 for (
int i; i < newCount; i += 2)
85 bool isRelated =
false;
87 for (; indexOld < oldCount; indexOld += 2)
89 if (newPoints[i] != oldPoints[indexOld] || newPoints[i + 1] != oldPoints[indexOld + 1])
91 removedIndices.Insert(indexOld * 0.5);
102 relatedIndices.Insert(i * 0.5);
105 if (indexOld < oldCount)
107 if (!relatedIndices.Contains(0))
108 relatedIndices.Insert(0);
110 if (!relatedIndices.Contains(newCount * 0.5 - 1))
111 relatedIndices.Insert(newCount * 0.5 - 1);
116 array<float> result = {};
117 foreach (
int removedIndex : removedIndices)
119 int floatIndex = removedIndex * 2;
123 oldPoints[oldCount - 2], oldPoints[oldCount - 1], oldPoints[0], oldPoints[1],
124 oldPoints[0], oldPoints[1], oldPoints[2], oldPoints[3],
127 else if (floatIndex == oldCount - 2)
130 oldPoints[oldCount - 4], oldPoints[oldCount - 3], oldPoints[oldCount - 2], oldPoints[oldCount - 1],
131 oldPoints[oldCount - 2], oldPoints[oldCount - 1], oldPoints[0], oldPoints[1],
137 oldPoints[floatIndex - 2], oldPoints[floatIndex - 1], oldPoints[floatIndex], oldPoints[floatIndex + 1],
138 oldPoints[floatIndex], oldPoints[floatIndex + 1], oldPoints[floatIndex + 2], oldPoints[floatIndex + 3],
142 foreach (
float value : tmp)
144 result.Insert(value);
150 foreach (
int relatedIndex : relatedIndices)
152 int floatIndex = relatedIndex * 2;
156 newPoints[newCount - 2], newPoints[newCount - 1], newPoints[0], newPoints[1],
157 newPoints[0], newPoints[1], newPoints[2], newPoints[3],
160 else if (floatIndex == newCount - 2)
163 newPoints[newCount - 4], newPoints[newCount - 3], newPoints[newCount - 2], newPoints[newCount - 1],
164 newPoints[newCount - 2], newPoints[newCount - 1], newPoints[0], newPoints[1],
170 newPoints[floatIndex - 2], newPoints[floatIndex - 1], newPoints[floatIndex], newPoints[floatIndex + 1],
171 newPoints[floatIndex], newPoints[floatIndex + 1], newPoints[floatIndex + 2], newPoints[floatIndex + 3],
175 foreach (
float value : tmp)
177 result.Insert(value);
190 int count = oldPoints.Count();
194 int lastIndex = count - 2;
196 float prevOldPoint[2];
197 float currOldPoint[2];
198 float nextOldPoint[2];
200 float prevNewPoint[2];
201 float currNewPoint[2];
202 float nextNewPoint[2];
205 array<float> result = {};
206 for (
int i; i < count; i += 2)
208 if (oldPoints[i] != newPoints[i] || newPoints[i + 1] != newPoints[i + 1])
210 currOldPoint = { oldPoints[i], oldPoints[i + 1] };
211 currNewPoint = { newPoints[i], newPoints[i + 1] };
215 prevOldPoint = { oldPoints[lastIndex], oldPoints[lastIndex + 1] };
216 nextOldPoint = { oldPoints[i + 2], oldPoints[i + 3] };
218 prevNewPoint = { newPoints[lastIndex], newPoints[lastIndex + 1] };
219 nextNewPoint = { newPoints[i + 2], newPoints[i + 3] };
221 else if (i == lastIndex)
223 prevOldPoint = { oldPoints[i - 2], oldPoints[i - 1] };
224 nextOldPoint = { oldPoints[0], oldPoints[1] };
226 prevNewPoint = { newPoints[i - 2], oldPoints[i - 1] };
227 nextNewPoint = { newPoints[0], oldPoints[1] };
231 prevOldPoint = { oldPoints[i - 2], oldPoints[i - 1] };
232 nextOldPoint = { oldPoints[i + 2], oldPoints[i + 3] };
234 prevNewPoint = { newPoints[i - 2], oldPoints[i - 1] };
235 nextNewPoint = { newPoints[i + 2], newPoints[i + 3] };
239 prevOldPoint[0], prevOldPoint[1], currOldPoint[0], currOldPoint[1],
240 nextOldPoint[0], nextOldPoint[1], currOldPoint[0], currOldPoint[1],
242 prevNewPoint[0], prevNewPoint[1], currNewPoint[0], currNewPoint[1],
243 nextNewPoint[0], nextNewPoint[1], currNewPoint[0], currNewPoint[1],
246 foreach (
float value : tmp)
248 result.Insert(value);
267 int newCount = newPoints.Count();
271 int oldCount = oldPoints.Count();
273 for (
int i; i < oldCount; i += 2)
275 if (oldPoints[i] != newPoints[i] || oldPoints[i + 1] != newPoints[i + 1])
282 bool isLastPoint =
false;
286 index = oldCount + 2;
289 float newPoint[2] = { newPoints[
index], newPoints[
index + 1] };
296 prevPoint = { oldPoints[oldCount - 2], oldPoints[oldCount - 1] };
297 nextPoint = { oldPoints[
index + 2], oldPoints[
index + 3] };
299 else if (isLastPoint)
301 prevPoint = { newPoints[
index - 2], oldPoints[
index - 1] };
302 nextPoint = { oldPoints[0], oldPoints[1] };
306 prevPoint = { oldPoints[
index - 2], oldPoints[
index - 1] };
307 nextPoint = { oldPoints[
index + 2], oldPoints[
index + 3] };
310 float oldPoint[2] = {
311 nextPoint[0] + 0.5 * (nextPoint[0] - prevPoint[0]),
312 nextPoint[1] + 0.5 * (nextPoint[1] - prevPoint[1]),
316 prevPoint[0], prevPoint[1], oldPoint[0], oldPoint[1],
317 nextPoint[0], nextPoint[1], oldPoint[0], oldPoint[1],
319 prevPoint[0], prevPoint[1], newPoint[0], newPoint[1],
320 nextPoint[0], nextPoint[1], newPoint[0], newPoint[1],
333 array<vector> segment;
334 for (
int i, count = allOutlinePoints.Count(); i < count; i += 4)
337 { allOutlinePoints[i], 0, allOutlinePoints[i + 1] },
338 { allOutlinePoints[i + 2], 0, allOutlinePoints[i + 3] },