summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic')
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic17
1 files changed, 13 insertions, 4 deletions
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic b/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic
index 656c83a6c8a..61180396584 100644
--- a/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic
+++ b/Master/texmf-dist/doc/latex/circuit-macros/dpictools.pic
@@ -3,7 +3,7 @@
# m4 macro NeedDpicTools or the pic statement copy "HOMELIB_/dpictools.pic"
# when HOMELIB_ is defined or, generically, copy "<path>dpictools.pic"
-# Circuit_macros Version 10.1, copyright (c) 2022 J. D. Aplevich under #
+# Circuit_macros Version 10.2, copyright (c) 2023 J. D. Aplevich under #
# the LaTeX Project Public Licence in file Licence.txt. The files of #
# this distribution may be redistributed or modified provided that this #
# copyright notice is included and provided that modifications are clearly #
@@ -75,7 +75,7 @@ define posarray {
define posarray2 { for i_array=3 to $+ do {
exec sprintf("$1[%g,%g] : $%g",$2,i_array-2,i_array); }}
-# Operations on 3-d vectors (could be generalized
+# Operations on 3D vectors (could be generalized
# except for cross):
# $3 = $1 + $2
define sum3 {
@@ -323,7 +323,7 @@ define rgbtocmyk {
# postprocessor specified by dpic command-line
# option; colorname then evaluates to a string
define DefineRGBColor {
-case(dpicopt, # The order of the following is defined in dpic source:
+case(abs(dpicopt), # The order of the following is defined in dpic source:
# MFpic:
command sprintf("\mfpdefinecolor{_$1__}{rgb}{%g,%g,%g}",$2,$3,$4)
define $1 {"_$1__"} ,
@@ -507,12 +507,21 @@ define Intersect_ {intersect_($1.start,$1.end,$2.start,$2.end)}
# Nearest multiple of 90
define drawdir_ {(int(pmod($1+45,360)/90)*90)}
-# vlength(x,y) 2-D vector length
+# vlength(x,y) 2-D length
define vlength {sqrt(abs(($1)^2+($2)^2))}
# distance(Pos1,Pos2) distance between positions
define distance {vlength(($1).x-($2).x,($1).y-($2).y)}
+# linang(linear obj) angle of linear object
+define linang {atan2($1.end.y-$1.start.y,$1.end.x-$1.start.x)}
+
+# posang(Position) angle of position wrt (0,0)
+define posang {atan2(($1).y,($1).x)}
+
+# cangle(A,B,C) angle at B of line A to B to C
+define cangle { (posang(($1-($2)))-posang(($3-($2)))) }
+
# For PGF, PSTricks, or SVG only:
define dpshade { beginshade($1); $2; endshade } # like libgen shade()