How to properly point Sun?

I prepared a Cesium sandcastle example based on this answer from @FSimardGIS, but something is going wrong: only one of many rays correctly points to the Sun, the other appears random.

What’s wrong here?
I took the test coordinates from SunCalc library, but you can also insert data manually, using for example this site for calculations:

This is the source code from the other answer:

function CalcPosFromAltAzDist(startPoint, vectorPointing) {
  var ellipsoid = Cesium.Ellipsoid.WGS84;
  var ENU = new Cesium.Matrix4();
  var myX = vectorPointing.dist * Math.sin( * Math.PI / 180);
  var myY = vectorPointing.dist * Math.cos( * Math.PI / 180);
  var myZ = vectorPointing.dist * Math.sin(vectorPointing.alt * Math.PI / 180);
  var offset = new Cesium.Cartesian3(myX,myY,myZ);
  var finalPoint = Cesium.Matrix4.multiplyByPoint(ENU, offset, new Cesium.Cartesian3());
  return finalPoint;    

Call with:

vectorPointing= {"alt" : 30, "az" : 0};
startPoint= Cesium.Cartesian3.fromDegrees(290.6, -35.78);

You can also find the sun position with Cesium.Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame and input that as the other end of your polyline.

Thanks, this results in all lines correctly pointing to the Sun.
Does it exist a Cesium function to calculate altitude/azimuth of a body given its coordinates w.r.t. point on Earth surface? I wish to figure out why my algorithm is not working properly, as I want to track other objects than Sun.