MCPcopy Create free account
hub / github.com/comaps/comaps / CalcTransform

Method CalcTransform

libs/geometry/screenbase.cpp:240–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240ScreenBase::MatrixT ScreenBase::CalcTransform(m2::PointD const & oldPt1, m2::PointD const & oldPt2,
241 m2::PointD const & newPt1, m2::PointD const & newPt2, bool allowRotate,
242 bool allowScale)
243{
244 double const s = allowScale ? newPt1.Length(newPt2) / oldPt1.Length(oldPt2) : 1.0;
245 double const a = allowRotate ? ang::AngleTo(newPt1, newPt2) - ang::AngleTo(oldPt1, oldPt2) : 0.0;
246
247 MatrixT m =
248 math::Shift(math::Scale(math::Rotate(math::Shift(math::Identity<double, 3>(), -oldPt1.x, -oldPt1.y), a), s, s),
249 newPt1.x, newPt1.y);
250 return m;
251}
252
253void ScreenBase::SetGtoPMatrix(MatrixT const & m)
254{

Callers

nothing calls this directly

Calls 5

AngleToFunction · 0.85
ScaleFunction · 0.85
ShiftFunction · 0.70
RotateFunction · 0.70
LengthMethod · 0.45

Tested by

no test coverage detected