Table of Contents

Struct Direction8

Namespace
PAC.Geometry

One of the following 8 directions:

  • Up
  • Down
  • Left
  • Right
  • Up-Right
  • Up-Left
  • Down-Right
  • Down-Left
public readonly struct Direction8 : IEquatable<Direction8>
Implements
Inherited Members
Extension Methods

Fields

All

All 8 directions.

public static readonly IEnumerable<Direction8> All

Field Value

IEnumerable<Direction8>

Diagonals

The directions UpRight, UpLeft, DownRight and DownLeft.

public static readonly IEnumerable<Direction8> Diagonals

Field Value

IEnumerable<Direction8>

Down

The direction (0, -1).

public static readonly Direction8 Down

Field Value

Direction8

DownLeft

The direction (-1, -1).

public static readonly Direction8 DownLeft

Field Value

Direction8

DownRight

The direction (1, -1).

public static readonly Direction8 DownRight

Field Value

Direction8

Left

The direction (-1, 0).

public static readonly Direction8 Left

Field Value

Direction8

Right

The direction (1, 0).

public static readonly Direction8 Right

Field Value

Direction8

Up

The direction (0, 1).

public static readonly Direction8 Up

Field Value

Direction8

UpDownLeftRight

The directions Up, Down, Left and Right.

public static readonly IEnumerable<Direction8> UpDownLeftRight

Field Value

IEnumerable<Direction8>

UpLeft

The direction (-1, 1).

public static readonly Direction8 UpLeft

Field Value

Direction8

UpRight

The direction (1, 1).

public static readonly Direction8 UpRight

Field Value

Direction8

Methods

Deconstruct(out int, out int)

public void Deconstruct(out int x, out int y)

Parameters

x int
y int

Equals(Direction8)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Direction8 other)

Parameters

other Direction8

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(Direction8, Direction8)

public static bool operator ==(Direction8 a, Direction8 b)

Parameters

a Direction8
b Direction8

Returns

bool

explicit operator Direction8(IntVector2)

Converts an IntVector2 with supNorm 1 into the corresponding Direction8.

public static explicit operator Direction8(IntVector2 direction)

Parameters

direction IntVector2

Returns

Direction8

Exceptions

ArgumentException

direction does not have supNorm 1.

implicit operator IntVector2(Direction8)

Converts the Direction8 into the corresponding IntVector2 with supNorm 1.

public static implicit operator IntVector2(Direction8 direction)

Parameters

direction Direction8

Returns

IntVector2

operator !=(Direction8, Direction8)

public static bool operator !=(Direction8 a, Direction8 b)

Parameters

a Direction8
b Direction8

Returns

bool

operator -(Direction8)

Returns the direction rotated 180 degrees.

public static Direction8 operator -(Direction8 direction)

Parameters

direction Direction8

Returns

Direction8