gentooboontoo / js-quantities

JavaScript library for quantity calculation and unit conversion
http://gentooboontoo.github.io/js-quantities/
MIT License
396 stars 102 forks source link

Torque #4

Closed evantandersen closed 10 years ago

evantandersen commented 10 years ago

There is currently no support for units of torque. Newton meters, pound feet, etc.

gentooboontoo commented 10 years ago

What do you mean exactly? Could you give me some example?

Quantities below seem to work as expected:

new Qty('12 N*m');
new Qty('12 pound ft');
evantandersen commented 10 years ago
(new Qty('12 pound ft')).to('N m')

Throws an exception.

rage-shadowman commented 10 years ago

pound*ft is not the same as foot-pound... try the unit "pound-force" or "lbf" instead

new Qty('12 lbf').to('N');
new Qty('12 lbf*ft').to('N*m');
gentooboontoo commented 10 years ago

As pointed out by @rage-shadowman, pounds are mass not force so as expected pound*feet cannot be converted to torque. Try to use SI units when unsure.

(new Qty('N*m')).toBase().units(); // => "kg*m2/s2"
(new Qty('lbs*ft')).toBase().units(); // => "kg*m"
(new Qty('lbf*ft')).toBase().units(); // => "kg*m2/s2"

I also have to add documentation about supported units.