Skip to content

Commit 6e1cf3b

Browse files
committed
Addressed Co-Pilot reviews
1 parent 2af5bfc commit 6e1cf3b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

components/ColorAnalyzer/src/ColorPaletteSampler/ColorPaletteSampler.DBScan.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private bool CreateCluster(int originIndex, out Vector3 centroid, out float weig
5959
return true;
6060
}
6161

62-
private void ExpandCluster(Queue<int> seeds, out Vector3 centroid, out float weight)
62+
private void ExpandCluster(Queue<int> seeds, out Vector3 centroid, out float weight)
6363
{
6464
weight = 0;
6565
centroid = Vector3.Zero;
@@ -95,6 +95,10 @@ private Queue<int> GetSeeds(int originIndex, out bool isCore)
9595
{
9696
var origin = Points[originIndex];
9797

98+
// NOTE: Seeding could be done using a spatial data structure to improve traversal
99+
// speeds. However currently DBSCAN is run after KMeans with a maximum of 8 points.
100+
// There is no need.
101+
98102
var seeds = new Queue<int>();
99103
for (int i = 0; i < Points.Length; i++)
100104
{
@@ -107,7 +111,7 @@ private Queue<int> GetSeeds(int originIndex, out bool isCore)
107111
return seeds;
108112
}
109113

110-
private DBScan(Span<Vector3> points, Span<float> weights, double epsilon, int minPoints)
114+
private DBScan(Span<Vector3> points, Span<float> weights, float epsilon, int minPoints)
111115
{
112116
Points = points;
113117
Weights = weights;
@@ -141,15 +145,15 @@ private DBScan(Span<Vector3> points, Span<float> weights, double epsilon, int mi
141145
public int[] PointClusterIds { get; }
142146

143147
/// <summary>
144-
/// Gets epsilon squared. Where epslion is the max distance to consider two points connected.
148+
/// Gets epsilon squared. Where epsilon is the max distance to consider two points connected.
145149
/// </summary>
146150
/// <remarks>
147151
/// This is cached as epsilon squared to skip a sqrt operation when comparing distances to epsilon.
148152
/// </remarks>
149153
public double Epsilon2 { get; }
150154

151155
/// <summary>
152-
/// Gets the miniumum number of points required to make a core point.
156+
/// Gets the minimum number of points required to make a core point.
153157
/// </summary>
154158
public int MinPoints { get; }
155159
}

0 commit comments

Comments
 (0)