p.inside(50,50) may be false due to a bug in
updateBounds().updateBounds() is called in method g()
of the following applet, but not in method f().
Workaround: reconstruct the polygon after the last addPoint:
p = new Polygon(p.xpoints, p.ypoints, p.npoints);