ocvolume.vq
Class centroid

java.lang.Object
  |
  +--ocvolume.vq.point
        |
        +--ocvolume.vq.centroid

public class centroid
extends point

last updated on June 15, 2002
description: centroid of a codebook calls: point
called by: codebook
input: k-dimensional points
output: distortion measure


Field Summary
protected  double distortion
          distortion measure - sum of all points' distances from the centroid
protected  java.util.Vector pts
          stores the points that belong to this centroid or cell
protected  int total_pts
          total number of points that belong to this centroid or cell
 
Fields inherited from class ocvolume.vq.point
coordinates, dimension
 
Constructor Summary
centroid(double[] Co)
          constructor to create a centroid from input coordinates
calls: none
called by: codebook
 
Method Summary
 void add(point pt, double dist)
          add point to centroid's cell
calls: none
called by: codebook
 double getDistortion()
          returns the distortion measure of the current cell
calls: none
called by: codebook
 int getNumPts()
          returns the number of points in this cell
calls: none
called by: codebook
 point getPoint(int index)
          get a point at specified index
calls: none
called by: codebook
 void remove(point pt, double dist)
          removes a given point from the centroid's cell
calls: none
called by: codebook
 void update()
          update centroid by taking average of all points in the cell
calls: none
called by: codebook
 
Methods inherited from class ocvolume.vq.point
changeCo, equals, getAllCo, getCo, getDimension, setCo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

distortion

protected double distortion
distortion measure - sum of all points' distances from the centroid


pts

protected java.util.Vector pts
stores the points that belong to this centroid or cell


total_pts

protected int total_pts
total number of points that belong to this centroid or cell

Constructor Detail

centroid

public centroid(double[] Co)
constructor to create a centroid from input coordinates
calls: none
called by: codebook

Parameters:
Co - coordinates array
Method Detail

getPoint

public point getPoint(int index)
get a point at specified index
calls: none
called by: codebook

Parameters:
index - index number
Returns:
the point at the specified index

getNumPts

public int getNumPts()
returns the number of points in this cell
calls: none
called by: codebook

Returns:
number of points

remove

public void remove(point pt,
                   double dist)
removes a given point from the centroid's cell
calls: none
called by: codebook

Parameters:
pt - the point to be removed
dist - distance from the centroid

add

public void add(point pt,
                double dist)
add point to centroid's cell
calls: none
called by: codebook

Parameters:
pt - a point belonging to the centroid
dist - distance from the centroid

update

public void update()
update centroid by taking average of all points in the cell
calls: none
called by: codebook


getDistortion

public double getDistortion()
returns the distortion measure of the current cell
calls: none
called by: codebook

Returns:
distortion of current cell