7 private const int randomInitEveryNiterations = 5;
8 private int frameCounter = 0;
11 ComputeShader computeShader,
25 this.frameCounter = 0;
28 public override string name =>
"Knecht";
36 if (result.
converged ==
false ||
this.frameCounter == randomInitEveryNiterations)
38 this.DoExploration(clusteringTextures, result);
41 if (this.frameCounter == randomInitEveryNiterations)
43 this.frameCounter = 0;
48 private void DoExploration(
50 RunUntilConvergesResult currentResult
58 if (currentResult.clusterCenters.variance < newResult.clusterCenters.variance)
61 currentResult.clusterCenters.centers
Call Allocate before using and Dispose after using.
void SetClusterCenters(Vector4[] clusterCentersBufferData)
Reads the cluster centers data from the array and loads it into the ComputeBuffer.
void RandomizeClusterCenters()
DispatcherKnecht(ComputeShader computeShader, bool doRandomizeEmptyClusters, ClusteringRTsAndBuffers clusteringRTsAndBuffers)
override void RunClustering(ClusteringTextures clusteringTextures)
ClusteringRTsAndBuffers clusteringRTsAndBuffers
RunUntilConvergesResult RunUntilConverges(ClusteringTextures clusteringTextures)
bool doRandomizeEmptyClusters
Call Dispose after using.