lib: implement perpendicular