Bookmark this: tool.io/lighting/candela-to-lumens-calculator/source-code
Candela to Lumens Calculator Source Code
Browse the implementation files for Candela to Lumens Calculator.tool.ts typescript
const parseFinite = (value: unknown): number | null => {
if (value === '' || value === null || value === undefined)
return null;
const parsed = Number(value);
return Number.isFinite(parsed) ? parsed : null;
};
export const calculateLumensFromCandela = (
candelaInput: unknown,
beamAngleInput: unknown
) => {
const candela = parseFinite(candelaInput);
const beamAngle = parseFinite(beamAngleInput);
if (
candela === null ||
candela < 0 ||
beamAngle === null ||
beamAngle < 0 ||
beamAngle > 360
)
return '';
const halfAngleRadians = (beamAngle * Math.PI) / 360;
const solidAngle =
2 * Math.PI * (1 - Math.cos(halfAngleRadians));
return candela * solidAngle;
};
export const Tool: TypeTool = {
name: 'Candela to Lumens Calculator',
slug: 'lighting/candela-to-lumens-calculator',
tool: calculateLumensFromCandela,
intro:
'Estimate luminous flux from luminous intensity and the full angle of an ideal uniform conical beam.',
i: [
{
example: '1000',
label: 'Luminous intensity',
placeholder: 'Candela (cd)',
type: 'number'
},
{
example: '60',
label: 'Full beam angle',
placeholder: 'Degrees (°)',
type: 'number'
}
],
o: [
{
example: '841.7872144769325',
label: 'Estimated luminous flux',
placeholder: 'Lumens (lm)',
render: 'textarea',
type: 'number'
}
],
equation: 'Φᵥ = Iᵥ × 2π × (1 − cos(θ / 2))',
alternative: [
{
title: 'Beam Angle Calculator',
url: '/lighting/beam-angle-calculator'
},
{
title: 'Lumens to Lux Calculator',
url: '/lighting/lumens-to-lux-calculator'
},
{
title: 'Convert luminous flux',
url: '/convert/luminous-flux'
},
{
title: 'Convert luminous intensity',
url: '/convert/luminous-intensity'
}
],
cite: [
{
title: 'Solid angle — Wikipedia',
url: 'https://en.wikipedia.org/wiki/Solid_angle'
},
{
title: 'Luminous intensity — Wikipedia',
url: 'https://en.wikipedia.org/wiki/Luminous_intensity'
}
]
};
export default Tool;
Description
Browse the implementation files for Candela to Lumens Calculator.