Find Jobs
Hire Freelancers

JavaScript - math - geometry - find zigzag line length

$30-250 USD

Completed
Posted almost 11 years ago

$30-250 USD

Paid on delivery
I have a zigzag line defined by array of [x,y] points, like: var points = [ [50,100], [200,120], [40,200], [50,400] ]; This line is drawn on the screen as SVG path. Later, mouse cursor is traveling on the screen near the line, and I need to be able to say at which LENGTH the mouse cursor is within the path. I may have many different zigzag lines, so I need an universal solution. I need you to write function getLengthAtPoint() in javascript. The function will accepts three input arguments - first is the array of point coordinates, which describe the zigzag line. Second and third parameters are x and y position of the mouse cursor on the screen. The mouse cursor coordinates doesn't need to be on the line itself, in fact it may be anywhere on the screen, in that case the result will be approximate. But the nearest the cursor is to the line, the more precision I need. Your goal is to find out which point on the zigzag line is the most nearest to the mouse cursor's x-y coordinates and what is the total LENGTH of the zigzag line from the starting coordinate to the point. You can see demo here: [login to view URL] As you can see, if you hover your mouse above the first part of the zigzag line, it works (it shows the red circle right under the mouse). But it doesn't work for the rest of the path. Your goal is to fix getLengthAtPoint() function so it works within the whole zigzag path.
Project ID: 4580290

About the project

4 proposals
Remote project
Active 11 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
Hello again Tomas, we worked on a previous project together I believe. I'm fairly confident I would be able to knock out this project as well for you by tonight.
$69 USD in 0 day
5.0 (9 reviews)
3.9
3.9
4 freelancers are bidding on average $126 USD for this job
User Avatar
Hi i am recently worked raphaeljs. my code is work properly rest of path... i will do rest of path
$210 USD in 3 days
4.9 (12 reviews)
4.0
4.0
User Avatar
Hi, I will complete it within 2 hours of awarding the project. Thanks
$35 USD in 3 days
5.0 (2 reviews)
2.0
2.0
User Avatar
sir, I have science and math background and a computer savvy as well. Consider me for this project.
$205 USD in 3 days
0.0 (0 reviews)
0.0
0.0
User Avatar
10+ years expirience with javascript
$55 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of CZECH REPUBLIC
Sumperk, Czech Republic
5.0
67
Payment method verified
Member since Apr 5, 2009

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.