if point.y == self.top_right.y {
// top
BoundingBoxTopBottomEdge::Top
} else if point.y == -self.top_right.y {
BoundingBoxTopBottomEdge::Bottom
} else {
BoundingBoxTopBottomEdge::None
}
relies on mirrored coordinates around the origin (0,0)
point.y == -self.top_right.y
The simplest solution would be to add a private centered_bounding_box-variable to the VoronoiBuilder.
Center arbitrary bounding_box by subtracting BoundingBox.center() from every site
Use this centered centered_bounding_box in all calculations (which is the current working state)
Reapply shift back to every obtained vertex/centerpoint
However, this is problematic, if users can access the algorithm directly, without using VoronoiBuilder, because they could supply noncentered boxes instead which results in something like this:
25 different Voronoi-Diagrams with different Bounding boxes.
The blue cross is the world origin,
and the red dots in the 3 quadrants (right-up, right-down, left-down) are sites for which no Voronoi-Diagram could be generated
Hello,
The Voronoi-algorithm for example uses
BoundingBox::is_inside()
which only works for centered boxes.
Similarily
which_edge()
relies on mirrored coordinates around the origin
(0,0)
The simplest solution would be to add a private
centered_bounding_box
-variable to the VoronoiBuilder.bounding_box
by subtractingBoundingBox.center()
from everysite
centered_bounding_box
in all calculations (which is the current working state)shift
back to every obtainedvertex
/centerpoint
However, this is problematic, if users can access the algorithm directly, without using VoronoiBuilder, because they could supply noncentered boxes instead which results in something like this:
25 different Voronoi-Diagrams with different Bounding boxes.
The blue cross is the world origin,
and the red dots in the 3 quadrants (right-up, right-down, left-down) are sites for which no Voronoi-Diagram could be generated