# Help Debugging a Transformation

I’ve stared at this for an hour and I can’t see where I’m going wrong. I am trying to rotate a point on a plane with pts(0) being my start point, pt(1) rotated 180 deg, pt(2) rotated 90 deg, and pt(3) rotated 270 deg. The center of rotation is the center of the plane.

``````'get an xform to translate between world and plane points
xform = Rhino.XformChangeBasis(Rhino.WorldXYPlane, plane)
'take the world coordinate and translate to planar coordinate
pts(0) = Rhino.PointTransform(Rhino.PlaneClosestPoint(plane, crvMidPt, True), xform)
``````

I was expecting the z of pts(0) to be zero, but it is near zero, i.e. -1.2E-15.

``````'create a rotation xform to rotate 90 deg around the plane's center, with the z vector as the rotation axis
xform = Rhino.XformRotation(90, plane(0), plane(3))

pts(2) = Rhino.PointTransform(pts(0), xform) '90 deg from pt(0)
pts(1) = Rhino.PointTransform(pts(2), xform) '180 deg from pt(0)
pts(3) = Rhino.PointTransform(pts(1), xform) '270 deg from pt(0)
``````

The magnitude of z’s value for pts(1) through pt(3) ranges from .08 to 1.77. Why is z changing at all? If pt(0) was (0,1,0), I would expect my remaining values to be (0,-1,0), (-1,0,0), and (1,0,0).

Edit Another 30 minutes and I got it:

``````xform = Rhino.XformRotation(90, Array(0, 0, 1), Array(0, 0, 0))
``````

I needed to rotate around 0, not the world point definition of the plane’s center.