enum Chem::Spatial::Direction

Overview

An enum that represents directions along the axes in 3D space.

Defined in:

chem/spatial/direction.cr

Enum Members

X = 0

Direction along the X axis

Y = 1

Direction along the Y axis

Z = 2

Direction along the Z axis

XY = 3

Direction along the X and Y axes

XZ = 4

Direction along the X and Z axes

YZ = 5

Direction along the Y and Z axes

XYZ = 6

Direction along the X, Y, and Z axes

Instance Method Summary

Instance Method Detail

def includes?(axis : self) : Bool #

Returns true if the direction includes the component axis, else false.

Direction::X.includes?(:x)    # => true
Direction::Y.includes?(:x)    # => false
Direction::XY.includes?(:x)   # => true
Direction::YZ.includes?(:x)   # => false
Direction::XYZ.includes?(:x)  # => true
Direction::XY.includes?(:xy)  # => true
Direction::X.includes?(:xy)   # => false
Direction::XY.includes?(:xy)  # => true
Direction::XZ.includes?(:xy)  # => false
Direction::XYZ.includes?(:xy) # => true

[View source]
def to_vector : Vec3 #

Returns the unit vector pointing towards this direction.

Direction::X.to_vector  # => Vec3[ 1  0  0 ]
Direction::Y.to_vector  # => Vec3[ 0  1  0 ]
Direction::XY.to_vector # => Vec3[ 0.7071068  0.7071068  0 ]

[View source]
def x? #

[View source]
def xy? #

[View source]
def xyz? #

[View source]
def xz? #

[View source]
def y? #

[View source]
def yz? #

[View source]
def z? #

[View source]