some geometric class methods ported from js/rb