Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Position of a point with respect to a line

Posted on 2013-12-04
Medium Priority
Last Modified: 2013-12-04
Given a point (x,y)
and a line defined by (x1, y1) and (x2, y2)

what is the distance between the point and the line? and
what is the check whether the point lies within the end points?
All in terms of x's and y's for plugging in a computer program.
Question by:Saqib Husain, Syed
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 84

Expert Comment

ID: 39696718
What does "within the end points" mean?
Is it a region bounded by lines through (x1, y1) and (x2, y2) perpendicular to the line between (x1, y1) and (x2, y2)?
LVL 43

Author Comment

by:Saqib Husain, Syed
ID: 39696721
LVL 43

Author Comment

by:Saqib Husain, Syed
ID: 39696729
On a drawing, they are texts written next to lines at a defined distance.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 27

Expert Comment

ID: 39696730
There is a formula for the distance from a point to a line (not a line segment).

You would have to convert your line segment into the   ax + by + c = 0 form.
LVL 84

Accepted Solution

ozo earned 2000 total points
ID: 39696743
distance = |(x1-x)(y2-y)-(x2-x)(y1-y)|/sqrt((x1-x2)^2+(y1-y2)^2)

when ((x1-x2)*(x-x2)+(y1-y2)*(y-y2))/((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)) is between 0 and 1, the point is within the end points
LVL 43

Author Closing Comment

by:Saqib Husain, Syed
ID: 39697064
Great, thanks. Working perfectly.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article seeks to propel the full implementation of geothermal power plants in Mexico as a renewable energy source.
We are taking giant steps in technological advances in the field of wireless telephony. At just 10 years since the advent of smartphones, it is crucial to examine the benefits and disadvantages that have been report to us.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question