Chaining function calls via the dot operator is a very common thing to do in C++. Of course, you chain things because it's nice, and easier to read than nested function calls. The prototypical use case is matrix composition:
auto m = Matrix::Indentity().RotateX(145.0).RotateY(-90.0).Scale(2.0);
Which seems preferable to
auto m = Scale(RotateY(RotateX(Matrix::Identity, 145.0), -90.0), 2.0).
Usually, dot chaining is implemented by return *this
from Scale
, RotateX
, RotateY
, and having those functions be part of the Matrix
class. This is usually a brilliant way to work.