Remove offset before calculating distance. Define 'plane3' to BLI_math, since we often don't need the 4th component.