use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class SamplingBasedSplitStrategy method preprocessSamples.
/**
* Preprocess the samples
* @param splitDimension
* @param coveringBox
* @return
*/
private List<Double> preprocessSamples(final int splitDimension, final BoundingBox coveringBox) {
final List<Double> pointSamples = new ArrayList<>();
for (final BoundingBox sampleBox : samples) {
// Add the begin and end pos to the lists, if the begin / end is in the
// covering box
final DoubleInterval tupleInterval = sampleBox.getIntervalForDimension(splitDimension);
final DoubleInterval groupInterval = coveringBox.getIntervalForDimension(splitDimension);
if (groupInterval.isPointIncluded(tupleInterval.getBegin())) {
pointSamples.add(tupleInterval.getBegin());
}
if (groupInterval.isPointIncluded(tupleInterval.getEnd())) {
pointSamples.add(tupleInterval.getEnd());
}
}
logger.info("Samples list has a size of {}, usable elements {}", samples.size(), pointSamples.size());
return pointSamples;
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class SimpleSplitStrategy method getSplitPoint.
/**
* Perform a split of the given distribution region
*/
@Override
public double getSplitPoint(final int splitDimension, final BoundingBox coveringBox) {
// Split region
final DoubleInterval interval = coveringBox.getIntervalForDimension(splitDimension);
logger.info("Split at dimension:" + splitDimension + " interval: " + interval);
return interval.getMidpoint();
}
use of org.bboxdb.commons.math.DoubleInterval in project bboxdb by jnidzwetzki.
the class QuadtreeSpacePartitioner method generateIntervalLists.
/**
* Generate the interval lists
* @param box
* @param list1
* @param list2
*/
private void generateIntervalLists(final BoundingBox box, final List<DoubleInterval> list1, final List<DoubleInterval> list2) {
for (int dimension = 0; dimension < box.getDimension(); dimension++) {
final DoubleInterval interval = box.getIntervalForDimension(dimension);
final double midpoint = interval.getMidpoint();
final DoubleInterval interval1 = interval.splitAndGetLeftPart(midpoint, false);
list1.add(interval1);
final DoubleInterval interval2 = interval.splitAndGetRightPart(midpoint, true);
list2.add(interval2);
}
}
Aggregations