Geometry

scalata.domain.util.Geometry
object Geometry

Lightweight 2-D integer geometry using an opaque type.

  • Point2D is represented as a tuple (x, y) but the tuple is hidden outside the module.
  • Convenience ops: Manhattan distance, 4-neighbour listing, axis-aligned range and vector addition.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Geometry.type

Members list

Type members

Classlikes

object Point2D

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Point2D.type

Types

opaque type Point2D

Extensions

Extensions

extension (p: Point2D)
def distanceTo(to: Point2D): Int

Manhattan distance to another point.

Manhattan distance to another point.

Attributes

def moveBy(delta: Point2D): Point2D

Translate the point by a delta vector.

Translate the point by a delta vector.

Attributes

def neighboursFiltered(f: Point2D => Boolean): List[Point2D]

Neighbours that satisfy a predicate.

Neighbours that satisfy a predicate.

Attributes

def rangeTo(dest: Point2D): List[Point2D]

All integer points in the axis-aligned rectangle from this to dest.

All integer points in the axis-aligned rectangle from this to dest.

Attributes

def x: Int
def y: Int