C# PerpendicularTo to get results strictly in XY plane

Hi there,
I am using Vector3d method PerpendicularTo in order to determine perp direction.
My problem is planar in XY plane, however when I iterate this method over set of 4 planar lines in 2 cases I get perp direction in XY plane, and in other 2 cases YZ plane…

Any solution how to get results always in XY plane?


Solved it:
vec = Vector3d.CrossProduct(dirVector, Vector3d.ZAxis);