`p0` may not be an instance of a `Cartesian2`. Can we check if the `z` property is present? Then use `Cartesian3` methods otherwise use `Cartesian2` methods. That way it will work for object literals.