How to smoothly connect a number of points
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: How to smoothly connect a number of points

  1. #1
    Join Date
    Mar 2013
    Posts
    31

    How to smoothly connect a number of points

    Name:  points.png
Views: 102
Size:  4.2 KB

    Hello every body,

    I have attached a picture of a number of points. I need to connect the points smoothly, there should not be any sharp corners. Could any one tell me how that can be done?

    Thanks in advance.

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,881

    Re: How to smoothly connect a number of points

    One way would be to use LeGrange interpolation to create a smooth curve that passes through the points. See
    http://web.cs.wpi.edu/~matt/courses/...ks/curves.html
    http://en.wikipedia.org/wiki/Lagrange_polynomial

    There are also several sites offering c/c++ implementations. See
    https://www.google.co.uk/search?q=la...EOWI0AX1zoDYAw
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++17 Compiler: Microsoft VS2017 (15.5.1)

  3. #3
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    4,626

    Re: How to smoothly connect a number of points

    for the above a "simple" interpolation like Lagrange will work.

    there are other techniques that will work for less obvious sets of points. Such as bezier curves. (which is not the same as a bezier spline). Bezier typically needs additional parameters to define how "tight" the path needs to. (this is something Lagrange doesn't need, but it has deficiencies elsewhere).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)