Boost-Geometry-Utils
view release on metacpan or search on metacpan
src/boost/polygon/rectangle_concept.hpp view on Meta::CPAN
return rectangle;
}
struct y_r_convolve2 : gtl_yes {};
// convolve with point
template <typename rectangle_type, typename point_type>
typename enable_if< typename gtl_and_3<y_r_convolve2, typename is_mutable_rectangle_concept<typename geometry_concept<rectangle_type>::type>::type,
typename is_point_concept<typename geometry_concept<point_type>::type>::type>::type,
rectangle_type>::type &
convolve(rectangle_type& rectangle, const point_type& convolution_point) {
typename rectangle_interval_type<rectangle_type>::type ivl = horizontal(rectangle);
horizontal(rectangle, convolve(ivl, x(convolution_point)));
ivl = vertical(rectangle);
vertical(rectangle, convolve(ivl, y(convolution_point)));
return rectangle;
}
struct y_r_deconvolve2 : gtl_yes {};
// deconvolve with point
template <typename rectangle_type, typename point_type>
typename enable_if<
typename gtl_and_3<y_r_deconvolve2, typename is_mutable_rectangle_concept<typename geometry_concept<rectangle_type>::type>::type,
typename is_point_concept<typename geometry_concept<point_type>::type>::type>::type, rectangle_type>::type &
deconvolve(rectangle_type& rectangle, const point_type& convolution_point) {
typename rectangle_interval_type<rectangle_type>::type ivl = horizontal(rectangle);
horizontal(rectangle, deconvolve(ivl, x(convolution_point)));
ivl = vertical(rectangle);
vertical(rectangle, deconvolve(ivl, y(convolution_point)));
return rectangle;
}
struct y_r_delta : gtl_yes {};
// get the magnitude of the interval range depending on orient
template <typename rectangle_type>
typename enable_if< typename gtl_and<y_r_delta, typename is_rectangle_concept<typename geometry_concept<rectangle_type>::type>::type>::type,
typename rectangle_difference_type<rectangle_type>::type>::type
delta(const rectangle_type& rectangle, orientation_2d orient) {
return delta(get(rectangle, orient));
}
struct y_r_area : gtl_yes {};
// get the area of the rectangle
template <typename rectangle_type>
typename enable_if< typename gtl_and<y_r_area, typename is_rectangle_concept<typename geometry_concept<rectangle_type>::type>::type>::type,
typename coordinate_traits<typename rectangle_coordinate_type<rectangle_type>::type>::manhattan_area_type>::type
area(const rectangle_type& rectangle) {
typedef typename coordinate_traits<typename rectangle_coordinate_type<rectangle_type>::type>::manhattan_area_type area_type;
return (area_type)delta(rectangle, HORIZONTAL) * (area_type)delta(rectangle, VERTICAL);
}
struct y_r_go : gtl_yes {};
// returns the orientation of the longest side
template <typename rectangle_type>
typename enable_if<typename gtl_and<y_r_go, typename is_rectangle_concept<typename geometry_concept<rectangle_type>::type>::type>::type,
orientation_2d>::type
guess_orientation(const rectangle_type& rectangle) {
return delta(rectangle, HORIZONTAL) >= delta(rectangle, VERTICAL) ?
HORIZONTAL : VERTICAL;
}
struct y_r_half_p : gtl_yes {};
// get the half perimeter of the rectangle
template <typename rectangle_type>
typename enable_if< typename gtl_and<y_r_half_p, typename is_rectangle_concept<typename geometry_concept<rectangle_type>::type>::type>::type,
typename rectangle_difference_type<rectangle_type>::type>::type
half_perimeter(const rectangle_type& rectangle) {
return delta(rectangle, HORIZONTAL) + delta(rectangle, VERTICAL);
}
struct y_r_perimeter : gtl_yes {};
// get the perimeter of the rectangle
template <typename rectangle_type>
typename enable_if< typename gtl_and<y_r_perimeter, typename is_rectangle_concept<typename geometry_concept<rectangle_type>::type>::type>::type,
typename rectangle_difference_type<rectangle_type>::type>::type
perimeter(const rectangle_type& rectangle) {
return 2 * half_perimeter(rectangle);
}
struct y_r_intersects : gtl_yes {};
// check if Rectangle b intersects `this` Rectangle
// [in] b Rectangle that will be checked
// [in] considerTouch If true, return true even if b touches the boundary
// [ret] . true if `t` intersects b
template <typename rectangle_type_1, typename rectangle_type_2>
typename enable_if<
typename gtl_and_3<y_r_intersects, typename is_rectangle_concept<typename geometry_concept<rectangle_type_1>::type>::type,
typename is_rectangle_concept<typename geometry_concept<rectangle_type_2>::type>::type>::type,
bool>::type
intersects(const rectangle_type_1& rectangle, const rectangle_type_2& b, bool consider_touch = true) {
return intersects(horizontal(rectangle), horizontal(b), consider_touch) &&
intersects(vertical(rectangle), vertical(b), consider_touch);
}
struct y_r_b_intersect : gtl_yes {};
// Check if boundaries of Rectangle b and `this` Rectangle intersect
// [in] b Rectangle that will be checked
// [in] considerTouch If true, return true even if p is on the foundary
// [ret] . true if `t` contains p
template <typename rectangle_type_1, typename rectangle_type_2>
typename enable_if<
typename gtl_and_3<y_r_b_intersect, typename is_rectangle_concept<typename geometry_concept<rectangle_type_1>::type>::type,
typename is_rectangle_concept<typename geometry_concept<rectangle_type_2>::type>::type>::type,
bool>::type
boundaries_intersect(const rectangle_type_1& rectangle, const rectangle_type_2& b,
bool consider_touch = true) {
return (intersects(rectangle, b, consider_touch) &&
!(contains(rectangle, b, !consider_touch)) &&
!(contains(b, rectangle, !consider_touch)));
}
struct y_r_b_abuts : gtl_yes {};
( run in 0.689 second using v1.01-cache-2.11-cpan-39bf76dae61 )