• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

closed curved path without doubling start/end point

Community Beginner ,
Aug 12, 2021 Aug 12, 2021

Copy link to clipboard

Copied

Is it possible to make a closed path (curved, no straight lines) in pure PostScript without having two equal points at start/end? I can contruct this easily in Illustrator clicking the last point onto the start point and dragging the handles, but I didn't find a way to realize it in code.

Views

354

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Beginner , Aug 12, 2021 Aug 12, 2021

Without returning to the starting point (last point some distance away from start point), closepath will connect  the last point with the start point by a straight line (not what I want).

What I need is a curveto to the same location as the starting point. In that case, closepath connects these points (end on top of start) with a straight line (lenght zero), leaving two same points. Doing the same in Illustrator, I get one less point: bild 64.png

The picture shows the result in Illustrator: A closed curved p

...

Votes

Translate

Translate
Community Expert , Aug 13, 2021 Aug 13, 2021

Ahh, okay.. so here's the thing:

There's always 3 points involved; Your starting location, your second location, then the third location. It doesn't matter if it's the same position, it's still a third position.

In the simple Postscript you are using, it doesn't KNOW you want to join the first and third position as a common control point; a closepath will ALWAYS add a line segment between the first and last positions.

Even the Illustrator shape is technically 3 points, but Illustrator (and Illus

...

Votes

Translate

Translate
LEGEND ,
Aug 12, 2021 Aug 12, 2021

Copy link to clipboard

Copied

To close a path in PostScript use "closepath". Just returning to the starting point does not close the path, however, for filling operations closure is assumed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 12, 2021 Aug 12, 2021

Copy link to clipboard

Copied

Without returning to the starting point (last point some distance away from start point), closepath will connect  the last point with the start point by a straight line (not what I want).

What I need is a curveto to the same location as the starting point. In that case, closepath connects these points (end on top of start) with a straight line (lenght zero), leaving two same points. Doing the same in Illustrator, I get one less point: bild 64.png

The picture shows the result in Illustrator: A closed curved path with only two points.

My question is how to achieve this with pure PostScript code. But after the second curveto, followed by a closepath I get a path with three points.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 13, 2021 Aug 13, 2021

Copy link to clipboard

Copied

Ahh, okay.. so here's the thing:

There's always 3 points involved; Your starting location, your second location, then the third location. It doesn't matter if it's the same position, it's still a third position.

In the simple Postscript you are using, it doesn't KNOW you want to join the first and third position as a common control point; a closepath will ALWAYS add a line segment between the first and last positions.

Even the Illustrator shape is technically 3 points, but Illustrator (and Illustrator's procset dictionary) is defining what to do with that common point, so it requires the dictionary to decode it in the program.

When the postscript is sent to a printer, it's still 3 positions with an implied closepath which you don't see.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 14, 2021 Aug 14, 2021

Copy link to clipboard

Copied

LATEST

OK, that makes sense: Illustrator is doing its own thing.

Thank you for answering. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 12, 2021 Aug 12, 2021

Copy link to clipboard

Copied

Where are you seeing the result as 3 points?

Basically, it should be as simple as:

starting Point A (x1,y1) (move to)

Point B x2,y2 (curve to)

Point A x1,y1 (curve to)

then close it (close path)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 12, 2021 Aug 12, 2021

Copy link to clipboard

Copied

After moveto, curveto, curveto there a three points, regardless of a closepath, last point sitting on top of the first one.

Open this text (file) in Illustrator

%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 0 0 400 400
100 200 moveto
120 280 240 260 280 160 curveto 
320 60 80 120 100 200 curveto closepath stroke

Select left point, drag it away, and you can see it: three points.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 12, 2021 Aug 12, 2021

Copy link to clipboard

Copied

SO you are trying to test how PostScript works by importing it to Illustrator? Seems to me you could be seeing a limitation of Illustrator's import.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines