Distance by local axis

Is it real to check distance from one object to other by using local axis?
For example :
I have object Cube and object Sphere
There is local axis X in object Cube so i want to know the distanse from center Cube to center Sphere by local axis X
So that value can be >=0 and <=0
Can someone help me?

from Mathutils import Vector, Matrix

objects = GameLogic.getCurrentScene().objects

cube = objects["OBCube"]
sphere = objects["OBSphere"]

dist, world, local = cube.getVectTo(sphere)
xdist = (Vector(local) * dist).x