How can i create function to find Angle between vector by use 3D position of each joint

I can only create angle between vector from 2D position but in 3D position it must have some function to find skeleton in z-plane
How ever I have some example from c# but I need to how to write this function by using nuitrack module?

private static Skeleton GetPrimarySkeleton(Skeleton[] skeletons)
{
Skeleton skeleton = null;
if (skeletons != null)
{
// if skeletons exits in the frame
for (int i = 0; i < skeletons.Length; i++)
{
if (skeletons[i].TrackingState == SkeletonTrackingState.Tracked)
{
if (skeleton == null)
{
skeleton = skeletons[i];
}
else
{
if (skeleton.Position.Z > skeletons[i].Position.Z)
{
skeleton = skeletons[i];
}
}
}
}
}
return skeleton;
}

Hi!
Look at this: