Angle

com.phasmidsoftware.number.algebra.eager.Angle
See theAngle companion class
object Angle

The Angle companion object contains utility methods, predefined constants, and typeclass instances for working with angles. Angles are represented using rational numbers and comply with the algebraic structure of a commutative group.

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Angle.type

Members list

Grouped members

Typeclass Instances

Provides an implicit conversion instance for transforming an Angle type into another Angle type.

Provides an implicit conversion instance for transforming an Angle type into another Angle type.

This given instance conforms to the Convertible typeclass, offering a no-op conversion logic where the input Angle instance is returned as is without any transformation.

Attributes

See also

Convertible

Provides an implicit conversion instance for transforming an Angle type into another Angle type.

Provides an implicit conversion instance for transforming an Angle type into another Angle type.

This given instance conforms to the Convertible typeclass, offering a no-op conversion logic where the input Angle instance is returned as is without any transformation.

Attributes

See also

Convertible

Supertypes
class Object
trait Matchable
class Any
Self type

Type members

Classlikes

object angleIsCommutativeGroup extends AdditiveCommutativeGroup[Angle]

Provides an implicit implementation of a commutative group for the Angle type, supporting group operations such as identity, combination, and inversion.

Provides an implicit implementation of a commutative group for the Angle type, supporting group operations such as identity, combination, and inversion.

This allows Angle objects to adhere to the algebraic structure of a commutative group, where the combine operation is associative and commutative, an identity element exists, and each element has an additive inverse.

Attributes

Supertypes
trait AdditiveCommutativeGroup[Angle]
trait AdditiveCommutativeMonoid[Angle]
trait AdditiveCommutativeSemigroup[Angle]
trait AdditiveGroup[Angle]
trait AdditiveMonoid[Angle]
trait AdditiveSemigroup[Angle]
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type

Provides a Convertible instance to allow transformations from Real to Angle.

Provides a Convertible instance to allow transformations from Real to Angle.

This implementation leverages the convert function to create a new Angle instance using a Real value. The conversion relies on the asDouble method of the Real type to extract its numeric representation before constructing the Angle.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Value members

Concrete methods

def apply(value: Value): Angle

Converts a Value into an Angle instance based on its structure.

Converts a Value into an Angle instance based on its structure.

Value parameters

value

the input Value which may represent different numeric types; Right(x) is treated as a whole number, Left(Right(x)) is treated as a rational number, Left(Left(Some(x))) is treated as a real number, and Left(Left(None)) represents an invalid or undefined angle.

Attributes

Returns

an Angle instance corresponding to the structure of the input Value; returns Angle.nan if the input represents an undefined value.

def apply(x: Int): Angle

Converts the given integer value to an Angle instance.

Converts the given integer value to an Angle instance.

Value parameters

x

the input integer value to be converted into an angle

Attributes

Returns

an Angle instance corresponding to the given integer value

def apply(x: Long): Angle

Converts the given long value to an Angle instance.

Converts the given long value to an Angle instance.

Value parameters

x

the input long value to be converted into an angle

Attributes

Returns

an Angle instance corresponding to the given long value

def apply(rational: Rational): Angle

Converts the given rational value into an Angle.

Converts the given rational value into an Angle.

Value parameters

rational

the Rational value representing the input to be converted into an Angle

Attributes

Returns

an Angle instance corresponding to the given Rational value

def apply(r: Number): Angle

Converts the given rational number to an Angle instance by performing modulation and necessary computations. CONSIDER whether we really need this method. The Angle class already has a normalize method that performs modulation and other necessary computations.

Converts the given rational number to an Angle instance by performing modulation and necessary computations. CONSIDER whether we really need this method. The Angle class already has a normalize method that performs modulation and other necessary computations.

Value parameters

r

the input RationalNumber representing the rational value to be converted into an angle

Attributes

Returns

an Angle instance corresponding to the given rational value

Creates an Angle instance based on the input Structure value.

Creates an Angle instance based on the input Structure value.

Converts the input Structure into an Angle, handling various types of numerical structures. If the input is already an Angle, or if the type is unsupported, an exception is thrown.

Value parameters

s

the input Structure to be converted into an Angle; can represent a whole number, rational number, or real number. Passing an existing Angle or unsupported type results in an exception.

Attributes

Returns

an Angle instance corresponding to the input Structure value

Note

