reimplemented using robust-orientation