The easierst way to create a Physical Value is to use the Extension Methods for a double. The Extension Method creates a new instance of the generic type PhysicalValue<T>.
using IMaverick.Physics;
var meter = new PhysicalValue<Length>(2.5, Length.Meter);
var kg = new PhysicalValue<Weight>(23.2, Weight.Kilogram);
Member | Description |
Unit | Returns the unit class used by the Physical Value. e.g. Length.Meter |
UnitString | Returns the SI unit symbol as string. e.g. m |
Value | Returns the value of the Physical Value. e.g. 2.5 |
EqualsApproximately | Used to compare two Physical Values with a tolernce. e.g. 2.0.m().EqualsApproximately(1.98.m(), 0.05.m()) |
ScaleTo() | Scales a Physical Value to a specific unit. e.g. 200.0.m().ScaleTo(Length.Kilometer) |
ToDefault() | Scales a Physical Value to the default SI unit. e.g. 0.2.km().ToDefault() //The Physical Value has now the Value 200 and the Unit Length.Meter |
ToString() | ToString is overloaded, that it return the value and the unit symbol. e.g. 200 m |
Unit Group | Units |
Acceleration | MeterPerSecond |
Angle | Degree, Radian, Grade, Brad |
AngularVelocity | DegreePerSecond, RadianPerSecond, RotationsPerMinute, RotationsPerSecond |
Current | Ampere, Kiloampere, Milliampere, Microampere |
Frequency | Hertz, Kilohertz, Megahertz, Gigahertz, Decihertz, Centihertz, Millihertz, Microhertz |
Length | Meter, Kilometer, Decimeter, Centimeter, Millimeter, Micrometer |
Power | Newton |
Pressure | Pascal, Kilopascal, Hectopascal, Bar, Millibar |
Temperature | Kelvin, Celsius, Fahrenheit |
Time | Second, Millisecond, Microsecond, Minute, Hour, Day, Month, Year |
Torque | Newtonmeter |
Velocity | MeterPerSecond, CentimeterPerSecond, KilometerPerHour, MilesPerHour |
Voltage | Volt, Kilovolt, Millivolt, Microvolt |
Weight | Gram, Kilogram, Ton, Milligram, Microgram |