Each environment (sketch, Drawing, Model, Assembly ) has its own coordinate system. Transformation is like a math coefficient which you can get from API and use to multiply on coordinates.
So if needed to measure the distance between two entities from the same environments then they have the the same coordinate system and transformation is not needed.
If the entities are located in assembly but belong to different components then we should get the coefficient for the first component COEFF_1 and multiply to the entity of the first component. Then get the coefficient for the second component COEFF_2 and multiply to the entity of the second component. Now these multiplied entities have the same coordinate system (the same as active assembly) and we can get the correct distance between them and also between each component and some assembly point (like center of mass )
More info on how the transformation is calculate could be found everywhere (e.g. http://web.iitd.ac.in/~hegde/cad/lecture/L6_3dtrans.pdf )
Hope this can help as a start
This is a great start. It appears that when a point is selected within an Assembly model that SW returns the point from the perspective of the individual model. So, if the points are selected between two parts within an assembly. It makes sense that the the two points need to be "transformed" into the assembly coordinate system. Is this correct?
One thing that confuses me is that if two points are selected on the same part within an Assembly model, and a line is to be drawin between the two selected points, the two points need to be transformed if a proper line is to be drawn between them, even though they are on the same model. What this implies is that when placing point (and lines) into an Assembly model they will be placed within Assembly coordinate system. So, even though two points are selected within the same model part, and relative to each other they are correct, when they are "drawn" they must be translated to the assembly coordinate system. Is this correct?
If this is all correct, it is not clear why SW would not just automatically provide Assembly coordinate points when working within an Assembly model? Any ideas why SW didn't do this?
If you take a random point, it surely belongs to a sketch. If the sketch is from a part, then the default coordinates are with regards to the part's coordinate system. So it depends on the perspective. To compute the transformation, simply express it in the matrix form. SolidWorks' coordinate system are cartesian(x, y, and z) so the transform matrix is rather not difficult to understand. Actually SolidWorks has an interface for handling matrix data.
Take a look at this:
2015 SOLIDWORKS API Help - IMathTransform Interface Members