Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1829 > unrolled thread
| Started by | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| First post | 2014-03-26 22:03 +0100 |
| Last post | 2014-04-02 19:17 -0700 |
| Articles | 7 — 4 participants |
Back to article view | Back to comp.lang.postscript
How to get smote lines Cecil Westerhof <Cecil@decebal.nl> - 2014-03-26 22:03 +0100
Re: How to get smote lines Mark Carroll <mtbc@bcs.org> - 2014-03-26 21:49 +0000
Re: How to get smote lines Cecil Westerhof <Cecil@decebal.nl> - 2014-03-27 03:45 +0100
Re: How to get smote lines luser- -droog <mijoryx@yahoo.com> - 2014-03-26 14:52 -0700
Re: How to get smote lines Cecil Westerhof <Cecil@decebal.nl> - 2014-03-27 03:47 +0100
Re: How to get smote lines Don Lancaster <don@tinaja.com> - 2014-04-02 12:21 -0700
Re: How to get smote lines luser- -droog <mijoryx@yahoo.com> - 2014-04-02 19:17 -0700
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2014-03-26 22:03 +0100 |
| Subject | How to get smote lines |
| Message-ID | <87d2h8y8oj.fsf@Equus.Decebal.nl> |
I have the following code:
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 100 25
30 12 90 {
gsave
0 translate
-11 6 moveto
0 6 rlineto
6 0 rlineto
0 -6 rlineto
6 0 rlineto
stroke
grestore
} for
showpage
But I noticed that the connection is not smooth. When I change the
last rlineto to:
7 0 rlineto
It goes to far. How can I get a smooth connection?
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [next] | [standalone]
| From | Mark Carroll <mtbc@bcs.org> |
|---|---|
| Date | 2014-03-26 21:49 +0000 |
| Message-ID | <87a9ccfx5g.fsf@ixod.org> |
| In reply to | #1829 |
Cecil Westerhof <Cecil@decebal.nl> writes:
(snip)
> 30 12 90 {
(snip)
> stroke
> grestore
> } for
>
> showpage
>
> But I noticed that the connection is not smooth.
(snip)
setlinejoin and setlinecap are worth knowing about: here if you start
out with a 2 setlinecap then it goes much better.
Still, notice that you are doing a few strokes here: the difference
between the join and the cap is related to where you stroke and start a
new line, instead of continuing the previous, and the connection issues
are at those boundaries.
I hope that helps.
-- Mark
[toc] | [prev] | [next] | [standalone]
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2014-03-27 03:45 +0100 |
| Message-ID | <877g7gxstx.fsf@Equus.Decebal.nl> |
| In reply to | #1830 |
Op Wednesday 26 Mar 2014 22:49 CET schreef Mark Carroll:
> Cecil Westerhof <Cecil@decebal.nl> writes:
> (snip)
>> 30 12 90 {
> (snip)
>> stroke
>> grestore
>> } for
>>
>> showpage
>>
>> But I noticed that the connection is not smooth.
> (snip)
>
> setlinejoin and setlinecap are worth knowing about: here if you
> start out with a 2 setlinecap then it goes much better.
>
> Still, notice that you are doing a few strokes here: the difference
> between the join and the cap is related to where you stroke and
> start a new line, instead of continuing the previous, and the
> connection issues are at those boundaries.
I thought that I had done that, but now it works. So probably I made a
mistake somewhere. This and some other things look a lot better now.
There are some other things that do not see completely correct. So I
will probably ask something again in the near future.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [prev] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2014-03-26 14:52 -0700 |
| Message-ID | <b0986275-83a7-45de-918d-f68c9daf308f@googlegroups.com> |
| In reply to | #1829 |
On Wednesday, March 26, 2014 4:03:08 PM UTC-5, Cecil Westerhof wrote:
> I have the following code:
>
> %!PS-Adobe-3.0 EPSF-3.0
> %%BoundingBox: 0 0 100 25
>
> 30 12 90 {
> gsave
> 0 translate
> -11 6 moveto
> 0 6 rlineto
> 6 0 rlineto
> 0 -6 rlineto
> 6 0 rlineto
> stroke
> grestore
> } for
>
> showpage
>
> But I noticed that the connection is not smooth. When I change the
> last rlineto to:
> 7 0 rlineto
>
> It goes to far. How can I get a smooth connection?
>
The usual best answer is to construct one big path and make
a single call to `stroke`. But you've kind of painted yourself
into a corner with the gsave...grestore. So, I think the
simplest fix here is add 1/2 of the line-width.
10 10 scale
0 10 translate % just to see it better
30 12 90 {
gsave
0 translate
-11 6 moveto
0 6 rlineto
6 0 rlineto
0 -6 rlineto
currentlinewidth .5 mul
6 add 0 rlineto
stroke
grestore
} for
showpage
[toc] | [prev] | [next] | [standalone]
| From | Cecil Westerhof <Cecil@decebal.nl> |
|---|---|
| Date | 2014-03-27 03:47 +0100 |
| Message-ID | <8738i4xsqg.fsf@Equus.Decebal.nl> |
| In reply to | #1831 |
Op Wednesday 26 Mar 2014 22:52 CET schreef luser:
> On Wednesday, March 26, 2014 4:03:08 PM UTC-5, Cecil Westerhof wrote:
>> I have the following code:
>>
>> %!PS-Adobe-3.0 EPSF-3.0
>> %%BoundingBox: 0 0 100 25
>>
>> 30 12 90 {
>> gsave
>> 0 translate
>> -11 6 moveto
>> 0 6 rlineto
>> 6 0 rlineto
>> 0 -6 rlineto
>> 6 0 rlineto
>> stroke
>> grestore
>> } for
>>
>> showpage
>>
>> But I noticed that the connection is not smooth. When I change the
>> last rlineto to:
>> 7 0 rlineto
>>
>> It goes to far. How can I get a smooth connection?
>>
>
> The usual best answer is to construct one big path and make
> a single call to `stroke`. But you've kind of painted yourself
> into a corner with the gsave...grestore. So, I think the
> simplest fix here is add 1/2 of the line-width.
>
>
> 10 10 scale
> 0 10 translate % just to see it better
>
> 30 12 90 {
> gsave
> 0 translate
> -11 6 moveto
> 0 6 rlineto
> 6 0 rlineto
> 0 -6 rlineto
> currentlinewidth .5 mul
> 6 add 0 rlineto
> stroke
> grestore
> } for
>
> showpage
The idea of working with:
2 setlinejoin
2 setlinecap
works better. (And is also only needed on one point.) But thanks anyway.
--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
[toc] | [prev] | [next] | [standalone]
| From | Don Lancaster <don@tinaja.com> |
|---|---|
| Date | 2014-04-02 12:21 -0700 |
| Message-ID | <bq36a8Fj5csU1@mid.individual.net> |
| In reply to | #1829 |
On 3/26/2014 2:03 PM, Cecil Westerhof wrote:
> I have the following code:
> %!PS-Adobe-3.0 EPSF-3.0
> %%BoundingBox: 0 0 100 25
>
> 30 12 90 {
> gsave
> 0 translate
> -11 6 moveto
> 0 6 rlineto
> 6 0 rlineto
> 0 -6 rlineto
> 6 0 rlineto
> stroke
> grestore
> } for
>
> showpage
>
> But I noticed that the connection is not smooth. When I change the
> last rlineto to:
> 7 0 rlineto
>
> It goes to far. How can I get a smooth connection?
>
closepath
--
Many thanks,
Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: don@tinaja.com
Please visit my GURU's LAIR web site at http://www.tinaja.com
[toc] | [prev] | [next] | [standalone]
| From | luser- -droog <mijoryx@yahoo.com> |
|---|---|
| Date | 2014-04-02 19:17 -0700 |
| Message-ID | <9250b212-3022-4ed5-a334-28aaeeb0c35d@googlegroups.com> |
| In reply to | #1847 |
On Wednesday, April 2, 2014 2:21:42 PM UTC-5, Don Lancaster wrote:
> On 3/26/2014 2:03 PM, Cecil Westerhof wrote:
>
> > I have the following code:
>
> > %!PS-Adobe-3.0 EPSF-3.0
> > %%BoundingBox: 0 0 100 25
> >
> > 30 12 90 {
> > gsave
> > 0 translate
> > -11 6 moveto
> > 0 6 rlineto
> > 6 0 rlineto
> > 0 -6 rlineto
> > 6 0 rlineto
> > stroke
> > grestore
> > } for
> >
> > showpage
> >
> > But I noticed that the connection is not smooth. When I change the
> > last rlineto to:
> > 7 0 rlineto
> >
> > It goes to far. How can I get a smooth connection?
> >
>
> closepath
>
Before anybody jumps on Don for this nonsensical advice,
this bit of code:
> > -11 6 moveto
> > 0 6 rlineto
> > 6 0 rlineto
> > 0 -6 rlineto
> > 6 0 rlineto
> > stroke
looks very much like the idiom the drawing a square. And it
would be a square if one of the horizontal lines went the
other direction. And it would be good advice in that case.
But now that I've got your attention, I really think this
doodle would be better expressed as a continuous piece.
And the 2 setlinecap makes the first vertical line look
better, even though it's not needed here for "joins".
%10 10 scale %the better to see you with, my dear
%0 10 translate
gsave
2 setlinecap
30 0 translate
-11 6 moveto
30 12 90 {
pop
0 6 rlineto
6 0 rlineto
0 -6 rlineto
6 0 rlineto
} for
stroke
grestore
showpage
The best way to get connected lines in Postscript is:
don't move the point in the middle. Then the lines are
connected naturally.
--
droog
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web