Bookmark this: tool.io/convert/angle/source-code
Convert Angle Source Code
Browse the implementation files for Convert Angle.tool.ts typescript
import { convertAngle as convertPortableAngle } from '@tool.io/tools/convert/angle';
import { measureFactorOptions } from '../tool';
import { measureFactors } from './factors';
export const convertAngle = (
value: number,
from: string,
to: string
) => convertPortableAngle(value, from, to) ?? '';
export const Tool: TypeTool = {
name: 'Convert Angle',
slug: 'convert/angle',
tool: convertAngle,
intro:
'Convert plane angles between radians, degrees, gradians, revolutions, angular minutes, angular seconds, and mils.',
i: [
{
example: '180',
label: 'Value',
placeholder: '180',
type: 'number'
},
{
example: 'deg',
label: 'From',
placeholder: 'Select the source angle unit',
options: measureFactorOptions(measureFactors, 'deg'),
type: 'select',
value: 'deg'
},
{
example: 'rad',
label: 'To',
placeholder: 'Select the destination angle unit',
options: measureFactorOptions(measureFactors, 'rad'),
type: 'select',
value: 'rad'
}
],
o: [
{
example: '3.141592653589793',
label: 'Angle',
placeholder: 'Converted angle',
render: 'textarea',
type: 'number'
}
],
swap: {
inputs: [1, 2],
name: 'Swap angle units',
state: false
},
alternative: [
{
title: 'Convert angular velocity',
url: '/convert/angular-velocity'
},
{
title: 'Beam Angle Calculator',
url: '/lighting/beam-angle-calculator'
}
],
cite: [
{
title: 'Angle — Wikipedia',
url: 'https://en.wikipedia.org/wiki/Angle'
},
{
title: 'NIST Guide to SI conversion factors',
url: 'https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors'
}
]
};
export default Tool;
Description
Browse the implementation files for Convert Angle.