I am coding an app using react, and I got this error - Uncaught TypeError: Cannot read properties of undefined (reading 'x')at calculateIntersectionX. I really have no idea why I am getting this error when there's a legit x part in the limits constant.
const limits = [
{ x: 12.3456777, y: -12.3456777 },
{ x: 12.3456777, y: -12.3456777 },
{ x: 12.3456777, y: -12.3456777 },
];
for (var i = 0; i < limits.length; i++) {
for (var g = 0; g < limits.length; i++) {
if (limits[i] != limits[g]) {
let a1 = limits[i];
let a2 = limits[g];
calculateIntersectionX(avgfakex1, avgfakex2, a1, a2);
calculateIntersectionY(avgfakey1, avgfakey2, a1, a2);
}
}
}
function calculateIntersectionX(p1, p2, p3, p4) {
var c2x = p3.x - p4.x; // (x3 - x4)
var c3x = p1.x - p2.x; // (x1 - x2)
var c2y = p3.y - p4.y; // (y3 - y4)
var c3y = p1.y - p2.y; // (y1 - y2)
I think you have to change:
consider fixing these and maybe it will help you figure it out:)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.