struct

DataDungeon::Direction

Inherits JSON::Serializable < Struct < Value < Object

A direction in readable form, in quarter turns (1 = 90 degrees): side front or back, yaw toward the right (+1) or left (-1) on either face, pitch from above (+1) or below (-1), and for a view roll, the picture turned in its own plane (-2 to 2). A view is where the camera stands, in the thing's frame (z toward its front, x its right, y up); a light is where the light comes from, in the picture's frame (z toward the viewer, x right, y up). DataDungeon stores the unit vector, so neighbouring directions compare by a dot product with no seams; this is the form for people. A profile whose nose points left in the picture shows the thing's right side: yaw +1.

Constants

AROUND = ["front", "front-right", "right", "back-right", "back", "back-left", "left", "front-left"] of ::String

Eight directions around a thing, by azimuth from its front.

QUARTER = Math::PI / 2

Constructors

from(x : Float64, y : Float64, z : Float64, roll : Float64 = 0.0) : Direction

The readable form of a vector (made unit length first).

Source
new(side : String = "front", yaw : Float64 = 0.0, pitch : Float64 = 0.0, roll : Float64 = 0.0)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Class methods

name(x : Float64, y : Float64, z : Float64) : String
Source

A vector of length 1 in the same direction; a zero vector has none.

Source

Instance methods

name

Its name: one of eight directions around (back-left), with from-above or from-below nearer 45 degrees up or down than level, or top-down or bottom-up nearer the poles. Each name is the middle of its sector, where pictures asked for by name sit.

Source
pitch
Source
roll
Source
side
Source
vector
Source