2022-10-08 12:26:06 +05:30
|
|
|
import { degreeToRadian } from './DegreeToRadian.js'
|
|
|
|
|
|
|
|
|
|
/**
|
2023-10-03 23:08:19 +02:00
|
|
|
* @function circularArcLength
|
|
|
|
|
* @description calculate the length of a circular arc
|
|
|
|
|
* @param {Integer} radius
|
|
|
|
|
* @param {Integer} degrees
|
|
|
|
|
* @returns {Integer} radius * angle_in_radians
|
|
|
|
|
* @see https://en.wikipedia.org/wiki/Circular_arc
|
|
|
|
|
* @example circularArcLength(3, 45) = 2.356194490192345
|
|
|
|
|
*/
|
|
|
|
|
function circularArcLength(radius, degrees) {
|
2022-10-08 12:26:06 +05:30
|
|
|
return radius * degreeToRadian(degrees)
|
|
|
|
|
}
|
|
|
|
|
/**
|
2023-10-03 23:08:19 +02:00
|
|
|
* @function circularArcArea
|
|
|
|
|
* @description calculate the area of the sector formed by an arc
|
|
|
|
|
* @param {Integer} radius
|
|
|
|
|
* @param {Integer} degrees
|
|
|
|
|
* @returns {Integer} 0.5 * r * r * angle_in_radians
|
|
|
|
|
* @see https://en.wikipedia.org/wiki/Circular_arc
|
|
|
|
|
* @example circularArcArea(3,45) = 3.5342917352885173
|
|
|
|
|
*/
|
|
|
|
|
function circularArcArea(radius, degrees) {
|
|
|
|
|
return (Math.pow(radius, 2) * degreeToRadian(degrees)) / 2
|
2022-10-08 12:26:06 +05:30
|
|
|
}
|
|
|
|
|
|
2023-10-03 23:08:19 +02:00
|
|
|
export { circularArcLength, circularArcArea }
|