Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
Mapa de folleto: interrumpa la línea de ruta dibujada usando una matriz de coordenadas, si los valores de la matriz son 0

Estoy dibujando una ruta basada en una matriz de coordenadas . Si la matriz tiene elementos con coordenadas de "[0,0]", quiero interrumpir esa línea durante ese período y luego continuar la ruta cuando los valores no sean cero. La matriz se ve así:

ingrese la descripción de la imagen aquí

y la ruta debería verse así:

ingrese la descripción de la imagen aquí

El código:

 function lineDistance(x1, y1, x2, y2) { var xs = 0, ys = 0; xs = x2 - x1; xs = xs * xs; ys = y2 - y1; ys = ys * ys; return Math.sqrt(xs + ys); } function nearest_point(lat, lng) { var dist = Number.POSITIVE_INFINITY; var it; for (var i = 0, e = point_locs.length; i < e; ++i) { var ld = lineDistance(lng.toString(), lat.toString(), point_locs[i].x, point_locs[i].y); if (ld < dist) { dist = ld it = point_locs[i]; } } return it; } var marker = L.marker(new L.LatLng(point_locs[0][1], point_locs[0][0]), { icon: L.icon({ iconUrl: 'https://tracking.dailyroads.com/dailyroads_assets/dailyroads_images/pin.png', iconSize: [29, 39], }), draggable: false }).addTo(map); marker.on('dragend', function(event) { var marker = event.target; var result = marker.getLatLng(); video.get(0).currentTime = nearest_point(result.lat, result.lng).sec; }); function set_marker(point) { const lat = parseFloat(point[1]); const long = parseFloat(point[0]); marker.setLatLng(L.latLng(lat, long)); set_marker.now = point; } set_marker.now = point_locs[0]; // handle for marker location based on video time function point_at_time(timeindex_sec) { var it = point_locs[0]; var min_dt = Number.POSITIVE_INFINITY; const index = Math.round(timeindex_sec); return point_locs[index]; var e = point_locs.length for (var i = 0; i < e; ++i) { var dt = Math.abs(i - timeindex_sec); if (dt < min_dt) { it = point_locs[i]; min_dt = dt; } } return it; }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!