
Geometry : 
Subject: [geometry] support for general dimensions in matrix_transformer
From: Tinko Bartels (tinkobartels_at_[hidden])
Date: 20190425 10:49:59
Hi,
sorry to bump my PR, here, but I'd love to see it in 1.71 (Of course I'd
also understand if there was a general reason not to provide this feature
in the library) and wondered if anybody had time to look at it and consider
it or the general idea?
The code is here https://github.com/boostorg/geometry/pull/584 (I improved
the formatting a little since the creation of the original PR).
Basically defines an ndimensional to mdimensional matrixtransformer type
that has an (m+1)x(n+1) qvm matrix as its internal representation and can
be constructed from arbitrary matrices that are compatible with qvm. This
is a generalization of the current matrix_transformer that supports 3d to
3d, 2d to 2d and 3d to 2d. The original interface is preserved almost
entirely and no existing testcase was broken. It does, however, change the
representation of the matrix_transformer<ct, 3, 2> to a 3x4 matrix (which
I'd argue to be the correct representation). This chance is publicly
visible.
This PR also allows composing matrix_transformers across dimensions (as
long as the math makes sense), like this
bg::strategy::transform::matrix_transformer<coordinate_type, 2, 2>
trans_composed(
trans32.matrix() * trans33.matrix() * trans43.matrix() *
scale44.matrix() * trans24.matrix()
);
Where trans24 is a matrix_transformer<ct, 2, 4> and so on. Currently only
matrix_transformers of the same type (same dimensions) can be combined that
way.
I'd also be very happy to rework the code if it falls short of meeting the
Boost.Geometry coding standards and if you're ok with the general idea but
not with my implementation.
Kind regards,
Tinko Bartels
Geometry list run by mateusz at loskot.net