Throws com.phasmidsoftware.number.algebra.util.AlgebraException if the input is already an Angle or is of an unsupported type

def degrees(x: Number): Angle

Converts the given numeric value to an Angle instance represented in degrees.

Converts the given numeric value to an Angle instance represented in degrees.

Value parameters

x

the numeric input value to be converted into an angle in degrees

Attributes

Returns

an Angle instance corresponding to the given numeric value in degrees

def degrees(x: Value): Angle

Converts a Value into an Angle represented as degrees. CONSIDER invoking degrees(Number) instead.

Converts a Value into an Angle represented as degrees. CONSIDER invoking degrees(Number) instead.

Value parameters

x

the input Value to be converted to an angle in degrees; the type of value can represent various numeric structures such as whole numbers, rational numbers, or real numbers.

Attributes

Returns

an Angle instance representing the given Value in degrees.

def degrees(x: Int): Angle

Converts the given integer to an Angle instance represented in degrees.

Converts the given integer to an Angle instance represented in degrees.

Value parameters

x

the integer value to be converted into an angle in degrees

Attributes

Returns

an Angle instance corresponding to the given integer value in degrees

Concrete fields

val negPi: Angle
val pi: Angle

Represents an angle equivalent to mathematical π radians.

Represents an angle equivalent to mathematical π radians.

The value pi is an instance of the Angle class initialized with the RationalNumber.one, which corresponds to the rational representation of π in the specific context of the Angle implementation.

Attributes

val piBy2: Angle

Represents an angle equivalent to π/2 radians.

Represents an angle equivalent to π/2 radians.

The value piBy2 is a constant instance of the Angle class initialized using a RationalNumber constructed with a value of 1/2. This corresponds to π/2 radians in mathematical terms.

Attributes

val piBy3: Angle
val piBy4: Angle
val r180: Rational
val twoPi: Angle
val zero: Angle

Represents the additive identity for angles.

Represents the additive identity for angles.

This value denotes an angle of zero radians, serving as the identity element in the group structure of angles. It is constructed using the Angle companion object initialized with the additive identity of RationalNumber.

Attributes

val 𝛑: Angle

Alias for the pi value, representing an angle equivalent to mathematical π radians.

Alias for the pi value, representing an angle equivalent to mathematical π radians.

This value is a symbolic representation of π radians, reused from the Angle.pi value. It is denoted by the Greek mathematical symbol 𝛑 and can be used interchangeably with pi.

Attributes

Givens

Givens

Provides a Convertible instance to allow transformations from Real to Angle.

Provides a Convertible instance to allow transformations from Real to Angle.

This implementation leverages the convert function to create a new Angle instance using a Real value. The conversion relies on the asDouble method of the Real type to extract its numeric representation before constructing the Angle.

Attributes

Provides a DyadicOperator instance for the type Angle.

Provides a DyadicOperator instance for the type Angle.

This implementation defines a binary operation (op) that operates on two angles and applies a user-defined function f to the inputs. The resulting computation is encapsulated in a Try to handle potential failures.

Attributes

Returns

A DyadicOperator[Angle] instance that allows performing binary operations on Angle values using a function f.

given given_Eq_Angle: Eq[Angle]

Provides an instance of equality comparison (Eq) for the Angle type.

Provides an instance of equality comparison (Eq) for the Angle type.

Compares two Angle instances for equivalence based on their internal equality logic. The method delegates to the eqv method of one Angle instance and processes the result. If the equivalence check returns None, the method defaults to false.

Attributes

Returns

an Eq[Angle] instance that defines equality behavior for Angle

Provides an instance of FuzzyEq[Angle] that defines fuzzy equality for angles.

Provides an instance of FuzzyEq[Angle] that defines fuzzy equality for angles.

Fuzzy equality is determined by checking if two angles are exactly equal (===) or approximately equal based on a given probability p.

Attributes

Returns

an instance of FuzzyEq[Angle] that implements fuzzy equality logic for comparing Angle values.

Implicits

Implicits

implicit val showAngle: Show[Angle]

Provides an implicit Show instance for the Angle class, enabling conversion of an Angle instance to a string representation using its render method.

Provides an implicit Show instance for the Angle class, enabling conversion of an Angle instance to a string representation using its render method.

This allows the Angle class to integrate seamlessly with libraries or frameworks requiring a Show typeclass instance for displaying or logging purposes.

Attributes