Add comments and non-functional code cleanup

This commit is contained in:
Pitchaya Boonsarngsuk
2018-01-31 18:25:09 +00:00
parent f6c151a761
commit fa80339df0

View File

@@ -24,7 +24,7 @@ export function takeSampleFrom(sourceList, amount) {
} }
randElements.push(rand); randElements.push(rand);
} }
var remainder = sourceList.filter(function (obj) { let remainder = sourceList.filter(function (obj) {
return !randElements.includes(obj); return !randElements.includes(obj);
}); });
@@ -36,20 +36,17 @@ export function takeSampleFrom(sourceList, amount) {
/** /**
* With a circle radius r, and center at (h,k), * With a circle radius r, and center at (h,k),
* Find the coordinate of a point at angle degrees * Find the coordinate of on the circle with the specified angle degrees
* @param {number} h * @param {number} h
* @param {number} k * @param {number} k
* @param {number} angle * @param {number} angle (degree)
* @param {number} r * @param {number} r
* @return {object} - coordinate {x: number, y: number} of the point * @return {object} - coordinate {x: number, y: number} of the point
*/ */
export function pointOnCircle(h, k, angle, r) { export function pointOnCircle(h, k, angle, r) {
let x = h + r*Math.cos(toRadians(angle));
let y = k + r*Math.sin(toRadians(angle));
return { return {
x: x, x: h + r*Math.cos(toRadians(angle)),
y: y y: k + r*Math.sin(toRadians(angle))
}; };
} }