geometric.go and matrix.go ported, not tested