abstract struct Number

Overview

The top-level number type.

Included Modules

Defined in:

geode/extensions/angles.cr
geode/extensions/matrices.cr
geode/extensions/number.cr
geode/extensions/vectors.cr

Instance Method Summary

Instance Method Detail

Scales a matrix by this amount.

5 * Matrix[[1, 2, 3], [4, 5, 6]] # => [[5, 10, 15], [20, 25, 30]]

[View source]

Scales a vector by this amount.

5 * Vector[2, 3, 4] # => (10, 15, 20)

[View source]
def degrees : Geode::Degrees #

Returns a Geode::Degrees of self degrees.

45.degrees # => 45°

See: Geode::Degrees


[View source]
def gradians : Geode::Gradians #

Returns a Geode::Gradians of self gradians.

100.gradians # => 100 grad

See: Geode::Gradians


[View source]
def inv #

Returns the inverse of this value.

2.inv    # => 0.5
0.25.inv # => 4.0

[View source]
def radians : Geode::Radians #

Returns a Geode::Radians of self radians.

Math::PI.radians # => 3.14 rad

See: Geode::Radians


[View source]
def to_degrees : Geode::Degrees #

Returns a Geode::Degrees of self radians.

(Math::PI / 4).to_degrees # => 45°

See: Geode::Degrees


[View source]
def to_gradians : Geode::Gradians #

Returns a Geode::Gradians of self radians.

(Math::PI / 4).to_gradians # => 100.0 grad

See: Geode::Gradians


[View source]
def to_radians : Geode::Radians #

Returns a Geode::Radians of self radians.

Math::PI.to_radians # => 3.14 rad

See: Geode::Radians


[View source]
def to_turns : Geode::Turns #

Returns a Geode::Turns of self radians.

(Math::PI / 4).to_turns # => 0.25 turns

See: Geode::Turns


[View source]
def turns : Geode::Turns #

Returns a Geode::Turns of self turns.

0.25.turns # => 0.25 turns

See: Geode::Turns


[View source]