Wall

model.entities.Wall
See theWall companion object
case class Wall(id: String, position: Vector2D, width: Double, height: Double) extends Positioned, Sized, Collidable, SizeChangingEntity, Entity

Represents a wall entity that acts as a collision barrier in the

simulation.

Walls are static rectangular obstacles that can block movement and provide boundaries within the simulation space.They support dynamic resizing and participate in the collision detection system .

Value parameters

height

the height of the wall in simulation units

id

unique identifier for this wall instance

position

the 2D coordinates of the wall 's top -left corner

width

the width of the wall in simulation units

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Entity
trait Collidable
trait Sized
trait Positioned
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def withHeight(newHeight: Double): this.type

Creates a copy of this entity with a new height.

Creates a copy of this entity with a new height.

Value parameters

newHeight

the new height value

Attributes

Returns

a new instance with the updated height

def withSize(newWidth: Double, newHeight: Double): this.type

Creates a copy of this entity with new dimensions.

Creates a copy of this entity with new dimensions.

Value parameters

newHeight

the new height value

newWidth

the new width value

Attributes

Returns

a new instance with the updated dimensions

def withWidth(newWidth: Double): this.type

Creates a copy of this entity with a new width.

Creates a copy of this entity with a new width.

Value parameters

newWidth

the new width value

Attributes

Returns

a new instance with the updated width

Inherited methods

Returns the bottom-left corner coordinates of this entity.

Returns the bottom-left corner coordinates of this entity.

Attributes

Returns

the position vector representing the bottom-left corner

Inherited from:
Collidable

Returns the bottom-right corner coordinates of this entity.

Returns the bottom-right corner coordinates of this entity.

Attributes

Returns

the position vector representing the bottom-right corner

Inherited from:
Collidable

Returns the center point of this entity's bounding rectangle.

Returns the center point of this entity's bounding rectangle.

Attributes

Returns

the position vector representing the geometric center

Inherited from:
Collidable
final def collidesWith[E <: Positioned](other: E): Boolean

Checks if this entity collides with another positioned entity.

Checks if this entity collides with another positioned entity.

Performs axis-aligned bounding box collision detection by checking for overlap on both horizontal and vertical axes. Both overlaps must be true for a collision to be detected.

Value parameters

other

the other positioned entity to check collision against

Attributes

Returns

true if the entities' bounding boxes overlap

Inherited from:
Collidable
final def contains(point: Vector2D): Boolean

Checks if a point is contained within this entity's bounds.

Checks if a point is contained within this entity's bounds.

Uses inclusive bounds checking on the left and top edges, and exclusive on the right and bottom edges to prevent edge overlap issues.

Value parameters

point

the 2D point to test for containment

Attributes

Returns

true if the point is within this entity's rectangular bounds

Inherited from:
Collidable
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Returns the top-left corner coordinates of this entity.

Returns the top-left corner coordinates of this entity.

Attributes

Returns

the position vector representing the top-left corner

Inherited from:
Collidable

Returns the top-right corner coordinates of this entity.

Returns the top-right corner coordinates of this entity.

Attributes

Returns

the position vector representing the top-right corner

Inherited from:
Collidable
def vertices: Seq[Vector2D]

Returns all four corner vertices of this entity's bounding rectangle.

Returns all four corner vertices of this entity's bounding rectangle.

Attributes

Returns

sequence containing topLeft, topRight, bottomLeft, and bottomRight vertices

Inherited from:
Collidable