Port _KPolygon to Scala