1 package org.djunits.unit;
2
3 import org.djunits.quantity.Quantity;
4 import org.djunits.unit.scale.OffsetLinearScale;
5 import org.djunits.unit.si.SIPrefixes;
6 import org.djunits.unit.unitsystem.UnitSystem;
7
8
9
10
11
12
13
14
15
16
17
18
19 public class DirectionUnit extends AbsoluteLinearUnit<DirectionUnit, AngleUnit>
20 {
21
22 private static final long serialVersionUID = 20140607L;
23
24
25 public static final Quantity<DirectionUnit> BASE = new Quantity<>("Direction", "rad");
26
27
28 public static final DirectionUnit EAST_RADIAN =
29 new DirectionUnit().build(new AbsoluteLinearUnit.Builder<DirectionUnit, AngleUnit>().setQuantity(BASE)
30 .setId("rad(E)").setName("radians (East)").setDefaultDisplayAbbreviation("rad(E)")
31 .setDefaultTextualAbbreviation("rad(E)").setUnitSystem(UnitSystem.OTHER).setSiPrefixes(SIPrefixes.NONE, 1.0)
32 .setScale(new OffsetLinearScale(1.0, 0.0)).setRelativeUnit(AngleUnit.RADIAN));
33
34
35 public static final DirectionUnit DEFAULT = EAST_RADIAN;
36
37
38 public static final DirectionUnit EAST_DEGREE =
39 new DirectionUnit().build(new AbsoluteLinearUnit.Builder<DirectionUnit, AngleUnit>().setQuantity(BASE)
40 .setId("deg(E)").setName("degrees (East)").setDefaultDisplayAbbreviation("\u00b0(E)")
41 .setDefaultTextualAbbreviation("deg(E)").setUnitSystem(UnitSystem.OTHER).setSiPrefixes(SIPrefixes.NONE, 1.0)
42 .setScale(new OffsetLinearScale(Math.PI / 180.0, 0.0)).setRelativeUnit(AngleUnit.DEGREE));
43
44
45 public static final DirectionUnit NORTH_RADIAN =
46 new DirectionUnit().build(new AbsoluteLinearUnit.Builder<DirectionUnit, AngleUnit>().setQuantity(BASE)
47 .setId("rad(N)").setName("radians (North)").setDefaultDisplayAbbreviation("rad(N)")
48 .setDefaultTextualAbbreviation("rad(N)").setUnitSystem(UnitSystem.OTHER).setSiPrefixes(SIPrefixes.NONE, 1.0)
49 .setScale(new OffsetLinearScale(1.0, Math.PI / 2.0)).setRelativeUnit(AngleUnit.RADIAN));
50
51
52 public static final DirectionUnit NORTH_DEGREE =
53 new DirectionUnit().build(new AbsoluteLinearUnit.Builder<DirectionUnit, AngleUnit>().setQuantity(BASE)
54 .setId("deg(N)").setName("degrees (North)").setDefaultDisplayAbbreviation("\u00b0(N)")
55 .setDefaultTextualAbbreviation("deg(N)").setUnitSystem(UnitSystem.OTHER).setSiPrefixes(SIPrefixes.NONE, 1.0)
56 .setScale(new OffsetLinearScale(Math.PI / 180.0, 90.0)).setRelativeUnit(AngleUnit.DEGREE));
57
58 }