Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8904371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:06:45+00:00 2026-06-15T02:06:45+00:00

How would I go about changing points that are ‘near’ linear (within a threshold),

  • 0

How would I go about changing points that are ‘near’ linear (within a threshold), actually linear?

I have some code that checks if 3 points are linear to one another (give or take), and I want to replace those coordinates with new ones that are 100% inline.

        double distance = (x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3);

        double threshold = 4;

        if (Math.abs(distance) <= threshold) {
            // is Near line
            return true;
        }
        else
            return false;

This is an EXTENSION of another post of mine… This is NOT a repost, simply a related topic:

Java – Average Linear Graph Plots

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:06:46+00:00Added an answer on June 15, 2026 at 2:06 am

    The technical term for snapping a point to a line is projecting a point to a line(-segment)

    The only question that remains: Should the points projected to the line or to the line segment? (A line segment is only between two points, the line has infinity length and goes through both points)

    The code below solves both:
    To allow also projecting points to th epart of the line that is outside of points A->B, the code would be much simpler, but this is covered in the link below, too.

    See http://forums.codeguru.com/showthread.php?194400-Distance-between-point-and-line-segment

    The projected point is in the variables (xx,yy):
    (xx,yy) is the point on the lineSegment closest to (cx,cy)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some questions about the following code: using System; namespace ConsoleApplication2 { public
Does anyone know how I would go about changing (transforming) an image based on
I would like to know how I would go about altering the HTML that
Anyone have any idea how I would go about converting a timestamp in milliseconds
I have an assembly that defines a UserControl X. Within that assembly, X is
We have a library of Java code that we intend to use across projects.
i am new to stackoverflow and i would have a question about C# structs
I have a theorical/pratical question about how inheritance works in C#. Let's say that
I would like 'about' to route to 'abouts/1' I tried this: match 'about' =>
Any ideas how I would go about writing a javascript method to insert an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.