1
0
Fork 0

Finish line simplification support

This commit is contained in:
Starbeamrainbowlabs 2017-11-14 15:03:39 +00:00
parent d9ce6387a3
commit b35445fda9
4 changed files with 15 additions and 1193 deletions

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Nibriboard.RippleSpace; using Nibriboard.RippleSpace;
using Nibriboard.Utilities;
using SBRL.Utilities; using SBRL.Utilities;
namespace Nibriboard.Client namespace Nibriboard.Client
@ -84,10 +85,19 @@ namespace Nibriboard.Client
if(!currentLines.ContainsKey(lineId)) if(!currentLines.ContainsKey(lineId))
throw new KeyNotFoundException("Error: A line with that id wasn't found in this LineIncubator."); throw new KeyNotFoundException("Error: A line with that id wasn't found in this LineIncubator.");
Log.WriteLine("[LineIncubator] Completing line #{0}", lineId); DrawnLine completedLine = currentLines[lineId];
currentLines.Remove(lineId);
DrawnLine completedLine = currentLines[lineId]; int originalPointCount = completedLine.Points.Count;
currentLines.Remove(lineId); completedLine.Points = LineSimplifier.SimplifyLine(completedLine.Points, 6);
Log.WriteLine(
"[LineIncubator] [LineComplete] #{0}: {1} -> {2} points ({3:0.00}% reduction)",
lineId,
originalPointCount,
completedLine.Points.Count,
((float)completedLine.Points.Count / (float)originalPointCount) * 100f
);
return completedLine; return completedLine;
} }

View File

@ -180,7 +180,7 @@ class Pencil
*/ */
recalculateSimplifiedLine() recalculateSimplifiedLine()
{ {
this.currentSimplifiedLineSegments = simplify_line(this.currentLineSegments); this.currentSimplifiedLineSegments = simplify_line(this.currentLineSegments, 6);
} }
/** /**

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ namespace Nibriboard.RippleSpace
/// </summary> /// </summary>
Addition, Addition,
/// <summary> /// <summary>
/// Something was deleted form the chunk. /// Something was deleted from the chunk.
/// </summary> /// </summary>
Deletion, Deletion,
/// <summary> /// <summary>