-
Does boost::geometry supports something for mirroring geometries out-of-the-box? I cannot find something releted |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The algorithm boost::geometry::transform with a scale-strategy with a negative value for one of the dimensions might be what you are looking for. #include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
int main()
{
using namespace boost::geometry;
using namespace boost::geometry::strategy::transform;
using point_2d = model::d2::point_xy<double>;
point_2d p(2,5), pm;
scale_transformer<double, 2, 2> mirror(-1, 1);
transform(p, pm, mirror);
std::cout << wkt(pm) << "\n"; //POINT(-2 5)
return 0;
} More generally, with matrix_transformer you can have arbitrary affine transformations, this example shows how they can be used and chained: https://github.com/boostorg/geometry/blob/develop/example/06_b_transformation_example.cpp . Here you can see the definitions of various matrix transformers: . |
Beta Was this translation helpful? Give feedback.
The algorithm boost::geometry::transform with a scale-strategy with a negative value for one of the dimensions might be what you are looking for.
More generally, with matrix_transformer you can have arbitrary affine transformations, this example shows how they c…