Class CentroidCalculator

java.lang.Object
org.elasticsearch.lucene.spatial.CentroidCalculator

public class CentroidCalculator extends Object
This class keeps a running Kahan-sum of coordinates that are to be averaged in TriangleTreeWriter for use as the centroid of a shape.
  • Constructor Details

    • CentroidCalculator

      public CentroidCalculator()
  • Method Details

    • add

      public void add(Geometry geometry)
      Add a geometry to the calculator
      Parameters:
      geometry - the geometry to add
    • getX

      public double getX()
      Returns:
      the x-coordinate centroid
    • getY

      public double getY()
      Returns:
      the y-coordinate centroid
    • sumWeight

      public double sumWeight()
      Returns:
      the sum of all the weighted coordinates summed in the calculator
    • getDimensionalShapeType

      public DimensionalShapeType getDimensionalShapeType()
      Returns:
      the highest dimensional shape type summed in the calculator