Bounds

o1.world.Bounds
See theBounds companion object
final case class Bounds(left: Double, top: Double, width: Double, height: Double)

A Bounds represents the dimensions of a rectangular area in two-dimensional space.

Bounds objects are immutable. They assume a space in which x coordinates increase rightwards and y coordinates downwards.

This class has an alias in the top-level package o1, so it’s accessible to students simply via import o1.*.

Parameters

height

the height of the Bounds (the distance from its top edge to its bottom edge)

left

the x coordinate of the left edge of the Bounds

top

the y coordinate of the top edge of the Bounds

width

the width of the Bounds (the distance from its left edge to its right edge)

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Determines if the given pair of coordinates is within the bounds. For that to be the case, the given x needs to be between the left edge (inclusive) and the right edge (exclusive) and the given y needs to be betewen the top edge (inclusive) and the bottom edge (exclusive).

Determines if the given pair of coordinates is within the bounds. For that to be the case, the given x needs to be between the left edge (inclusive) and the right edge (exclusive) and the given y needs to be betewen the top edge (inclusive) and the bottom edge (exclusive).

Attributes

Determines if the given Pos is within the bounds. For that to be the case, the Pos object’s x needs to be between the left edge (inclusive) and the right edge (exclusive) and its y needs to be betewen the top edge (inclusive) and the bottom edge (exclusive).

Determines if the given Pos is within the bounds. For that to be the case, the Pos object’s x needs to be between the left edge (inclusive) and the right edge (exclusive) and its y needs to be betewen the top edge (inclusive) and the bottom edge (exclusive).

Attributes

override def toString: String

Returns a textual description of the bounds.

Returns a textual description of the bounds.

Attributes

Definition Classes
Any

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product

Concrete fields

lazy val bottom: Double

the y coordinate of the bottom edge of the Bounds

the y coordinate of the bottom edge of the Bounds

Attributes

lazy val pos: Pos

the coordinates of the top left-hand corner of the Bounds

the coordinates of the top left-hand corner of the Bounds

Attributes

lazy val right: Double

the x coordinate of the right edge of the Bounds

the x coordinate of the right edge of the Bounds

Attributes