Space

object Space

Module that contains the space-related concepts.

class Object
trait Matchable
class Any
Space.type

Type members

Classlikes

case class Point2D(x: Int, y: Int)

Model a Point in a 2D Space.

Model a Point in a 2D Space.

Value parameters:
x

the x coordinate

y

the Y coordinate

Companion:
object
object Point2D
Companion:
class

Types

type Distance = Double

Alias for modeling a Distance in a Space in a more declarative way.

Alias for modeling a Distance in a Space in a more declarative way.

Extensions

Extensions

extension (p: Point2D)
@targetName("product")
def *(other: Point2D): Point2D

Product operator.

Product operator.

Value parameters:
other

the other point involved in the operation

Returns:

the multiplication of the two points.

@targetName("plus")
def +(other: Point2D): Point2D

Plus operator.

Plus operator.

Value parameters:
other

the other point to sum with

Returns:

the sum of the two points.

@targetName("minus")
def -(other: Point2D): Point2D

Minus operator.

Minus operator.

Value parameters:
other

the other point involved in the operation

Returns:

the difference of the two points

def combine(other: Point2D)(f: (Int, Int) => Int): Point2D

General method to combine two Point2D.

General method to combine two Point2D.

Value parameters:
f

the function applied to both the coordinate of the point

other

the other point to combine with

Get the distance between the current and the provided point.

Get the distance between the current and the provided point.

Value parameters:
other

the point to witch compute the distance

Returns:

the distance from the point.