headsUp clarification

As far as i understood,

headsUp (NodePath const other, Point3 const point, Vec3 const up) 

will orient the nodepath such that its Y axis will be towards “point” and Z axis towards “up”. Then, if i try to headsup the nodepath towards its own Y and Z axis, it should not make any changes in its orientation at all. But, this is not being the case. As i run the following code, the HPR of nodepath seems to get changed.

import direct.directbase.DirectStart
from panda3d.core import *

nodePath = base.render.attachNewNode("SomeNode")
nodePath.setHpr(157.856, 39.9825, -14.654)

pointAtYDirection = base.render.getRelativePoint(nodePath, Point3(0,1,0))
vectorAtZDirection = base.render.getRelativeVector(nodePath, Point3(0,0,1))

nodePath.headsUp(base.render, pointAtYDirection, vectorAtZDirection)


#Output is LVecBase3f(134.802, 42.1528, 0.610864)

Hope i will get some headsup from expert.

My main attempt was to orient a model such that it wont change its forward direction as it moves along some planes keeping its head up along the plane/surface normal. Since above headsUp is not working as i expected, i tried a different approach. This is working for me for the time being.

import direct.directbase.DirectStart
from panda3d.core import *

def orientToThis(nodePath, normal):
    newZVect = nodePath.getRelativeVector(base.render, normal)

    presentZ = Vec3(0,0,1)
    presentX = Vec3(1,0,0)
    presentY = Vec3(0,1,0)

    newZVectProjectYZ = Vec3(0, newZVect[1], newZVect[2])
    pitchChangeKeepingXFixed = presentZ.signedAngleDeg(newZVectProjectYZ, presentX)
    nodePath.setP(nodePath, pitchChangeKeepingXFixed)
    newZVectProjectXZ = Vec3(newZVect[0], 0, newZVect[2])
    rollChangeKeepingYFixed = presentZ.signedAngleDeg(newZVectProjectXZ, presentY)
    nodePath.setR(nodePath, rollChangeKeepingYFixed)

    print("Hpr of nodepath is {0}".format(nodePath.getHpr()))

nodePath = base.render.attachNewNode("SomeNode")
normal = Vec3(.1,.2,.3)

attempt = 2
for i in range(2*attempt):
    orientToThis(nodePath, normal)