1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

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,11 +85,20 @@ 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]; DrawnLine completedLine = currentLines[lineId];
currentLines.Remove(lineId); currentLines.Remove(lineId);
int originalPointCount = completedLine.Points.Count;
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>