O1Library Docs
Fall 2026
Docs API

# o1.world.objects

package o1.world.objects

## Members list

### Type members

#### Classlikes

object Anchor

This companion object of class `Anchor` contains a number of standard anchors (`TopLeft`, `Center`, etc.) and a class for creating anchors in a custom location.

This companion object of class `Anchor` contains a number of standard anchors (`TopLeft`, `Center`, etc.) and a class for creating anchors in a custom location.

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

## Attributes

See also

  HasAnchor

Companion
  trait
Supertypes
  class Object
  trait Matchable
  class Any
Self type
  Anchor.type

trait Anchor

An `Anchor` is a point where a two-dimensional object, such as a Pic, attaches to other such objects; you can also think of it as a “pin” that attaches a `Pic` to a background.

An `Anchor` is a point where a two-dimensional object, such as a Pic, attaches to other such objects; you can also think of it as a “pin” that attaches a `Pic` to a background.

For instance, a `Pic` may have its `Anchor` at its center; the `Pic` may then be attached to a larger image at that image’s `TopLeft` (another anchor), so that the center of the first `Pic` is located at the top left-hand corner of the second `Pic`.

The companion object of this class provides several standard `Anchor`s and a class `Anchor.Absolute` for creating new ones.

`Anchor` objects are immutable.

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

## Attributes

See also

  HasAnchor

Companion
  object
Supertypes
  class Object
  trait Matchable
  class Any
Known subtypes
  class Absolute
  object BottomCenter
  object BottomLeft
  object BottomRight
  object Center
  object CenterLeft
  object CenterRight
  object TopCenter
  object TopLeft
  object TopRight
  Show all

trait HasAnchor extends HasSize

A supertype for objects that have an anchoring point.

A supertype for objects that have an anchoring point.

## Attributes

Supertypes
  trait HasSize
  class Object
  trait Matchable
  class Any
Known subtypes
  trait HasEdges
  trait HasContainer
  trait ContainedObject
  trait MovingObjectInContainer

trait HasContainer extends HasEdges

A supertype for objects that take up a rectangular area and whose position may be constrained by a larger object around them.

A supertype for objects that take up a rectangular area and whose position may be constrained by a larger object around them.

## Attributes

Supertypes
  trait HasEdges
  trait HasAnchor
  trait HasSize
  trait HasPos
  class Object
  trait Matchable
  class Any
  Show all
Known subtypes
  trait ContainedObject
  trait MovingObjectInContainer

trait HasEdges extends HasPos, HasAnchor

A supertype for objects that take up a rectangular area and have an anchoring point. The object’s `pos` indicates the position of the anchoring point; the locations of its edges are determined relative to the anchor.

A supertype for objects that take up a rectangular area and have an anchoring point. The object’s `pos` indicates the position of the anchoring point; the locations of its edges are determined relative to the anchor.

## Attributes

Supertypes
  trait HasAnchor
  trait HasSize
  trait HasPos
  class Object
  trait Matchable
  class Any
  Show all
Known subtypes
  trait HasContainer
  trait ContainedObject
  trait MovingObjectInContainer

trait HasPos

A supertype for objects that have a location in two-dimensional space.

A supertype for objects that have a location in two-dimensional space.

## Attributes

Supertypes
  class Object
  trait Matchable
  class Any
Known subtypes
  trait HasEdges
  trait HasContainer
  trait ContainedObject
  trait MovingObjectInContainer
  trait HasVelocity
  trait MovingObject
  trait MutablePos
  Show all

trait HasSize

A supertype for objects that have a size: a width and a height.

A supertype for objects that have a size: a width and a height.

## Attributes

Supertypes
  class Object
  trait Matchable
  class Any
Known subtypes
  trait HasAnchor
  trait HasEdges
  trait HasContainer
  trait ContainedObject
  trait MovingObjectInContainer

trait HasVelocity extends HasPos

A supertype for objects that have a position and a velocity in two-dimensional space.

A supertype for objects that have a position and a velocity in two-dimensional space.

## Attributes

Supertypes
  trait HasPos
  class Object
  trait Matchable
  class Any
Known subtypes
  trait MovingObject
  trait MovingObjectInContainer

object mutable

This subpackage defines a few additional traits that extend the ones in of o1.world.objects. These traits provide additional convenience methods for working with mutable objects in two-dimensional space.

This subpackage defines a few additional traits that extend the ones in of o1.world.objects. These traits provide additional convenience methods for working with mutable objects in two-dimensional space.

NOTE TO STUDENTS: In this course, you don’t need to understand how this package works or can be used. That being said, some students may wish to experiment with some of its contents. Several of the traits in this package have aliases in the top-level package o1, so they are accessible to students simply via `import o1.*`.

## Attributes

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