Module math

Class GenLloyd

java.lang.Object
de.grogra.math.GenLloyd

public class GenLloyd extends Object
GenLloyd Library - Implementation of Generalized Lloyd (also known as Linde-Buzo-Gray or LBG) algorithm
Author:
Markus Konrad <post@mkonrad.net>
  • Field Details

    • samplePoints

      protected List<Point3d> samplePoints
    • clusterPoints

      protected List<Point3d> clusterPoints
    • epsilon

      protected double epsilon
    • avgDistortion

      protected double avgDistortion
  • Constructor Details

    • GenLloyd

      public GenLloyd(List<Point3d> samplePoints)
      Create Generalized Lloyd object with an array of sample points
      Parameters:
      samplePoint3ds - 2-dimensional array of N sample points where each point has the same dimension K
    • GenLloyd

      public GenLloyd(Point3d[] samplePoints)
  • Method Details

    • getEpsilon

      public double getEpsilon()
      Return epsilon parameter (accuracy)
      Returns:
      epsilon parameter (accuracy)
    • setEpsilon

      public void setEpsilon(double epsilon)
      Set epsilon parameter (accuracy). Should be a small number 0.0 < epsilon < 0.1
      Parameters:
      epsilon - parameter (accuracy)
    • setSamplePoints

      public void setSamplePoints(List<Point3d> samplePoints)
      Set list of sample points
      Parameters:
      samplePoints -
    • getClusterPoints

      public List<Point3d> getClusterPoints(int numClusters)
      Get calculated cluster points. cluster points will be calculated and returned
      Parameters:
      numClusters - number of clusters that should be calculated. This should be a power of 2.
      Returns:
      calculated cluster points
    • calcClusters

      protected void calcClusters(int numClusters)
    • splitClusters

      protected int splitClusters()
    • initializeClusterPoint

      protected Point3d initializeClusterPoint(List<Point3d> pointsInCluster)
    • createNewClusterPoint

      protected Point3d createNewClusterPoint(Point3d clusterPoint3d, int epsilonFactor)