How to draw a zero-length psline without an arrow?
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
Question:
Should zero-length psline[arrows=->](1,1)(1,1)
be displayed?
Why does zero-length psellipticarc
get rendered while zero-length psarc
does not?
pstricks
|
show 4 more comments
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
Question:
Should zero-length psline[arrows=->](1,1)(1,1)
be displayed?
Why does zero-length psellipticarc
get rendered while zero-length psarc
does not?
pstricks
(1,1) to (1,1) is a rather short line? did you intend (0,0)(1,1) ?
– David Carlisle
Jan 6 at 15:44
1
@chishimotoji that is specifying the start and end point to be at the same place what kind of line do you expect to see in that case? "short" was an under-statement, it has length 0pt.
– David Carlisle
Jan 6 at 15:58
1
The coordinates ofpsline[arrows=->](1,1)(1,1)
are nonsense and if you want an arrow for such coordinates you get nonsense...
– Herbert
Jan 6 at 18:20
1
@Herbert: Sopsline[arrows=->](1,1)(1,1)
should be rendered as "nothing" or an arrow? The current condition in both PSTricks and TikZ, it produces an arrow that looks like a bug.
– God Must Be Crazy
Jan 6 at 18:24
1
With pstricks.tex from archiv.dante.de/~herbert/texnik/tex/generic/pstricks you can usepsLine
(uppercase L) which can have only one or two pairs of coordinates, but will test for a length between the points. Will later be on CTAN.
– Herbert
Jan 7 at 18:31
|
show 4 more comments
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
Question:
Should zero-length psline[arrows=->](1,1)(1,1)
be displayed?
Why does zero-length psellipticarc
get rendered while zero-length psarc
does not?
pstricks
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
Question:
Should zero-length psline[arrows=->](1,1)(1,1)
be displayed?
Why does zero-length psellipticarc
get rendered while zero-length psarc
does not?
pstricks
pstricks
edited Jan 6 at 18:05
God Must Be Crazy
6,08011039
6,08011039
asked Jan 6 at 15:33
chishimotojichishimotoji
622318
622318
(1,1) to (1,1) is a rather short line? did you intend (0,0)(1,1) ?
– David Carlisle
Jan 6 at 15:44
1
@chishimotoji that is specifying the start and end point to be at the same place what kind of line do you expect to see in that case? "short" was an under-statement, it has length 0pt.
– David Carlisle
Jan 6 at 15:58
1
The coordinates ofpsline[arrows=->](1,1)(1,1)
are nonsense and if you want an arrow for such coordinates you get nonsense...
– Herbert
Jan 6 at 18:20
1
@Herbert: Sopsline[arrows=->](1,1)(1,1)
should be rendered as "nothing" or an arrow? The current condition in both PSTricks and TikZ, it produces an arrow that looks like a bug.
– God Must Be Crazy
Jan 6 at 18:24
1
With pstricks.tex from archiv.dante.de/~herbert/texnik/tex/generic/pstricks you can usepsLine
(uppercase L) which can have only one or two pairs of coordinates, but will test for a length between the points. Will later be on CTAN.
– Herbert
Jan 7 at 18:31
|
show 4 more comments
(1,1) to (1,1) is a rather short line? did you intend (0,0)(1,1) ?
– David Carlisle
Jan 6 at 15:44
1
@chishimotoji that is specifying the start and end point to be at the same place what kind of line do you expect to see in that case? "short" was an under-statement, it has length 0pt.
– David Carlisle
Jan 6 at 15:58
1
The coordinates ofpsline[arrows=->](1,1)(1,1)
are nonsense and if you want an arrow for such coordinates you get nonsense...
– Herbert
Jan 6 at 18:20
1
@Herbert: Sopsline[arrows=->](1,1)(1,1)
should be rendered as "nothing" or an arrow? The current condition in both PSTricks and TikZ, it produces an arrow that looks like a bug.
– God Must Be Crazy
Jan 6 at 18:24
1
With pstricks.tex from archiv.dante.de/~herbert/texnik/tex/generic/pstricks you can usepsLine
(uppercase L) which can have only one or two pairs of coordinates, but will test for a length between the points. Will later be on CTAN.
– Herbert
Jan 7 at 18:31
(1,1) to (1,1) is a rather short line? did you intend (0,0)(1,1) ?
– David Carlisle
Jan 6 at 15:44
(1,1) to (1,1) is a rather short line? did you intend (0,0)(1,1) ?
– David Carlisle
Jan 6 at 15:44
1
1
@chishimotoji that is specifying the start and end point to be at the same place what kind of line do you expect to see in that case? "short" was an under-statement, it has length 0pt.
– David Carlisle
Jan 6 at 15:58
@chishimotoji that is specifying the start and end point to be at the same place what kind of line do you expect to see in that case? "short" was an under-statement, it has length 0pt.
– David Carlisle
Jan 6 at 15:58
1
1
The coordinates of
psline[arrows=->](1,1)(1,1)
are nonsense and if you want an arrow for such coordinates you get nonsense...– Herbert
Jan 6 at 18:20
The coordinates of
psline[arrows=->](1,1)(1,1)
are nonsense and if you want an arrow for such coordinates you get nonsense...– Herbert
Jan 6 at 18:20
1
1
@Herbert: So
psline[arrows=->](1,1)(1,1)
should be rendered as "nothing" or an arrow? The current condition in both PSTricks and TikZ, it produces an arrow that looks like a bug.– God Must Be Crazy
Jan 6 at 18:24
@Herbert: So
psline[arrows=->](1,1)(1,1)
should be rendered as "nothing" or an arrow? The current condition in both PSTricks and TikZ, it produces an arrow that looks like a bug.– God Must Be Crazy
Jan 6 at 18:24
1
1
With pstricks.tex from archiv.dante.de/~herbert/texnik/tex/generic/pstricks you can use
psLine
(uppercase L) which can have only one or two pairs of coordinates, but will test for a length between the points. Will later be on CTAN.– Herbert
Jan 7 at 18:31
With pstricks.tex from archiv.dante.de/~herbert/texnik/tex/generic/pstricks you can use
psLine
(uppercase L) which can have only one or two pairs of coordinates, but will test for a length between the points. Will later be on CTAN.– Herbert
Jan 7 at 18:31
|
show 4 more comments
3 Answers
3
active
oldest
votes
With an up-to-date pstricks.tex
from http://archiv.dante.de/~herbert/texnik/tex/generic/pstricks/
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psLine[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
you'll get an empty grid.
add a comment |
I can only reproduce the single arrow for psline[arrows=->](1,1)(1,1)
because I use the latest TeX Live 2018 update. I think someone has changed the arc-related macros several days ago.
A single arrow for the zero-length line is a feature that is intentionally kept as it is because according to someone it is useful for drawing zero-length vectors. TikZ also has the same feature, right? :-)
So if you want to get nothing for a zero-length line, do modify the psline
as follows.
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
Here I present an example in which zero-length lines are practically useful in our life. Of course we can use conditional macro to get the same result.
documentclass[pstricks,border=1cm]{standalone}
usepackage{pstricks-add}
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
usepackage[nomessages]{fp}
newcommandconst[3][3]{%
expandafterFPevalcsname#2endcsname{round(#3:#1)}%
pstVerb{/#2 csname#2endcsnamespace def}%
}
newcommandConst[3][3]{begingroupedeftemp{endgroupnoexpandconst[#1]{#2}{#3}}temp}
Const{Tpeak}{1}
Const{Theta}{80/180*pi}
Const{Gravity}{10}
Const{SpeedFactor}{0.2}
Const{FPS}{11}
defX#1{Vinit*cos(Theta)*#1}
defY#1{Vinit*sin(Theta)*#1-Gravity*pow(2,#1)/2}
Const{Vinit}{Tpeak*Gravity/sin(Theta)}
Const{Xpeak}{X{Tpeak}}
Const{Ypeak}{Y{Tpeak}}
defpoint#1{%
pnode(!Vinit Theta RadToDeg 2 copy cos mul #1 mul 3 1 roll sin mul #1 mul Gravity #1 2 exp mul 2 div sub){P}
pscircle[linecolor=red,fillstyle=solid,fillcolor=yellow](P){3pt}
pnode[!Vinit Theta RadToDeg cos mul SpeedFactor mul 0](P){PX}
pnode[!0 Vinit Theta RadToDeg sin mul Gravity #1 mul sub SpeedFactor mul](P){PY}
%
psline[linecolor=blue]{->}(P)(PX)
psline[linecolor=magenta]{->}(P)(PX|PY)
psline[linecolor=blue]{->}(P)(PY)
}
Const{DeltaTime}{1/FPS}
Const[0]{TotalFrames}{FPS*2*Tpeak}
Const[0]{TotalFrames}{TotalFrames+1}
begin{document}
multido{nt=0.000+DeltaTime}{TotalFrames}{%
begin{pspicture}[showgrid=false](0,-35pt)(2dimexprXpeakpsxunitrelax,dimexprYpeakpsyunit+7ptrelax)
parabola[linewidth=0.5pslinewidth,linestyle=dashed](0,0)(Xpeak,Ypeak)
point{nt}
end{pspicture}}
end{document}
add a comment |
Try out this:
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psline[arrows=->](0,1)(1,0)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{360}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{360}
psarc[arrows=->](2.5,2.5){1}{0}{360}
psarcn[arrows=->](2.5,2.5){2}{0}{360}
end{pspicture}
end{document}
What do you want to get when letting start a vector (psline) at the same point where it ends? Just produce an arrowhead with a given direction?
Note: psarc[arrows=->](2.5,2.5){1}{0}{360}
The parentheses give the coordinates of the center of the arc of the circle.
The first mandatory argument gives the radius of the arc of the circle.
The second and third mandatory arguments give the starting and ending angle of the arc.
When both angles are chosen to 0, there is no arc to be drawn, as well as with the ellipses ... I cannot reproduce that the elliptic arcs are drawn.
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
I think you are now using the latest update so you cannot reproduce the elliptical arcs.
– God Must Be Crazy
Jan 6 at 18:09
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468837%2fhow-to-draw-a-zero-length-psline-without-an-arrow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
With an up-to-date pstricks.tex
from http://archiv.dante.de/~herbert/texnik/tex/generic/pstricks/
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psLine[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
you'll get an empty grid.
add a comment |
With an up-to-date pstricks.tex
from http://archiv.dante.de/~herbert/texnik/tex/generic/pstricks/
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psLine[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
you'll get an empty grid.
add a comment |
With an up-to-date pstricks.tex
from http://archiv.dante.de/~herbert/texnik/tex/generic/pstricks/
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psLine[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
you'll get an empty grid.
With an up-to-date pstricks.tex
from http://archiv.dante.de/~herbert/texnik/tex/generic/pstricks/
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psLine[arrows=->](1,1)(1,1)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
psarc[arrows=->](2.5,2.5){1}{0}{0}
psarcn[arrows=->](2.5,2.5){2}{0}{0}
end{pspicture}
end{document}
you'll get an empty grid.
answered Jan 7 at 18:34
HerbertHerbert
271k24409718
271k24409718
add a comment |
add a comment |
I can only reproduce the single arrow for psline[arrows=->](1,1)(1,1)
because I use the latest TeX Live 2018 update. I think someone has changed the arc-related macros several days ago.
A single arrow for the zero-length line is a feature that is intentionally kept as it is because according to someone it is useful for drawing zero-length vectors. TikZ also has the same feature, right? :-)
So if you want to get nothing for a zero-length line, do modify the psline
as follows.
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
Here I present an example in which zero-length lines are practically useful in our life. Of course we can use conditional macro to get the same result.
documentclass[pstricks,border=1cm]{standalone}
usepackage{pstricks-add}
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
usepackage[nomessages]{fp}
newcommandconst[3][3]{%
expandafterFPevalcsname#2endcsname{round(#3:#1)}%
pstVerb{/#2 csname#2endcsnamespace def}%
}
newcommandConst[3][3]{begingroupedeftemp{endgroupnoexpandconst[#1]{#2}{#3}}temp}
Const{Tpeak}{1}
Const{Theta}{80/180*pi}
Const{Gravity}{10}
Const{SpeedFactor}{0.2}
Const{FPS}{11}
defX#1{Vinit*cos(Theta)*#1}
defY#1{Vinit*sin(Theta)*#1-Gravity*pow(2,#1)/2}
Const{Vinit}{Tpeak*Gravity/sin(Theta)}
Const{Xpeak}{X{Tpeak}}
Const{Ypeak}{Y{Tpeak}}
defpoint#1{%
pnode(!Vinit Theta RadToDeg 2 copy cos mul #1 mul 3 1 roll sin mul #1 mul Gravity #1 2 exp mul 2 div sub){P}
pscircle[linecolor=red,fillstyle=solid,fillcolor=yellow](P){3pt}
pnode[!Vinit Theta RadToDeg cos mul SpeedFactor mul 0](P){PX}
pnode[!0 Vinit Theta RadToDeg sin mul Gravity #1 mul sub SpeedFactor mul](P){PY}
%
psline[linecolor=blue]{->}(P)(PX)
psline[linecolor=magenta]{->}(P)(PX|PY)
psline[linecolor=blue]{->}(P)(PY)
}
Const{DeltaTime}{1/FPS}
Const[0]{TotalFrames}{FPS*2*Tpeak}
Const[0]{TotalFrames}{TotalFrames+1}
begin{document}
multido{nt=0.000+DeltaTime}{TotalFrames}{%
begin{pspicture}[showgrid=false](0,-35pt)(2dimexprXpeakpsxunitrelax,dimexprYpeakpsyunit+7ptrelax)
parabola[linewidth=0.5pslinewidth,linestyle=dashed](0,0)(Xpeak,Ypeak)
point{nt}
end{pspicture}}
end{document}
add a comment |
I can only reproduce the single arrow for psline[arrows=->](1,1)(1,1)
because I use the latest TeX Live 2018 update. I think someone has changed the arc-related macros several days ago.
A single arrow for the zero-length line is a feature that is intentionally kept as it is because according to someone it is useful for drawing zero-length vectors. TikZ also has the same feature, right? :-)
So if you want to get nothing for a zero-length line, do modify the psline
as follows.
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
Here I present an example in which zero-length lines are practically useful in our life. Of course we can use conditional macro to get the same result.
documentclass[pstricks,border=1cm]{standalone}
usepackage{pstricks-add}
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
usepackage[nomessages]{fp}
newcommandconst[3][3]{%
expandafterFPevalcsname#2endcsname{round(#3:#1)}%
pstVerb{/#2 csname#2endcsnamespace def}%
}
newcommandConst[3][3]{begingroupedeftemp{endgroupnoexpandconst[#1]{#2}{#3}}temp}
Const{Tpeak}{1}
Const{Theta}{80/180*pi}
Const{Gravity}{10}
Const{SpeedFactor}{0.2}
Const{FPS}{11}
defX#1{Vinit*cos(Theta)*#1}
defY#1{Vinit*sin(Theta)*#1-Gravity*pow(2,#1)/2}
Const{Vinit}{Tpeak*Gravity/sin(Theta)}
Const{Xpeak}{X{Tpeak}}
Const{Ypeak}{Y{Tpeak}}
defpoint#1{%
pnode(!Vinit Theta RadToDeg 2 copy cos mul #1 mul 3 1 roll sin mul #1 mul Gravity #1 2 exp mul 2 div sub){P}
pscircle[linecolor=red,fillstyle=solid,fillcolor=yellow](P){3pt}
pnode[!Vinit Theta RadToDeg cos mul SpeedFactor mul 0](P){PX}
pnode[!0 Vinit Theta RadToDeg sin mul Gravity #1 mul sub SpeedFactor mul](P){PY}
%
psline[linecolor=blue]{->}(P)(PX)
psline[linecolor=magenta]{->}(P)(PX|PY)
psline[linecolor=blue]{->}(P)(PY)
}
Const{DeltaTime}{1/FPS}
Const[0]{TotalFrames}{FPS*2*Tpeak}
Const[0]{TotalFrames}{TotalFrames+1}
begin{document}
multido{nt=0.000+DeltaTime}{TotalFrames}{%
begin{pspicture}[showgrid=false](0,-35pt)(2dimexprXpeakpsxunitrelax,dimexprYpeakpsyunit+7ptrelax)
parabola[linewidth=0.5pslinewidth,linestyle=dashed](0,0)(Xpeak,Ypeak)
point{nt}
end{pspicture}}
end{document}
add a comment |
I can only reproduce the single arrow for psline[arrows=->](1,1)(1,1)
because I use the latest TeX Live 2018 update. I think someone has changed the arc-related macros several days ago.
A single arrow for the zero-length line is a feature that is intentionally kept as it is because according to someone it is useful for drawing zero-length vectors. TikZ also has the same feature, right? :-)
So if you want to get nothing for a zero-length line, do modify the psline
as follows.
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
Here I present an example in which zero-length lines are practically useful in our life. Of course we can use conditional macro to get the same result.
documentclass[pstricks,border=1cm]{standalone}
usepackage{pstricks-add}
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
usepackage[nomessages]{fp}
newcommandconst[3][3]{%
expandafterFPevalcsname#2endcsname{round(#3:#1)}%
pstVerb{/#2 csname#2endcsnamespace def}%
}
newcommandConst[3][3]{begingroupedeftemp{endgroupnoexpandconst[#1]{#2}{#3}}temp}
Const{Tpeak}{1}
Const{Theta}{80/180*pi}
Const{Gravity}{10}
Const{SpeedFactor}{0.2}
Const{FPS}{11}
defX#1{Vinit*cos(Theta)*#1}
defY#1{Vinit*sin(Theta)*#1-Gravity*pow(2,#1)/2}
Const{Vinit}{Tpeak*Gravity/sin(Theta)}
Const{Xpeak}{X{Tpeak}}
Const{Ypeak}{Y{Tpeak}}
defpoint#1{%
pnode(!Vinit Theta RadToDeg 2 copy cos mul #1 mul 3 1 roll sin mul #1 mul Gravity #1 2 exp mul 2 div sub){P}
pscircle[linecolor=red,fillstyle=solid,fillcolor=yellow](P){3pt}
pnode[!Vinit Theta RadToDeg cos mul SpeedFactor mul 0](P){PX}
pnode[!0 Vinit Theta RadToDeg sin mul Gravity #1 mul sub SpeedFactor mul](P){PY}
%
psline[linecolor=blue]{->}(P)(PX)
psline[linecolor=magenta]{->}(P)(PX|PY)
psline[linecolor=blue]{->}(P)(PY)
}
Const{DeltaTime}{1/FPS}
Const[0]{TotalFrames}{FPS*2*Tpeak}
Const[0]{TotalFrames}{TotalFrames+1}
begin{document}
multido{nt=0.000+DeltaTime}{TotalFrames}{%
begin{pspicture}[showgrid=false](0,-35pt)(2dimexprXpeakpsxunitrelax,dimexprYpeakpsyunit+7ptrelax)
parabola[linewidth=0.5pslinewidth,linestyle=dashed](0,0)(Xpeak,Ypeak)
point{nt}
end{pspicture}}
end{document}
I can only reproduce the single arrow for psline[arrows=->](1,1)(1,1)
because I use the latest TeX Live 2018 update. I think someone has changed the arc-related macros several days ago.
A single arrow for the zero-length line is a feature that is intentionally kept as it is because according to someone it is useful for drawing zero-length vectors. TikZ also has the same feature, right? :-)
So if you want to get nothing for a zero-length line, do modify the psline
as follows.
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
Here I present an example in which zero-length lines are practically useful in our life. Of course we can use conditional macro to get the same result.
documentclass[pstricks,border=1cm]{standalone}
usepackage{pstricks-add}
makeatletter
defpsline{pst@object{psline}}% a special Line
defpsline@i{pst@getarrows{begin@OpenObj pst@getcoors[psline@ii}}
defpsline@ii{%
addto@pscode{
ifPst@noCurrentPointelsepst@cpfi% current point?
4 copy Pyth2 psk@arrowlength ge
{ psline@iii tx@Line }% arc and lineto type
{ pop pop pop pop } ifelse }%
end@OpenObj}
makeatother
usepackage[nomessages]{fp}
newcommandconst[3][3]{%
expandafterFPevalcsname#2endcsname{round(#3:#1)}%
pstVerb{/#2 csname#2endcsnamespace def}%
}
newcommandConst[3][3]{begingroupedeftemp{endgroupnoexpandconst[#1]{#2}{#3}}temp}
Const{Tpeak}{1}
Const{Theta}{80/180*pi}
Const{Gravity}{10}
Const{SpeedFactor}{0.2}
Const{FPS}{11}
defX#1{Vinit*cos(Theta)*#1}
defY#1{Vinit*sin(Theta)*#1-Gravity*pow(2,#1)/2}
Const{Vinit}{Tpeak*Gravity/sin(Theta)}
Const{Xpeak}{X{Tpeak}}
Const{Ypeak}{Y{Tpeak}}
defpoint#1{%
pnode(!Vinit Theta RadToDeg 2 copy cos mul #1 mul 3 1 roll sin mul #1 mul Gravity #1 2 exp mul 2 div sub){P}
pscircle[linecolor=red,fillstyle=solid,fillcolor=yellow](P){3pt}
pnode[!Vinit Theta RadToDeg cos mul SpeedFactor mul 0](P){PX}
pnode[!0 Vinit Theta RadToDeg sin mul Gravity #1 mul sub SpeedFactor mul](P){PY}
%
psline[linecolor=blue]{->}(P)(PX)
psline[linecolor=magenta]{->}(P)(PX|PY)
psline[linecolor=blue]{->}(P)(PY)
}
Const{DeltaTime}{1/FPS}
Const[0]{TotalFrames}{FPS*2*Tpeak}
Const[0]{TotalFrames}{TotalFrames+1}
begin{document}
multido{nt=0.000+DeltaTime}{TotalFrames}{%
begin{pspicture}[showgrid=false](0,-35pt)(2dimexprXpeakpsxunitrelax,dimexprYpeakpsyunit+7ptrelax)
parabola[linewidth=0.5pslinewidth,linestyle=dashed](0,0)(Xpeak,Ypeak)
point{nt}
end{pspicture}}
end{document}
edited Jan 6 at 17:57
answered Jan 6 at 17:41
God Must Be CrazyGod Must Be Crazy
6,08011039
6,08011039
add a comment |
add a comment |
Try out this:
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psline[arrows=->](0,1)(1,0)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{360}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{360}
psarc[arrows=->](2.5,2.5){1}{0}{360}
psarcn[arrows=->](2.5,2.5){2}{0}{360}
end{pspicture}
end{document}
What do you want to get when letting start a vector (psline) at the same point where it ends? Just produce an arrowhead with a given direction?
Note: psarc[arrows=->](2.5,2.5){1}{0}{360}
The parentheses give the coordinates of the center of the arc of the circle.
The first mandatory argument gives the radius of the arc of the circle.
The second and third mandatory arguments give the starting and ending angle of the arc.
When both angles are chosen to 0, there is no arc to be drawn, as well as with the ellipses ... I cannot reproduce that the elliptic arcs are drawn.
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
I think you are now using the latest update so you cannot reproduce the elliptical arcs.
– God Must Be Crazy
Jan 6 at 18:09
add a comment |
Try out this:
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psline[arrows=->](0,1)(1,0)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{360}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{360}
psarc[arrows=->](2.5,2.5){1}{0}{360}
psarcn[arrows=->](2.5,2.5){2}{0}{360}
end{pspicture}
end{document}
What do you want to get when letting start a vector (psline) at the same point where it ends? Just produce an arrowhead with a given direction?
Note: psarc[arrows=->](2.5,2.5){1}{0}{360}
The parentheses give the coordinates of the center of the arc of the circle.
The first mandatory argument gives the radius of the arc of the circle.
The second and third mandatory arguments give the starting and ending angle of the arc.
When both angles are chosen to 0, there is no arc to be drawn, as well as with the ellipses ... I cannot reproduce that the elliptic arcs are drawn.
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
I think you are now using the latest update so you cannot reproduce the elliptical arcs.
– God Must Be Crazy
Jan 6 at 18:09
add a comment |
Try out this:
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psline[arrows=->](0,1)(1,0)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{360}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{360}
psarc[arrows=->](2.5,2.5){1}{0}{360}
psarcn[arrows=->](2.5,2.5){2}{0}{360}
end{pspicture}
end{document}
What do you want to get when letting start a vector (psline) at the same point where it ends? Just produce an arrowhead with a given direction?
Note: psarc[arrows=->](2.5,2.5){1}{0}{360}
The parentheses give the coordinates of the center of the arc of the circle.
The first mandatory argument gives the radius of the arc of the circle.
The second and third mandatory arguments give the starting and ending angle of the arc.
When both angles are chosen to 0, there is no arc to be drawn, as well as with the ellipses ... I cannot reproduce that the elliptic arcs are drawn.
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
Try out this:
documentclass[pstricks,border=12pt]{standalone}
begin{document}
begin{pspicture}[showgrid](5,5)
psline[arrows=->](1,1)(1,1)
psline[arrows=->](0,1)(1,0)
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{360}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{360}
psarc[arrows=->](2.5,2.5){1}{0}{360}
psarcn[arrows=->](2.5,2.5){2}{0}{360}
end{pspicture}
end{document}
What do you want to get when letting start a vector (psline) at the same point where it ends? Just produce an arrowhead with a given direction?
Note: psarc[arrows=->](2.5,2.5){1}{0}{360}
The parentheses give the coordinates of the center of the arc of the circle.
The first mandatory argument gives the radius of the arc of the circle.
The second and third mandatory arguments give the starting and ending angle of the arc.
When both angles are chosen to 0, there is no arc to be drawn, as well as with the ellipses ... I cannot reproduce that the elliptic arcs are drawn.
psellipticarc[arrows=->](2.5,2.5)(1,2){0}{0}
psellipticarcn[arrows=->](2.5,2.5)(2,1){0}{0}
edited Jan 6 at 23:36
Sebastiano
9,34341756
9,34341756
answered Jan 6 at 17:41
Jürgen GJürgen G
1,130214
1,130214
I think you are now using the latest update so you cannot reproduce the elliptical arcs.
– God Must Be Crazy
Jan 6 at 18:09
add a comment |
I think you are now using the latest update so you cannot reproduce the elliptical arcs.
– God Must Be Crazy
Jan 6 at 18:09
I think you are now using the latest update so you cannot reproduce the elliptical arcs.
– God Must Be Crazy
Jan 6 at 18:09
I think you are now using the latest update so you cannot reproduce the elliptical arcs.
– God Must Be Crazy
Jan 6 at 18:09
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f468837%2fhow-to-draw-a-zero-length-psline-without-an-arrow%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
(1,1) to (1,1) is a rather short line? did you intend (0,0)(1,1) ?
– David Carlisle
Jan 6 at 15:44
1
@chishimotoji that is specifying the start and end point to be at the same place what kind of line do you expect to see in that case? "short" was an under-statement, it has length 0pt.
– David Carlisle
Jan 6 at 15:58
1
The coordinates of
psline[arrows=->](1,1)(1,1)
are nonsense and if you want an arrow for such coordinates you get nonsense...– Herbert
Jan 6 at 18:20
1
@Herbert: So
psline[arrows=->](1,1)(1,1)
should be rendered as "nothing" or an arrow? The current condition in both PSTricks and TikZ, it produces an arrow that looks like a bug.– God Must Be Crazy
Jan 6 at 18:24
1
With pstricks.tex from archiv.dante.de/~herbert/texnik/tex/generic/pstricks you can use
psLine
(uppercase L) which can have only one or two pairs of coordinates, but will test for a length between the points. Will later be on CTAN.– Herbert
Jan 7 at 18:31