LaundrySorcery

Log | Files | Refs

commit fc9e838cfc3da77b71757927b32c2f68c90b5929
parent 6259e4757ec602642ab41aecedee22c0b8d2e956
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Sat, 30 Jun 2018 16:36:12 +0000

Return both cluster and minimum distance from the closest function

Diffstat:
src/laundryclustery.d | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/laundryclustery.d b/src/laundryclustery.d @@ -56,7 +56,7 @@ in{ assert(clusters.length>0); } out(res){ - assert(res!=null); + assert(res[0]!=null); } do{ Cluster *res; @@ -68,14 +68,14 @@ do{ mindist=dist; } } - return res; + return tuple(res,mindist); } /** * Adds the point p to the cluster whose mean is closest to it */ void addToClosest(Cluster[] clusters, Point p){ - closest(clusters,p).add(p); + closest(clusters,p)[0].add(p); } import std.random;