# Class VoronoiCell

java.lang.Object
com.treemap.swing.voronoi.VoronoiCell

All Implemented Interfaces:
  `Comparable<VoronoiCell>`

public class VoronoiCell extends Object implements Comparable<VoronoiCell>
A Voronoi Cell containing all related data and properties

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final VoronoiCell`
  `outsideDomainCell`
  `double`
  `weight`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VoronoiCell(double desiredNormalizedArea, MutableTreeMapNode child, MutableTreeMapNode parent)`
  Creates an instance of VoronoiCell.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addPixelForAreaAndCenterOfMassDetermination(int x, int y)`
  Updates the center of mass, area and bounds of the cell.
  `int`
  `compareTo(VoronoiCell o)`
  `Point2d`
  `getCenterOfMass()`
  Returns the center of mass.
  `MutableTreeMapNode`
  `getChild()`
  Get the assigned child node.
  `int`
  `getCurrentArea()`
  Returns the curent area of the cell in pixels.
  `double`
  `getCurrentNormalizedArea()`
  Gets the normalized area of the cell which is its area devided by the area of the parent cell or shape which contains it.
  `double`
  `getDesiredNormalizedArea()`
  Returns the desired area of the cell in pixels.
  `double`
  `getErrorAbsolute()`
  Returns the absolute value (i.e.
  `MutableTreeMapNode`
  `getParent()`
  `com.macrofocus.geom.Polygon`
  `getPolygon()`
  Returns the polygon outline shape of the cell which is the original unsmooth version of its shape.
  `Point2d`
  `getPosition()`
  Returns the center position of the cell in pixels.
  `double`
  `getWeight()`
  Returns the current wieght of the cell.
  `void`
  `resetCellShapeData()`
  Resets center of mass, area and bounds of the cell.
  `void`
  `scale(double scale)`
  Scales the cell (e.g.
  `void`
  `set(VoronoiCell cell)`
  Assign the field value of another cell to this cell.
  `void`
  `setCurrentNormalizedArea(double currentNormalizedArea)`
  Sets the normalized area of the cell which is its area devided by the area of the parent cell or shape which contains it.
  `void`
  `setErrorAbsolute(double errorAbsolute)`
  Sets the absolute value (i.e.
  `void`
  `setLineSegments(List<LineSegment> lineSegments)`
  Sets the line segments of a cell.
  `void`
  `setPolygon(com.macrofocus.geom.Polygon polygon)`
  Sets the polygon outline shape of the cell which is the original unsmooth version of its shape.
  `void`
  `setPosition(int x, int y)`
  Sets the center position of the cell in pixels.
  `void`
  `setPosition(Point2d position)`
  Sets the center position of the cell in pixels.
  `void`
  `setWeight(double weight)`
  Sets the weight of the cell.
  `String`
  `toString()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### weight

    public double weight

  - ### outsideDomainCell

    public static final VoronoiCell outsideDomainCell

- ## Constructor Details

  - ### VoronoiCell

    public VoronoiCell(double desiredNormalizedArea, MutableTreeMapNode child, MutableTreeMapNode parent)
    Creates an instance of VoronoiCell.
    Parameters:
      `desiredNormalizedArea` - normalize desired area. Desired area divided by the area of the containing cell or shape.
      `child` - representing child node
      `parent` -

