Port JavaPointMath to Scala