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


Groups > comp.lang.postscript > #2778

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 (2 earlier) <slrnnqtqv6.48s.peter@box8.pjb.com.au> <slrnnr250f.1ol.peter@box8.pjb.com.au> <norbmp$7mt$1@reader2.panix.com> <slrnnr3382.451.peter@box8.pjb.com.au> <notq8d$c09$1@reader2.panix.com>
Message-ID <slrnnr78k2.1pc.peter@box8.pjb.com.au> (permalink)
Date 2016-08-16 23:32 +0000
Organization Unlimited download news at news.astraweb.com

Show all headers | View raw


> Peter Billam <peter@www.pjb.com.au> wrote:
>> I'll road-test it a bit over the next few days.

I found a bug:
  2 setlinewidth /Helvetica 16 selectfont
  70 600 moveto (right to left) show
  [ 450 700  350 680  250 720  150 680   50 700 ] points2curve
  [ 450 500  350 520  250 480  150 520   50 500 ] points2curve
  70 200 moveto (left to right) show
  [  50 300  150 280  250 320  350 280  450 300 ] points2curve
  [  50 100  150 120  250  80  350 120  450 100 ] points2curve
  stroke

It comes from "bisecting an angle": If I average 1 and -1 that's 0
but average 1 and 359 and I get 180. On the other side of the circle
then it's the same the other way round; average 179 and -179 I get 0
but 179 and 181 I get 180.  I think I trod in something quite deep,
like one of Penrose's spinor things where you have to go round
twice just to get back to the same place.

I tried All Sorts of combinations of  if else add sub gt lt
and ended up with a combination that works :-) though I don't
really understand what it's  doing :-(   There must be a
neater way to do it...  Anyway, the core of the fix is:

p_ip1_x p_im1_x gt angle_before 180 sub angle_after 180 sub mul 0 lt and {
  angle_before 180 ge { /angle_before angle_before 360 sub def } if
  angle_after  180 gt { /angle_after  angle_after  360 sub def } if
} if

On 2016-08-16, JohnF <john@please.see.sig.for.email.com> wrote:
> Please do re-post when you're satisfied with it (not necessarily
> the procedure itself, but just the fact it's "ready for prime time").

So check out:
  http://www.pjb.com.au/comp/line_drawing.html#points2curve
  http://www.pjb.com.au/comp/line_drawing.html#install
  https://github.com/peterbillam/postscriptlib

or the source:
  http://www.pjb.com.au/comp/free/line_drawing.ps.txt
and look for points2curve.  It seems to work :-)

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