Robot inside or outside of an area

You should consider the functions pose_trans() and pose_inv().
Maybe this topic is useful to get the position of the TCP in respect to a feature coordinate.