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


Groups > comp.lang.postscript > #2767

Re: a smooth curve through given points ?

Newsgroups comp.lang.postscript
From Peter Billam <peter@www.pjb.com.au>
Subject Re: a smooth curve through given points ?
References <slrnnqr130.4f6.peter@box8.pjb.com.au> <3243f726-6885-4ae2-aac9-f8834261dc73@googlegroups.com>
Message-ID <slrnnqtqv6.48s.peter@box8.pjb.com.au> (permalink)
Date 2016-08-13 09:44 +0000
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


On 2016-08-13, 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,

You're all thinking about exactly the kind of succession of
curveto's that I was thinking about.

> 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,

Nice ascii-art :-)

> 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.
> ...
> <p3, p4, p5> need to be collinear.

Yes, that's important. Possibly the <p3, p4, p5> gradient should
be at right-angles to the line bisecting the p1-p4-p7 angle?

> To match curvature, the magnitudes of the adjacent tangent
> vectors need to be the same (or not too different).

Matching curvature is not as important as matching gradient, and
I think if p1-to-p4 is a long segment and p4-to-p7 is a short one,
then it probably looks better if p3-to-p4 is reasonable in the
p1-to-p4 context, and p4-to-p5 reasonable in its p4-to-p7 context.
Needs trying out :-)
(Can always take the sqrt of the product of both estimates...)

> So, not an algorithm. But maybe this can help someone else come
> up with something.

OK, I'll give it a go (don't hold your breaths, though).  I'm not
really motivated by plotting smooth graphs, but by drawing curves
for arty stuff, like http://www.pjb.com.au/art/posters/index.html

It should also make it easy to copy a smooth curve from a .jpg or
.png, because you just note the pixel-positions at a few places
along the curve and let the algorithm do the rest. If it's not
right yet, you insert an extra pixel-position into your list...

Thanks,  Peter

-- 

Peter Billam    www.pjb.com.au    www.pjb.com.au/comp/contact.html

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