Question PlaneNode Normal

I am currently creating planes based on 3 control points as follows:

planeNode = slicer.mrmlScene.AddNewNodeByClass(“vtkMRMLMarkupsPlaneNode”, “myPlaneNode")

planeNode.SetPlaneType(2) # PlaneTypeThreePoints

planeNode.AddControlPoint(p1[0], p1[1], p1[2])

planeNode.AddControlPoint(p2[0], p2[1], p2[2])

planeNode.AddControlPoint(p3[0], p3[1], p3[2])

However, sometimes the normal points correctly following right hand rule of order of points

i.e. it matches the normal that I can compute in python:

n1 = np.cross(p2 - p1, p3 - p1) # Normal direction for the plane

but other times the normal is flipped.

I see I can also set the plane by normal as a solution, but I want to understand how the normal is assigned for the 3 point based plane method (does it follow the right hand rule based on order of control points or not?).

Thank you.

The code is opensource so you can check out the implementation:

HIH

Thank you!

That answers my question, the bug must be somewhere else on my end.

Best,

Eva