- ## Method Details

  - ### scale

    public void scale(double scale)
    Scales the cell (e.g. for placing it in a scaled diagram)
    Parameters:
      `scale` - scale factor

  - ### getCurrentArea

    public int getCurrentArea()
    Returns the curent area of the cell in pixels.
    Returns:
      current area in pixels

  - ### getDesiredNormalizedArea

    public double getDesiredNormalizedArea()
    Returns the desired area of the cell in pixels.
    Returns:
      desired area in pixels

  - ### getPosition

    public Point2d getPosition()
    Returns the center position of the cell in pixels.
    Returns:
      center position in pixels

  - ### getWeight

    public double getWeight()
    Returns the current wieght of the cell.
    Returns:
      current weight

  - ### setPosition

    public void setPosition(int x, int y)
    Sets the center position of the cell in pixels.
    Parameters:
      `x` - x-coordinate in pixels
      `y` - y-coordinate in pixels

  - ### setPosition

    public void setPosition(Point2d position)
    Sets the center position of the cell in pixels.
    Parameters:
      `position` - center position of the cell in pixels

  - ### setWeight

    public void setWeight(double weight)
    Sets the weight of the cell.
    Parameters:
      `weight` - the new weight

  - ### setCurrentNormalizedArea

    public void setCurrentNormalizedArea(double currentNormalizedArea)
    Sets the normalized area of the cell which is its area devided by the area of the parent cell or shape which contains it.
    Parameters:
      `currentNormalizedArea` - normalized area: area of the cell devided by the area of the parent cell/shape

  - ### getCurrentNormalizedArea

    public double getCurrentNormalizedArea()
    Gets the normalized area of the cell which is its area devided by the area of the parent cell or shape which contains it.
    Returns:
      normalized area: area of the cell devided by the area of the parent cell/shape

  - ### addPixelForAreaAndCenterOfMassDetermination

    public void addPixelForAreaAndCenterOfMassDetermination(int x, int y)
    Updates the center of mass, area and bounds of the cell. Call this function to gradually update the center of mass, area and bounds while assigning new pixels to the cell.
    Parameters:
      `x` - x-coordinate of a new pixel (in pixels)
      `y` - y-coordinate of a new pixel (in pixels)

  - ### resetCellShapeData

    public void resetCellShapeData()
    Resets center of mass, area and bounds of the cell.

  - ### getCenterOfMass

    public Point2d getCenterOfMass()
    Returns the center of mass.
    Returns:
      center of mass in pixels

  - ### getChild

    public MutableTreeMapNode getChild()
    Get the assigned child node.
    Returns:
      the assigned child node

  - ### set

    public void set(VoronoiCell cell)
    Assign the field value of another cell to this cell.
    Parameters:
      `cell` - a VoronoiCell whose field values are assigned to this cell

  - ### setErrorAbsolute

    public void setErrorAbsolute(double errorAbsolute)
    Sets the absolute value (i.e. removed sign) of the current area error devided by the containing parent cell or shape area.
    Parameters:
      `errorAbsolute` - absolute value (i.e. removed sign) of the current area error devided by the containing parent cell or shape area

  - ### getErrorAbsolute

    public double getErrorAbsolute()
    Returns the absolute value (i.e. removed sign) of the current area error devided by the containing parent cell or shape area.
    Returns:
      absolute value (i.e. removed sign) of the current area error devided by the containing parent cell or shape area

  - ### setLineSegments

    public void setLineSegments(List<LineSegment> lineSegments)
    Sets the line segments of a cell. Line segments: Outline segments of a cell. A segment defines a curved or straight segment of the outline of the cell which connects to corners (vertices).
    Parameters:
      `lineSegments` - outline segments of a cell. A segment defines a curved or straight segment of the outline of the cell which connects to corners (vertices)

  - ### setPolygon

    public void setPolygon(com.macrofocus.geom.Polygon polygon)
    Sets the polygon outline shape of the cell which is the original unsmooth version of its shape. Th Polygon is mainly used for debugging, to compare the original unsmooth shape with the smoothed one.
    Parameters:
      `polygon` - polygon outline shape of the cell

  - ### getPolygon

    public com.macrofocus.geom.Polygon getPolygon()
    Returns the polygon outline shape of the cell which is the original unsmooth version of its shape. Th Polygon is mainly used for debugging, to compare the original unsmooth shape with the smoothed one.
    Returns:
      polygon outline shape of the cell

  - ### compareTo

    public int compareTo(VoronoiCell o)
    Specified by:
      `compareTo` in interface `Comparable<VoronoiCell>`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### getParent

    public MutableTreeMapNode getParent()