Try component_instance.transformation.to_a - it returns a 16 item array that has all of the stuff you need like scaling rotation and location. You really need to use all of these to compare distances between components etc as they might be rotated, scaled etc as well as moved in XYZ...
The 16 item array has items 12,13,14 == x,y,z
.