created getPerpendicularComponent util function