Obtaining Spot from Point

Starting with a go.Point in document coordinates (one like 153, 57, for example), I need to get the correspondent go.Spot inside a Panel (from 0,0 to 1,1), How can I do this?

// given a Point p and Rect r in the same coordinate systems:
new go.Spot(Math.max(0, Math.min(1, (p.x-r.x) / (r.width || 1))),
            Math.max(0, Math.min(1, (p.y-r.y) / (r.height || 1))))