0% found this document useful (0 votes)
82 views1 page

Plotting Relative Lines in PostScript

The \psRelLine macro plots lines relative to a given line. It takes parameters for the angle and length factor relative to the original line. The length factor scales the distance between the original points, while the end node name assigns a name to the endpoint. Examples show \psRelLine drawing lines at angles of 30, -30, 90, and -90 degrees that are half the length of the original line, connecting two points on an ellipse and circle.

Uploaded by

jimusos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views1 page

Plotting Relative Lines in PostScript

The \psRelLine macro plots lines relative to a given line. It takes parameters for the angle and length factor relative to the original line. The length factor scales the distance between the original points, while the end node name assigns a name to the endpoint. Examples show \psRelLine drawing lines at angles of 30, -30, 90, and -90 degrees that are half the length of the original line, connecting two points on an ellipse and circle.

Uploaded by

jimusos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

17.

\psRelLine 32

17. \psRelLine

With this macro it is possible to plot lines relative to a given one. Parameter are the angle and the
length factor:
\psRelLine(P0 )(P1 ){length factor }{<end node name> }
\psRelLine [{arrows }] (P0 )(P1 ){length factor }{end node name }
\psRelLine [Options] (P0 )(P1 ){length factor }{end node name }
\psRelLine [Options] [{arrows }] (P0 )(P1 ){length factor }{end node name }

The length factor relates to the distance P0 P1 and the end node name must be a valid nodename
and shouldn’t contain any of the special PostScript characters. There are two valid options which
are described in the foregoing section for \psRelNode.
The following two figures show the same, the first one with a scaling different to 1 : 1, this is the
reason why the end points are on an ellipse and not on a circle like in the second figure.
2

\psset{yunit=2,xunit=1}
\begin{pspicture}(-2,-2)(3,2)
1 \psgrid[subgriddiv=2,subgriddots=10,gridcolor=lightgray]
\pnode(-1,0){A}\pnode(3,2){B}
\psline[linecolor=red](A)(B)
\psRelLine[linecolor=blue,angle=30](-1,0)(B){0.5}{EndNode}
\qdisk(EndNode){2pt}
0
\psRelLine[linecolor=blue,angle=-30](A)(B){0.5}{EndNode}
\qdisk(EndNode){2pt}
\psRelLine[linecolor=magenta,angle=90](-1,0)(3,2){0.5}{EndNode}
\qdisk(EndNode){2pt}
-1 \psRelLine[linecolor=magenta,angle=-90](A)(B){0.5}{EndNode}
\qdisk(EndNode){2pt}
\end{pspicture}

-2
-2 -1 0 1 2 3
\begin{pspicture}(-2,-2)(3,2)
\psgrid[subgriddiv=2,subgriddots=10,gridcolor=lightgray]
2 \pnode(-1,0){A}\pnode(3,2){B}
\psline[linecolor=red](A)(B)
1 \psarc[linestyle=dashed](A){2.23}{-90}{135}
\psRelLine[linecolor=blue,angle=30](-1,0)(B){0.5}{EndNode}
\qdisk(EndNode){2pt}
0
\psRelLine[linecolor=blue,angle=-30](A)(B){0.5}{EndNode}
\qdisk(EndNode){2pt}
-1 \psRelLine[linecolor=magenta,angle=90](-1,0)(3,2){0.5}{EndNode}
\qdisk(EndNode){2pt}
-2 \psRelLine[linecolor=magenta,angle=-90](A)(B){0.5}{EndNode}
-2 -1 0 1 2 3 \qdisk(EndNode){2pt}
\end{pspicture}

The following figure has also a different scaling, but has set the option trueAngle, all angles refer
to "what you see".

You might also like