convert Vec2 class from Java to Scala.