@dc42 I think I have a conceptual solution for my dilemma:
RRF right now (as of 3.4) as far I understood:
machine position [mm]
motor position [microsteps]
but I need to think, as for 5-axis PAX kinematics, in 3 layers:
machine position [mm] - that is what G-code states
motor position [mm] - that what motors have to do in [mm] after inverse kinematics calculated
motor steps [microsteps] - that's the actual steps to perform
Right now I do 2 & 3 in CartesianToMotorSteps(), which isn't ideal, and the trick with LimitPosition() as @JoergS5 mentioned to get start & end machine position helps a bit.
I think in the long term RRF might introduce the layer 2), and make a hard distinction of layer 1, 2 and 3.
The segmentation count and length in my opinion must be calculated from 2), and consider 3) as lower-bound. If segmentation is only calculated at 1) level, then the other involved motor moves as part of inverse kinematics cannot be determined or CartesianToMotorSteps() needs to be called (where inverse kinematics is calculated) but with motor steps given back that's not sufficient details or is it?
In a nutshell, machine movements do not reflect actual motor movements, no assumption can be made outside of Kinematics which motor actually have to move and how much (!!) - therefore such layer 2) might be worth to introduce in the long term, e.g. Kinematics::CalculateMotorPosition().
From top-down:
Gcodes::DoStraightMove(): Gcode positions in [mm]
Kinematics::LimitPosition()
Kinematics::CalculateMotorPosition() [new] transforming "tool or machine position" to "motor position" yet still in [mm], e.g. applying inverse kinematics, if not implemented, machine position [mm] => motor position [mm]
Kinematics::MotorPositionToMotorSteps() (formerly known as CartesianToMotorSteps()), calculating [mm] into [steps], if not implemented simply do motorPos[axis] * stepsPerMm[axis]
DDA::*(): deals with actual steps / time
or in short: MachinePosition[mm] -> MotorPosition[mm] -> MotorSteps[steps]
Anyway, these are my thoughts based on my limited comprehension of RRF.