AngleUnit

Used to represent an angular values

type AngleUnit struct {
    Type  AngleUnitType
    Value float64
}
Member Type Description
Type AngleUnitType Type of the angle value, see below
Value float64 Value

where possible values for Type are:

Value Constant Description
0 Radian value field defines an angular value in radians
1 PiRadian value field defines an angular value in radians multiplied by π
2 Degree value field defines an angular value in degrees
3 Gradian value field defines an angular value in grades(gradians)
4 Turn value field defines an angular value in turns(1 turn == 360°)

In resource files AngleUnit values are represented by number values with specific suffix added, see below:

Suffix Resulting type of AngleUnit
deg Degree
° Degree
rad Radian
π PiRadian
pi PiRadian
grad Gradian
turn Turn

Examples: "45deg", "90°", "3rad", "2π", "0.5pi"

Create from source

func Deg(value float64) AngleUnit

Creates angle unit with Degree type

func Grad(value float64) AngleUnit

Create angle unit with Gradian type

func PiRad(value float64) AngleUnit

Create angle unit with PiRadian type

func Rad(value float64) AngleUnit

Create angle unit with Radian type

Create from resource

View {
    rotate = 45deg,
}
View {
    rotate = 45°,
}
View {
    rotate = 1rad,
}
View {
    rotate = 2π,
}
View {
    rotate = 0.5pi,
}
View {
    rotate = 1turn,
}
func StringToAngleUnit(value string) (AngleUnit, bool)

Converts the string argument to angle unit