AngleUnit
Table of contents
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[T float64 | float32 | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](value T) AngleUnit
Creates angle unit with Degree
type
func Grad[T float64 | float32 | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](value T) AngleUnit
Creates angle unit with Gradian
type
func PiRad[T float64 | float32 | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](value T) AngleUnit
Creates angle unit with PiRadian
type
func Rad[T float64 | float32 | int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](value T) AngleUnit
Creates 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,
}
Related global functions
func StringToAngleUnit(value string) (AngleUnit, bool)
Converts the string argument to angle unit