add generic algorithm for computing segment-to-box distances:
the algorithm first checks the segment and the box for intersection,
then if no intersection is found, it returns the minimum distance
over all point-segment combinations from the two geometries; for
computing a point-box distance the algorithm either calls the default
point-box strategy, or calls the detail::distance::point_to_range
algorithm; this alternate segment-box distance computation algorithm
is currently used in unit tests of segment-box distances to verify
results with the cartesian-specific approach
move the free function and reverse dispatch in algorithms/distance/interface.hpp
move the details of the implementation in algorithms/distance/implementation.hpp
keep only these two headers in algorithms/distance.hpp
move the free function and reverse dispatch in algorithms/distance/interface.hpp
move the details of the implementation in algorithms/distance/implementation.hpp
keep only these two headers in algorithms/distance.hpp
Use less comparisions in equals(Seg,Seg) - suggested by Menelaos Karavelas
Add missing include to examples - caused by the recent change of the distance/rtree
Problem:
when p1 (2nd argument of apply) has float as coordinate type, then
the result of the differences u-p1 and w-p1 is a double (because
the calculation type is double), which then is implicitly converted
to float (because the result of the difference is implicitly
converted to the type of the second operand), which means that we
may loose precision.
Solution:
convert p1 to the correct point type (fp_point_type), and then
perform the subtractions (p1 is anyways converted later on, so
just do then conversion a bit earlier).
Note:
This problem was generated as a warning on VS2010, and also appears
as a warning in clang++ and g++ if the -Wconversion option is used.
This commit also adds the support for equals(Segment, Segment).
During the creation of the rtree all metrics are calculated for Segments viewed as bounding Boxes.
During the querying Segments are passed into the BG algorithms.
This commit also fixes a compilation error related to the calculation of the Box/Box intersection in the index::detail::intersection_content().
Add indexed_point_view<> which allows to see Boxes and Segments as one of the Points.
Move normalized_view<> to views/detail.
Add index::detail::bounded_view<> which allows to see simple Geometry e.g. a Segment as its bounding Geometry e.g. a Box.
TODO/RECONSIDER:
1. This commit adds return_ref_or_bounds() which returns const& for Points and Boxes and bounding Box view for Segment. The resulting object is then passed into various algorithms like covered_by() or within(). Whenever possible the algorithms should be implemented for the input parameters and the call to return_ref_or_bounds() removed.
2. It's possible that for Segments metrics (like the amount of overlap in the leaf node) could be calculated differently than for Boxes and naiive conversion to bounding Boxes is not fully correct.
3. The way how bounded_view<> works may be not correct for non-cartesian CS. Now, for Segments it just picks MIN and MAX coordinates on the fly which may not be ok e.g. for Segments defined in the spherical CS because of the "winding" of the coordinates.
quick fix: further specialize this specialization of intersection insert so that it works only for overlay_intersection;
problem and quick fix related to boost trac ticket #10019;