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 837661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:10:38+00:00 2026-05-15T05:10:38+00:00

How could I, having a path defined by several points that are not in

  • 0

How could I, having a path defined by several points that are not in a uniform distance from each other, redefine along the same path the same number of points but with a uniform distance. I’m trying to do this in Objective-C with NSArrays of CGPoints but so far I haven’t had any luck with this.
Thank you for any help.

EDIT

I was wondering if it would help to reduce the number of points, like when detecting if 3 points are collinear we could remove the middle one, but I’m not sure that would help.

EDIT

Illustrating:
Reds are the original points, blues the post processed points:

alt text

The new path defined by the blue dots does not correspond to the original one.

  • 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-05-15T05:10:39+00:00Added an answer on May 15, 2026 at 5:10 am

    I think the problem is simple and easily solvable actually 🙂

    The basic idea is:

    • First check if the distance between your current point (P) and the end point of the line segment you are on is >= the distance between P and the next point (Q).

    • If it is, great, we use some simple trigonometry to figure it out.

    • Else, we move to the adjacent line segment (in your ordering) and deduct the distance between P and the endpoint of the line segment you are on and continue the process.

    Pseudocode:

    Defined previously

    struct LineSegment
    {
      Point start,end;
      int ID;
      double len; // len = EuclideanDistance(start,end);
      LineSegment *next_segment;
      double theta; // theta = atan2(slope_of_line_segment);
    }
    
    Function [LineSegment nextseg] = FindNextLineSegment(LineSegment lineseg)
    Input: LineSegment object of the current line segment
    Output: LineSegment object of the adjacent line segment in your ordering. 
    nextseg.ID = -1 if there are no more segments
    

    Function: Find the next point along your path

    Function [Point Q, LineSegment Z] = FindNextPt(Point P, LineSegment lineseg, int dist): 
    Input: The current point P, the distance between this point and the next, and the LineSegment of the line segment which contains P.
    Output: The next point Q, and the line segment it is on
    
    Procedure:
    distToEndpt = EuclideanDistance(P,lineseg->end);
    if( distToEndpt >= d )
    {
     Point Q(lineseg->start.x + dist*cos(lineseg.theta), lineseg->start.y + dist*sin(lineseg.theta));
     Z = lineseg;
    }
    else
    {
     nextseg = lineseg->next_segment;
        if( nextseg.ID !=-1 )
        {
      [Q, Z] = FindNextPt(nextseg->start,nextseg->ID,dist-distToEndpt);
     }
        else
        {
      return [P,lineseg];
     }
    }
     return [Q,Z]
    

    Entry point

    Function main()
    Output: vector of points
    Procedure:
    
    vector<LineSegment> line_segments;
    // Define it somehow giving it all the properties
    // ....
    
    vector<Point> equidistant_points;
    const int d = DIST;
    
    [Q Z] = FindNextPoint(line_segments[0].start,line_segments[0],DIST);
    while( Z.ID != -1 )
    {
     equidistant_points.push_back(Q);
     [Q Z] = FindNextPt(Q,Z,d);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a path, for example: composed of a set of points 'p' I have
I'm having trouble calling a model's show path from within a create controller. I'm
I am having a bit of an issue getting the file path from the
The issue I am having could be a hardware-related. In any case I'm stumped.
I'm having the following problem and wondered whether anyone could see why this is
I am having issues, could you point me in the right direction? EDIT: This
I am having a problem with LINQ and I was hoping someone could explain
I'm having a bit of trouble trying to understand how WARP could potentially interact
Instead of having to type tmux every time, how could I have tmux always
I am having some trouble comparing two variables, hope someone could help. Basically what

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.