Package

cwinter.codecraft.util

maths

Permalink

package maths

Visibility
  1. Public
  2. All

Type Members

  1. final case class Rectangle(xMin: Double, xMax: Double, yMin: Double, yMax: Double) extends Product with Serializable

    Permalink

    Defines an axis aligned rectangle positioned in 2D space.

    Defines an axis aligned rectangle positioned in 2D space.

    xMin

    The x coordinate for the left side of the rectangle.

    xMax

    The x coordinate for the right hand side of the rectangle.

    yMin

    The y coordinate of the bottom side of the rectangle.

    yMax

    The y coordinate of the top side of the rectangle.

    Annotations
    @JSExportAll()
  2. final case class Vector2(_x: Float, _y: Float) extends Product with Serializable

    Permalink

    Immutable 2D Vector.

    Immutable 2D Vector.

    There are two ways to create vectors: Vector2(x, y) will create a vector with components x and y and Vector2(a) will create a unit vector rotated by an angle of a radians. (In the JavaScript version, create vectors using Game.vector2(x, y).) Addition, subtraction, multiplication and division work as expected:

    >> 2 * Vector2(0.5, 0) + Vector2(0, 10) / 10 - Vector2(10, 0)
    res0: Vector2 = Vector2(-9, 1)

    If you are using Java, you can use the methods plus, times and minus in place of the symbolic operators.

    _x

    The x coordinate.

    _y

    The y coordinate.

    Annotations
    @JSExport()

Value Members

  1. object Vector2 extends Serializable

    Permalink

Ungrouped