Zone

@Serializable
data class Zone(val corner1: Translation2d, val corner2: Translation2d, val tag: String, val displayName: String)

A rectangular bound that defines a specific zone with a purpose.

Zones are stored as two points, and are strictly rectangular. The tag of a zone denotes its purpose, while the display name (which should be unique) exists to differentiate zones for the user.

The coordinate system used by this class is the same as Translation2d, where x is "forward" and y is "sideways." More specifically, the positive x-axis points away from the driver wall, and the positive y-axis points perpendicularly left.

Zones also support serialization with kotlinx.serialization

Author

Matthew Clark

See also

Translation2d

Constructors

Link copied to clipboard
constructor(x1: Double, y1: Double, x2: Double, y2: Double, tag: String, displayName: String)

Creates a zone with rectangular bounds defined by opposite corners at points (x1, y1) and (x2, y2).

constructor(x1: Measure<Distance>, y1: Measure<Distance>, x2: Measure<Distance>, y2: Measure<Distance>, tag: String, displayName: String)

Creates a zone with rectangular bounds defined by opposite corners at points (x1, y1) and (x2, y2).

constructor(corner1: Translation2d, corner2: Translation2d, tag: String, displayName: String)

Creates a zone with two given opposite corners and bounds made from them.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val bottomLeft: Translation2d

The position of the bottom left corner of this zone

Link copied to clipboard
val bottomRight: Translation2d

The position of the bottom right corner of this zone

Link copied to clipboard

The x-coordinate of the bottom bound of this zone

Link copied to clipboard
@Serializable(with = Translation2dSerializer::class)
val corner1: Translation2d

The first corner of the rectangular bound of this zone.

Link copied to clipboard
@Serializable(with = Translation2dSerializer::class)
val corner2: Translation2d

The second corner of the rectangular bound of this zone.

Link copied to clipboard

A unique display name to differentiate this zone from possible similar ones for the user.

Link copied to clipboard

The y-coordinate of the left bound of this zone

Link copied to clipboard

The y-coordinate of the right bound of this zone

Link copied to clipboard
val tag: String

A short tag to denote this zone's purpose.

Link copied to clipboard
val topLeft: Translation2d

The position of the top left corner of this zone

Link copied to clipboard
val topRight: Translation2d

The position of the top right corner of this zone

Link copied to clipboard

The x-coordinate of the top bound of this zone

Functions

Link copied to clipboard
operator fun contains(point: Translation2d): Boolean

Checks if a Translation2d (a point) is contained within the rectangular bounding provided by this zone.

Checks if a point described by two given doubles is contained within the rectangular bounding provided by this zone.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String

Returns the display name of this zone. For its descriptive tag, see tag