Skip to content
Snippets Groups Projects
Commit e19e30eb authored by Yuriy Maksymets's avatar Yuriy Maksymets
Browse files

Fixed webpack argument issue

parent 94b133d5
Branches
No related tags found
1 merge request!68Shape recognition
Pipeline #107501 passed
......@@ -16,7 +16,8 @@ function getDistance(p1, p2) {
return Math.hypot(x1 - x0, y1 - y0)
}
function vectorLength([x, y]) {
function vectorLen(v) {
const [x, y] = v
return Math.hypot(x, y)
}
......@@ -26,7 +27,7 @@ function diffVector([x0, y0], [x1, y1]) {
function angleBetweenVectors(p1, p2) {
const [[x0, y0], [x1, y1]] = [p1, p2]
return Math.acos((x0 * x1 + y0 * y1) / (vectorLength(p1) * vectorLength(p2)))
return Math.acos((x0 * x1 + y0 * y1) / (vectorLen(p1) * vectorLen(p2)))
}
function boundingCoords(points) {
......@@ -127,7 +128,6 @@ function couldBeLine(points) {
)
const pivot = points[0]
let cumulativeThreshold = 0
for (let i = 2; i < points.length; i++) {
const prev = points[i - 1]
const curr = points[i]
......@@ -136,7 +136,7 @@ function couldBeLine(points) {
const angle = angleBetweenVectors(d1, d2)
if (Math.abs(angle) > LINE_ANGLE_THRESHOLD) {
const d2Len = vectorLength(d2)
const d2Len = vectorLen(d2)
if (cumulativeThreshold < vectorThreshold && d2Len < vectorThreshold) {
cumulativeThreshold += d2Len
continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment