Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #2771

Re: a smooth curve through given points ?

From JohnF <john@please.see.sig.for.email.com>
Newsgroups comp.lang.postscript
Subject Re: a smooth curve through given points ?
Date 2016-08-14 06:17 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <nop2el$j5o$1@reader2.panix.com> (permalink)
References <slrnnqr130.4f6.peter@box8.pjb.com.au> <3243f726-6885-4ae2-aac9-f8834261dc73@googlegroups.com>

Show all headers | View raw


luser droog <luser.droog@gmail.com> wrote:
> On Friday, August 12, 2016 at 3:10:09 AM UTC-5, Peter Billam wrote:
>> Hi.  There must be reasonable ways of constructing a series
>> of curveto's that go smoothly through a given array of points
>> [x1 y1 x2 y2 ... xN yN] ...  Anyone here written stuff like that,
>> or know of where it could be found ?
>>    If I do it, it'll turn out very ad-hoc and heuristic-ish,
>> with lots of arrays-of-points that cause wild behaviour :-(
> 
> Somewhat on the same level as tlvp's thoughts, I have a few 
> observations about Bezier curves. Everybody probably knows
> these things already, but perhaps I can describe them in a
> novel way.
> 
> A cubic Bezier curve in 2D is determined by 4 coordinate pairs,
> x1 y1, x2 y2, x3 y3, x4 y4, and passes through points 1 and 4.
> The vectors from the interior points to their adjacent outer
> points determine the tangents as the curve passes through those
> same outer points.
> 
> In ascii-art,
> 
>      .      .
> .    p2     p3    .
> p1                p4
> 
> The trace of the curve from t=0 to t=1 starts at p1, then moves 
> toward p2, along the vector p2-p1. As the curve progresses, the
> weight associated with the p2-p1 tangent vector goes from 1 to 0.
> At the same time the weight associated with the p4-p3 tangent
> vector goes from 0 to 1. So the instant the curve crosses the
> finish t=1, it is wholly under the control of the exiting tangent
> vector p4-p3.
> 
> Now with some calculus background, we learn that tangents in general
> can be found by taking the derivative of a function. The first 
> derivative, evaluated at a specific value for t, gives the "slope"
> at the corresponding point of the original function for the same t 
> value. The second derivative gives the "curvature" or acceleration,
> how much the slope is changing.
> 
> The practical upshot (and skipping a few steps) is, to smoothly 
> connect two Bezier curves at a join, first the inner control
> points adjacent to the join point need to be collinear. This gives
> gives you matching slopes as the curve crosses the join.
> 
>      .      .
> .    p2     p3    .                 .
> p1                p4    .     .     p7
>                         p5    p6
> 
> <p3, p4, p5> need to be collinear.
> 
> To match curvature, the magnitudes of the adjacent tangent vectors
> need to be the same (or not too different).
> 
> |p4-p3| ~= |p5-p4|
> 
> So what remains is the "outer" inner control points, p2 and p6.
> With no rigor at all, my guess is they should be collinear with
> their adjacent control points.
> 
> So, not an algorithm. But maybe this can help someone else come
> up with something.

Maybe see

http://stackoverflow.com/questions/7715788/find-bezier-control-points-for-curve-passing-through-n-points

for additional discussion.
-- 
John Forkosh  ( mailto:  j@f.com  where j=john and f=forkosh )

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

a smooth curve through given points ? Peter Billam <peter@www.pjb.com.au> - 2016-08-12 08:10 +0000
  Re: a smooth curve through given points ? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-08-12 01:12 -0700
  Re: a smooth curve through given points ? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2016-08-12 21:59 -0400
    Re: a smooth curve through given points ? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2016-08-13 22:42 -0400
  Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-12 21:49 -0700
    Re: a smooth curve through given points ? Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-08-12 21:59 -0700
      Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-12 22:21 -0700
      Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-18 15:01 -0700
        Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-19 13:10 -0700
          Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-19 13:13 -0700
    Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-12 22:00 -0700
    Re: a smooth curve through given points ? Peter Billam <peter@www.pjb.com.au> - 2016-08-13 09:44 +0000
      Re: a smooth curve through given points ? Peter Billam <peter@www.pjb.com.au> - 2016-08-15 01:00 +0000
        Re: a smooth curve through given points ? John Forkosh <forkosh@panix.com> - 2016-08-15 03:08 +0000
          Re: a smooth curve through given points ? Peter Billam <peter@www.pjb.com.au> - 2016-08-15 09:36 +0000
            Re: a smooth curve through given points ? JohnF <john@please.see.sig.for.email.com> - 2016-08-16 01:28 +0000
              Re: a smooth curve through given points ? Peter Billam <peter@www.pjb.com.au> - 2016-08-16 23:32 +0000
                Re: a smooth curve through given points ? tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2016-08-17 01:07 -0400
    Re: a smooth curve through given points ? JohnF <john@please.see.sig.for.email.com> - 2016-08-14 06:17 +0000
  Re: a smooth curve through given points ? jdaw1 <jdawiseman@gmail.com> - 2016-08-16 03:14 -0700
  Re: a smooth curve through given points ? Alan <alan.isaac@gmail.com> - 2016-08-18 14:42 -0700
    Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-18 15:19 -0700
      Re: a smooth curve through given points ? Alan <alan.isaac@gmail.com> - 2016-08-18 18:52 -0700
        Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-18 21:47 -0700
          Re: a smooth curve through given points ? Alan <alan.isaac@gmail.com> - 2016-08-19 06:01 -0700
            Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-08-19 14:06 -0700
  Re: a smooth curve through given points ? luser droog <luser.droog@gmail.com> - 2016-11-03 22:03 -0700
    Re: a smooth curve through given points ? JohnF <john@please.see.sig.for.email.com> - 2016-11-05 05:19 +0000
    Re: a smooth curve through given points ? don lancaster <don@tinaja.com> - 2016-11-05 10:12 -0700

csiph-web