struct Geode::Angle

Overview

The Angle struct represents a geometric angle. Basic arithmetic as well as trigonometric functions can be applied to it.

Included Modules

Defined in:

geode/angle.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(measure : Number::Primitive, unit : Symbol = :radians) #

Creates a new Angle.


[View source]

Instance Method Detail

def *(other : Number) #

Multiplies an angle's measure by the given scalar.


[View source]
def +(other : Angle) #

Adds the measures of two angles.


[View source]
def -(other : Angle) #

Subtracts the measure of one angle from another angle.


[View source]
def /(other : Number) #

Divides an angle's measure by the given scalar.


[View source]
def <=>(other : Angle) #

Compares the measures of two angles.


[View source]
def boundary? #

Returns whether or not the given angle lines on a quadrant boundary, i.e. whether the angle's measure is divisible by 1/2pi / 90 degrees.


[View source]
def cos #

Returns the cosine function of the angle.


[View source]
def cot #

Returns the cotangent function (inverse tangent) of the angle.


[View source]
def csc #

Returns the cosecant function (inverse sine) of the angle.


[View source]
def degrees #

Returns the angle's measure in degrees.


[View source]
def full? #

Returns whether or not the given angle represents a full circle, i.e. whether the angle's measure is divisible by 2pi / 360 degrees.


[View source]
def half? #

Returns whether or not the given angle represents a semi-circle, i.e. whether the angle's measure is divisible by pi / 180 degrees.


[View source]
def normalize #

Returns a new Angle with the measure restricted to the interval [0, 2pi) / [0, 360).


[View source]
def quadrant #

Returns which quadrant the angle lies in. If the angle lies on a quadrant boundary, it returns nil.


[View source]
def radians : Float32 | Float64 | Int128 | Int16 | Int32 | Int64 | Int8 | UInt128 | UInt16 | UInt32 | UInt64 | UInt8 #

Returns the angle's measure in radians.


[View source]
def reference #

Returns the reference angle, i.e. the smallest angle that the terminal side makes with the x-axis.


[View source]
def sec #

Returns the secant function (inverse cosine) of the angle.


[View source]
def sin #

Returns the sine function of the angle.


[View source]
def tan #

Returns the tangent function of the angle.


[View source]
def to_point(distance : Number = 1, center : Point = Point.new) #

Returns the Point that lies distance units away from the terminal side centered at center.


[View source]