# triangulatePoints and undistortPoints

I need some help in understanding these two functions. So afaik, triangulatePoints takes in a pair of 2D Pixel coordinates from calibrated images, and returns the triangulated point in homogeneous coordinates. I know in general what homogenous coordinates are but I'm confused about the 4th element in the output, what does this scale factor refer to? After we divide all the coordinates by this last element this is supposed to be in euclidean coordinates, but what is the origin for this euclidean coordinate system? Is it the left camera which is usually taken as the origin in stereoCalibrate?

Also, what are the units of the coordinate system, is it the size of the checkerboard square?

In addition, I also do not understand why we need to undistortPoints and what does undistortPoints exactly give us. I am hoping to find all my answers here because I am unable to understand properly anything from similar questions asked on stack overflow regarding these functions and the documentation isn't very informative