summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.am2
-rw-r--r--Build/source/texk/texlive/linked_scripts/Makefile.in2
-rwxr-xr-x[-rw-r--r--]Build/source/texk/texlive/linked_scripts/mathspic/mathspic113.pl (renamed from Master/texmf-dist/doc/latex/mathspic/mathpic.pl)109
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/texlive/tlmgr.pl27
l---------Master/bin/alpha-linux/mathspic2
l---------Master/bin/amd64-freebsd/mathspic2
l---------Master/bin/amd64-kfreebsd/mathspic2
l---------Master/bin/i386-cygwin/mathspic2
l---------Master/bin/i386-freebsd/mathspic2
l---------Master/bin/i386-kfreebsd/mathspic2
l---------Master/bin/i386-linux/mathspic2
l---------Master/bin/i386-netbsd/mathspic2
l---------Master/bin/i386-solaris/mathspic2
l---------Master/bin/mips-irix/mathspic2
l---------Master/bin/powerpc-aix/mathspic2
l---------Master/bin/powerpc-linux/mathspic2
l---------Master/bin/sparc-linux/mathspic2
l---------Master/bin/sparc-solaris/mathspic2
l---------Master/bin/universal-darwin/mathspic2
l---------Master/bin/x86_64-darwin/mathspic2
l---------Master/bin/x86_64-linux/mathspic2
l---------Master/bin/x86_64-solaris/mathspic2
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/HELP.txt173
-rwxr-xr-xMaster/texmf-dist/doc/latex/mathspic/MATHSPIC.BAT2
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/README.txt55
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/cleanmathspic.pl23
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/drawcube.pl50
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/drawcurvedarrow.pl10
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/figures.tgzbin25107 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/grabtexdata.tex13
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/mathsPICa4.pdfbin610089 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/mathsPICa5.pdfbin624776 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/mathsPICfigures.zipbin0 -> 14582 bytes
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/mathsPICmanual.pdfbin0 -> 686541 bytes
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/mathsPICmanual.zipbin0 -> 1240540 bytes
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/mathspic.144
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/mathspic.lib4
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/mathspic.sh16
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/sourcecode.pdfbin377535 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/sourcecode113.html (renamed from Master/texmf-dist/doc/latex/mathspic/sourcecode.html)938
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/sourcecode113.nw (renamed from Master/texmf-dist/doc/latex/mathspic/sourcecode.nw)141
-rw-r--r--Master/texmf-dist/doc/latex/mathspic/sourcecode113.pdfbin0 -> 2864043 bytes
-rwxr-xr-xMaster/texmf-dist/scripts/mathspic/mathspic.pl3329
-rwxr-xr-x[-rw-r--r--]Master/texmf-dist/scripts/mathspic/mathspic113.pl (renamed from Build/source/texk/texlive/linked_scripts/mathspic/mathspic.pl)203
-rw-r--r--Master/texmf-dist/tex/latex/mathspic/mathspic.sty17
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds6
46 files changed, 889 insertions, 4311 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.am b/Build/source/texk/texlive/linked_scripts/Makefile.am
index 0891b7cd457..d9b69a2f2e9 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.am
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.am
@@ -96,7 +96,7 @@ texmf_dist_other_scripts = \
latexmk/latexmk.pl \
luaotfload/mkluatexfontdb.lua \
match_parens/match_parens \
- mathspic/mathspic.pl \
+ mathspic/mathspic113.pl \
mf2pt1/mf2pt1.pl \
mkjobtexmf/mkjobtexmf.pl \
mkgrkindex/mkgrkindex \
diff --git a/Build/source/texk/texlive/linked_scripts/Makefile.in b/Build/source/texk/texlive/linked_scripts/Makefile.in
index 7e8fb94fc84..643edb57a2e 100644
--- a/Build/source/texk/texlive/linked_scripts/Makefile.in
+++ b/Build/source/texk/texlive/linked_scripts/Makefile.in
@@ -234,7 +234,7 @@ texmf_dist_other_scripts = \
latexmk/latexmk.pl \
luaotfload/mkluatexfontdb.lua \
match_parens/match_parens \
- mathspic/mathspic.pl \
+ mathspic/mathspic113.pl \
mf2pt1/mf2pt1.pl \
mkjobtexmf/mkjobtexmf.pl \
mkgrkindex/mkgrkindex \
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathpic.pl b/Build/source/texk/texlive/linked_scripts/mathspic/mathspic113.pl
index 21a3b5c6167..5c3ed4ec1f9 100644..100755
--- a/Master/texmf-dist/doc/latex/mathspic/mathpic.pl
+++ b/Build/source/texk/texlive/linked_scripts/mathspic/mathspic113.pl
@@ -1,8 +1,8 @@
#!/usr/bin/perl
#
-#(c) Copyright 2005-2007
+#(c) Copyright 2005-2010 VERSION 1.13 April 26, 2010
# Apostolos Syropoulos & R.W.D. Nickalls
-# asyropoulos@yahoo.com dicknickalls@compuserve.com
+# asyropoulos@yahoo.com dick@nickalls.org
#
# This program can be redistributed and/or modified under the terms
# of the LaTeX Project Public License Distributed from CTAN
@@ -30,7 +30,7 @@ sub READLINE {
package main;
use Math::Trig;
-our $version_number = "1.10 Feb 18, 2007";
+our $version_number = "1.13 Apr 26, 2010";
our $commandLineArgs = join(" ", @ARGV);
our $command = "";
our $curr_in_file = "";
@@ -345,7 +345,7 @@ our $LineThickness = 0.4;
print OUT "%* -----------------------------------------------\n";
print OUT "%* mathspic (Perl version $version_number)\n";
print OUT "%* A filter program for use with PiCTeX\n";
- print OUT "%* Copyright (c) 2005 A Syropoulos & RWD Nickalls \n";
+ print OUT "%* Copyright (c) 2005-2010 A Syropoulos & RWD Nickalls \n";
print OUT "%* Command line: $0 $commandLineArgs\n";
print OUT "%* Input filename : $source_file\n";
print OUT "%* Output filename: $out_file\n";
@@ -355,7 +355,7 @@ our $LineThickness = 0.4;
print LOG "----\n";
print LOG "$now_string\n";
print LOG "mathspic (Perl version $version_number)\n";
- print LOG "Copyright (c) 2005 A Syropoulos & RWD Nickalls \n";
+ print LOG "Copyright (c) 2005-2010 A Syropoulos & RWD Nickalls \n";
print LOG "Input file = $source_file\n";
print LOG "Output file = $out_file\n";
print LOG "Log file = $log_file\n";
@@ -367,7 +367,7 @@ our $LineThickness = 0.4;
my ($lc) = $_[0];
my ($PointName);
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})\s*//i) { #point name
$PointName = $1;
if (!exists($PointTable{lc($PointName)})) {
PrintErrorMessage("Undefined point $PointName",$lc);
@@ -550,20 +550,20 @@ our $LineThickness = 0.4;
{
return ($1, 1);
}
- elsif (/^[^\W\d_]\d{0,3}[^\W\d_]\d{0,3}/) #it is a pair of IDs?
+ elsif (/^[^\W\d_]\d{0,4}[^\W\d_]\d{0,4}/) #it is a pair of IDs?
{
- s/^([^\W\d_]\d{0,3})//i;
+ s/^([^\W\d_]\d{0,4})//i;
$v1 = $1;
if (!exists($PointTable{lc($v1)})) {
if (exists($VarTable{lc($v1)})) {
return ($VarTable{lc($v1)}, 1);
}
PrintErrorMessage("Point $v1 has not been defined", $lc);
- s/^\s*[^\W\d_]\d{0,3}//i;
+ s/^\s*[^\W\d_]\d{0,4}//i;
return (0,0);
}
$v1 = lc($v1);
- s/^\s*([^\W\d_]\d{0,3})//i;
+ s/^\s*([^\W\d_]\d{0,4})//i;
$v2 = $1;
if (!exists($PointTable{lc($v2)}))
{
@@ -575,7 +575,7 @@ our $LineThickness = 0.4;
my ($x2,$y2,$pSV2,$pS2) = unpack("d3A*",$PointTable{$v2});
return (Length($x1,$y1,$x2,$y2), 1);
}
- elsif (s/^([^\W\d_]\d{0,3})//i) # it is a single id
+ elsif (s/^([^\W\d_]\d{0,4})//i) # it is a single id
{
$v1 = $1;
if (!exists($VarTable{lc($v1)})) #it isn't a variable
@@ -822,7 +822,7 @@ our $LineThickness = 0.4;
DRAWLINES:while(1) {
@PP = () ;
while(1) {
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})\s*//i) { #point name
$P = $1;
if (!exists($PointTable{lc($P)})) {
PrintErrorMessage("Undefined point $P",$lc);
@@ -1262,7 +1262,7 @@ our $LineThickness = 0.4;
chk_rparen("Missing right parenthesis", $lc);
}
elsif (s/^angle//i) {
- chk_lparen("angle".$lc);
+ chk_lparen("angle",$lc);
my $point_1 = get_point($lc);
my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
my $point_2 = get_point($lc);
@@ -1463,6 +1463,13 @@ our $LineThickness = 0.4;
return $found;
}
+ sub midpoint {
+ my ($x1, $y1, $x2, $y2)=@_;
+ return ($x1 + ($x2 - $x1)/2,
+ $y1 + ($y2 - $y1)/2);
+ }
+
+
sub tand {
my $d = $_[0];
$d = $d * PI / 180;
@@ -1721,7 +1728,7 @@ our $LineThickness = 0.4;
do{
s/\s*//;
PrintErrorMessage("no identifier found after token const",$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
+ if $_ !~ s/^([^\W\d_]\d{0,4})//i;
my $Constname = $1;
my $constname = lc($Constname);
if (exists $ConstTable{$constname}) {
@@ -2074,7 +2081,7 @@ our $LineThickness = 0.4;
}
my(@PP);
DRAWPOINTS:while(1) {
- if (s/^([^\W\d_]\d{0,3})//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})//i) { #point name
$P = $1;
if (!exists($PointTable{lc($P)})) {
PrintErrorMessage("Undefined point $P",$lc);
@@ -2099,7 +2106,7 @@ our $LineThickness = 0.4;
my ($cmd) = $1;
print OUT "%% $cmd$_" if $comments_on;
- chk_lparen("drawRightAngle",lc);
+ chk_lparen("drawRightAngle",$lc);
my $point1 = get_point($lc);
next LINE if $point1 eq "_undef_";
my $point2 = get_point($lc);
@@ -2116,34 +2123,23 @@ our $LineThickness = 0.4;
#
#actual computation
#
- my $lengthAC = Length($x1, $y1, $x3, $y3);
- my $angleBAC = Angle($x2, $y2, $x1, $y1, $x3, $y3);
- my $line1 = $lengthAC / (1 + tand($angleBAC));
- #
- # determine coordinates of point Q
- #
- my ($xQ, $yQ) = pointOnLine($x1, $y1, $x3, $y3, $line1);
- #
- # determine coordinates of point S
- #
- my $deltax = $xQ - $x2;
- my $deltay = $yQ - $y2;
- my $lengthBQ = sqrt($deltax * $deltax + $deltay * $deltay);
- my $xS = $x2 + ($dist * sqrt(2) * $deltax / $lengthBQ);
- my $yS = $y2 + ($dist * sqrt(2) * $deltay / $lengthBQ);
- #
- # determine coordinates of points S1 and S2
- #
- my ($xS1, $yS1) = pointOnLine($x2, $y2, $x3, $y3, $dist);
- ($xS2, $yS2) = ($xS, $yS);
- #
- # emit PiCTeX code
- #
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $xS1, $yS1, $xS2, $yS2;
- ($xS1, $yS1) = pointOnLine($x2, $y2, $x1, $y1, $dist);
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $xS1, $yS1, $xS2, $yS2;
+ my ($Px, $Py) = pointOnLine($x2, $y2, $x1, $y1, $dist);
+ my ($Qx, $Qy) = pointOnLine($x2, $y2, $x3, $y3, $dist);
+ my ($Tx, $Ty) = midpoint($Px, $Py, $Qx, $Qy);
+ my ($Ux, $Uy) = pointOnLine($x2, $y2, $Tx, $Ty, 2*Length($x2, $y2, $Tx, $Ty));
+ if ($Px == $Ux || $Py == $Uy) {
+ printf OUT "\\putrule from %.5f %.5f to %.5f %.5f \n", $Px,$Py,$Ux,$Uy;
+ }
+ else {
+ printf OUT "\\plot %.5f %.5f\t%.5f %.5f / \n", $Px, $Py,$Ux,$Uy;
+ }
+ if ($Ux == $Qx || $Uy == $Qy) {
+ printf OUT "\\putrule from %.5f %.5f to %.5f %.5f \n", $Ux,$Uy,$Qx,$Qy;
+ }
+ else {
+ printf OUT "\\plot %.5f %.5f\t%.5f %.5f / \n", $Ux, $Uy,$Qx,$Qy;
+ }
+
}
elsif (s/^\s*(drawsquare(?=\W))//i)
@@ -2638,7 +2634,7 @@ our $LineThickness = 0.4;
$pointStar = 0; # default value: he have a point command
$pointStar = 1 if s/^\*//;
chk_lparen("point" . (($pointStar)?"*":""),$lc);
- if (s/^([^\W\d_](?![^\W\d_])\d{0,3})//i) {
+ if (s/^([^\W\d_](?![^\W\d_])\d{0,4})//i) {
#
# Note: the regular expression (foo)(?!bar) means that we are
# looking a foo not followed by a bar. Moreover, the regular
@@ -2705,8 +2701,7 @@ our $LineThickness = 0.4;
chk_rparen("No closing parenthesis found",$lc);
my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- $Px = $x1 + ($x2 - $x1)/2;
- $Py = $y1 + ($y2 - $y1)/2;
+ ($Px, $Py) = midpoint($x1, $y1, $x2, $y2);
}
elsif (s/^pointonline(?=\W)//i) {
@@ -2785,8 +2780,8 @@ our $LineThickness = 0.4;
chk_rparen("after coordinates part",$lc);
}
- elsif (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
- m/^([^\W\d_]\d{0,3})\s*/i;
+ elsif (/^[^\W\d_]\d{0,4}\s*[^,\w]/) {
+ m/^([^\W\d_]\d{0,4})\s*/i;
if (exists($PointTable{lc($1)})) {
my $Tcoord = get_point($lc);
my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{$Tcoord});
@@ -2799,8 +2794,8 @@ our $LineThickness = 0.4;
$Py = expr();
}
}
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar|rotate|vector/i) { #a point?
- s/^([^\W\d_]\d{0,3})//i;
+ elsif (/[^\W\d_]\d{0,4}\s*,\s*shift|polar|rotate|vector/i) { #a point?
+ s/^([^\W\d_]\d{0,4})//i;
my $PointA = $1;
if (exists($PointTable{lc($PointA)})) {
s/\s*//;
@@ -3094,14 +3089,14 @@ our $LineThickness = 0.4;
$pos="";
s/\s*//;
- if (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
+ if (/^[^\W\d_]\d{0,4}\s*[^,\w]/) {
my $Tcoord = get_point($lc);
my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{$Tcoord});
$Px = $x;
$Py = $y;
}
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar/i) {
- s/^([^\W\d_]\d{0,3})//i;
+ elsif (/[^\W\d_]\d{0,4}\s*,\s*shift|polar/i) {
+ s/^([^\W\d_]\d{0,4})//i;
my $PointA = $1;
if (exists($PointTable{lc($PointA)})) {
s/\s*//;
@@ -3225,7 +3220,7 @@ our $LineThickness = 0.4;
do{
s/\s*//;
PrintErrorMessage("no identifier found after token var",$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
+ if $_ !~ s/^([^\W\d_]\d{0,4})//i;
my $Varname = $1;
my $varname = lc($Varname);
if (exists $ConstTable{$varname}) {
@@ -3291,7 +3286,7 @@ else {
"Usage:\tmathspic [-h] [-b] [-c] [-o <out file>] <in file>\n" .
"\twhere,\n" .
"\t[-b]\tenables bell sound if error exists\n" .
- "\t[-c]\tdisables comments in ouput file\n" .
+ "\t[-c]\tdisables comments in output file\n" .
"\t[-h]\tgives this help listing\n" .
"\t[-o]\tcreates specified output file\n\n";
}
@@ -3312,7 +3307,7 @@ else {
else {
$file = $_;
}
- }
+ }my ($xA, $yA, $xB, $yB, $dist)=@_;
die "No input file specified!\n" if $file eq "";
print "This is mathspic version $version_number\n";
diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
index 8f0065442c8..f6cfb8ff1fc 100755
--- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
+++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl
@@ -1,12 +1,12 @@
#!/usr/bin/env perl
-# $Id: tlmgr.pl 23420 2011-08-05 06:27:04Z preining $
+# $Id: tlmgr.pl 23514 2011-08-12 21:36:21Z karl $
#
# Copyright 2008, 2009, 2010, 2011 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
-my $svnrev = '$Revision: 23420 $';
-my $datrev = '$Date: 2011-08-05 08:27:04 +0200 (Fri, 05 Aug 2011) $';
+my $svnrev = '$Revision: 23514 $';
+my $datrev = '$Date: 2011-08-12 23:36:21 +0200 (Fri, 12 Aug 2011) $';
my $tlmgrrevision;
if ($svnrev =~ m/: ([0-9]+) /) {
$tlmgrrevision = $1;
@@ -5598,8 +5598,8 @@ postinstallation action code. It is set by default, and again disabling
is not likely to be of interest except perhaps to developers.
The C<docfiles> and C<srcfiles> options control the installation of
-their respective files of a package. By default both are enabled. This
-can be disabled if disk space is (very) limited.
+their respective files of a package. By default both are enabled (1).
+This can be disabled (set to 0) if disk space is (very) limited.
The options C<autobackup> and C<backupdir> determine the defaults for
the actions C<update>, C<backup> and C<restore>. These three actions
@@ -5630,7 +5630,7 @@ The C<sys_bin>, C<sys_man>, and C<sys_info> options are used on
Unix-like systems to control the generation of links for executables,
info files and man pages. See the C<path> action for details.
-For the <generate_updmap> option, see the C<updmap> section in
+For the C<generate_updmap> option, see the C<updmap> section in
L<generate|/"generate [I<option>]... I<what>">.
The last three options control behaviour on Windows installations. If
@@ -5644,14 +5644,13 @@ instead of only the current user. All three options are on by default.
=head2 conf [texmf|tlmgr [I<key> [I<value>]]]
-With only the C<conf>, show general configuration information for TeX
-Live, including active configuration files, path settings, and more.
-This is like the C<texconfig conf> call, but works on all supported
-platforms.
+With only C<conf>, show general configuration information for TeX Live,
+including active configuration files, path settings, and more. This is
+like the C<texconfig conf> call, but works on all supported platforms.
-With either C<texmf> or C<tlmgr> given in addition, shows all key/value
-pairs (i.e., all settings) as saved in C<ROOT/texmf.cnf> or the tlmgr
-configuration file (see below), respectively.
+With either C<conf texmf> or C<conf tlmgr> given in addition, shows all
+key/value pairs (i.e., all settings) as saved in C<ROOT/texmf.cnf> or
+the tlmgr configuration file (see below), respectively.
If I<key> is given in addition, shows the value of only that given
I<key> in the respective file.
@@ -5665,7 +5664,7 @@ it afterwards:
tlmgr conf texmf shell_escape 0
-B<WARNING:> The general facility is here, but tinkering with settings in
+Warning: The general facility is here, but tinkering with settings in
this way is very strongly discouraged. Again, no error checking is
done, so any sort of breakage is possible.
diff --git a/Master/bin/alpha-linux/mathspic b/Master/bin/alpha-linux/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/alpha-linux/mathspic
+++ b/Master/bin/alpha-linux/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/amd64-freebsd/mathspic b/Master/bin/amd64-freebsd/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/amd64-freebsd/mathspic
+++ b/Master/bin/amd64-freebsd/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/amd64-kfreebsd/mathspic b/Master/bin/amd64-kfreebsd/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/amd64-kfreebsd/mathspic
+++ b/Master/bin/amd64-kfreebsd/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/i386-cygwin/mathspic b/Master/bin/i386-cygwin/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/i386-cygwin/mathspic
+++ b/Master/bin/i386-cygwin/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/i386-freebsd/mathspic b/Master/bin/i386-freebsd/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/i386-freebsd/mathspic
+++ b/Master/bin/i386-freebsd/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/i386-kfreebsd/mathspic b/Master/bin/i386-kfreebsd/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/i386-kfreebsd/mathspic
+++ b/Master/bin/i386-kfreebsd/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/i386-linux/mathspic b/Master/bin/i386-linux/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/i386-linux/mathspic
+++ b/Master/bin/i386-linux/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/i386-netbsd/mathspic b/Master/bin/i386-netbsd/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/i386-netbsd/mathspic
+++ b/Master/bin/i386-netbsd/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/i386-solaris/mathspic b/Master/bin/i386-solaris/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/i386-solaris/mathspic
+++ b/Master/bin/i386-solaris/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/mips-irix/mathspic b/Master/bin/mips-irix/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/mips-irix/mathspic
+++ b/Master/bin/mips-irix/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/powerpc-aix/mathspic b/Master/bin/powerpc-aix/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/powerpc-aix/mathspic
+++ b/Master/bin/powerpc-aix/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/powerpc-linux/mathspic b/Master/bin/powerpc-linux/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/powerpc-linux/mathspic
+++ b/Master/bin/powerpc-linux/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/sparc-linux/mathspic b/Master/bin/sparc-linux/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/sparc-linux/mathspic
+++ b/Master/bin/sparc-linux/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/sparc-solaris/mathspic b/Master/bin/sparc-solaris/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/sparc-solaris/mathspic
+++ b/Master/bin/sparc-solaris/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/universal-darwin/mathspic b/Master/bin/universal-darwin/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/universal-darwin/mathspic
+++ b/Master/bin/universal-darwin/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/x86_64-darwin/mathspic b/Master/bin/x86_64-darwin/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/x86_64-darwin/mathspic
+++ b/Master/bin/x86_64-darwin/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/x86_64-linux/mathspic b/Master/bin/x86_64-linux/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/x86_64-linux/mathspic
+++ b/Master/bin/x86_64-linux/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/bin/x86_64-solaris/mathspic b/Master/bin/x86_64-solaris/mathspic
index 53c2b249348..756e54b6352 120000
--- a/Master/bin/x86_64-solaris/mathspic
+++ b/Master/bin/x86_64-solaris/mathspic
@@ -1 +1 @@
-../../texmf-dist/scripts/mathspic/mathspic.pl \ No newline at end of file
+../../texmf-dist/scripts/mathspic/mathspic113.pl \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/mathspic/HELP.txt b/Master/texmf-dist/doc/latex/mathspic/HELP.txt
index 43a72e81f6a..2ecc7547003 100644
--- a/Master/texmf-dist/doc/latex/mathspic/HELP.txt
+++ b/Master/texmf-dist/doc/latex/mathspic/HELP.txt
@@ -1,54 +1,60 @@
+
+
HELP.txt
-A .txt version of the manpage for MS-Windows users
-copyright (c) 2005 A Syropoulos and RWD Nickalls
-mathsPIC February 2005
+A .txt version of the Linux manpage (for use with MS-Windows)
+
+copyright (c) 2010 A Syropoulos and RWD Nickalls
+mathsPIC 1.13 April 26, 2010 mathsPIC perl version
-NAME: mathsPIC (Perl version 1.0)
+NAME: mathsPIC
-AUTHORS: A. Syropoulos and R.W.D. Nickalls
- apostolo[at]<ocean1><ee><duth><gr>
- dicknickalls[at]<compuserve><com>
+AUTHORS: A. Syropoulos and R.W.D. Nickalls (April 26, 2010)
+
+ asyropoulos[at]<yahoo><com>
+ dick[at]<nickalls><org>
DESCRIPTION
-----------
-mathsPIC is a Perl filter program for PiCTeX. mathsPIC has its own macro and macro library capability, and allows use of mathsPIC, PiCTeX, TeX and LaTeX commands. A significant feature of mathsPIC is that it allows access to the command-line, and so allows the user to extend mathsPIC commands by calling Perl and other programs written to perform particular drawing actions. See the package manual for full details and examples. The latest version can be downloaded from
+mathsPIC is a Perl filter program for PiCTeX. mathsPIC has its own macro and macro library capability, and allows use of mathsPIC, PiCTeX, TeX and LaTeX commands. A significant feature of mathsPIC is that it allows access to the command-line, and so allows the user to extend mathsPIC commands by calling Perl and other programs written to perform particular drawing actions. See the package manual for full details and examples. The latest version can be downloaded from
-CTAN: tex-archive/graphics/pictex/mathspic/perl
+ CTAN: tex-archive/graphics/pictex/mathspic/perl
Commands which can be used in the mathsPIC script file fall into four main groups (a)-mathsPIC macro commands (prefixed with %def), (b)-regular mathsPIC commands (do not have a backslash), (c)-regular PiCTeX commands (all have a backslash), and (d)-regular TeX and LaTeX commands (all have a backslash).
+
The following mathematics functions can used (note that decimal fractions having an absolute value less than 1 must have a leading zero). Note also that all the trignometric functions require their argument in radians.
-Trigonometric: sin(), cos(), tan(), asin(), acos(), atan()
+Trigonometric: sin(), cos(), tan(), asin(), acos(), atan()
Remainder: rem(); eg var r=12 rem(5)
-Integer: int(); eg var r= int(3.87) --> 3
-Sign (returns -1, 0, +1): sgn(); eg var s=sgn(-3.27) --> -1
-Square root: sqrt(); eg var s = sqrt(14)
-Exponentiation: **; eg var j = r**2
-Pi constant: _Pi_ and _pi_ (3.14159...)
-e constant: _E_ and _e_ (2.71828...)
-Linethickness: _linethickness_ ; eg var t = _linethickness_
+Integer: int(); eg var r= int(3.87) --> 3
+Sign (returns -1, 0, +1): sgn(); eg var s=sgn(-3.27) --> -1
+Square root: sqrt(); eg var s = sqrt(14)
+Exponentiation: **; eg var j = r**2
+Pi constant (3.14159...): _Pi_ and _pi_
+e constant (2.71828...): _E_ and _e_
+Linethickness: _linethickness_ ; eg var t = _linethickness_
COMMAND-LINE USE
-----------------
+-----------------
+
perl mathspic.pl [-b] [-c] [-h] [-o <outfile>] <infile>
- -b enables beep if mathsPIC detects an error
- -c disables the writing of comments to output file
- -h displays the help file
- -o defines the output file name
+ -b enables beep if mathsPIC detects an error
+ -c disables the writing of comments to output file
+ -h displays the help file
+ -o defines the output file name
+
MACRO COMMANDS
--------------
-macro definition commands are prefixed with %def and can take either 0, 1, or more parameters. Macros will generally be used as part of a
-var command as shown below. Macros are deleted using the %undef command.
+macro definition commands are prefixed with %def and can take either 0, 1, or more parameters. Macros will generally be used as part of a var command as shown below. Macros are deleted using the %undef command.
-----syntax:
%def MACRONAME(parameters)<macrodefinition>
%undef MACRONAME(parameters)
-----notes:
- Notes: (a)-the () must be used in the definition even if no parameters are used, (b)-the name can be any combination of upper and lower case characters and numbers, (c)-when the macro is used in a command it is prefixed by a & symbol, (d)-it is a good idea to always place a % symbol at the end of the definition, (e)-comments (prefixed by a % symbol) can be placed after the macro definition just as in TeX or LaTeX.
+ Notes: (a) the () must be used in the definition even if no parameters are used, (b) the name can be any combination of upper and lower case characters and numbers, (c) when the macro is used in a command it is prefixed by a & symbol, (d) it is a good idea to always place a % symbol at the end of the definition, (e) comments (prefixed by a % symbol) can be placed after the macro definition just as in TeX or LaTeX.
-----examples:
%def d2r()_pi_/180% % degrees2radians
@@ -62,8 +68,7 @@ var command as shown below. Macros are deleted using the %undef command.
GENERAL COMMANDS
----------------
- NUMERICAL EXPRESSIONS
-
+ NUMERICAL EXPRESSIONS
When dealing with commands we will refer frequently to the term `numerical expression' by which is meant either (a) a number (integer or decimal), (b) a numeric variable or constant (defined using the var or const command), (c) any mathsPIC function, macro, or mathematical expression which evaluates to a number, or (d) a pair of point names (e.g. AB) representing the Pythagorean distance between the two points. A leading zero must be used with decimal fractions less than one.
In general, if a command's argument accepts a number then it will also accept a `numerical expression' (<expr>) as defined above. Sometimes a following <unit> is associated with the number or numerical expression, in which case the number or numerical expression can be delimited by a round bracket (or separated from the unit by a <space>), as shown in the following examples.
@@ -74,39 +79,25 @@ GENERAL COMMANDS
ArrowShape(h mm, 20, 40)
ArrowShape((2*h)mm,20,40)
- ==============================
+=============================
- BACKSLASH \
+ BACKSLASH \
A leading backslash without a following space indicates that it is part of a PiCTeX, TeX or LaTeX command, in which case mathsPIC simply copies the whole line verbatim into the output file. A leading backslash followed by one or more spaces makes mathsPIC copy the whole line verbatim into the output file but without the backslash.
- ==============================
+=============================
- USING THE COLOR PACKAGE
+ USING THE COLOR PACKAGE
The standard COLOR package can be used with mathsPIC, but note that it is important to load the COLOR package after the mathsPIC package.
It is best to place a comment symbol % at the end of LaTeX and TeX commands to limit white space at the end.
- In order to prevent color commands in a diagram from influencing any following text (in the document) we recommend that the \normalcolor command is used as a delimiter within the \beginpicture... \endpicture environment as shown in the example below. i.e.-use two \normalcolor commands; one just after the \beginpicture command, and one just before the \endpicture command.
-
- -----example:
- \usepackage{mathspic, color}
- ...
- \beginpicture
- \normalcolor
- ...
- \color{red}%
- drawline{AB}
- \color{blue}%
- drawcircle(C,5)
- ...
- \normalcolor
- \endpicture
+ In the event of any colour-spill from a diagram into any following text (this used to be a problem in early TeX implementations) consider using the \normalcolor command as a delimiter within the \beginpicture...\endpicture environment.
==============================
- ARROWSHAPE
+ ARROWSHAPE
This command defines the shape of an arrowhead, and allows
different arrowheads to be customised.
@@ -124,7 +115,7 @@ This default arrowhead shape can be reset using the Arrowshape(default) command,
==============================
- beginLOOP...endLOOP
+ beginLOOP...endLOOP
This is an environment which cycles a block of code a specified number of times.
@@ -141,15 +132,16 @@ This default arrowhead shape can be reset using the Arrowshape(default) command,
...
endLoop
+
==============================
- beginSKIP...endSKIP
+ beginSKIP...endSKIP
- This is an `environment' within which commands are not actioned. It is useful in development for testing isolated commands and excluding other commands.
+ This is an `environment' within which commands are not actioned. It is useful in development for testing isolated commands and excluding other commands.
==============================
- CONST
+ CONST
The const command is used to define scalar constants. Note that a constant-name must begin with a single letter (either upper or lower case), and may have up to a maximum of three following digits. Note that constants, variables and points have the same name structure, and a constant could have the same name as a point (and so we suggest points have uppercase letters and variables and constants have lowercase letters). The scalar argument can be any numeric expression. New values cannot be re-allocated to existing constant-names. If this occurs mathsPIC will issue an error message.
@@ -161,7 +153,7 @@ This default arrowhead shape can be reset using the Arrowshape(default) command,
==============================
- DashArray
+ DashArray
The dasharray command takes an arbitrary number of paired arguments that are used to specify a dash pattern.
@@ -180,10 +172,10 @@ This default arrowhead shape can be reset using the Arrowshape(default) command,
==============================
- DrawAngleArc
+ DrawAngleArc
This command draws an arc in the specified angle, a distance <radius> from the angle. The angle is either <internal> (less than 180 deg) or <external> (greater than 180 deg). The direction of the arc is either <clockwise> or <anticlockwise>, and this direction must correspond with the letter sequence specified for the angle.
-Strange and unexpected results will be produced if the four parameters are not internally consistent. The option order angle/radius/internal/clockwise is important. The <radius> parameter can be any numerical expression.
+Strange and unexpected results will be produced if the four parameters are not internally consistent. The option order angle/radius/internal or external/clockwise or anticlockwise is important. The <radius> parameter can be any numerical expression.
-----syntax:
DrawAngleArc{angle(), radius(), external, clockwise}
@@ -195,7 +187,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawAngleArrow
+ DrawAngleArrow
This command draws a curved arrow in the specified angle, a distance <radius> from the angle. The angle is either <internal> (less than 180 deg) or <external> (greater than 180 deg). The direction of the arrow is either <clockwise> or <anticlockwise>, and this direction must correspond with the letter sequence specified for the angle.
Strange and unexpected results will be produced if the four parameters are not internally consistent. The option order angle/radius/internal/clockwise is important. The <radius> parameter can be any numerical expression.
@@ -210,7 +202,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawArrow
+ DrawArrow
This command draws an arrow(s) joining two points. The direction of the arrow is in the point order specified.
@@ -226,7 +218,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawCircle
+ DrawCircle
This command draws a circle defined by its radius and the point-name of its centre. The <radius> can be any numerical expression. If the units of the X and Y axes are different, circles may be drawn strangely, and mathsPIC therefore generates a warning message to this effect.
@@ -241,7 +233,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawCircumcircle
+ DrawCircumcircle
This command draws the circumcircle of a triangle.
@@ -253,7 +245,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawCurve
+ DrawCurve
This command draws a smooth quadratic curve through three points in the point order specified. Note that curves drawn using this command do not break to avoid line-free zones associated with the points.
@@ -265,7 +257,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawExcircle
+ DrawExcircle
This command draws the excircle touching one side of a triangle.
@@ -277,7 +269,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawIncircle
+ DrawIncircle
This command draws the incircle of a triangle.
@@ -289,9 +281,9 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawLine
+ DrawLine
- This command draws a line joining two or more points. Use the Linethickness command to vary thickness.
+ This command draws a line joining two or more points. Use the Linethickness command to vary thickness. This command uses the PiCTeX \putrule command for horizontal and vertical lines, and the \plot command for all other orientations.
-----syntax:
DrawLine( <points> [, <points>] )
@@ -309,7 +301,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawPerpendicular
+ DrawPerpendicular
This command draws the perpendicular from a point to a line.
@@ -321,7 +313,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawPoint
+ DrawPoint
This command draws the point-symbol at the point-location. Commas must not be used to separate point names. The default point-symbol is \$\bullet\$, unless an optional point-symbol (or string of characters) is specified in the associated point command.
@@ -335,7 +327,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawRightangle
+ DrawRightangle
This command draws the standard right-angle symbol in the internal angle specified at the size specified by <expr>.
@@ -353,7 +345,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawSquare
+ DrawSquare
This command draws a square defined by its side and the point-name of its centre. The <sidelength> can be any numerical expression.
@@ -369,7 +361,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawThickArrow
+ DrawThickArrow
This command draws a thick arrow(s) joining two points. The direction of the arrow is in the point order specified. The shape of the arrowhead is controlled by the ArrowShape command.
@@ -382,7 +374,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- DrawThickLine
+ DrawThickLine
This command draws a thick line(s) joining two points. The direction of the line is in the point order specified. Use the Linethickness command to vary thickness of a line.
@@ -395,17 +387,15 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
- InputFile
+ InputFile
- This command inputs a plain text file containing mathsPIC commands. Optionally, the file can be input several times, in which case this command functions like a DO--LOOP.
-The <loopnumber> can be any numerical expression. If the <loopnumber> is not an integer then mathsPIC will round the value down to the nearest integer.
+ This command inputs a plain text file containing mathsPIC commands. Optionally, the file can be input several times, in which case this command functions like a DO--LOOP. The <loopnumber> can be any numerical expression. If the <loopnumber> is not an integer then mathsPIC will round the value down to the nearest integer. See also the beginLOOP ... endLOOP commands.
-----syntax:
inputFile[*](<filename>)[<loopnumber>]
-----notes:
- The inputfile* command is used to input a file in verbatim, i.e. a file with no mathsPIC commands, for example, a file containing only PiCTeX commands or data-points
-for plotting etc. Note that the inputfile* command has no <loopnumber> option.
+ The inputfile* command is used to input a file in verbatim, i.e. a file with no mathsPIC commands, for example, a file containing only PiCTeX commands or data-points for plotting etc. Note that the inputfile* command has no <loopnumber> option. Note also that PiCTeX requires a ODD number of points.
-----examples:
inputFile(myfile.dat)[4]
@@ -413,7 +403,7 @@ for plotting etc. Note that the inputfile* command has no <loopnumber> option.
==============================
- LineThickness
+ LineThickness
This command sets a particular linethickness. The command linethickness(default) restores the working linethickness to the default value of 0.4pt.
The current value of the linethickness (in current units) can be accessed using the var command (this can be useful when drawing figures using thick lines) .
@@ -424,7 +414,7 @@ The current value of the linethickness (in current units) can be accessed using
var t = _linethickness_
-----notes:
- This command also sets the font to \verb!cmr! and plotsymbol to \CM . and also sets the rule thickness for drawing horizontal and vertical lines. It is important to include a leading zero with decimal fractions less than one.
+ This command also sets the font to cmr and plotsymbol to \CM . and also sets the rule thickness for drawing horizontal and vertical lines. It is important to include a leading zero with decimal fractions less than one.
-----examples:
linethickness(2pt)
@@ -439,7 +429,7 @@ The current value of the linethickness (in current units) can be accessed using
==============================
- PAPER
+ PAPER
Defines the plotting area in terms of the options units(), xrange(), yrange(), axes(), and ticks(). The units() argument must contain a numeric value and a valid TeX length unit mm, cm, pt, pc(pica), in(inch), bp(big point), dd(didot), cc(cicero), sp(scaled point). The X and Y axes can have different units (see second example below). The axes() arguments XYTBLR refer to the X and Y axes, and the Top, Bottom, Left and Right axes. A * following one of the axes disables ticks on that axis. The X and Y axes pass through the zeros.
@@ -452,7 +442,7 @@ The current value of the linethickness (in current units) can be accessed using
==============================
- POINT
+ POINT
Defines a new point by allocating coordinates to a new point name. The * option re-allocates coordinates to an existing point name.
@@ -461,10 +451,10 @@ The current value of the linethickness (in current units) can be accessed using
POINT[*](<name>){<location>}[symbol=<chars>, radius=<expr>]
-----notes:
- <name> one leading letter plus maximum of three trailing digits
+ <name> one leading letter plus maximum of four trailing digits
<chars> any TeX string allowed in an \hbox{}
<expr> any numerical expression
- The polar(r,theta) option defaults to radians for the angle theta. To work in degrees then must append <deg> eg: polar(r,theta deg). Can use <direction()> and <directiondeg()> to replace theta.
+ The polar(r,theta) option defaults to radians for the angle theta. To work in degrees then must append <deg> eg: polar(r,theta deg). Can use <direction()> and <directiondeg()> to replace theta. Note that the term vector(AB) means use same (r, theta) as AB.
-----examples:
point(A){5,5}
@@ -495,7 +485,7 @@ The current value of the linethickness (in current units) can be accessed using
==============================
- PointSymbol
+ PointSymbol
This command allows the default point-symbol \bullet (with zero line-free radius) to be changed. The PointSymbol command is particularly useful where a set of points uses the same point-symbol, for example, when drawing graphs. The point-symbol can be reset to the default \bullet using the command PointSymbol(default).
@@ -513,7 +503,7 @@ The current value of the linethickness (in current units) can be accessed using
==============================
- SYSTEM
+ SYSTEM
This command allows the user to access the command line and execute standard Linux commands. A important use for this command is to run a Perl program.
@@ -529,7 +519,7 @@ The current value of the linethickness (in current units) can be accessed using
==============================
- SHOW....
+ SHOW....
This command makes mathsPIC return the value of a calculation or specified parameter; for example, the value of a particular angle, or the length of a line. The result is shown in the output-file as a commented line. This allows mathsPIC commands to be adjusted in the light of calculations. There are currently five such commands as follows.
@@ -543,7 +533,7 @@ The current value of the linethickness (in current units) can be accessed using
==============================
- TEXT
+ TEXT
This command places a text-string at a specific location. By default the text is centered vertically and horizontally at the specified point. Optionally, text can be placed relative to a point using appropriate combinations of the PiCTeX `position' options l t r B b to align the (l)eft edge, (r)ight edge, (t)op edge, (B)aseline, (b)ottom edge respectively of the text box with the point-location.
@@ -564,9 +554,9 @@ The current value of the linethickness (in current units) can be accessed using
==============================
- VAR
+ VAR
- The var command is used to define scalar variables. It can be any numerical expression. A variable-name must begin with a single letter (either upper or lower case), and may have up to a maximum of three following digits. If a more detailed variable name is required, then a simple alternative is to use a mathsPIC macro---as any string can be allocated via macros (see the beginning of this chapter for details on macros).
+ The var command is used to define scalar variables. It can be any numerical expression. A variable-name must begin with a single letter (either upper or lower case), and may have up to a maximum of four following digits. If a more detailed variable name is required, then a simple alternative is to use a mathsPIC macro---as any string can be allocated via macros (see the beginning of this chapter for details on macros).
Note that variables, constants and points have the same name structure, and a variable can have the same name as a point (and so we suggest points have uppercase letters and variables and constants have lowercase letters). New values can be re-allocated to existing variable-names; however, when this occurs then mathsPIC does not issue a warning message to hightlight this fact.
@@ -599,17 +589,10 @@ The current value of the linethickness (in current units) can be accessed using
var d1 = directiondeg(PQ)
==============================
-
SEE ALSO
- --------
-
The mathsPIC package manual and examples
-==============================
-
BUGS
- ----
-
-Please report bugs to Dick Nickalls (see manual and above for address)
+Please report bugs to Dick Nickalls (dick [AT] nickalls [dot] org) or to Apostolos Syropoulos
-------------------------END---------------------
+================END================= \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/mathspic/MATHSPIC.BAT b/Master/texmf-dist/doc/latex/mathspic/MATHSPIC.BAT
index 1a865ad7c73..6ffcadce683 100755
--- a/Master/texmf-dist/doc/latex/mathspic/MATHSPIC.BAT
+++ b/Master/texmf-dist/doc/latex/mathspic/MATHSPIC.BAT
@@ -1,2 +1,2 @@
-perl mathspic.pl %1 %2 %3 %4 %5
+perl mathspic113.pl %1 %2 %3 %4 %5
diff --git a/Master/texmf-dist/doc/latex/mathspic/README.txt b/Master/texmf-dist/doc/latex/mathspic/README.txt
index e84f830431c..4ef106013a4 100644
--- a/Master/texmf-dist/doc/latex/mathspic/README.txt
+++ b/Master/texmf-dist/doc/latex/mathspic/README.txt
@@ -1,10 +1,10 @@
%% readme.txt
-%% for mathsPIC (version 1.00)
+%% for mathsPIC (version 1.13)
Name:- mathsPIC (Perl version)
-Authors:- A. Syropoulos and R.W.D. Nickalls
-Affiliation:- see manual
-Date:- February 2005
+Authors:- A. Syropoulos (asyropoulos@yahoo.com)
+ and R.W.D. Nickalls (dick@nickalls.org)
+Date:- April 26, 2010
(1) INTRODUCTION
-----------------
@@ -31,24 +31,23 @@ MathsPIC was originally an MS-DOS program (September 1999). mathsPIC was impleme
------------------
The following files are included in the mathsPIC package.
-readme.txt % this file
-mathspic.pl % mathsPIC program (perl)
+
+grabtexdata.pl % Perl program used in Chapter 8 (Accessing TeX parameters)
+HELP.TXT % text version of the Unix manpage
+mathspic113.pl % mathsPIC program version 1.13 (perl)
mathspic.sty % style option
mathspic.1 % unix/Linux manpage file
-HELP.TXT % text version of the Unix manpage
-mathspic.sh % an example BASH file for running the program
-MATHSPIC.BAT % an example batch file (MS-Windows)
-mathsPICa4.pdf % manual (PDF) in A4 size
-mathsPICa4.ps % manual (PostScript) in A4 size
-mathsPICa5.pdf % manual (PDF) in A5 size
-mathsPICa5.ps % manual (PostScript) in A5 size
-drawcube.pl % perl program described in the manual
-drawcurvedarrow.pl % perl program described in the manual
-grabtexdata.tex % tex file (see manual) for accessing texfile data
+mathspic.sh % example BASH file for running the program
+MATHSPIC.BAT % example batch file (MS-Windows)
+mathsPICmanual.pdf % manual
+mathsPICmanual.zip % manual--all the LaTeX and figure files
+mathsPICfigures.zip % all the .m and .pl files described in the manual
mathspic.lib % example library file of macros
-sourcecode.pdf/.html % perl source code
-sourcecode.nw % perl source code (noweb)
-figures.tgz % compressed file of all figure files in manual
+README.txt % this file
+sourcecode.pdf % source code
+sourcecode.html % source code
+sourcecode.nw % source code (noweb)
+
(5) INSTALLATION (Unix/Linux)
@@ -56,7 +55,7 @@ figures.tgz % compressed file of all figure files in manual
Four files need to be placed in specific locations as follows
(see also USAGE regarding the BASH script file)
-(a) mathsPIC program (mathspic.pl)
+(a) mathsPIC program (mathspic113.pl)
This needs to be placed where your shell can find it
(typically: /usr/local/bin)
@@ -72,18 +71,20 @@ This needs to be placed with the other style options
place this file in the /man1/ directory
(typically: /usr/share/man/man1/)
-Actually, there is no need to install the shell script. Instead one
-can just copy the file mathspic.pl to a directory where his/her shell
-can find it and to rename it mathspic. Then one just need to make
-executable the file mathspic (e.g., by issuing the command
-chmod 755 mathspic).
+An alternative to using the shell script (BASH file) is simply to make the
+perl script file (mathspic.pl) `executable', as follows:
+Just copy the file mathspic.pl to a directory where the shell
+can find it (typically /usr/local/bin) and then
+ (1) rename the file --> mathspic.
+ (2) make the file `executable' (e.g., by issuing the command <chmod 755 mathspic> ).
+
(6) USAGE (see manual for full details)
----------------------------------------
In Unix/Linux one way of running mathsPIC is to type the following at the command-line (options are shown in square brackets). Note this requires both the perl program (mathspic.pl) and the input file to be in the same directory.
Syntax:
- perl mathspic.pl [-b] [-c] [-h] infile [-o outfile]
+ perl mathspic113.pl [-b] [-c] [-h] infile [-o outfile]
Options:
-b enables bell/sound if errors are detected
@@ -93,7 +94,7 @@ Options:
However, it is generally much more convenient to run mathsPIC via a batch file, since we can then run mathsPIC from any directory.
-For example (Unix/Linux) rename the example BASH file <mathspic.sh> to <mathspic>. Now change the user permissions to make it a read/write/executable file. Finally, copy the file to a place where your shell will find it, typically the directory /usr/local/bin/. Now you will be able to run mathsPIC from the command-line in any directory using the command:-
+For example (Unix/Linux) rename the example BASH file <mathspic.sh> to <mathspic>. Now change the user permissions to make it a read/write/executable file ($ chmod 755 mathspic). Finally, copy the file to a place where your shell will find it, typically the directory /usr/local/bin/. Now you will be able to run mathsPIC from the command-line in any directory using the command:-
mathspic [-b] [-c] [-h] infile [-o outfile]
diff --git a/Master/texmf-dist/doc/latex/mathspic/cleanmathspic.pl b/Master/texmf-dist/doc/latex/mathspic/cleanmathspic.pl
deleted file mode 100644
index 02efc598804..00000000000
--- a/Master/texmf-dist/doc/latex/mathspic/cleanmathspic.pl
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/perl
-### cleanmathsPIC.pl
-## for Unix/Linux only
-## removes all unnecessary files to facilitate archiving etc
-## RWD Nickalls 2005
-##---------------------------------------
-
-## -w ## turned off for the moment
-##------------------
-system ("mv -vf *.dvi ~/allfiles/trashcan");
-system ("mv -vf *.aux ~/allfiles/trashcan");
-
-system ("mv -vf *.mt ~/allfiles/trashcan");
-system ("mv -vf *.mlg ~/allfiles/trashcan");
-
-#system ("mv -vf *.idx ~/allfiles/trashcan");
-#system ("mv -vf *.ind ~/allfiles/trashcan");
-#system ("mv -vf *.glo ~/allfiles/trashcan");
-#system ("mv -vf *.bbl ~/allfiles/trashcan");
-
-## ask permission for the .pic/.log/.gnu just in case
-system ("mv -vf *.log ~/allfiles/trashcan");
- __END__
diff --git a/Master/texmf-dist/doc/latex/mathspic/drawcube.pl b/Master/texmf-dist/doc/latex/mathspic/drawcube.pl
deleted file mode 100644
index 21b92cef689..00000000000
--- a/Master/texmf-dist/doc/latex/mathspic/drawcube.pl
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/perl
-## drawcube.pl
-# requires latex Color package
-# command line parameters Pointname,sidelength,temp-filename
-# use: system("perl drawcube.pl P s3 temp.txt")
-# see mathsPIC manual
-#===========================
-my ($argnumber) = $#ARGV +1;
-if ($argnumber != 3){
- print "============================\n";
- print "ERROR: drawcube.pl requires 3 arguments\n";
- print "USE: drawcube.pl <pointname> <sidelength> <filename> \n";
- print "============================\n";
- exit(1);
-}
-my ($point, $side, $filename)=@ARGV;
-open (outfile, ">$filename")|| die "ERROR can't create file $filename\n";
-print (outfile <<EOF);
-\%\%------mathsPIC code----------------
-var r=$side*sqrt(2)/2
-var a=30 %% angle degrees
-Point*(P990){$point, polar(r/2, (a-180) deg)}
-Point*(P991){P990, polar(r, 45 deg)}
-Point*(P992){P991, rotate(P990, 90)}
-Point*(P993){P991, rotate(P990, 180)}
-Point*(P994){P991, rotate(P990, 270)}
-Point*(P995){P991, polar(r, a deg)}
-Point*(P996){P992, polar(r, a deg)}
-Point*(P997){P993, polar(r, a deg)}
-Point*(P998){P994, polar(r, a deg)}
-%% draw the sides
-\\color{blue}
-drawline(P991 P992 P993 P994 P991, P994 P998 P995 P996 P992, P991 P995)
-\\setdashes
-drawline(P993 P997 P998, P997 P996)
-%% draw the diagonals
-\\color{red}
-drawline(P991 P997, P992 P998, P996 P994, P995 P993)
-%% draw the points and labels
-\\setsolid\\color{black}
-drawpoint($point P991 P992 P993 P994 P995 P996 P997 P998)
-text(\$$point\$){$point, shift(-0.4,-0.1)}
-text(\$P991\$){P991, shift(-0.3,0.3)}
-text(\$P995\$){P995, shift(-0.3,0.3)}
-%%----------------------------
-EOF
-# now delete the temp file
-print (outfile qq(system("rm $filename")\n));
-close outfile
-__END__
diff --git a/Master/texmf-dist/doc/latex/mathspic/drawcurvedarrow.pl b/Master/texmf-dist/doc/latex/mathspic/drawcurvedarrow.pl
deleted file mode 100644
index ba2bca83e8c..00000000000
--- a/Master/texmf-dist/doc/latex/mathspic/drawcurvedarrow.pl
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/perl
-## drawcurvedarrow.pl
-# command-line parameters A B C h filename
-my ($A, $B, $C, $h, $filename)=@ARGV;
-open (outfile, ">$filename")|| die "ERROR can't create file $filename\n";
-print (outfile "Point*(P999){pointonline($B$A, -($A$B)/3)}\n");
-print (outfile "Point*(H999){pointonline($C P999,$h)}\n");
-print (outfile "Drawcurve($A$B H999)\n");
-print (outfile "drawArrow(H999 $C)\n");
-close (outfile);
diff --git a/Master/texmf-dist/doc/latex/mathspic/figures.tgz b/Master/texmf-dist/doc/latex/mathspic/figures.tgz
deleted file mode 100644
index 10f011dc2fd..00000000000
--- a/Master/texmf-dist/doc/latex/mathspic/figures.tgz
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/mathspic/grabtexdata.tex b/Master/texmf-dist/doc/latex/mathspic/grabtexdata.tex
index d69d318b7ca..64b8e40bbe8 100644
--- a/Master/texmf-dist/doc/latex/mathspic/grabtexdata.tex
+++ b/Master/texmf-dist/doc/latex/mathspic/grabtexdata.tex
@@ -1,7 +1,12 @@
-%% grabtexdata.tex (from oxford.tex)
-%% RWD Nickalls (c) Jan 2005
-%% for extracting data into mathspic var commands
-%%========================================
+%% grabtexdata.tex
+%% part of the mathsPIC package
+%% example file used in Chapter 8 of the mathsPICmanual
+%% (accessing TeX parameter values)
+%% RWD Nickalls (c) April 2010
+%% dick@nickalls.org
+%%========================================================
+%% for extracting TeX-file data into mathspic var commands
+%%========================================================
\scrollmode % prevent LaTeX stopping if there are errors
%---------------------
% make a print command macro
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathsPICa4.pdf b/Master/texmf-dist/doc/latex/mathspic/mathsPICa4.pdf
deleted file mode 100644
index 20224849f6f..00000000000
--- a/Master/texmf-dist/doc/latex/mathspic/mathsPICa4.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathsPICa5.pdf b/Master/texmf-dist/doc/latex/mathspic/mathsPICa5.pdf
deleted file mode 100644
index 88aa80de721..00000000000
--- a/Master/texmf-dist/doc/latex/mathspic/mathsPICa5.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathsPICfigures.zip b/Master/texmf-dist/doc/latex/mathspic/mathsPICfigures.zip
new file mode 100644
index 00000000000..bd6e121ea07
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/mathspic/mathsPICfigures.zip
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathsPICmanual.pdf b/Master/texmf-dist/doc/latex/mathspic/mathsPICmanual.pdf
new file mode 100644
index 00000000000..b2ee735a10a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/mathspic/mathsPICmanual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathsPICmanual.zip b/Master/texmf-dist/doc/latex/mathspic/mathsPICmanual.zip
new file mode 100644
index 00000000000..3f96a502778
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/mathspic/mathsPICmanual.zip
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathspic.1 b/Master/texmf-dist/doc/latex/mathspic/mathspic.1
index a0f9a70fd5b..9ffa4b6c6c5 100644
--- a/Master/texmf-dist/doc/latex/mathspic/mathspic.1
+++ b/Master/texmf-dist/doc/latex/mathspic/mathspic.1
@@ -1,15 +1,15 @@
-.\" copyright (c) 2005 A Syropoulos and RWD Nickalls
+.\" copyright (c) 2010 A Syropoulos and RWD Nickalls
.\" mathspic.1
.\" place this file in: /usr/share/man/man1/
..
-.TH mathsPIC 1 "February 2nd, 2005" "mathsPIC perl version"
+.TH mathsPIC 1 "April 26, 2010" "mathsPIC perl version"
.SH NAME
.B mathsPIC
.SH AUTHORS
-A. Syropoulos and R.W.D. Nickalls (February 2005)
+A. Syropoulos and R.W.D. Nickalls (April 26, 2010)
- apostolo[at]<ocean1><ee><duth><gr>
- dicknickalls[at]<compuserve><com>
+ asyropoulos[at]<yahoo><com>
+ dick[at]<nickalls><org>
.SH DESCRIPTION
.B mathsPIC
@@ -100,21 +100,7 @@ command.
It is best to place a comment symbol % at the end of LaTeX and TeX commands to limit white space at the end.
- In order to prevent color commands in a diagram from influencing any following text (in the document) we recommend that the \\normalcolor command is used as a delimiter within the \\beginpicture...\\endpicture environment as shown in the example below. i.e. use two \\normalcolor commands; one just after the \\beginpicture command, and one just before the \\endpicture command.
-
- -----example:
- \\usepackage{mathspic, color}
- ...
- \\beginpicture
- \\normalcolor
- ...
- \\color{red}%
- drawline{AB}
- \\color{blue}%
- drawcircle(C,5)
- ...
- \\normalcolor
- \\endpicture
+ In the event of any colour-spill from a diagram into any following text (this used to be a problem in early TeX implementations) consider using the \\normalcolor command as a delimiter within the \\beginpicture...\\endpicture environment.
==============================
@@ -190,7 +176,7 @@ This default arrowhead shape can be reset using the Arrowshape(default) command,
.B DrawAngleArc
This command draws an arc in the specified angle, a distance <radius> from the angle. The angle is either <internal> (less than 180 deg) or <external> (greater than 180 deg). The direction of the arc is either <clockwise> or <anticlockwise>, and this direction must correspond with the letter sequence specified for the angle.
-Strange and unexpected results will be produced if the four parameters are not internally consistent. The option order angle/radius/internal/clockwise is important. The <radius> parameter can be any numerical expression.
+Strange and unexpected results will be produced if the four parameters are not internally consistent. The option order angle/radius/internal or external/clockwise or anticlockwise is important. The <radius> parameter can be any numerical expression.
-----syntax:
DrawAngleArc{angle(), radius(), external, clockwise}
@@ -290,7 +276,7 @@ Strange and unexpected results will be produced if the four parameters are not i
==============================
.B DrawLine
- This command draws a line joining two or more points. Use the Linethickness command to vary thickness.
+ This command draws a line joining two or more points. Use the Linethickness command to vary thickness. This command uses the PiCTeX \\putrule command for horizontal and vertical lines, and the \\plot command for all other orientations.
-----syntax:
DrawLine( <points> [, <points>] )
@@ -390,14 +376,14 @@ Strange and unexpected results will be produced if the four parameters are not i
.B InputFile
This command inputs a plain text file containing mathsPIC commands. Optionally, the file can be input several times, in which case this command functions like a DO--LOOP.
-The <loopnumber> can be any numerical expression. If the <loopnumber> is not an integer then mathsPIC will round the value down to the nearest integer.
+The <loopnumber> can be any numerical expression. If the <loopnumber> is not an integer then mathsPIC will round the value down to the nearest integer. See also the beginLOOP ... endLOOP commands.
-----syntax:
inputFile[*](<filename>)[<loopnumber>]
-----notes:
The inputfile* command is used to input a file in verbatim, i.e. a file with no mathsPIC commands, for example, a file containing only PiCTeX commands or data-points
-for plotting etc. Note that the inputfile* command has no <loopnumber> option.
+for plotting etc. Note that the inputfile* command has no <loopnumber> option. Note also that PiCTeX requires a ODD number of points.
-----examples:
inputFile(myfile.dat)[4]
@@ -415,7 +401,7 @@ The current value of the linethickness (in current units) can be accessed using
var t = _linethickness_
-----notes:
- This command also sets the font to \verb!cmr! and plotsymbol to \\CM . and also sets the rule thickness for drawing horizontal and vertical lines. It is important to include a leading zero with decimal fractions less than one.
+ This command also sets the font to cmr and plotsymbol to \\CM . and also sets the rule thickness for drawing horizontal and vertical lines. It is important to include a leading zero with decimal fractions less than one.
-----examples:
linethickness(2pt)
@@ -453,7 +439,7 @@ The current value of the linethickness (in current units) can be accessed using
<name> one leading letter plus maximum of three trailing digits
<chars> any TeX string allowed in an \\hbox{}
<expr> any numerical expression
- The polar(r,theta) option defaults to radians for the angle theta. To work in degrees then must append <deg> eg: polar(r,theta deg). Can use <direction()> and <directiondeg()> to replace theta.
+ The polar(r,theta) option defaults to radians for the angle theta. To work in degrees then must append <deg> eg: polar(r,theta deg). Can use <direction()> and <directiondeg()> to replace theta. Note that the term vector(AB) means use same (r, theta) as AB.
-----examples:
point(A){5,5}
@@ -545,12 +531,12 @@ The current value of the linethickness (in current units) can be accessed using
text(Z2){Z2, shift(5, -5)}[tr]
text(Z3){Z2, polar(5, 20 deg)}[Br]
text(Z4){Z2, polar(5, 1.34 rad)}
- text(\framebox{Z5}){Z5}
+ text(\\framebox{Z5}){Z5}
==============================
.B VAR
- The var command is used to define scalar variables. It can be any numerical expression. A variable-name must begin with a single letter (either upper or lower case), and may have up to a maximum of three following digits. If a more detailed variable name is required, then a simple alternative is to use a mathsPIC macro---as any string can be allocated via macros (see the beginning of this chapter for details on macros).
+ The var command is used to define scalar variables. It can be any numerical expression. A variable-name must begin with a single letter (either upper or lower case), and may have up to a maximum of four following digits. If a more detailed variable name is required, then a simple alternative is to use a mathsPIC macro---as any string can be allocated via macros (see the beginning of this chapter for details on macros).
Note that variables, constants and points have the same name structure, and a variable can have the same name as a point (and so we suggest points have uppercase letters and variables and constants have lowercase letters). New values can be re-allocated to existing variable-names; however, when this occurs then mathsPIC does not issue a warning message to hightlight this fact.
@@ -586,5 +572,5 @@ The current value of the linethickness (in current units) can be accessed using
.SH SEE ALSO
The mathsPIC package manual and examples
.SH BUGS
-Please report bugs to Dick Nickalls (see manual for address)
+Please report bugs to Dick Nickalls (dick [AT] nickalls [dot] org) or to Apostolos Syropoulos
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathspic.lib b/Master/texmf-dist/doc/latex/mathspic/mathspic.lib
index 0cf4368bd8c..97c26f3f181 100644
--- a/Master/texmf-dist/doc/latex/mathspic/mathspic.lib
+++ b/Master/texmf-dist/doc/latex/mathspic/mathspic.lib
@@ -1,5 +1,7 @@
%%--- mathspic.lib---
-%% February 2005
+%% RWD Nickalls & A Syropoulos
+%% April 2010
+%%----------------------
%% example mathsPIC macros
%def bigdots()\setplotsymbol({\large .})\setdots%
%def normaldots()\setplotsymbol({\tiny .})\setdots%
diff --git a/Master/texmf-dist/doc/latex/mathspic/mathspic.sh b/Master/texmf-dist/doc/latex/mathspic/mathspic.sh
index 6d548a3166e..f0d0d76fc14 100644
--- a/Master/texmf-dist/doc/latex/mathspic/mathspic.sh
+++ b/Master/texmf-dist/doc/latex/mathspic/mathspic.sh
@@ -1,12 +1,14 @@
#!/bin/bash
-# February 2005
-# mathspic.sh # mathspic script
-# put this file in /usr/local/bin
+## April 26, 2010
+## RWD Nickalls & A Syropoulos
+## mathspic.sh # mathspic script
+## put this file in /usr/local/bin
## rename it: mathspic.sh --> mathspic
+## and make it executable (chmod 755 mathspic)
#################
-# format is:
-# bash mathspic.sh <options etc>
-# mathspic [-b] [-c] [-h] [-o outfile] infile
+## format is:
+## bash mathspic.sh <options> filename
+## mathspic [-b] [-c] [-h] [-o outfile] infile
#################
-perl /usr/local/bin/mpic100.pl $1 $2 $3 $4 $5
+perl /usr/local/bin/mathspic113.pl $1 $2 $3 $4 $5
diff --git a/Master/texmf-dist/doc/latex/mathspic/sourcecode.pdf b/Master/texmf-dist/doc/latex/mathspic/sourcecode.pdf
deleted file mode 100644
index d56402e5dd2..00000000000
--- a/Master/texmf-dist/doc/latex/mathspic/sourcecode.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/mathspic/sourcecode.html b/Master/texmf-dist/doc/latex/mathspic/sourcecode113.html
index 5d963ef76dd..b611771f41c 100644
--- a/Master/texmf-dist/doc/latex/mathspic/sourcecode.html
+++ b/Master/texmf-dist/doc/latex/mathspic/sourcecode113.html
@@ -1,5 +1,5 @@
<!-- this file was generated automatically by noweave; better not edit it-->
-<html><head><title>sourcecode.nw</title></head><body><center><h1> <tt>mathspic</tt> in Perl </h1></center>
+<html><head><title>mathsPIC.nw</title></head><body><center><h1> <tt>mathspic</tt> in Perl </h1></center>
<center><h2>
<table>
<tr><td><address>
@@ -10,16 +10,17 @@ Greece<br>
email: <tt>asyropoulos@yahoo.com</tt>
</address></td>
<td><address>
-<b>R.W.D. Nickalls</b><br>
- Department of Anaesthesia<br>
-Nottingham City Hospital NHS Trust<br>
-<a name="NWD21HcNW-1">Hucknall Road</a><br>
-Nottingham, NG5-1PB<br>
-United Kingdom<br>
-email: <tt>dicknickalls@compuserve.com</tt>
+<b>R.W.D. Nickalls</b><br/>
+Consultant in Anaesthesia & Intensive Care (retired)<br/>
+c/o Department of Anaesthesia<br/>
+Nottingham University Hospitals<br/>
+<a name="NWDCUvTi-1">City Hospital Campus</a><br/>
+Hucknall Road<br/>
+Nottingham NG5 1PB, UK<br/>
+email:<tt>dick@nickalls.org</tt>
</address></td>
</table></h2>
-version 1.10 Feb 18, 2007
+version 1.13 Apr 26, 2010
</center>
<h3><b>Introduction</b></h3><p>
@@ -42,7 +43,7 @@ since not only is Perl pretty stable, but it has
extensive mathematical support.<p>
<h3><b>Program Structure</b></h3><p>
-<a name="NWD21HcNW-2">Initially, we define a little package that is used to implement the </a><code>loop</code>
+<a name="NWDCUvTi-2">Initially, we define a little package that is used to implement the </a><code>loop</code>
command. Then, we must do is to check the possible command line arguments.
Next, we process the input file.
If the user has used the <code>-b</code> (see below), the program will `beep'
@@ -51,29 +52,29 @@ We need some auxiliary subroutines in order to properly parse the input
file and of course to handle the various commands. We also need a
few global variables.
-<pre><a name="NW21HcNW-1p0Y9w-1" href="#NWD21HcNW-2"><dfn>&lt;*&gt;=</dfn></a>
+<pre><a name="NWCUvTi-1p0Y9w-1" href="#NWDCUvTi-2"><dfn>&lt;*&gt;=</dfn></a>
#!/usr/bin/perl
#
-#(c) Copyright 2005-2007
+#(c) Copyright 2005-2010
# Apostolos Syropoulos &amp; R.W.D. Nickalls
-# asyropoulos@yahoo.com dicknickalls@compuserve.com
+# asyropoulos@yahoo.com dick@nickalls.org
#
# This program can be redistributed and/or modified under the terms
# of the LaTeX Project Public License Distributed from CTAN
# archives in directory macros/latex/base/lppl.txt; either
# version 1 of the License, or any later version.
#
-<a name="NW21HcNW-1p0Y9w-1-u1" href="#NWD21HcNW-3"><i>&lt;package <tt>DummyFH</tt> &gt;</i></a>
+<a name="NWCUvTi-1p0Y9w-1-u1" href="#NWDCUvTi-3"><i>&lt;package <tt>DummyFH</tt> &gt;</i></a>
package main;
use Math::Trig;
-<a name="NW21HcNW-1p0Y9w-1-u2" href="#NWD21HcNW-8"><i>&lt;Define global variables&gt;</i></a>
-<a name="NW21HcNW-1p0Y9w-1-u3" href="#NWD21HcNW-9"><i>&lt;subroutine definitions&gt;</i></a>
-<a name="NW21HcNW-1p0Y9w-1-u4" href="#NWD21HcNW-4"><i>&lt;Check for command line arguments&gt;</i></a>
-<a name="NW21HcNW-1p0Y9w-1-u5" href="#NWD21HcNW-7"><i>&lt;process file&gt;</i></a>
+<a name="NWCUvTi-1p0Y9w-1-u2" href="#NWDCUvTi-8"><i>&lt;Define global variables&gt;</i></a>
+<a name="NWCUvTi-1p0Y9w-1-u3" href="#NWDCUvTi-9"><i>&lt;subroutine definitions&gt;</i></a>
+<a name="NWCUvTi-1p0Y9w-1-u4" href="#NWDCUvTi-4"><i>&lt;Check for command line arguments&gt;</i></a>
+<a name="NWCUvTi-1p0Y9w-1-u5" href="#NWDCUvTi-7"><i>&lt;process file&gt;</i></a>
print $alarm if $no_errors &gt; 0;
__END__
-</pre><p><a name="NWD21HcNW-3">The package </a><code>DummyFH</code> is used in the implementation of the <code>loop</code> command.
+</pre><p><a name="NWDCUvTi-3">The package </a><code>DummyFH</code> is used in the implementation of the <code>loop</code> command.
It creates a dummy filehandle that is associated with an array of strings. Since
we only read data from this dummy filehandle, we implement the <code>READLINE</code> subroutine.
When we read a line from this dummy filehandle, we actually requesting the next entry
@@ -81,7 +82,7 @@ of the array (if any). That is why we use the package variable <code>$index</cod
are no more entries in the array, subroutine <code>READLINE</code> returns the value <code>undef</code>
so to falsify loop that controls the consumption of input from this dummy filehandle.
-<pre><a name="NW21HcNW-2YwRNH-1" href="#NWD21HcNW-3"><dfn>&lt;package <tt>DummyFH</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-2">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2YwRNH-1" href="#NWDCUvTi-3"><dfn>&lt;package <tt>DummyFH</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-2">&lt;-U</a>)</b>
package DummyFH;
my $index = 0;
sub TIEHANDLE {
@@ -107,7 +108,7 @@ screen viewing of the output-file,
<tt>-c</tt> for cleaning out all comment-lines,
and <tt>-o</tt> with a following file-name
for specifying the output file-name.
-<tt><a name="NWD21HcNW-4">mathspic</a></tt> requires the name of an existing input-file
+<tt><a name="NWDCUvTi-4">mathspic</a></tt> requires the name of an existing input-file
(the so-called <tt>mathspic</tt>-file) containing
<tt>mathspic</tt>commands.
If no command-line arguments are supplied, we print a
@@ -116,7 +117,7 @@ For each command-line argument we set a global
variable. The default behavior is that the `bell' does not beep
and comment-lines are not removed from the output-file.
-<pre><a name="NW21HcNW-122Dzz-1" href="#NWD21HcNW-4"><dfn>&lt;Check for command line arguments&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-2">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-122Dzz-1" href="#NWDCUvTi-4"><dfn>&lt;Check for command line arguments&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-2">&lt;-U</a>)</b>
our $alarm=&quot;&quot;;
our $comments_on=1;
our $out_file=&quot;default&quot;;
@@ -127,16 +128,16 @@ if ($argc == 0 || $argc &gt; 5 ){ # no command line arguments or more than 4
&quot;Usage: mathspic [-h] [-b] [-c] [-o &lt;out file&gt;] &lt;in file&gt;\n\n&quot;;
}
else {
- <a name="NW21HcNW-122Dzz-1-u1" href="#NWD21HcNW-5"><i>&lt;Process command line arguments&gt;</i></a>
+ <a name="NWCUvTi-122Dzz-1-u1" href="#NWDCUvTi-5"><i>&lt;Process command line arguments&gt;</i></a>
print &quot;This is mathspic version $version_number\n&quot;;
}
-<a name="NW21HcNW-122Dzz-1-u2" href="#NWD21HcNW-6"><i>&lt;Check if .m file exists&gt;</i></a>
+<a name="NWCUvTi-122Dzz-1-u2" href="#NWDCUvTi-6"><i>&lt;Check if .m file exists&gt;</i></a>
-</pre><p><a name="NWD21HcNW-5">In order to get the various command-line arguments we use a simple</a>
+</pre><p><a name="NWDCUvTi-5">In order to get the various command-line arguments we use a simple</a>
<code>while</code> loop that checks each element of the array <code>@ARGV</code>. We check
for all the switches, and we get the name of the input-file.
-<pre><a name="NW21HcNW-LnOV9-1" href="#NWD21HcNW-5"><dfn>&lt;Process command line arguments&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-4">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-LnOV9-1" href="#NWDCUvTi-5"><dfn>&lt;Process command line arguments&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-4">&lt;-U</a>)</b>
our $file = &quot;&quot;;
SWITCHES:
while($_ = $ARGV[0]) {
@@ -168,10 +169,10 @@ for all the switches, and we get the name of the input-file.
else {
$file = $_;
}
- }
+ }my ($xA, $yA, $xB, $yB, $dist)=@_;
die &quot;No input file specified!\n&quot; if $file eq &quot;&quot;;
-</pre><p><a name="NWD21HcNW-6">In order to check whether the input-file exists, we simply use the</a>
+</pre><p><a name="NWDCUvTi-6">In order to check whether the input-file exists, we simply use the</a>
<code>-e</code> operator. First we check to see if <code>$file</code> exits.
If the input-file does exist then the variable <code>$file</code> contains
the file name. In case the user has not specified an output
@@ -180,7 +181,7 @@ extension <code>.mt</code>. Finally, the program outputs all error messages to
the screen and to a log file. The name of the log file consists of
the contents of the variable <code>$file</code> and the extension <code>.mlg</code>.
-<pre><a name="NW21HcNW-2K3CIm-1" href="#NWD21HcNW-6"><dfn>&lt;Check if .m file exists&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-4">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2K3CIm-1" href="#NWDCUvTi-6"><dfn>&lt;Check if .m file exists&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-4">&lt;-U</a>)</b>
our ($source_file, $log_file);
if (! -e $file) {
die &quot;$file: no such file!\n&quot; if (! (-e &quot;$file.m&quot;));
@@ -193,12 +194,12 @@ the contents of the variable <code>$file</code> and the extension <code>.mlg</co
$out_file= &quot;$file.mt&quot; if $out_file eq &quot;default&quot;;
$log_file= &quot;$file.mlg&quot;;
-</pre><p><a name="NWD21HcNW-7">Now that we have all the command line arguments, we can start processing</a>
+</pre><p><a name="NWDCUvTi-7">Now that we have all the command line arguments, we can start processing</a>
the input file. This is done by calling the subroutine <code>process_input</code>.
Before that we must open all necessary files. Next,
we print some `header' information to the output file and to the log file.
-<pre><a name="NW21HcNW-EP1QE-1" href="#NWD21HcNW-7"><dfn>&lt;process file&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-2">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-EP1QE-1" href="#NWDCUvTi-7"><dfn>&lt;process file&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-2">&lt;-U</a>)</b>
open(IN,&quot;$source_file&quot;)||die &quot;Can't open source file: $source_file\n&quot;;
open(OUT,&quot;&gt;$out_file&quot;)||die &quot;Can't open output file: $out_file\n&quot;;
open(LOG,&quot;&gt;$log_file&quot;)||die &quot;Can't open log file: $log_file\n&quot;;
@@ -226,7 +227,7 @@ The constant <code>R2D</code> holds the transformation factor to transform radia
degrees. The constant <code>D2R</code> holds the transformation factor
to transform degrees to radians, i.e., the value <code>1/R2D</code>. The global variables
<code>$arrowLength</code>, <code>$arrowAngleB</code> and <code>$arrowAngleC</code> are actually parameters that
-<a name="NWD21HcNW-8">are used by the subroutines that draw arrows. Since </a><code>$arrowLength</code> is actually
+<a name="NWDCUvTi-8">are used by the subroutines that draw arrows. Since </a><code>$arrowLength</code> is actually
a length, variable <code>$arrowLenghtUnits</code> holds the units of measure in which
this length is expressed. The hash table <code>%DimOfPoint</code> contains the side or the
radius of a point whose plot-symbol is a square or a circle, respectively. In case the
@@ -235,8 +236,8 @@ to store the length of the radius or the length of the side of default point sym
respectively. Variable <code>$LineThickness</code> holds the current line thickness (the
default value is 0.4&nbsp;pt).
-<pre><a name="NW21HcNW-xIn58-1" href="#NWD21HcNW-8"><dfn>&lt;Define global variables&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-2">&lt;-U</a>)</b>
-our $version_number = &quot;1.10 Feb 18, 2007&quot;;
+<pre><a name="NWCUvTi-xIn58-1" href="#NWDCUvTi-8"><dfn>&lt;Define global variables&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-2">&lt;-U</a>)</b>
+our $version_number = &quot;1.13 Apr 26, 2010&quot;;
our $commandLineArgs = join(&quot; &quot;, @ARGV);
our $command = &quot;&quot;;
our $curr_in_file = &quot;&quot;;
@@ -352,6 +353,8 @@ declaration.
<p> Subroutine <code>memberOf</code> is used to determine whether a string is a
member of a list of strings.
+<p> Subroutine <code>midpoint</code> computes the midpoint of two points.
+
<p> Subroutine <code>tand</code> computes the tangent of an angle, where the
angle is expressed in degrees.
@@ -369,7 +372,7 @@ and yields LaTeX code that draws a square.
<p> Subroutine <code>X2sp</code> can be used to transform a length to sp units.
-<p> <a name="NWD21HcNW-9">Subroutine </a><code>sp2X</code> can be used to transform a length expressed in sp units
+<p> <a name="NWDCUvTi-9">Subroutine </a><code>sp2X</code> can be used to transform a length expressed in sp units
to any other acceptable unit.
<p> Subroutine <code>setLineThickness</code> is used to determine the length of the
@@ -378,49 +381,50 @@ and yields LaTeX code that draws a square.
<p> Subroutine <code>process_input</code> parses the input file and any other file
being included in the main file, and generates output.
-<pre><a name="NW21HcNW-2AA3uL-1" href="#NWD21HcNW-9"><dfn>&lt;subroutine definitions&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-2">&lt;-U</a>)</b>
- <a name="NW21HcNW-2AA3uL-1-u1" href="#NWD21HcNW-A"><i>&lt;subroutine <tt>mpp</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u2" href="#NWD21HcNW-B"><i>&lt;subroutine <tt>PrintErrorMessage</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u3" href="#NWD21HcNW-C"><i>&lt;subroutine <tt>PrintWarningMessage</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u4" href="#NWD21HcNW-D"><i>&lt;subroutine <tt>PrintFatalError</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u5" href="#NWD21HcNW-E"><i>&lt;subroutine <tt>chk_lparen</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u6" href="#NWD21HcNW-F"><i>&lt;subroutine <tt>chk_rparen</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u7" href="#NWD21HcNW-G"><i>&lt;subroutine <tt>chk_lcb</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u8" href="#NWD21HcNW-H"><i>&lt;subroutine <tt>chk_rcb</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u9" href="#NWD21HcNW-I"><i>&lt;subroutine <tt>chk_lsb</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u10" href="#NWD21HcNW-J"><i>&lt;subroutine <tt>chk_rsb</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u11" href="#NWD21HcNW-K"><i>&lt;subroutine <tt>chk_comma</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u12" href="#NWD21HcNW-L"><i>&lt;subroutine <tt>chk_comment</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u13" href="#NWD21HcNW-M"><i>&lt;subroutine <tt>print_headers</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u14" href="#NWD21HcNW-N"><i>&lt;subroutine <tt>get_point</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u15" href="#NWD21HcNW-O"><i>&lt;subroutine <tt>perpendicular</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u16" href="#NWD21HcNW-P"><i>&lt;subroutine <tt>Length</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u17" href="#NWD21HcNW-Q"><i>&lt;subroutine <tt>triangleArea</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u18" href="#NWD21HcNW-R"><i>&lt;subroutine <tt>pointOnLine</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u19" href="#NWD21HcNW-S"><i>&lt;subroutine <tt>circumCircleCenter</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u20" href="#NWD21HcNW-T"><i>&lt;subroutine <tt>ComputeDist</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u21" href="#NWD21HcNW-U"><i>&lt;subroutine <tt>intersection4points</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u22" href="#NWD21HcNW-V"><i>&lt;subroutine <tt>IncircleCenter</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u23" href="#NWD21HcNW-W"><i>&lt;subroutine <tt>Angle</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u24" href="#NWD21HcNW-X"><i>&lt;subroutine <tt>excircle</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u25" href="#NWD21HcNW-Y"><i>&lt;subroutine <tt>DrawLineOrArrow</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u26" href="#NWD21HcNW-Z"><i>&lt;subroutine <tt>drawarrows</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u27" href="#NWD21HcNW-a"><i>&lt;subroutine <tt>drawlines</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u28" href="#NWD21HcNW-b"><i>&lt;subroutine <tt>drawCurve</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u29" href="#NWD21HcNW-c"><i>&lt;subroutine <tt>drawpoints</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u30" href="#NWD21HcNW-d"><i>&lt;subroutine <tt>drawAngleArc</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u31" href="#NWD21HcNW-e"><i>&lt;subroutine <tt>drawAngleArrow</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u32" href="#NWD21HcNW-f"><i>&lt;subroutine <tt>expr</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u33" href="#NWD21HcNW-g"><i>&lt;subroutine <tt>memberOf</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u34" href="#NWD21HcNW-h"><i>&lt;subroutine <tt>tand</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u35" href="#NWD21HcNW-i"><i>&lt;subroutine <tt>get_string</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u36" href="#NWD21HcNW-j"><i>&lt;subroutine <tt>is_tainted</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u37" href="#NWD21HcNW-k"><i>&lt;subroutine <tt>noOfDigits</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u38" href="#NWD21HcNW-l"><i>&lt;subroutine <tt>drawsquare</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u39" href="#NWD21HcNW-m"><i>&lt;subroutine <tt>X2sp</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u40" href="#NWD21HcNW-n"><i>&lt;subroutine <tt>sp2X</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u41" href="#NWD21HcNW-o"><i>&lt;subroutine <tt>setLineThickness</tt> &gt;</i></a>
- <a name="NW21HcNW-2AA3uL-1-u42" href="#NWD21HcNW-p"><i>&lt;subroutine <tt>process_input</tt> &gt;</i></a>
+<pre><a name="NWCUvTi-2AA3uL-1" href="#NWDCUvTi-9"><dfn>&lt;subroutine definitions&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-2">&lt;-U</a>)</b>
+ <a name="NWCUvTi-2AA3uL-1-u1" href="#NWDCUvTi-A"><i>&lt;subroutine <tt>mpp</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u2" href="#NWDCUvTi-B"><i>&lt;subroutine <tt>PrintErrorMessage</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u3" href="#NWDCUvTi-C"><i>&lt;subroutine <tt>PrintWarningMessage</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u4" href="#NWDCUvTi-D"><i>&lt;subroutine <tt>PrintFatalError</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u5" href="#NWDCUvTi-E"><i>&lt;subroutine <tt>chk_lparen</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u6" href="#NWDCUvTi-F"><i>&lt;subroutine <tt>chk_rparen</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u7" href="#NWDCUvTi-G"><i>&lt;subroutine <tt>chk_lcb</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u8" href="#NWDCUvTi-H"><i>&lt;subroutine <tt>chk_rcb</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u9" href="#NWDCUvTi-I"><i>&lt;subroutine <tt>chk_lsb</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u10" href="#NWDCUvTi-J"><i>&lt;subroutine <tt>chk_rsb</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u11" href="#NWDCUvTi-K"><i>&lt;subroutine <tt>chk_comma</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u12" href="#NWDCUvTi-L"><i>&lt;subroutine <tt>chk_comment</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u13" href="#NWDCUvTi-M"><i>&lt;subroutine <tt>print_headers</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u14" href="#NWDCUvTi-N"><i>&lt;subroutine <tt>get_point</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u15" href="#NWDCUvTi-O"><i>&lt;subroutine <tt>perpendicular</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u16" href="#NWDCUvTi-P"><i>&lt;subroutine <tt>Length</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u17" href="#NWDCUvTi-Q"><i>&lt;subroutine <tt>triangleArea</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u18" href="#NWDCUvTi-R"><i>&lt;subroutine <tt>pointOnLine</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u19" href="#NWDCUvTi-S"><i>&lt;subroutine <tt>circumCircleCenter</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u20" href="#NWDCUvTi-T"><i>&lt;subroutine <tt>ComputeDist</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u21" href="#NWDCUvTi-U"><i>&lt;subroutine <tt>intersection4points</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u22" href="#NWDCUvTi-V"><i>&lt;subroutine <tt>IncircleCenter</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u23" href="#NWDCUvTi-W"><i>&lt;subroutine <tt>Angle</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u24" href="#NWDCUvTi-X"><i>&lt;subroutine <tt>excircle</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u25" href="#NWDCUvTi-Y"><i>&lt;subroutine <tt>DrawLineOrArrow</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u26" href="#NWDCUvTi-Z"><i>&lt;subroutine <tt>drawarrows</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u27" href="#NWDCUvTi-a"><i>&lt;subroutine <tt>drawlines</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u28" href="#NWDCUvTi-b"><i>&lt;subroutine <tt>drawCurve</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u29" href="#NWDCUvTi-c"><i>&lt;subroutine <tt>drawpoints</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u30" href="#NWDCUvTi-d"><i>&lt;subroutine <tt>drawAngleArc</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u31" href="#NWDCUvTi-e"><i>&lt;subroutine <tt>drawAngleArrow</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u32" href="#NWDCUvTi-f"><i>&lt;subroutine <tt>expr</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u33" href="#NWDCUvTi-g"><i>&lt;subroutine <tt>memberOf</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u34" href="#NWDCUvTi-h"><i>&lt;subroutine <tt>midpoint</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u35" href="#NWDCUvTi-i"><i>&lt;subroutine <tt>tand</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u36" href="#NWDCUvTi-j"><i>&lt;subroutine <tt>get_string</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u37" href="#NWDCUvTi-k"><i>&lt;subroutine <tt>is_tainted</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u38" href="#NWDCUvTi-l"><i>&lt;subroutine <tt>noOfDigits</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u39" href="#NWDCUvTi-m"><i>&lt;subroutine <tt>drawsquare</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u40" href="#NWDCUvTi-n"><i>&lt;subroutine <tt>X2sp</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u41" href="#NWDCUvTi-o"><i>&lt;subroutine <tt>sp2X</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u42" href="#NWDCUvTi-p"><i>&lt;subroutine <tt>setLineThickness</tt> &gt;</i></a>
+ <a name="NWCUvTi-2AA3uL-1-u43" href="#NWDCUvTi-q"><i>&lt;subroutine <tt>process_input</tt> &gt;</i></a>
</pre><p>Subroutine <tt>mpp</tt> is an implementation of a mathspic preprocessor that allows
the definition of one-line macros with or without arguments. Macro definition has the
@@ -443,7 +447,7 @@ the macro processor operates.
a macro definition. We parse each component of the macro definition and finally we
store the macro name, the macro code and the macro parameters (if any) in an anonymous
hash that eventually becomes part of an array. If we encounter any error, we simply
-<a name="NWD21HcNW-A">skip to the next line after printing a suitable error message. Now, if the first tokens</a>
+<a name="NWDCUvTi-A">skip to the next line after printing a suitable error message. Now, if the first tokens</a>
of an input line are <tt>%undef</tt>, we assume the user wants to delete a macro.
In case these tokens are not followed by a macro name or the macro name has not been
defined we simply go on. Otherwise, we delete the corresponding macro data from the
@@ -452,7 +456,7 @@ more difficult and it will be described in detail in a separate document. At thi
we would like to thank Joachim Schneider <joachim at hal dot rhein-necker dot de>
for a suggestion on improving macro expansion.
-<pre><a name="NW21HcNW-2rq75n-1" href="#NWD21HcNW-A"><dfn>&lt;subroutine <tt>mpp</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2rq75n-1" href="#NWDCUvTi-A"><dfn>&lt;subroutine <tt>mpp</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub mpp {
my $in_line;
chomp($in_line = shift);
@@ -597,7 +601,7 @@ line X: paper{units(
where <code>X</code> denotes the line number and <code>Error_Message</code> is the
actual error message. Note, that we print the tokens processed so far
and on the text line the unprocessed tokens, so that the user knows
-<a name="NWD21HcNW-B">exactly where the error is. In the variable </a><code>$A</code> we store the processed
+<a name="NWDCUvTi-B">exactly where the error is. In the variable </a><code>$A</code> we store the processed
tokens, while the variable <code>$l</code> holds the length of <code>$A</code> plus the
length of the <code>$error_line</code> (that is the number of the input line where
the error occurred) plus 7, i.e., 4 (the length of the word
@@ -606,7 +610,7 @@ Finally, we increment the error counter (variable <code>$no_errors</code>). Note
in case the user has specified the <code>-c</code> command line switch, we will not
print any messages to the output file.
-<pre><a name="NW21HcNW-1m1522-1" href="#NWD21HcNW-B"><dfn>&lt;subroutine <tt>PrintErrorMessage</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1m1522-1" href="#NWDCUvTi-B"><dfn>&lt;subroutine <tt>PrintErrorMessage</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub PrintErrorMessage {
my $errormessage = shift;
my $error_line = shift;
@@ -626,12 +630,12 @@ print any messages to the output file.
$no_errors++;
}
-</pre><p><a name="NWD21HcNW-C">Subroutine </a><tt>PrintWarningMessage</tt> behaves exactly like the subroutine
+</pre><p><a name="NWDCUvTi-C">Subroutine </a><tt>PrintWarningMessage</tt> behaves exactly like the subroutine
<tt>PrintErrorMessage</tt>. The only difference is that the second
subroutine prints only a warning message. A warning is issued when
the system detects parameters that do nothing.
-<pre><a name="NW21HcNW-3Lpu7M-1" href="#NWD21HcNW-C"><dfn>&lt;subroutine <tt>PrintWarningMessage</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3Lpu7M-1" href="#NWDCUvTi-C"><dfn>&lt;subroutine <tt>PrintWarningMessage</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub PrintWarningMessage {
my $warningMessage = shift;
my $warning_line = shift;
@@ -650,11 +654,11 @@ the system detects parameters that do nothing.
}
}
-</pre><p><a name="NWD21HcNW-D">The subroutine </a><tt>PrintFatalError</tt> behaves similarly to the subroutine
+</pre><p><a name="NWDCUvTi-D">The subroutine </a><tt>PrintFatalError</tt> behaves similarly to the subroutine
<tt>PrintErrorMessage</tt>. It prints an error message to the
screen and aborts execution.
-<pre><a name="NW21HcNW-4RPeBe-1" href="#NWD21HcNW-D"><dfn>&lt;subroutine <tt>PrintFatalError</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4RPeBe-1" href="#NWDCUvTi-D"><dfn>&lt;subroutine <tt>PrintFatalError</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub PrintFatalError {
my $FatalMessage = shift;
my $fatal_line = shift;
@@ -667,14 +671,14 @@ screen and aborts execution.
(&quot; &quot; x $l) . $_ . &quot;***Fatal Error: $FatalMessage\n&quot;;
}
-</pre><p><a name="NWD21HcNW-E">The subroutine </a><tt>chk_lparen</tt> accepts two arguments: the name
+</pre><p><a name="NWDCUvTi-E">The subroutine </a><tt>chk_lparen</tt> accepts two arguments: the name
of the token that should be immediately before the left parenthesis (variable
<code>$token</code>), and the current line number (variable <code>$lc</code>). First we
skip any leading white space and then check whether the next
input character is a left parenthesis, then the subroutine skips any
trailing white space; otherwise it prints an error message.
-<pre><a name="NW21HcNW-4Y5BUt-1" href="#NWD21HcNW-E"><dfn>&lt;subroutine <tt>chk_lparen</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4Y5BUt-1" href="#NWDCUvTi-E"><dfn>&lt;subroutine <tt>chk_lparen</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub chk_lparen {
my $token = $_[0];
my $lc = $_[1];
@@ -687,14 +691,14 @@ sub chk_lparen {
}
}
-</pre><p><a name="NWD21HcNW-F">The subroutine </a><tt>chk_rparen</tt> accepts two parameters: the name
+</pre><p><a name="NWDCUvTi-F">The subroutine </a><tt>chk_rparen</tt> accepts two parameters: the name
of the token that should be immediately after a right parenthesis (variable
<code>$token</code>), and the current line number (variable <code>$lc</code>). Initially, we
skip any leading white space and then we check whether the next input
token is a right parenthesis. If it is not we issue a error message and
return, otherwise we skip the parenthesis and any trailing white space.
-<pre><a name="NW21HcNW-3fTYkz-1" href="#NWD21HcNW-F"><dfn>&lt;subroutine <tt>chk_rparen</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3fTYkz-1" href="#NWDCUvTi-F"><dfn>&lt;subroutine <tt>chk_rparen</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub chk_rparen {
my $token = $_[0];
my $lc = $_[1];
@@ -708,10 +712,10 @@ sub chk_rparen {
}
-</pre><p><a name="NWD21HcNW-G">The subroutine </a><tt>chk_lcb</tt> behaves in a similar way to the subroutine
+</pre><p><a name="NWDCUvTi-G">The subroutine </a><tt>chk_lcb</tt> behaves in a similar way to the subroutine
<tt>chk_lparen</tt>.
-<pre><a name="NW21HcNW-2vMx6j-1" href="#NWD21HcNW-G"><dfn>&lt;subroutine <tt>chk_lcb</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2vMx6j-1" href="#NWDCUvTi-G"><dfn>&lt;subroutine <tt>chk_lcb</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub chk_lcb {
my $token = $_[0];
my $lc = $_[1];
@@ -724,10 +728,10 @@ sub chk_lcb {
}
}
-</pre><p><a name="NWD21HcNW-H">Subroutine </a><tt>chk_rcb</tt> behaves in a similar way to the subroutine
+</pre><p><a name="NWDCUvTi-H">Subroutine </a><tt>chk_rcb</tt> behaves in a similar way to the subroutine
<tt>chk_rparen</tt>.
-<pre><a name="NW21HcNW-FE9Ax-1" href="#NWD21HcNW-H"><dfn>&lt;subroutine <tt>chk_rcb</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-FE9Ax-1" href="#NWDCUvTi-H"><dfn>&lt;subroutine <tt>chk_rcb</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub chk_rcb {
my $token = $_[0];
my $lc = $_[1];
@@ -739,10 +743,10 @@ sub chk_rcb {
}
}
-</pre><p><a name="NWD21HcNW-I">Subroutine </a><tt>chk_lsb</tt> behaves in a similar way to the subroutine
+</pre><p><a name="NWDCUvTi-I">Subroutine </a><tt>chk_lsb</tt> behaves in a similar way to the subroutine
<tt>chk_lparen</tt>.
-<pre><a name="NW21HcNW-3N30ZF-1" href="#NWD21HcNW-I"><dfn>&lt;subroutine <tt>chk_lsb</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3N30ZF-1" href="#NWDCUvTi-I"><dfn>&lt;subroutine <tt>chk_lsb</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub chk_lsb {
my $token = $_[0];
my $lc = $_[1];
@@ -756,10 +760,10 @@ sub chk_lsb {
}
}
-</pre><p><a name="NWD21HcNW-J">Subroutine </a><tt>chk_rsb</tt> behaves in a similar way to the subroutine
+</pre><p><a name="NWDCUvTi-J">Subroutine </a><tt>chk_rsb</tt> behaves in a similar way to the subroutine
<tt>chk_rparen</tt>.
-<pre><a name="NW21HcNW-ma6zf-1" href="#NWD21HcNW-J"><dfn>&lt;subroutine <tt>chk_rsb</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-ma6zf-1" href="#NWDCUvTi-J"><dfn>&lt;subroutine <tt>chk_rsb</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub chk_rsb {
my $token = $_[0];
my $lc = $_[1];
@@ -773,11 +777,11 @@ sub chk_rsb {
}
}
-</pre><p><a name="NWD21HcNW-K">The subroutine </a><code>chk_comma</code> checks whether the next token is a comma.
+</pre><p><a name="NWDCUvTi-K">The subroutine </a><code>chk_comma</code> checks whether the next token is a comma.
If it is not then it prints an error message, otherwise it consumes the
comma and any white space that follows the comma.
-<pre><a name="NW21HcNW-UyyUp-1" href="#NWD21HcNW-K"><dfn>&lt;subroutine <tt>chk_comma</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-UyyUp-1" href="#NWDCUvTi-K"><dfn>&lt;subroutine <tt>chk_comma</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub chk_comma {
my $lc = $_[0];
@@ -790,12 +794,12 @@ sub chk_comma {
}
}
-</pre><p><a name="NWD21HcNW-L">The subroutine </a><code>chk_comment</code> has only one parameter which is the current
+</pre><p><a name="NWDCUvTi-L">The subroutine </a><code>chk_comment</code> has only one parameter which is the current
line number. It checks whether the next input character is a comment
character and in this case it does nothing!. Otherwise, if there is some trailing text
it simply prints a warning to the screen.
-<pre><a name="NW21HcNW-wLKY1-1" href="#NWD21HcNW-L"><dfn>&lt;subroutine <tt>chk_comment</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-wLKY1-1" href="#NWDCUvTi-L"><dfn>&lt;subroutine <tt>chk_comment</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub chk_comment {
my $lc = $_[0];
@@ -808,13 +812,13 @@ sub chk_comment {
}
}
-</pre><p><a name="NWD21HcNW-M">The subroutine </a><code>print_headers</code> prints a header to the output file, as
+</pre><p><a name="NWDCUvTi-M">The subroutine </a><code>print_headers</code> prints a header to the output file, as
well as a header to the LOG file.
The header contains information regarding the version of the
program, a copyright notice, the command line, date and time information,
and the names of the various files processed/generated.
-<pre><a name="NW21HcNW-3iVliS-1" href="#NWD21HcNW-M"><dfn>&lt;subroutine <tt>print_headers</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3iVliS-1" href="#NWDCUvTi-M"><dfn>&lt;subroutine <tt>print_headers</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub print_headers
{
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
@@ -828,7 +832,7 @@ and the names of the various files processed/generated.
print OUT &quot;%* -----------------------------------------------\n&quot;;
print OUT &quot;%* mathspic (Perl version $version_number)\n&quot;;
print OUT &quot;%* A filter program for use with PiCTeX\n&quot;;
- print OUT &quot;%* Copyright (c) 2005 A Syropoulos &amp; RWD Nickalls \n&quot;;
+ print OUT &quot;%* Copyright (c) 2005-2010 A Syropoulos &amp; RWD Nickalls \n&quot;;
print OUT &quot;%* Command line: $0 $commandLineArgs\n&quot;;
print OUT &quot;%* Input filename : $source_file\n&quot;;
print OUT &quot;%* Output filename: $out_file\n&quot;;
@@ -838,26 +842,26 @@ and the names of the various files processed/generated.
print LOG &quot;----\n&quot;;
print LOG &quot;$now_string\n&quot;;
print LOG &quot;mathspic (Perl version $version_number)\n&quot;;
- print LOG &quot;Copyright (c) 2005 A Syropoulos &amp; RWD Nickalls \n&quot;;
+ print LOG &quot;Copyright (c) 2005-2010 A Syropoulos &amp; RWD Nickalls \n&quot;;
print LOG &quot;Input file = $source_file\n&quot;;
print LOG &quot;Output file = $out_file\n&quot;;
print LOG &quot;Log file = $log_file\n&quot;;
print LOG &quot;----\n&quot;;
}
-</pre><p><a name="NWD21HcNW-N">The subroutine </a><code>get_point</code> parses an individual point name.
+</pre><p><a name="NWDCUvTi-N">The subroutine </a><code>get_point</code> parses an individual point name.
If the next token is also a point name then it returns the point name
(but only if the only if
the point name exists in the PointTable). In all other cases it returns
the string <code>_undef_</code> to indicate that something is wrong.
-<pre><a name="NW21HcNW-1h5ef9-1" href="#NWD21HcNW-N"><dfn>&lt;subroutine <tt>get_point</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1h5ef9-1" href="#NWDCUvTi-N"><dfn>&lt;subroutine <tt>get_point</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub get_point {
my ($lc) = $_[0];
my ($PointName);
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})\s*//i) { #point name
$PointName = $1;
if (!exists($PointTable{lc($PointName)})) {
PrintErrorMessage(&quot;Undefined point $PointName&quot;,$lc);
@@ -885,7 +889,7 @@ y=m<sub>2</sub>x+c<sub>2</sub>. Since the line AB passes through A, then
c<sub>1</sub>=y<sub>A</sub>-m<sub>1</sub>x<sub>A</sub>. Similarly, as P is
on line PF, then c<sub>2</sub>=y<sub>P</sub>-m<sub>2</sub>x<sub>P</sub>.
Now point F is on both lines, therefore
-<a name="NWD21HcNW-O">y</a><sub>F</sub>=m<sub>2</sub>x<sub>F</sub>+c<sub>2</sub> and
+<a name="NWDCUvTi-O">y</a><sub>F</sub>=m<sub>2</sub>x<sub>F</sub>+c<sub>2</sub> and
y<sub>F</sub>=m<sub>1</sub>x<sub>F</sub>+c<sub>1</sub>. Solving these
equations for x<sub>F</sub> and y<sub>F</sub> gives:
<center>
@@ -894,7 +898,7 @@ y<sub>F</sub>=(m<sub>1</sub>c<sub>2</sub>-m<sub>2</sub>c<sub>1</sub>)/
(m<sub>1</sub>-m<sub>2</sub>)
</center>
-<pre><a name="NW21HcNW-1GxwYt-1" href="#NWD21HcNW-O"><dfn>&lt;subroutine <tt>perpendicular</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1GxwYt-1" href="#NWDCUvTi-O"><dfn>&lt;subroutine <tt>perpendicular</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub perpendicular {
my ($xP, $yP, $xA, $yA, $xB, $yB) = @_;
my ($xF, $yF, $deltax, $deltay, $m1, $m2, $c1, $c2, $factor);
@@ -913,18 +917,18 @@ y<sub>F</sub>=(m<sub>1</sub>c<sub>2</sub>-m<sub>2</sub>c<sub>1</sub>)/
return (($c2 - $c1) * $factor, ($m1 * $c2 - $m2 * $c1) * $factor);
}
-</pre><p> <a name="NWD21HcNW-P">The subroutine </a><code>Length</code> computes the distance between two points A and B.
+</pre><p> <a name="NWDCUvTi-P">The subroutine </a><code>Length</code> computes the distance between two points A and B.
Notice, that the name of the subroutine starts with a capital L, just
to avoid conflict with the predefined Perl function. The subroutine
requires four parameters which are the coordinates of the two points.
-<pre><a name="NW21HcNW-4XEuZg-1" href="#NWD21HcNW-P"><dfn>&lt;subroutine <tt>Length</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4XEuZg-1" href="#NWDCUvTi-P"><dfn>&lt;subroutine <tt>Length</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub Length {
my ($xA, $yA, $xB, $yB)=@_;
return sqrt(($xB - $xA)**2 + ($yB - $yA)**2);
}
-</pre><p><a name="NWD21HcNW-Q">The subroutine </a><code>triangleArea</code> computes the area of a triangle by using
+</pre><p><a name="NWDCUvTi-Q">The subroutine </a><code>triangleArea</code> computes the area of a triangle by using
Heron's formula, i.e., given a triangle ABC, we first compute
s=(AB+BC+CA)/2 and then the area of the triangle is equal to the
square root of s times (s-AB) times (s-BC) times (s-BA), where AB, BC, and CA
@@ -932,7 +936,7 @@ are the lengths of the three sides of the triangle. The subroutine accepts 6
parameters, which correspond to the coordinates of three points that define
the triangle.
-<pre><a name="NW21HcNW-4DwBs6-1" href="#NWD21HcNW-Q"><dfn>&lt;subroutine <tt>triangleArea</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4DwBs6-1" href="#NWDCUvTi-Q"><dfn>&lt;subroutine <tt>triangleArea</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub triangleArea {
my ($xA, $yA, $xB, $yB, $xC, $yC)=@_;
my ($lenAB, $lenBC, $lenCA, $s);
@@ -944,12 +948,12 @@ the triangle.
return sqrt($s * ($s - $lenAB)*($s - $lenBC)*($s - $lenCA));
}
-</pre><p><a name="NWD21HcNW-R">The subroutine </a><code>poinOnLine</code> accepts five arguments: the coordinates of two
+</pre><p><a name="NWDCUvTi-R">The subroutine </a><code>poinOnLine</code> accepts five arguments: the coordinates of two
points and the decimal number which corresponds to the distance from the
first point towards the second one. The way we compute the coordinates of
the point is fairly simple.
-<pre><a name="NW21HcNW-VFnEE-1" href="#NWD21HcNW-R"><dfn>&lt;subroutine <tt>pointOnLine</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-VFnEE-1" href="#NWDCUvTi-R"><dfn>&lt;subroutine <tt>pointOnLine</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub pointOnLine {
my ($xA, $yA, $xB, $yB, $dist)=@_;
my ($deltax, $deltay, $xPol, $yPol);
@@ -970,7 +974,7 @@ the circle. We now describe how the subroutine computes the center
of the circle and its radius. Let the triangle points be <code>t1</code>, <code>t2</code>
and <code>t3</code>. We use the two pairs of points to define two sides,
i.e., <code>t1t2</code> and <code>t2t3</code>. For each
-<a name="NWD21HcNW-S">side we locate the midpoints and get the their coordinates. We check</a>
+<a name="NWDCUvTi-S">side we locate the midpoints and get the their coordinates. We check</a>
whether either of these two lines is either vertical or horizontal. If this
is true, we know that one of the coordinates of the center of the circumcircle
is the same as that of the midpoints of the horizontal or vertical line.
@@ -979,7 +983,7 @@ We now determine the slope of lines at right-angles to these lines. We solve the
resulting equations and obtain the center of the circumcircle. Now we get the
radius, and then we are done.
-<pre><a name="NW21HcNW-lKNKf-1" href="#NWD21HcNW-S"><dfn>&lt;subroutine <tt>circumCircleCenter</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-lKNKf-1" href="#NWDCUvTi-S"><dfn>&lt;subroutine <tt>circumCircleCenter</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub circumCircleCenter {
my ($xA, $yA, $xB, $yB, $xC, $yC, $lc)=@_;
@@ -1100,7 +1104,7 @@ one is a point. If it isn't a point we assume we have a variable followed
by a keyword. Otherwise, i.e., if it is a point name, we check whether
the second identifier is also a point name. If it is, we simply return
the distance between them, otherwise we issue an error message.
-<a name="NWD21HcNW-T">If we have only a single identifier, we check whether it is a</a>
+<a name="NWDCUvTi-T">If we have only a single identifier, we check whether it is a</a>
variable that has already been defined, and if so we return its value.
Since, this
subroutine is heavily used, it actually returns a pair of numbers:
@@ -1109,7 +1113,7 @@ error indicator. If the value of this indicator is 0, then there is no
error. If its value is 1, then there is an error. Moreover, in case there
is an error the distance is assumed to be equal to zero.
-<pre><a name="NW21HcNW-3GSnCT-1" href="#NWD21HcNW-T"><dfn>&lt;subroutine <tt>ComputeDist</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3GSnCT-1" href="#NWDCUvTi-T"><dfn>&lt;subroutine <tt>ComputeDist</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub ComputeDist {
my ($lc) = $_[0];
my ($v1, $v2);
@@ -1118,20 +1122,20 @@ is an error the distance is assumed to be equal to zero.
{
return ($1, 1);
}
- elsif (/^[^\W\d_]\d{0,3}[^\W\d_]\d{0,3}/) #it is a pair of IDs?
+ elsif (/^[^\W\d_]\d{0,4}[^\W\d_]\d{0,4}/) #it is a pair of IDs?
{
- s/^([^\W\d_]\d{0,3})//i;
+ s/^([^\W\d_]\d{0,4})//i;
$v1 = $1;
if (!exists($PointTable{lc($v1)})) {
if (exists($VarTable{lc($v1)})) {
return ($VarTable{lc($v1)}, 1);
}
PrintErrorMessage(&quot;Point $v1 has not been defined&quot;, $lc);
- s/^\s*[^\W\d_]\d{0,3}//i;
+ s/^\s*[^\W\d_]\d{0,4}//i;
return (0,0);
}
$v1 = lc($v1);
- s/^\s*([^\W\d_]\d{0,3})//i;
+ s/^\s*([^\W\d_]\d{0,4})//i;
$v2 = $1;
if (!exists($PointTable{lc($v2)}))
{
@@ -1143,7 +1147,7 @@ is an error the distance is assumed to be equal to zero.
my ($x2,$y2,$pSV2,$pS2) = unpack(&quot;d3A*&quot;,$PointTable{$v2});
return (Length($x1,$y1,$x2,$y2), 1);
}
- elsif (s/^([^\W\d_]\d{0,3})//i) # it is a single id
+ elsif (s/^([^\W\d_]\d{0,4})//i) # it is a single id
{
$v1 = $1;
if (!exists($VarTable{lc($v1)})) #it isn't a variable
@@ -1160,11 +1164,11 @@ is an error the distance is assumed to be equal to zero.
}
}
-</pre><p><a name="NWD21HcNW-U">The subroutine </a><code>intersection4points</code> has 8 parameters that correspond to the
+</pre><p><a name="NWDCUvTi-U">The subroutine </a><code>intersection4points</code> has 8 parameters that correspond to the
coordinates of four points that uniquely determine two lines, and computes the
the point of intersection of these two lines.
-<pre><a name="NW21HcNW-106ivL-1" href="#NWD21HcNW-U"><dfn>&lt;subroutine <tt>intersection4points</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-106ivL-1" href="#NWDCUvTi-U"><dfn>&lt;subroutine <tt>intersection4points</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub intersection4points {
my ($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4) = @_;
my ($deltay12, $deltax12, $deltay34, $deltax34);
@@ -1264,7 +1268,7 @@ distance of A1 from B be designated BA1</li>
<li> Using the sine rule, one gets: BA1/c = a/(b+c), that is
BA1 = c * a/(b+c).</li>
<li> Now do the same for side b, and determine equivalent point B1.
-<a name="NWD21HcNW-V">CB1/a = b/(b+c), that is CB1 = a * b/(b+c).</a></li>
+<a name="NWDCUvTi-V">CB1/a = b/(b+c), that is CB1 = a * b/(b+c).</a></li>
<li> We can now find the intersection of the line from point A to point A1,
and the line from point B to point B1. We have four points, so we use the
mathspic internal <code>intersection4points</code> subroutine to return the
@@ -1273,7 +1277,7 @@ coordinates of the intersection X<sub>i</sub>, Y<sub>i</sub>.</li>
<li>Finally, return the radius and the coordinates of the center.
</ul>
-<pre><a name="NW21HcNW-Kxdzt-1" href="#NWD21HcNW-V"><dfn>&lt;subroutine <tt>IncircleCenter</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-Kxdzt-1" href="#NWDCUvTi-V"><dfn>&lt;subroutine <tt>IncircleCenter</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub IncircleCenter {
my ($Ax, $Ay, $Bx, $By, $Cx, $Cy) = @_;
my ($sideA, $sideB, $sideC);
@@ -1299,12 +1303,12 @@ coordinates of the intersection X<sub>i</sub>, Y<sub>i</sub>.</li>
return ($xcenter, $ycenter, $r);
}
-</pre><p><a name="NWD21HcNW-W">The subroutine </a><code>Angle</code> takes six arguments which correspond to the
+</pre><p><a name="NWDCUvTi-W">The subroutine </a><code>Angle</code> takes six arguments which correspond to the
coordinates of three points that define an angle. The subroutine computes
the opening of the angle in degrees. In case there is an error it returns
the number -500. ****EXPLAIN THE ALGORITHM****
-<pre><a name="NW21HcNW-3xteda-1" href="#NWD21HcNW-W"><dfn>&lt;subroutine <tt>Angle</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3xteda-1" href="#NWDCUvTi-W"><dfn>&lt;subroutine <tt>Angle</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub Angle {
my ($Ax, $Ay, $Bx, $By, $Cx, $Cy) = @_;
my ($RAx, $RAy, $RBx, $RBy, $RCx, $RCy, $deltax, $deltay);
@@ -1362,7 +1366,7 @@ by the 1rst, the 2nd and 3rd argument). Here are the details:
<li> Let the triangle points be A, B, C, and the given side be BC.</li>
<li> Now calculate the radius of Excircle = (triangle area)/(s - side length),
where s = (a+b+c)/2</li>
-<li><a name="NWD21HcNW-X">Calculate the distance from the angle (A) (opposite the given side BC)</a>
+<li><a name="NWDCUvTi-X">Calculate the distance from the angle (A) (opposite the given side BC)</a>
to the excircle center = radius/sin(A/2)</li>
<li> Now determine the the Excircle center by locating it on the angle bisector
(i.e., same line that the IncircleCenter is on), but at distance d further
@@ -1371,7 +1375,7 @@ away from angle A. So, we now have the Incircle center (I),
and then extend the line from I by distance d to Excenter Xc, Yc.</li>
</ul>
-<pre><a name="NW21HcNW-cchrT-1" href="#NWD21HcNW-X"><dfn>&lt;subroutine <tt>excircle</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-cchrT-1" href="#NWDCUvTi-X"><dfn>&lt;subroutine <tt>excircle</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub excircle {
my ($A, $B, $C, $D, $E) = @_;
my ($Ax,$Ay,$Bx,$By,$Dx,$Dy,$Ex,$Ey,$ASVA,$ASA);
@@ -1432,7 +1436,7 @@ comma, as the syntax of the other commands is identical:
Points ::= Point { separator Point}
separator ::= blank | empty
</pre>
-<a name="NWD21HcNW-Y">In the following code we</a>
+<a name="NWDCUvTi-Y">In the following code we</a>
scan a list of points (possibly separated by blanks) and we stop when
we encounter either a comma or some other character. In case we have found
a comma, we check whether we have a <code>drawline</code> command and if this is
@@ -1441,7 +1445,7 @@ until there are no more points. The inner while-loop is used to control the
consumption of point tokens and the external to reset the array <code>PP</code> which
holds the point names.
-<pre><a name="NW21HcNW-cviH2-1" href="#NWD21HcNW-Y"><dfn>&lt;subroutine <tt>DrawLineOrArrow</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-cviH2-1" href="#NWDCUvTi-Y"><dfn>&lt;subroutine <tt>DrawLineOrArrow</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub DrawLineOrArrow {
my $draw_Line = shift;
my $lc = shift;
@@ -1463,7 +1467,7 @@ holds the point names.
DRAWLINES:while(1) {
@PP = () ;
while(1) {
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})\s*//i) { #point name
$P = $1;
if (!exists($PointTable{lc($P)})) {
PrintErrorMessage(&quot;Undefined point $P&quot;,$lc);
@@ -1515,7 +1519,7 @@ holds the point names.
</pre><p>The subroutine <code>drawarrows</code> is used to draw one or more lines. The subroutine
accepts as argument an array which contains the names of the points which
-<a name="NWD21HcNW-Z">define the lines, plus the current program line number. Each arrow is printed</a>
+<a name="NWDCUvTi-Z">define the lines, plus the current program line number. Each arrow is printed</a>
using the following code:
<center>
<tt>\arrow < </tt>ArrowLength <tt> mm> [</tt> beta <tt>,</tt> gamma <tt>] from
@@ -1524,7 +1528,7 @@ x1 y1 to x2 y2 </tt>
where beta is equal to tan(<code>$arrowAngleB</code> * <code>d2r</code> /2) and gamma is equal to
2*tan(<code>$arrowAngleC</code> * <code>d2r</code> / 2).
-<pre><a name="NW21HcNW-4STZZz-1" href="#NWD21HcNW-Z"><dfn>&lt;subroutine <tt>drawarrows</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4STZZz-1" href="#NWDCUvTi-Z"><dfn>&lt;subroutine <tt>drawarrows</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub drawarrows {
my ($NoArgs);
$NoArgs = @_;
@@ -1578,7 +1582,7 @@ pairs with two points on each line (just to keep things simple) as follows:
<tt> \plot x2 y2 x3 y3 / %% pointname2 pointname3</tt>
<tt> \plot x3 y3 x4 y4 / %% pointname3 pointname4</tt>
</center>
-<a name="NWD21HcNW-a">An important part of the subroutine is devoted to checking whether either</a>
+<a name="NWDCUvTi-a">An important part of the subroutine is devoted to checking whether either</a>
or both of the pairs of points are associated with a line-free zone, and if
so, then we must take care not to draw the line inside the line-free zone. If
a point does have a line-free zone, then we use the <code>pointOnLine</code>
@@ -1586,7 +1590,7 @@ subroutine to determine the point on the line which is just on the line-free
boundary, and draw the line to the that point instead of to the exact
point-location.
-<pre><a name="NW21HcNW-3KtTfB-1" href="#NWD21HcNW-a"><dfn>&lt;subroutine <tt>drawlines</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3KtTfB-1" href="#NWDCUvTi-a"><dfn>&lt;subroutine <tt>drawlines</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub drawlines {
my ($NoArgs);
$NoArgs = @_;
@@ -1636,7 +1640,7 @@ number of points. The subroutine has as argument an array which contains the nam
points which define the lines plus the current program line number. The subroutine
emits code that has the following general form:
<pre>
- <a name="NWD21HcNW-b">\setquadratic</a>
+ <a name="NWDCUvTi-b">\setquadratic</a>
\plot
X1 Y1
X2 Y2
@@ -1645,7 +1649,7 @@ emits code that has the following general form:
</pre>
-<pre><a name="NW21HcNW-3c2Tgd-1" href="#NWD21HcNW-b"><dfn>&lt;subroutine <tt>drawCurve</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3c2Tgd-1" href="#NWDCUvTi-b"><dfn>&lt;subroutine <tt>drawCurve</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub drawCurve {
my ($NoArgs);
$NoArgs = @_;
@@ -1665,7 +1669,7 @@ emits code that has the following general form:
}
</pre><p>The subroutine <code>drawpoints</code> is used to draw one or more points. The subroutine
-<a name="NWD21HcNW-c">has as arguments a list of points. For each point we produce code that has</a>
+<a name="NWDCUvTi-c">has as arguments a list of points. For each point we produce code that has</a>
the following general form:
<center>
<tt> \put {SYMBOL} at Px PY</tt>
@@ -1674,7 +1678,7 @@ where <code>SYMBOL</code> is either the default plot symbol, i.e., <code>$\bulle
whatever the user has set with the <code>PointSymbol</code> command, or the plot
symbol specified in the definition of the point.
-<pre><a name="NW21HcNW-1NgToL-1" href="#NWD21HcNW-c"><dfn>&lt;subroutine <tt>drawpoints</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1NgToL-1" href="#NWDCUvTi-c"><dfn>&lt;subroutine <tt>drawpoints</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub drawpoints {
my ($NumberOfPoints,$p);
$NumberOfPoints = @_;
@@ -1740,7 +1744,7 @@ returns the corresponding PiCTeX code, the general format of
which is <pre>
\circulararc Angle degrees from x y center at x2 y2
</pre>
-<a name="NWD21HcNW-d">where </a><code>Angle</code> is the angle that the three points P1 P2 P3 define
+<a name="NWDCUvTi-d">where </a><code>Angle</code> is the angle that the three points P1 P2 P3 define
(computed by subroutine <code>Angle</code>),
and <code>x</code> and <code>y</code> are the coordinates of a point
residing on line P2P1 at distance equal to a <code>$radius</code> from
@@ -1748,7 +1752,7 @@ point <code>$P2</code>; and <code>x2</code>, <code>y2</code> are the coordinates
center of the circle about which the arc is drawn,
i.e., point <code>$P2</code>.
-<pre><a name="NW21HcNW-497AQD-1" href="#NWD21HcNW-d"><dfn>&lt;subroutine <tt>drawAngleArc</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-497AQD-1" href="#NWDCUvTi-d"><dfn>&lt;subroutine <tt>drawAngleArc</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub drawAngleArc {
my ($P1, $P2, $P3, $radius, $inout, $direction) = @_;
my ($x1,$y1,$pSV1,$pS1)=unpack(&quot;d3A*&quot;,$PointTable{$P1});
@@ -1778,14 +1782,14 @@ sub drawAngleArc {
return $code;
}
-</pre><p><a name="NWD21HcNW-e">The subroutine </a><code>drawAngleArrow</code> gets six arguments which correspond to
+</pre><p><a name="NWDCUvTi-e">The subroutine </a><code>drawAngleArrow</code> gets six arguments which correspond to
three points defining an angle (variables <code>$P1</code>, <code>$P2</code> and <code>$P3</code>),
the radius, the internal/external specification and the direction
specification. The subroutine mainly draws the arrowhead, and
calls the subroutine <code>drawAngleArc</code> to draw the
arc part of the arrow.
-<pre><a name="NW21HcNW-4UPwva-1" href="#NWD21HcNW-e"><dfn>&lt;subroutine <tt>drawAngleArrow</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4UPwva-1" href="#NWDCUvTi-e"><dfn>&lt;subroutine <tt>drawAngleArrow</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub drawAngleArrow {
my ($P1, $P2, $P3, $radius, $inout, $direction) = @_;
my ($x1,$y1,$pSV1,$pS1)=unpack(&quot;d3A*&quot;,$PointTable{$P1});
@@ -1906,7 +1910,7 @@ primitive ::= [ "+" | "-"] primitive | number | variable
"sin (" expr ")" | "cos (" expr ")" | "area (" ThreePoints ")" |
"tan (" expr ")" | "exp (" expr ")" | "int" "(" expr ")" |
"log (" expr ")" | "atan (" expr ")" | "sgn" "(" expr ")" |
- <a name="NWD21HcNW-f">"sqrt (" expr ")" | "acos (" expr ")" | "asin (" expr ")" |</a>
+ <a name="NWDCUvTi-f">"sqrt (" expr ")" | "acos (" expr ")" | "asin (" expr ")" |</a>
"atan (" expr ")" | "_pi_" | "_e_" |
"xcoord (" point ")" | "ycoord (" point ")" | "angle "(" ThreePoints ")"|
"angledeg" "(" ThreePoints ")" | "direction" "(" TwoPoints ")" |
@@ -1915,7 +1919,7 @@ primitive ::= [ "+" | "-"] primitive | number | variable
Note that <code>_pi_</code> and <code>_e_</code> can be used to access the value of the constants
Pi and e.
-<pre><a name="NW21HcNW-1aVxdI-1" href="#NWD21HcNW-f"><dfn>&lt;subroutine <tt>expr</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1aVxdI-1" href="#NWDCUvTi-f"><dfn>&lt;subroutine <tt>expr</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub expr {
my $lc = $_[0];
my($left,$op,$right);
@@ -2014,7 +2018,7 @@ sub primitive {
chk_rparen(&quot;Missing right parenthesis&quot;, $lc);
}
elsif (s/^angle//i) {
- chk_lparen(&quot;angle&quot;.$lc);
+ chk_lparen(&quot;angle&quot;,$lc);
my $point_1 = get_point($lc);
my ($x1,$y1,$pSV1,$pS1)=unpack(&quot;d3A*&quot;,$PointTable{$point_1});
my $point_2 = get_point($lc);
@@ -2202,13 +2206,13 @@ sub primitive {
return $val;
}
-</pre><p><a name="NWD21HcNW-g">The subroutine </a><code>memberOf</code> is used to check whether a string is part of
+</pre><p><a name="NWDCUvTi-g">The subroutine </a><code>memberOf</code> is used to check whether a string is part of
a list of strings. We assume that the first argument is the string in
question. We compare each list element against the string in question and
if we find it we stop and return the value <code>1</code> (denoting truth). Otherwise,
we simply return the value <code>0</code> (denoting false).
-<pre><a name="NW21HcNW-2tc9Fr-1" href="#NWD21HcNW-g"><dfn>&lt;subroutine <tt>memberOf</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2tc9Fr-1" href="#NWDCUvTi-g"><dfn>&lt;subroutine <tt>memberOf</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub memberOf {
my $elem = shift(@_);
@@ -2222,11 +2226,26 @@ sub memberOf {
return $found;
}
-</pre><p><a name="NWD21HcNW-h">The subroutine </a><code>tand</code> computes the tangent of an angle. The angle is
+</pre><p><a name="NWDCUvTi-h">The subroutine </a><code>midpoint</code> computes the coordinates of the midpoint of two points
+by means of the simple formula:
+<center>
+m<sub>x</sub>=x<sub>1</sub>+(y<sub>2</sub> - y<sub>1</sub>)/2 <br>
+m<sub>y</sub>=y<sub>1</sub>+(x<sub>2</sub> - x<sub>1</sub>)/2
+</center>
+
+<pre><a name="NWCUvTi-2wh1NN-1" href="#NWDCUvTi-h"><dfn>&lt;subroutine <tt>midpoint</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
+sub midpoint {
+ my ($x1, $y1, $x2, $y2)=@_;
+ return ($x1 + ($x2 - $x1)/2,
+ $y1 + ($y2 - $y1)/2);
+}
+
+
+</pre><p><a name="NWDCUvTi-i">The subroutine </a><code>tand</code> computes the tangent of an angle. The angle is
supposed to be in degrees. We simply transform it into radians and then
compute the actual result.
-<pre><a name="NW21HcNW-22jtMr-1" href="#NWD21HcNW-h"><dfn>&lt;subroutine <tt>tand</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-22jtMr-1" href="#NWDCUvTi-i"><dfn>&lt;subroutine <tt>tand</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub tand {
my $d = $_[0];
$d = $d * PI / 180;
@@ -2245,7 +2264,7 @@ we aren't at the end of the input string and the next character is a
quotation mark, we have an escape sequence. This means that we store these
two characters in the <code>@cmd</code> array and skip to characters after the quotation
mark. Otherwise, we simply store the character in the <code>@cmd</code> array and
-<a name="NWD21HcNW-i">skip to the next character. This process is repeated until either we consume</a>
+<a name="NWDCUvTi-j">skip to the next character. This process is repeated until either we consume</a>
all the characters of the string or until we find a sole quotation mark.
Since we are not sure what has forced the loop to exit, we check whether
there are still characters in the input string and we check whether this
@@ -2254,7 +2273,7 @@ closing quotation mark. In all cases we return a triplet consisting of
a number denoting success (1) or failure (0) and what we have consumed
from the input string, and what is left from the input string.
-<pre><a name="NW21HcNW-ufkvF-1" href="#NWD21HcNW-i"><dfn>&lt;subroutine <tt>get_string</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-ufkvF-1" href="#NWDCUvTi-j"><dfn>&lt;subroutine <tt>get_string</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub get_string {
my $string = shift;
my $lc = shift;
@@ -2287,10 +2306,10 @@ sub get_string {
}
}
-</pre><p><a name="NWD21HcNW-j">The definition as well as an explanation of the functionality of the</a>
+</pre><p><a name="NWDCUvTi-k">The definition as well as an explanation of the functionality of the</a>
following subroutine can be found in "Programming Perl", 3rd edition.
-<pre><a name="NW21HcNW-1MGdDt-1" href="#NWD21HcNW-j"><dfn>&lt;subroutine <tt>is_tainted</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1MGdDt-1" href="#NWDCUvTi-k"><dfn>&lt;subroutine <tt>is_tainted</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub is_tainted {
my $arg = shift;
my $nada = substr($arg,0,0);
@@ -2299,7 +2318,7 @@ sub is_tainted {
return length($@) != 0;
}
-</pre><p><a name="NWD21HcNW-k">The subroutine </a><code>noOfDigits</code> has one argument which is a number and returns
+</pre><p><a name="NWDCUvTi-l">The subroutine </a><code>noOfDigits</code> has one argument which is a number and returns
the number of decimal digits it has. If the number matches the regular
expression <code>^\d+(?!\.)</code> (a series of digits <i>not</i> followed by a
period), then the number of decimal digits is zero. If the
@@ -2307,7 +2326,7 @@ number matches the
regular expression <code>^\d+\.(\d+)?</code>, then number of decimal digits equals
<code>length($1)</code>. Naturally, it maybe zero!
-<pre><a name="NW21HcNW-3mBo7s-1" href="#NWD21HcNW-k"><dfn>&lt;subroutine <tt>noOfDigits</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3mBo7s-1" href="#NWDCUvTi-l"><dfn>&lt;subroutine <tt>noOfDigits</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub noOfDigits {
my $num = $_[0];
@@ -2319,12 +2338,12 @@ sub noOfDigits {
}
}
-</pre><p><a name="NWD21HcNW-l">Subroutine </a><code>drawsquare</code> is use by the <code>drawpoints</code> routine to plot a
+</pre><p><a name="NWDCUvTi-m">Subroutine </a><code>drawsquare</code> is use by the <code>drawpoints</code> routine to plot a
point whose point symbol is a square. The subroutine has one argument, which is
equal to the radius of the point. From this argument it computes the side of
the square.
-<pre><a name="NW21HcNW-3ywJ89-1" href="#NWD21HcNW-l"><dfn>&lt;subroutine <tt>drawsquare</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3ywJ89-1" href="#NWDCUvTi-m"><dfn>&lt;subroutine <tt>drawsquare</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub drawsquare {
my $s = $_[0];
#$s *= sqrt(2);
@@ -2335,10 +2354,10 @@ sub drawsquare {
return $code;
}
-</pre><p><a name="NWD21HcNW-m">Subroutine </a><code>X2sp</code> has two arguments: a number and a length unit. It returns
+</pre><p><a name="NWDCUvTi-n">Subroutine </a><code>X2sp</code> has two arguments: a number and a length unit. It returns
the length expresssed in sp units.
-<pre><a name="NW21HcNW-39f7o8-1" href="#NWD21HcNW-m"><dfn>&lt;subroutine <tt>X2sp</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-39f7o8-1" href="#NWDCUvTi-n"><dfn>&lt;subroutine <tt>X2sp</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub X2sp {
my $LT = shift;
my $units = shift;
@@ -2373,11 +2392,11 @@ sub X2sp {
}
-</pre><p><a name="NWD21HcNW-n">Subroutine </a><code>sp2X</code> has two arguments: a number that denotes a length in sp units
+</pre><p><a name="NWDCUvTi-o">Subroutine </a><code>sp2X</code> has two arguments: a number that denotes a length in sp units
and a length unit. It returns the length expresssed in units that are specified by
the second argument.
-<pre><a name="NW21HcNW-3wV39i-1" href="#NWD21HcNW-n"><dfn>&lt;subroutine <tt>sp2X</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3wV39i-1" href="#NWDCUvTi-o"><dfn>&lt;subroutine <tt>sp2X</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub sp2X {
my $LT = shift;
my $units = shift;
@@ -2411,11 +2430,11 @@ sub sp2X {
}
}
-</pre><p><a name="NWD21HcNW-o">Subroutine </a><code>setLineThickness</code> takes two arguments: the value of the variable
+</pre><p><a name="NWDCUvTi-p">Subroutine </a><code>setLineThickness</code> takes two arguments: the value of the variable
<code>$xunits</code> and a string denoting the linethickness. It returns the linthickness
expressed in the units of the <code>$xunits</code>.
-<pre><a name="NW21HcNW-4XWBBY-1" href="#NWD21HcNW-o"><dfn>&lt;subroutine <tt>setLineThickness</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4XWBBY-1" href="#NWDCUvTi-p"><dfn>&lt;subroutine <tt>setLineThickness</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub setLineThickness {
my $Xunits = shift;
my $LT = shift;
@@ -2441,7 +2460,7 @@ the input file and the variable <code>$lc</code> is the local line counter. The
commands <code>beginSkip</code> and <code>endSkip</code> can be used to ignore blocks
of code and so we need to process them here. The variable <code>$no_output</code>
is used as a switch to toggle from process mode to no-precess mode.
-<a name="NWD21HcNW-p">If the first token is </a><code>beginSkip</code>, we set the variable <code>$no_output</code> to 1,
+<a name="NWDCUvTi-q">If the first token is </a><code>beginSkip</code>, we set the variable <code>$no_output</code> to 1,
print a comment to the output file and continue with the next input line.
If the first token is <code>endSkip</code>, we check whether we are in a no-process
mode. If this is the case, we revert to process mode; otherwise we print
@@ -2450,7 +2469,7 @@ mode we process the input text or simply printed commented out to the output
file. Note, that we don't allow nested comment blocks, as this makes really
no sense!
-<pre><a name="NW21HcNW-1RrLPF-1" href="#NWD21HcNW-p"><dfn>&lt;subroutine <tt>process_input</tt> &gt;=</dfn></a> <b>(<a href="#NWD21HcNW-9">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1RrLPF-1" href="#NWDCUvTi-q"><dfn>&lt;subroutine <tt>process_input</tt> &gt;=</dfn></a> <b>(<a href="#NWDCUvTi-9">&lt;-U</a>)</b>
sub process_input {
my ($INFILE,$currInFile) = @_;
my $lc = 0;
@@ -2483,7 +2502,7 @@ no sense!
my $out_line = mpp($command,$lc) unless /^\\/; #call macro pre-processor
$_ = &quot;$out_line\n&quot;;
}
- <a name="NW21HcNW-1RrLPF-1-u1" href="#NWD21HcNW-q"><i>&lt;process input line&gt;</i></a>
+ <a name="NWCUvTi-1RrLPF-1-u1" href="#NWDCUvTi-r"><i>&lt;process input line&gt;</i></a>
}
}
}
@@ -2610,14 +2629,14 @@ Command <code>const</code> is used to store a numeric value into a comma separat
list of variables, whose value cannot be altered.
</li>
<li>
-<a name="NWD21HcNW-q">If a line starts with a backslash, </a><code>\</code>, then we copy verbatim this
+<a name="NWDCUvTi-r">If a line starts with a backslash, </a><code>\</code>, then we copy verbatim this
line to the output file. In case the second character is a space character,
then we simply output a copy of the line without the leading backslash.
</li>
</ul>
Empty lines are always ignored.
-<pre><a name="NW21HcNW-RKDir-1" href="#NWD21HcNW-q"><dfn>&lt;process input line&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-p">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-RKDir-1" href="#NWDCUvTi-r"><dfn>&lt;process input line&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-q">&lt;-U</a>)</b>
if (/^\s*%/)
{
@@ -2653,24 +2672,24 @@ Empty lines are always ignored.
{
my $cmd = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u1" href="#NWD21HcNW-1V"><i>&lt;process <tt>ArrowShape</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u1" href="#NWDCUvTi-1W"><i>&lt;process <tt>ArrowShape</tt> command&gt;</i></a>
}
elsif (s/^\s*(const(?=\W))//i)
{
print OUT &quot;%% $1$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u2" href="#NWD21HcNW-1b"><i>&lt;process <tt>const</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u2" href="#NWDCUvTi-1c"><i>&lt;process <tt>const</tt> command&gt;</i></a>
}
elsif (s/^\s*(dasharray(?=\W))//i)
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u3" href="#NWD21HcNW-r"><i>&lt;process <tt>dasharray</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u3" href="#NWDCUvTi-s"><i>&lt;process <tt>dasharray</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawAngleArc(?=\W))//i or s/^\s*(drawAngleArrow(?=\W))//i )
{
my $cmd = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u4" href="#NWD21HcNW-s"><i>&lt;process <tt>drawAngleArcOrArrow</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u4" href="#NWDCUvTi-t"><i>&lt;process <tt>drawAngleArcOrArrow</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawArrow(?=\W))//i)
{
@@ -2682,7 +2701,7 @@ Empty lines are always ignored.
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u5" href="#NWD21HcNW-v"><i>&lt;process <tt>drawcircle</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u5" href="#NWDCUvTi-w"><i>&lt;process <tt>drawcircle</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawcurve(?=\W))//i)
{
@@ -2694,19 +2713,19 @@ Empty lines are always ignored.
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u6" href="#NWD21HcNW-w"><i>&lt;process <tt>drawcircumcircle</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u6" href="#NWDCUvTi-x"><i>&lt;process <tt>drawcircumcircle</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawexcircle(?=\W))//i)
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u7" href="#NWD21HcNW-x"><i>&lt;process <tt>drawexcircle</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u7" href="#NWDCUvTi-y"><i>&lt;process <tt>drawexcircle</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawincircle(?=\W))//i)
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u8" href="#NWD21HcNW-y"><i>&lt;process <tt>drawincircle</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u8" href="#NWDCUvTi-z"><i>&lt;process <tt>drawincircle</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawline(?=\W))//i)
{
@@ -2740,59 +2759,59 @@ Empty lines are always ignored.
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u9" href="#NWD21HcNW-z"><i>&lt;process <tt>drawPerpendicular</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u9" href="#NWDCUvTi-10"><i>&lt;process <tt>drawPerpendicular</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawpoint(?=\W))//i)
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u10" href="#NWD21HcNW-10"><i>&lt;process <tt>drawpoint</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u10" href="#NWDCUvTi-11"><i>&lt;process <tt>drawpoint</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawRightAngle(?=\W))//i)
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u11" href="#NWD21HcNW-11"><i>&lt;process <tt>drawRightAngle</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u11" href="#NWDCUvTi-12"><i>&lt;process <tt>drawRightAngle</tt> command&gt;</i></a>
}
elsif (s/^\s*(drawsquare(?=\W))//i)
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u12" href="#NWD21HcNW-12"><i>&lt;process <tt>drawsquare</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u12" href="#NWDCUvTi-13"><i>&lt;process <tt>drawsquare</tt> command&gt;</i></a>
}
elsif (s/^\s*inputfile\*//i)
{
- <a name="NW21HcNW-RKDir-1-u13" href="#NWD21HcNW-13"><i>&lt;process <tt>inputfile*</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u13" href="#NWDCUvTi-14"><i>&lt;process <tt>inputfile*</tt> command&gt;</i></a>
}
elsif (s/^\s*(inputfile(?=\W))//i)
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u14" href="#NWD21HcNW-14"><i>&lt;process <tt>inputfile</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u14" href="#NWDCUvTi-15"><i>&lt;process <tt>inputfile</tt> command&gt;</i></a>
}
elsif (s/^\s*(linethickness(?=\W))//i)
{
my $cmd = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u15" href="#NWD21HcNW-15"><i>&lt;process <tt>linethickness</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u15" href="#NWDCUvTi-16"><i>&lt;process <tt>linethickness</tt> command&gt;</i></a>
}
elsif (s/^\s*(paper(?=\W))//i)
{
my ($cmd) = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u16" href="#NWD21HcNW-16"><i>&lt;process <tt>paper</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u16" href="#NWDCUvTi-17"><i>&lt;process <tt>paper</tt> command&gt;</i></a>
}
elsif (s/^\s*(PointSymbol(?=\W))//i)
{
my $cmd = $1;
print OUT &quot;%% $cmd$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u17" href="#NWD21HcNW-1W"><i>&lt;process <tt>PointSymbol</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u17" href="#NWDCUvTi-1X"><i>&lt;process <tt>PointSymbol</tt> command&gt;</i></a>
}
elsif (s/^\s*point(?=\W)//i)
{
my ($Point_Line);
chomp($Point_Line=$_);
- <a name="NW21HcNW-RKDir-1-u18" href="#NWD21HcNW-1H"><i>&lt;process <tt>point/point*</tt> commands&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u18" href="#NWDCUvTi-1I"><i>&lt;process <tt>point/point*</tt> commands&gt;</i></a>
}
elsif (/^\s*setPointNumber(?=\W)/i)
{
@@ -2801,15 +2820,15 @@ Empty lines are always ignored.
}
elsif (s/^\s*(showAngle(?=\W))//i)
{
- <a name="NW21HcNW-RKDir-1-u19" href="#NWD21HcNW-1A"><i>&lt;process <tt>showAngle</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u19" href="#NWDCUvTi-1B"><i>&lt;process <tt>showAngle</tt> command&gt;</i></a>
}
elsif (s/^\s*(showArea(?=\W))//i)
{
- <a name="NW21HcNW-RKDir-1-u20" href="#NWD21HcNW-1B"><i>&lt;process <tt>showArea</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u20" href="#NWDCUvTi-1C"><i>&lt;process <tt>showArea</tt> command&gt;</i></a>
}
elsif (s/^\s*(showLength(?=\W))//i)
{
- <a name="NW21HcNW-RKDir-1-u21" href="#NWD21HcNW-1C"><i>&lt;process <tt>showLength</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u21" href="#NWDCUvTi-1D"><i>&lt;process <tt>showLength</tt> command&gt;</i></a>
}
elsif (/^\s*showPoints(?=\W)/i)
{
@@ -2842,17 +2861,17 @@ Empty lines are always ignored.
elsif (s/^\s*(system(?=\W))//i)
{
print OUT &quot;%% $1$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u22" href="#NWD21HcNW-1X"><i>&lt;process <tt>system</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u22" href="#NWDCUvTi-1Y"><i>&lt;process <tt>system</tt> command&gt;</i></a>
}
elsif (s/^\s*(text(?=\W))//i)
{
print OUT &quot;%% $1$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u23" href="#NWD21HcNW-1Y"><i>&lt;process <tt>text</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u23" href="#NWDCUvTi-1Z"><i>&lt;process <tt>text</tt> command&gt;</i></a>
}
elsif (s/^\s*(var(?=\W))//i)
{
print OUT &quot;%% $1$_&quot; if $comments_on;
- <a name="NW21HcNW-RKDir-1-u24" href="#NWD21HcNW-1c"><i>&lt;process <tt>var</tt> command&gt;</i></a>
+ <a name="NWCUvTi-RKDir-1-u24" href="#NWDCUvTi-1d"><i>&lt;process <tt>var</tt> command&gt;</i></a>
}
elsif (/^\s*\\(.+)/)
{
@@ -2883,7 +2902,7 @@ specify a dash pattern. Its general syntax follows:
g<sub>2</sub> "," ... ")"</tt>
</center>
where <tt>d<sub>i</sub></tt> denotes the length of a dash and <tt>g<sub>i</sub></tt>
-<a name="NWD21HcNW-r">denotes the length of gap between two consecutive dashes. Each </a><tt>d<sub>i</sub></tt>
+<a name="NWDCUvTi-s">denotes the length of gap between two consecutive dashes. Each </a><tt>d<sub>i</sub></tt>
and <tt>g<sub>i</sub></tt> is a length (i.e., a number accompanied by a length of unit).
Since we do not a priori know the number of arguments, we push them onto a stack and
then we produce a command of the form
@@ -2892,7 +2911,7 @@ then we produce a command of the form
g<sub>2</sub>, ...&gt;</tt>
</center>
-<pre><a name="NW21HcNW-19jqyn-1" href="#NWD21HcNW-r"><dfn>&lt;process <tt>dasharray</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-19jqyn-1" href="#NWDCUvTi-s"><dfn>&lt;process <tt>dasharray</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen($cmd,$lc);
my @DashArray = ();
my $dash = &quot;&quot;;
@@ -2944,7 +2963,7 @@ call the either the subroutine <code>drawAngleArc</code> or the subroutine
<code>drawAngleArrow</code> to produce the actual code
which is then printed into the output file. In order to be able to distinguish
which command we are dealing with we simply use the variable <code>$cmd</code>.
-<a name="NWD21HcNW-s">We now start parsing the input line. We first check whether there is a</a>
+<a name="NWDCUvTi-t">We now start parsing the input line. We first check whether there is a</a>
left curly bracket. Next, we parse the <code>angle</code>, the <code>distance</code>, the
<code>internal</code> and the <code>clockwise</code> parts of the command. Finally, we check
for right curly bracket and a trailing comment. Depending on
@@ -2953,12 +2972,12 @@ the variable <code>$cmd</code> we call either the subroutine <code>drawAngleArc<
subroutine <code>drawAngleArrow</code>. These subroutines return the code that will be
finally output to the output file.
-<pre><a name="NW21HcNW-12lwO-1" href="#NWD21HcNW-s"><dfn>&lt;process <tt>drawAngleArcOrArrow</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-12lwO-1" href="#NWDCUvTi-t"><dfn>&lt;process <tt>drawAngleArcOrArrow</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lcb($cmd,$lc);
- <a name="NW21HcNW-12lwO-1-u1" href="#NWD21HcNW-t"><i>&lt;process <tt>angle</tt> part of command&gt;</i></a>
+ <a name="NWCUvTi-12lwO-1-u1" href="#NWDCUvTi-u"><i>&lt;process <tt>angle</tt> part of command&gt;</i></a>
s/^,\s*// or s/\s*//; #parse optional comma
- <a name="NW21HcNW-12lwO-1-u2" href="#NWD21HcNW-u"><i>&lt;process <tt>radius</tt> part of command&gt;</i></a>
+ <a name="NWCUvTi-12lwO-1-u2" href="#NWDCUvTi-v"><i>&lt;process <tt>radius</tt> part of command&gt;</i></a>
s/^,\s*// or s/\s*//; #parse optional comma
my $inout = &quot;&quot;;
if (s/^(internal(?=\W))//i or s/^(external(?=\W))//i) {
@@ -2988,7 +3007,7 @@ finally output to the output file.
}
print OUT $code if $code ne &quot;&quot;;
-</pre><p><a name="NWD21HcNW-t">We first check whether the first token is the word </a><code>angle</code>. In case it
+</pre><p><a name="NWDCUvTi-u">We first check whether the first token is the word </a><code>angle</code>. In case it
isn't, this yields an unrecoverable error. In case the expected word is
there, we check for a left parenthesis. Next, we parse the three points that
must follow. For this purpose we use the user-defined subroutine
@@ -2996,7 +3015,7 @@ must follow. For this purpose we use the user-defined subroutine
it is less than -400 or equal to zero, the value yields an unrecoverable error.
We finish by checking whether there is a right parenthesis.
-<pre><a name="NW21HcNW-4X9wPg-1" href="#NWD21HcNW-t"><dfn>&lt;process <tt>angle</tt> part of command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-s">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4X9wPg-1" href="#NWDCUvTi-u"><dfn>&lt;process <tt>angle</tt> part of command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-t">&lt;-U</a>)</b>
my ($P1, $P2, $P3);
if (s/^angle(?=\W)//i) {
chk_lparen(&quot;token angle of command $cmd&quot;,$lc);
@@ -3027,11 +3046,11 @@ We finish by checking whether there is a right parenthesis.
next LINE;
}
-</pre><p><a name="NWD21HcNW-u">In this section we parse the </a><code>radius</code> part of the <code>drawAngleArc</code> or the
+</pre><p><a name="NWDCUvTi-v">In this section we parse the </a><code>radius</code> part of the <code>drawAngleArc</code> or the
<code>drawAngleArrow</code> command. We first check whether the next token is the word
<code>radius</code>. If it is not, then we continue with the next line.
-<pre><a name="NW21HcNW-2mAaDL-1" href="#NWD21HcNW-u"><dfn>&lt;process <tt>radius</tt> part of command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-s">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2mAaDL-1" href="#NWDCUvTi-v"><dfn>&lt;process <tt>radius</tt> part of command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-t">&lt;-U</a>)</b>
my $radius;
if (s/^radius(?=\W)//i) {
@@ -3058,7 +3077,7 @@ equal to <code>R</code> is:
\circulararc 360 degrees from X y center at x y
</pre>
where <code>X = x+R</code>.<p>
-<a name="NWD21HcNW-v">Initially, we check whether there is an opening left parenthesis. Next,</a>
+<a name="NWDCUvTi-w">Initially, we check whether there is an opening left parenthesis. Next,</a>
we get the point name by using the subroutine <code>get_point</code> which
issues an error message if the point hasn't been defined. In this
case we stop processing the command, as there is absolutely no reason to
@@ -3067,7 +3086,7 @@ the subroutine <code>ComputeDist</code>. If there is no problem, we emit the cod
and finally we check for a closing right parenthesis and for
possible garbage that may follow the command.
-<pre><a name="NW21HcNW-EIAAh-1" href="#NWD21HcNW-v"><dfn>&lt;process <tt>drawcircle</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-EIAAh-1" href="#NWDCUvTi-w"><dfn>&lt;process <tt>drawcircle</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;drawcircle&quot;,$lc);
my $Point = get_point($lc);
next LINE if $Point eq &quot;_undef_&quot;;
@@ -3091,7 +3110,7 @@ the radius of the circumcircle by calling the subroutine <code>circumCircleCente
If the triangle area is equal to zero, then this subroutine will return
the array <code>(0,0,0)</code> to indicate this fact.
We now have all necessary information to draw the circumcircle. We use the
-<a name="NWD21HcNW-w">following code to do the job:</a>
+<a name="NWDCUvTi-x">following code to do the job:</a>
<pre>
\circulararc 360 degrees from X y center x y
</pre>
@@ -3100,7 +3119,7 @@ radius and <code>X=x+R</code>. What is left is to check whether there is a
closing right parenthesis and any trailing garbage.
-<pre><a name="NW21HcNW-1HqG4z-1" href="#NWD21HcNW-w"><dfn>&lt;process <tt>drawcircumcircle</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1HqG4z-1" href="#NWDCUvTi-x"><dfn>&lt;process <tt>drawcircumcircle</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;drawcircumcircle&quot;,$lc);
my $point1 = get_point($lc);
next LINE if $point1 eq &quot;_undef_&quot;;
@@ -3150,7 +3169,7 @@ the optional part. The value of the optional part is stored in the variable <cod
At this point we check whether the sum of the radius
plus the optional part is equal to zero and if it is we continue with the
next input line. Next, we check for a closing right square bracket. We are
-<a name="NWD21HcNW-x">now ready to emit the source code. The first thing we must check is that</a>
+<a name="NWDCUvTi-y">now ready to emit the source code. The first thing we must check is that</a>
the radius is not too big for PiCTeX, i.e., not greater than 500/2.845.
Then we print some informative text to the output file and of course the
actual code. We use the following code to do the job:
@@ -3159,7 +3178,7 @@ actual code. We use the following code to do the job:
</pre>
The last thing we check is whether there is some trailing garbage.
-<pre><a name="NW21HcNW-Wbuba-1" href="#NWD21HcNW-x"><dfn>&lt;process <tt>drawexcircle</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-Wbuba-1" href="#NWDCUvTi-y"><dfn>&lt;process <tt>drawexcircle</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;drawexcircle&quot;,$lc);
my $point1 = get_point($lc);
next LINE if $point1 eq &quot;_undef_&quot;;
@@ -3233,7 +3252,7 @@ the optional part
is stored in the variable <code>$R</code>. At this point we check whether the sum of the
radius plus the optional part is equal to zero and if it is we continue with
the next input line. Next, we check for a closing right square bracket.
-<a name="NWD21HcNW-y">We are now ready to emit the source code. The first thing we must check is</a>
+<a name="NWDCUvTi-z">We are now ready to emit the source code. The first thing we must check is</a>
that the radius is not too big for PiCTeX, i.e., not greater than 500/2.845.
Then we print some informative text to the output file and of course the
actual code. We use the following code to do the job:
@@ -3242,7 +3261,7 @@ actual code. We use the following code to do the job:
</pre>
The last thing we check is whether there is some trailing garbage.
-<pre><a name="NW21HcNW-3GJ2p7-1" href="#NWD21HcNW-y"><dfn>&lt;process <tt>drawincircle</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3GJ2p7-1" href="#NWDCUvTi-z"><dfn>&lt;process <tt>drawincircle</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;drawincircle&quot;,$lc);
my $point1 = get_point($lc);
next LINE if $point1 eq &quot;_undef_&quot;;
@@ -3292,7 +3311,7 @@ error message and continue with the next input line. Finally, we check for
a closing right parenthesis and a possible trailing comment. Now we are
ready to compute the coordinates of the foot of the
perpendicular line. We do so my calling subroutine
-<code><a name="NWD21HcNW-z">perpendicular</a></code>. Certainly, before we do this we have to get the
+<code><a name="NWDCUvTi-10">perpendicular</a></code>. Certainly, before we do this we have to get the
coordinates of the points that we have parsed. Finally, we output the
PiCTeX code:
<pre>
@@ -3301,7 +3320,7 @@ PiCTeX code:
where <code>x1</code> and <code>y1</code> are coordinates of the point A and <code>xF</code> and <code>yF</code>
the coordinates of the foot.
-<pre><a name="NW21HcNW-4OiWfi-1" href="#NWD21HcNW-z"><dfn>&lt;process <tt>drawPerpendicular</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4OiWfi-1" href="#NWDCUvTi-10"><dfn>&lt;process <tt>drawPerpendicular</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen($cmd,$lc);
my $A = get_point($lc);
@@ -3331,7 +3350,7 @@ syntax of the command is as follows:
drawpoint ::= "drawpoint" "(" Point { separator Point } ")"
</pre>
The <code>while</code> loop is used to consume all points that are
-<a name="NWD21HcNW-10">between an opening left parenthesis and a closing right parenthesis. All</a>
+<a name="NWDCUvTi-11">between an opening left parenthesis and a closing right parenthesis. All</a>
points are pushed on the local array <code>PP</code>. When we have parsed the lists
of points, we call the subroutine <code>drawpoints</code> to emit the actual PiCTeX code.
Finally, we check whether there is a closing parenthesis
@@ -3340,7 +3359,7 @@ there is some trailing text that makes no sense. In case there are no points
between the parentheses, then we issue an appropriate error message and
we continue with the next input line.
-<pre><a name="NW21HcNW-2EC5Ei-1" href="#NWD21HcNW-10"><dfn>&lt;process <tt>drawpoint</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2EC5Ei-1" href="#NWDCUvTi-11"><dfn>&lt;process <tt>drawpoint</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
my ($stacklen);
chk_lparen(&quot;$cmd&quot;,$lc);
if (/^\)/) {
@@ -3349,7 +3368,7 @@ we continue with the next input line.
}
my(@PP);
DRAWPOINTS:while(1) {
- if (s/^([^\W\d_]\d{0,3})//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})//i) { #point name
$P = $1;
if (!exists($PointTable{lc($P)})) {
PrintErrorMessage(&quot;Undefined point $P&quot;,$lc);
@@ -3399,7 +3418,7 @@ draw S<sub>1</sub>-S and S<sub>2</sub>-S.</li>
<li> We compute the coordinates of S<sub>1</sub> and S<sub>2</sub> by using
The subroutine <code>pointOnLine</code>.</li>
</ol>
-<a name="NWD21HcNW-11">In order to implement the above steps we first compute the length of the line</a>
+<a name="NWDCUvTi-12">In order to implement the above steps we first compute the length of the line</a>
AB. Note that A is <code>$point1</code>, etc. Next we compute the angle BAC. Now
we compute the distance AQ (variable <code>$line1</code>). The coordinates of point
Q are stored in variables <code>$xQ</code> and <code>$yQ</code>. The coordinates of point
@@ -3408,9 +3427,9 @@ coordinates of points S<sub>1</sub> and S<sub>2</sub>. These coordinates
are stored in variables <code>$xS1</code>, <code>$yS1</code> and <code>$xS2</code>, <code>$yS2</code>,
respectively. Finally, we emit the PiCTeX target code.
-<pre><a name="NW21HcNW-2KJKP6-1" href="#NWD21HcNW-11"><dfn>&lt;process <tt>drawRightAngle</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2KJKP6-1" href="#NWDCUvTi-12"><dfn>&lt;process <tt>drawRightAngle</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
- chk_lparen(&quot;drawRightAngle&quot;,lc);
+ chk_lparen(&quot;drawRightAngle&quot;,$lc);
my $point1 = get_point($lc);
next LINE if $point1 eq &quot;_undef_&quot;;
my $point2 = get_point($lc);
@@ -3427,36 +3446,25 @@ respectively. Finally, we emit the PiCTeX target code.
#
#actual computation
#
- my $lengthAC = Length($x1, $y1, $x3, $y3);
- my $angleBAC = Angle($x2, $y2, $x1, $y1, $x3, $y3);
- my $line1 = $lengthAC / (1 + tand($angleBAC));
- #
- # determine coordinates of point Q
- #
- my ($xQ, $yQ) = pointOnLine($x1, $y1, $x3, $y3, $line1);
- #
- # determine coordinates of point S
- #
- my $deltax = $xQ - $x2;
- my $deltay = $yQ - $y2;
- my $lengthBQ = sqrt($deltax * $deltax + $deltay * $deltay);
- my $xS = $x2 + ($dist * sqrt(2) * $deltax / $lengthBQ);
- my $yS = $y2 + ($dist * sqrt(2) * $deltay / $lengthBQ);
- #
- # determine coordinates of points S1 and S2
- #
- my ($xS1, $yS1) = pointOnLine($x2, $y2, $x3, $y3, $dist);
- ($xS2, $yS2) = ($xS, $yS);
- #
- # emit PiCTeX code
- #
- printf OUT &quot;\\plot %.5f %.5f %.5f %.5f /\n&quot;,
- $xS1, $yS1, $xS2, $yS2;
- ($xS1, $yS1) = pointOnLine($x2, $y2, $x1, $y1, $dist);
- printf OUT &quot;\\plot %.5f %.5f %.5f %.5f /\n&quot;,
- $xS1, $yS1, $xS2, $yS2;
+ my ($Px, $Py) = pointOnLine($x2, $y2, $x1, $y1, $dist);
+ my ($Qx, $Qy) = pointOnLine($x2, $y2, $x3, $y3, $dist);
+ my ($Tx, $Ty) = midpoint($Px, $Py, $Qx, $Qy);
+ my ($Ux, $Uy) = pointOnLine($x2, $y2, $Tx, $Ty, 2*Length($x2, $y2, $Tx, $Ty));
+ if ($Px == $Ux || $Py == $Uy) {
+ printf OUT &quot;\\putrule from %.5f %.5f to %.5f %.5f \n&quot;, $Px,$Py,$Ux,$Uy;
+ }
+ else {
+ printf OUT &quot;\\plot %.5f %.5f\t%.5f %.5f / \n&quot;, $Px, $Py,$Ux,$Uy;
+ }
+ if ($Ux == $Qx || $Uy == $Qy) {
+ printf OUT &quot;\\putrule from %.5f %.5f to %.5f %.5f \n&quot;, $Ux,$Uy,$Qx,$Qy;
+ }
+ else {
+ printf OUT &quot;\\plot %.5f %.5f\t%.5f %.5f / \n&quot;, $Ux, $Uy,$Qx,$Qy;
+ }
-</pre><p><a name="NWD21HcNW-12">The command </a><code>drawsquare</code> has two arguments: a point, which specifies the
+
+</pre><p><a name="NWDCUvTi-13">The command </a><code>drawsquare</code> has two arguments: a point, which specifies the
coordinates of the point where the square will be placed, and a number, which
specifies the length of the side of the square. The syntax of the command is as follows:
<center>
@@ -3465,7 +3473,7 @@ specifies the length of the side of the square. The syntax of the command is as
Note that RWDN has suggested to alter the value of the <code>$side</code> variable (see the
line with <code>RWDN</code> comment).
-<pre><a name="NW21HcNW-2lxjRF-1" href="#NWD21HcNW-12"><dfn>&lt;process <tt>drawsquare</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2lxjRF-1" href="#NWDCUvTi-13"><dfn>&lt;process <tt>drawsquare</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;drawSquare&quot;,$lc);
my $p = get_point($lc);
chk_comma($lc);
@@ -3483,7 +3491,7 @@ enclosed in parentheses:
file-name ::= (alpha | period) { alpha | period }
alpha ::= letter | digit | "_" | "-"
</pre>
-<a name="NWD21HcNW-13">Note, that the input file is assumed to contain TeX code.</a>
+<a name="NWDCUvTi-14">Note, that the input file is assumed to contain TeX code.</a>
We first check to see if there is a left parenthesis. Then we consume
the file name. We check if the file exists and then we copy verbatim the
input file to the output file. Next, we check for the closing parenthesis.
@@ -3491,7 +3499,7 @@ Now, if there is a trailing comment we copy it to the output file depending
on the value of the variable <code>$comments_on</code>, else if there is some other
text we simply ignore it and issue a warning message.
-<pre><a name="NW21HcNW-fJuCf-1" href="#NWD21HcNW-13"><dfn>&lt;process <tt>inputfile*</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-fJuCf-1" href="#NWDCUvTi-14"><dfn>&lt;process <tt>inputfile*</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;inputfile*&quot;,$lc);
my $row_in = &quot;&quot;;
if (s/^((\w|-|\.)+)//) {
@@ -3518,7 +3526,7 @@ optional: a file name enclosed in curly brackets and the number of
times this file should be included in square brackets:
<pre>
inputfile ::= "inputfile" "(" file-name ")" [ Times ]
- <a name="NWD21HcNW-14">Times ::= "[" expr "]"</a>
+ <a name="NWDCUvTi-15">Times ::= "[" expr "]"</a>
</pre>
Note that the input file is assumed to contain mathspic commands. In addition, if
the expression is equal to a decimal number, it is truncated.
@@ -3527,7 +3535,7 @@ the file name, the right parenthesis and the optional argument if it exists.
In order to process the commands contained in the input file, we call
The subroutine <code>process_input</code>.
-<pre><a name="NW21HcNW-2EQO3c-1" href="#NWD21HcNW-14"><dfn>&lt;process <tt>inputfile</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2EQO3c-1" href="#NWDCUvTi-15"><dfn>&lt;process <tt>inputfile</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;inputfile&quot;,$lc);
my $comm_in = &quot;&quot;;
@@ -3560,11 +3568,11 @@ The subroutine <code>process_input</code>.
print OUT &quot;%% ... end of file &lt;$comm_in&gt; loop [$input_times]\n&quot;;
chk_comment($lc);
-</pre><p><a name="NWD21HcNW-15">The </a><code>linethickness</code> command should be used to set the thickness of lines.
+</pre><p><a name="NWDCUvTi-16">The </a><code>linethickness</code> command should be used to set the thickness of lines.
The command has one argument, which is a length or the word <code>default</code>.
The default line thickness is 0.4 pt.
-<pre><a name="NW21HcNW-1t58ZF-1" href="#NWD21HcNW-15"><dfn>&lt;process <tt>linethickness</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1t58ZF-1" href="#NWDCUvTi-16"><dfn>&lt;process <tt>linethickness</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;linethickness&quot;, $lc);
if (s/^default//i) {
print OUT &quot;\\linethickness=0.4pt\\Linethickness{0.4pt}%%\n&quot;;
@@ -3625,7 +3633,7 @@ that the <code>units</code> part is optional. Next we process the <code>xrange</
<code>yrange</code> part of the command, which are also optional parts of the command.
We are now ready to process the <code>axis</code> part. Note, that the user is allowed
to alternatively specify this part with the word <code>axes</code>.
-<a name="NWD21HcNW-16">The variable </a><code>$axis</code>
+<a name="NWDCUvTi-17">The variable </a><code>$axis</code>
is supposed to hold the various data relate to the <code>axis</code> part. The last
thing we check is the <code>ticks</code> part. In case the user has not specified
this part we assume that both ticks are equal to zero. If everything is
@@ -3634,11 +3642,11 @@ Now, that we have all relevant information we can output the rest of the code,
as some parts of it have already been output during parsing. The last thing we
do is to check whether there is any trailing comment.
-<pre><a name="NW21HcNW-1Pby5X-1" href="#NWD21HcNW-16"><dfn>&lt;process <tt>paper</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1Pby5X-1" href="#NWDCUvTi-17"><dfn>&lt;process <tt>paper</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lcb(&quot;paper&quot;, $lc);
if (s/^units(?=\W)//i)
{
- <a name="NW21HcNW-1Pby5X-1-u1" href="#NWD21HcNW-17"><i>&lt;process <tt>unit</tt> part&gt;</i></a>
+ <a name="NWCUvTi-1Pby5X-1-u1" href="#NWDCUvTi-18"><i>&lt;process <tt>unit</tt> part&gt;</i></a>
$nounits = 0;
}
else
@@ -3648,7 +3656,7 @@ do is to check whether there is any trailing comment.
s/^,\s*// or s/\s*//;
if (s/^xrange//i)
{
- <a name="NW21HcNW-1Pby5X-1-u2" href="#NWD21HcNW-18"><i>&lt;process <tt>xrange</tt> part&gt;</i></a>
+ <a name="NWCUvTi-1Pby5X-1-u2" href="#NWDCUvTi-19"><i>&lt;process <tt>xrange</tt> part&gt;</i></a>
$noxrange = 0;
}
else
@@ -3658,35 +3666,35 @@ do is to check whether there is any trailing comment.
s/^,\s*// or s/\s*//;
if (s/^yrange//i)
{
- <a name="NW21HcNW-1Pby5X-1-u3" href="#NWD21HcNW-19"><i>&lt;process <tt>yrange</tt> part&gt;</i></a>
+ <a name="NWCUvTi-1Pby5X-1-u3" href="#NWDCUvTi-1A"><i>&lt;process <tt>yrange</tt> part&gt;</i></a>
$noyrange = 0;
}
else
{
$noyrange = 1;
}
- <a name="NW21HcNW-1Pby5X-1-u4" href="#NWD21HcNW-1D"><i>&lt;generate plot area related commands&gt;</i></a>
+ <a name="NWCUvTi-1Pby5X-1-u4" href="#NWDCUvTi-1E"><i>&lt;generate plot area related commands&gt;</i></a>
s/^,\s*// or s/\s*//;
$axis = &quot;&quot;;
if (s/^ax[ei]s(?=\W)//i)
{
- <a name="NW21HcNW-1Pby5X-1-u5" href="#NWD21HcNW-1E"><i>&lt;process <tt>axis</tt> part&gt;</i></a>
+ <a name="NWCUvTi-1Pby5X-1-u5" href="#NWDCUvTi-1F"><i>&lt;process <tt>axis</tt> part&gt;</i></a>
}
$axis = uc($axis);
s/^,\s*// or s/\s*//;
if (s/^ticks(?=\W)//i)
{
- <a name="NW21HcNW-1Pby5X-1-u6" href="#NWD21HcNW-1F"><i>&lt;process <tt>ticks</tt> part&gt;</i></a>
+ <a name="NWCUvTi-1Pby5X-1-u6" href="#NWDCUvTi-1G"><i>&lt;process <tt>ticks</tt> part&gt;</i></a>
}
else
{
$xticks = $yticks = 0;
}
chk_rcb(&quot;paper&quot;, $lc);
- <a name="NW21HcNW-1Pby5X-1-u7" href="#NWD21HcNW-1G"><i>&lt;generate the rest of the code for the <tt>paper</tt> command&gt;</i></a>
+ <a name="NWCUvTi-1Pby5X-1-u7" href="#NWDCUvTi-1H"><i>&lt;generate the rest of the code for the <tt>paper</tt> command&gt;</i></a>
chk_comment($lc);
-</pre><p><a name="NWD21HcNW-17">We first check whether there is a left parenthesis. Next, we check</a>
+</pre><p><a name="NWDCUvTi-18">We first check whether there is a left parenthesis. Next, we check</a>
whether there is decimal number or a variable name. In case there isn't one we assume it
is the number 1. Now, we get the units. If there is no valid unit, we issue
an error and the x-unit is set to its default value. In case, there is
@@ -3695,7 +3703,7 @@ we process this part just like we did with the x-unit part. Finally, we
output the corresponding PiCTeX command. In case there is no y-unit
we assume it is equal to the x-unit.
-<pre><a name="NW21HcNW-15UlOC-1" href="#NWD21HcNW-17"><dfn>&lt;process <tt>unit</tt> part&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-16">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-15UlOC-1" href="#NWDCUvTi-18"><dfn>&lt;process <tt>unit</tt> part&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-17">&lt;-U</a>)</b>
chk_lparen(&quot;units&quot;,$lc);
if(s/^\)//)
@@ -3742,7 +3750,7 @@ we assume it is equal to the x-unit.
chk_rparen(&quot;units&quot;,$lc);
}
-</pre><p><a name="NWD21HcNW-18">The </a><code>xrange</code> token must be followed by a left parenthesis, so we
+</pre><p><a name="NWDCUvTi-19">The </a><code>xrange</code> token must be followed by a left parenthesis, so we
check whether the next token is a left parenthesis. We store in the variables
<code>$xlow</code> and <code>$xhigh</code> the values of the range. The range is specified
as pair of decimal numbers/variable/pair of points, separated by a
@@ -3751,7 +3759,7 @@ end and the upper end of the range. The last thing we check is whether
the lower end is less than the upper end. If this isn't the case we
issue an error message and we skip into the next input line.
-<pre><a name="NW21HcNW-39noUt-1" href="#NWD21HcNW-18"><dfn>&lt;process <tt>xrange</tt> part&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-16">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-39noUt-1" href="#NWDCUvTi-19"><dfn>&lt;process <tt>xrange</tt> part&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-17">&lt;-U</a>)</b>
chk_lparen(&quot;xrange&quot;,$lc);
my $ec;
@@ -3767,7 +3775,7 @@ issue an error message and we skip into the next input line.
}
chk_rparen(&quot;$xhigh&quot;,$lc);
-</pre><p><a name="NWD21HcNW-19">The </a><code>yrange</code> token must be followed by a left parenthesis, so we
+</pre><p><a name="NWDCUvTi-1A">The </a><code>yrange</code> token must be followed by a left parenthesis, so we
check whether the next token is a left parenthesis. We store in the variables
<code>$ylow</code> and <code>$yhigh</code> the values of the range. The range is specified
as pair of decimal numbers/variable/pair of points, separated by a
@@ -3776,7 +3784,7 @@ end and the upper end of the range. The last thing we check is whether
the lower end is less than the upper end. If this isn't the case we
issue an error message and we skip into the next input line.
-<pre><a name="NW21HcNW-3SApmu-1" href="#NWD21HcNW-19"><dfn>&lt;process <tt>yrange</tt> part&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-16">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3SApmu-1" href="#NWDCUvTi-1A"><dfn>&lt;process <tt>yrange</tt> part&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-17">&lt;-U</a>)</b>
chk_lparen(&quot;yrange&quot;,$lc);
my $ec;
@@ -3792,14 +3800,14 @@ issue an error message and we skip into the next input line.
}
chk_rparen(&quot;$yhigh&quot;,$lc);
-</pre><p><a name="NWD21HcNW-1A">The </a><code>showAngle</code> command has three arguments that correspond to three distinct
+</pre><p><a name="NWDCUvTi-1B">The </a><code>showAngle</code> command has three arguments that correspond to three distinct
points and emits a comment of the form:
<center>
<tt>%% angle(ABC) = 45</tt>
</center>
Note that the computed angle is expressed in degrees.
-<pre><a name="NW21HcNW-2ObcXb-1" href="#NWD21HcNW-1A"><dfn>&lt;process <tt>showAngle</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2ObcXb-1" href="#NWDCUvTi-1B"><dfn>&lt;process <tt>showAngle</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;showangle&quot;,$lc);
my $point_1 = get_point($lc);
my ($x1,$y1,$pSV1,$pS1)=unpack(&quot;d3A*&quot;,$PointTable{$point_1});
@@ -3813,14 +3821,14 @@ Note that the computed angle is expressed in degrees.
$point_2, $point_3, $angle, $angle*D2R;
chk_rparen(&quot;Missing right parenthesis&quot;, $lc);
-</pre><p><a name="NWD21HcNW-1B">The </a><code>showArea</code> command has three arguments that correspond to three distinct
+</pre><p><a name="NWDCUvTi-1C">The </a><code>showArea</code> command has three arguments that correspond to three distinct
points and emits a comment of the form:
<center>
<tt>%% area(ABC) = 45</tt>
</center>
Note that the computed angle is expressed in degrees.
-<pre><a name="NW21HcNW-2THNRJ-1" href="#NWD21HcNW-1B"><dfn>&lt;process <tt>showArea</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2THNRJ-1" href="#NWDCUvTi-1C"><dfn>&lt;process <tt>showArea</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;showarea&quot;,$lc);
my $point_1 = get_point($lc);
my ($x1,$y1,$pSV1,$pS1)=unpack(&quot;d3A*&quot;,$PointTable{$point_1});
@@ -3832,14 +3840,14 @@ Note that the computed angle is expressed in degrees.
triangleArea($x1, $y1, $x2, $y2, $x3, $y3), &quot;\n&quot;;
chk_rparen(&quot;Missing right parenthesis&quot;, $lc);
-</pre><p><a name="NWD21HcNW-1C">The </a><code>showLength</code> command has two arguments that correspond to two distinct
+</pre><p><a name="NWDCUvTi-1D">The </a><code>showLength</code> command has two arguments that correspond to two distinct
points and emits a comment of the form:
<center>
<tt>%% length(AB) = 45</tt>
</center>
Note that the computed angle is expressed in degrees.
-<pre><a name="NW21HcNW-Ofe1b-1" href="#NWD21HcNW-1C"><dfn>&lt;process <tt>showLength</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-Ofe1b-1" href="#NWDCUvTi-1D"><dfn>&lt;process <tt>showLength</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;showlength&quot;,$lc);
my $point_1 = get_point($lc);
my ($x1,$y1,$pSV1,$pS1)=unpack(&quot;d3A*&quot;,$PointTable{$point_1});
@@ -3850,12 +3858,12 @@ Note that the computed angle is expressed in degrees.
chk_rparen(&quot;Missing right parenthesis&quot;, $lc);
-</pre><p><a name="NWD21HcNW-1D">If the user hasn't specified units then we use the previous values to</a>
+</pre><p><a name="NWDCUvTi-1E">If the user hasn't specified units then we use the previous values to</a>
set the coordinate system. If the user hasn't specified either the
<code>xunits</code> part or the <code>yunits</code>, then we don't emit code. In case he/she
has specified both parts we generate the command that sets the plot area.
-<pre><a name="NW21HcNW-2SitZA-1" href="#NWD21HcNW-1D"><dfn>&lt;generate plot area related commands&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-16">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2SitZA-1" href="#NWDCUvTi-1E"><dfn>&lt;generate plot area related commands&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-17">&lt;-U</a>)</b>
if (!$nounits)
{
@@ -3870,7 +3878,7 @@ has specified both parts we generate the command that sets the plot area.
}
</pre><p>We first check to see whether there is an opening left parenthesis. Next
-<a name="NWD21HcNW-1E">we get the various options the user may have entered. The valid options</a>
+<a name="NWDCUvTi-1F">we get the various options the user may have entered. The valid options</a>
are the letters L, R, T, B, X, and Y. These letters may be followed by
an optional star <code>*</code> with space characters between the letter and the star.
We use a loop, that stops when a right parenthesis is found, to
@@ -3879,7 +3887,7 @@ possible arguments and append each argument in the string <code>$axis</code>. No
one can have blank space between different arguments. The last thing we do is
to check for the closing right parenthesis.
-<pre><a name="NW21HcNW-19Hy2D-1" href="#NWD21HcNW-1E"><dfn>&lt;process <tt>axis</tt> part&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-16">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-19Hy2D-1" href="#NWDCUvTi-1F"><dfn>&lt;process <tt>axis</tt> part&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-17">&lt;-U</a>)</b>
chk_lparen(&quot;axis&quot;,$lc);
while(/^[^\)]/)
@@ -3897,7 +3905,7 @@ to check for the closing right parenthesis.
chk_rparen(&quot;axis(arguments&quot;,$lc);
</pre><p>As usual we start by skipping white space. Next we check whether there is
-<a name="NWD21HcNW-1F">an opening left parenthesis. Now, we expect two numbers/variables/pair of</a>
+<a name="NWDCUvTi-1G">an opening left parenthesis. Now, we expect two numbers/variables/pair of</a>
point representing the <code>ticks</code> increment value. These <code>ticks</code> increment
values must be separated by a comma (and possibly some white space around
them). We use the subroutine <code>ComputeDist</code> to get the value of the <code>ticks</code>
@@ -3906,7 +3914,7 @@ the value of x-ticks and y-ticks increment value. In case there is a
problem we issue an error message and continue with the next line. The last
thing we check is whether there is a closing right parenthesis.
-<pre><a name="NW21HcNW-1isLLJ-1" href="#NWD21HcNW-1F"><dfn>&lt;process <tt>ticks</tt> part&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-16">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1isLLJ-1" href="#NWDCUvTi-1G"><dfn>&lt;process <tt>ticks</tt> part&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-17">&lt;-U</a>)</b>
chk_lparen(&quot;ticks&quot;,$lc);
my $ec;
($xticks,$ec) = ComputeDist($lc);
@@ -3916,7 +3924,7 @@ thing we check is whether there is a closing right parenthesis.
next LINE if $ec == 0;
chk_rparen(&quot;ticks(arguments&quot;,$lc);
-</pre><p><a name="NWD21HcNW-1G">We actually emit code if the user has specified either the </a><code>X</code> or
+</pre><p><a name="NWDCUvTi-1H">We actually emit code if the user has specified either the </a><code>X</code> or
<code>Y</code> option in the <code>axis</code> part. If the user has specified the
<code>Y*</code> or the <code>X*</code> option in the axis part, we just emit the commands
<code>\axis left shiftedto x=0</code> or <code>\axis bottom shiftedto y=0</code> respectively
@@ -3925,7 +3933,7 @@ he had supplied with the <code>axis</code> part, we emit code that
implements the user's wishes.
**** HERE WE MUST EXPLAIN THE MEANING OF THE CODE EMITTED!!! *****
-<pre><a name="NW21HcNW-2gFm3I-1" href="#NWD21HcNW-1G"><dfn>&lt;generate the rest of the code for the <tt>paper</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-16">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2gFm3I-1" href="#NWDCUvTi-1H"><dfn>&lt;generate the rest of the code for the <tt>paper</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-17">&lt;-U</a>)</b>
YBRANCH: {
if (index($axis, &quot;Y&quot;)&gt;-1)
{
@@ -4095,7 +4103,7 @@ The first thing we do is to set the point shape to the default symbol
we have a <code>point</code>command or a <code>point*</code> simply by inspecting the very
next token. Note that there must be no blank spaces between the token
<code>point</code> and the star symbol. Next, we get the point name: remember that
-<a name="NWD21HcNW-1H">the point name is surrounded by parentheses. In case we don't find a valid</a>
+<a name="NWDCUvTi-1I">the point name is surrounded by parentheses. In case we don't find a valid</a>
point name we issue an error message and continue with the next line of
input. Suppose the point name was a valid one. If we have a <code>point*</code>
command we must ensure that the this particular point name has been defined.
@@ -4104,12 +4112,12 @@ name has not been defined. Point names are stored in the hash <code>%PointTable<
We are now ready to process the coordinates part and the optional
plot symbol part.
-<pre><a name="NW21HcNW-2bvYBY-1" href="#NWD21HcNW-1H"><dfn>&lt;process <tt>point/point*</tt> commands&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2bvYBY-1" href="#NWDCUvTi-1I"><dfn>&lt;process <tt>point/point*</tt> commands&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
my ($pointStar, $PointName, $origPN);
$pointStar = 0; # default value: he have a point command
$pointStar = 1 if s/^\*//;
chk_lparen(&quot;point&quot; . (($pointStar)?&quot;*&quot;:&quot;&quot;),$lc);
- if (s/^([^\W\d_](?![^\W\d_])\d{0,3})//i) {
+ if (s/^([^\W\d_](?![^\W\d_])\d{0,4})//i) {
#
# Note: the regular expression (foo)(?!bar) means that we are
# looking a foo not followed by a bar. Moreover, the regular
@@ -4131,13 +4139,13 @@ plot symbol part.
chk_rparen(&quot;point&quot; . (($pointStar)?&quot;*&quot;:&quot;&quot;). &quot;($origPN&quot;,$lc);
chk_lcb(&quot;point&quot; . (($pointStar)?&quot;*&quot;:&quot;&quot;). &quot;($origPN)&quot;,$lc);
my ($Px, $Py);
- <a name="NW21HcNW-2bvYBY-1-u1" href="#NWD21HcNW-1I"><i>&lt;process coordinates&gt;</i></a>
+ <a name="NWCUvTi-2bvYBY-1-u1" href="#NWDCUvTi-1J"><i>&lt;process coordinates&gt;</i></a>
chk_rcb(&quot;coordinates part&quot;,$lc);
my $sv = $defaultsymbol;
my $sh = $defaultLFradius;
my $side_or_radius = undef;
if (s/^\[\s*//) { # the user has opted to specify the optional part
- <a name="NW21HcNW-2bvYBY-1-u2" href="#NWD21HcNW-1U"><i>&lt;process optional point shape part&gt;</i></a>
+ <a name="NWCUvTi-2bvYBY-1-u2" href="#NWDCUvTi-1V"><i>&lt;process optional point shape part&gt;</i></a>
chk_rsb(&quot;optional part&quot;,$lc);
}
# to avoid truncation problems introduced by the pack function, we
@@ -4207,7 +4215,7 @@ its name in the variable <code>$PointA</code>. If this identifier is a defined p
we check whether the next token is a comma. In case it is, we check whether
he token after the comma is either the token <code>shift</code>, <code>polar</code>, or
<code>rotate</code> and process each case accordingly. If it is
-<a name="NWD21HcNW-1I">none of these tokens we issue an error message and continue with the next</a>
+<a name="NWDCUvTi-1J">none of these tokens we issue an error message and continue with the next</a>
input line. Now, if the token after the identifier isn't a comma, we assume
that the coordinates of the point will be identical to those of the point
whose name has been stored in the variable <code>$PointA</code>. If the identifier is a
@@ -4216,30 +4224,30 @@ We check whether the next token is a comma, and compute the y-coordinate by
calling the subroutine <code>ComputeDist</code>. The x-coordinate is stored in the variable
<code>$Px</code> and the y-coordinate in the variable <code>$Py</code>.
-<pre><a name="NW21HcNW-3bnmlP-1" href="#NWD21HcNW-1I"><dfn>&lt;process coordinates&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1H">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3bnmlP-1" href="#NWDCUvTi-1J"><dfn>&lt;process coordinates&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1I">&lt;-U</a>)</b>
if (s/^perpendicular(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u1" href="#NWD21HcNW-1J"><i>&lt;process <tt>perpendicular</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u1" href="#NWDCUvTi-1K"><i>&lt;process <tt>perpendicular</tt> case&gt;</i></a>
}
elsif (s/^intersection(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u2" href="#NWD21HcNW-1K"><i>&lt;process <tt>intersection</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u2" href="#NWDCUvTi-1L"><i>&lt;process <tt>intersection</tt> case&gt;</i></a>
}
elsif (s/^midpoint(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u3" href="#NWD21HcNW-1L"><i>&lt;process <tt>midpoint</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u3" href="#NWDCUvTi-1M"><i>&lt;process <tt>midpoint</tt> case&gt;</i></a>
}
elsif (s/^pointonline(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u4" href="#NWD21HcNW-1M"><i>&lt;process <tt>pointonline</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u4" href="#NWDCUvTi-1N"><i>&lt;process <tt>pointonline</tt> case&gt;</i></a>
}
elsif (s/^circumcircleCenter(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u5" href="#NWD21HcNW-1N"><i>&lt;process <tt>circumcircleCenter</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u5" href="#NWDCUvTi-1O"><i>&lt;process <tt>circumcircleCenter</tt> case&gt;</i></a>
}
elsif (s/^IncircleCenter(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u6" href="#NWD21HcNW-1O"><i>&lt;process <tt>IncircleCenter</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u6" href="#NWDCUvTi-1P"><i>&lt;process <tt>IncircleCenter</tt> case&gt;</i></a>
}
elsif (s/^ExcircleCenter(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u7" href="#NWD21HcNW-1P"><i>&lt;process <tt>ExcircleCenter</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u7" href="#NWDCUvTi-1Q"><i>&lt;process <tt>ExcircleCenter</tt> case&gt;</i></a>
}
- elsif (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
- m/^([^\W\d_]\d{0,3})\s*/i;
+ elsif (/^[^\W\d_]\d{0,4}\s*[^,\w]/) {
+ m/^([^\W\d_]\d{0,4})\s*/i;
if (exists($PointTable{lc($1)})) {
my $Tcoord = get_point($lc);
my ($x,$y,$pSV,$pS)=unpack(&quot;d3A*&quot;,$PointTable{$Tcoord});
@@ -4252,24 +4260,24 @@ calling the subroutine <code>ComputeDist</code>. The x-coordinate is stored in t
$Py = expr();
}
}
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar|rotate|vector/i) { #a point?
- s/^([^\W\d_]\d{0,3})//i;
+ elsif (/[^\W\d_]\d{0,4}\s*,\s*shift|polar|rotate|vector/i) { #a point?
+ s/^([^\W\d_]\d{0,4})//i;
my $PointA = $1;
if (exists($PointTable{lc($PointA)})) {
s/\s*//;
if (s/^,//) {
s/\s*//;
if (s/^shift(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u8" href="#NWD21HcNW-1Q"><i>&lt;process <tt>shift</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u8" href="#NWDCUvTi-1R"><i>&lt;process <tt>shift</tt> case&gt;</i></a>
}
elsif (s/^polar(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u9" href="#NWD21HcNW-1R"><i>&lt;process <tt>polar</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u9" href="#NWDCUvTi-1S"><i>&lt;process <tt>polar</tt> case&gt;</i></a>
}
elsif (s/^rotate(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u10" href="#NWD21HcNW-1S"><i>&lt;process <tt>rotate</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u10" href="#NWDCUvTi-1T"><i>&lt;process <tt>rotate</tt> case&gt;</i></a>
}
elsif (s/^vector(?=\W)//i) {
- <a name="NW21HcNW-3bnmlP-1-u11" href="#NWD21HcNW-1T"><i>&lt;process <tt>vector</tt> case&gt;</i></a>
+ <a name="NWCUvTi-3bnmlP-1-u11" href="#NWDCUvTi-1U"><i>&lt;process <tt>vector</tt> case&gt;</i></a>
}
else {
PrintErrorMessage(&quot;unexpected token&quot;,$lc);
@@ -4295,7 +4303,7 @@ calling the subroutine <code>ComputeDist</code>. The x-coordinate is stored in t
</pre><p>In the following piece of code we process the <code>perpendicular</code>
case of the <code>point</code> specification. We first check whether there is an
-<a name="NWD21HcNW-1J">opening left parenthesis. Next, we get the first point name. In case</a>
+<a name="NWDCUvTi-1K">opening left parenthesis. Next, we get the first point name. In case</a>
there is no point name, we simply abandon the processing of this
line and continue with the next one. Then we see whether there is
a trailing comma. Omitting this token yields a non-fatal error.
@@ -4304,7 +4312,7 @@ points this yields a fatal-error. Note, that each time we check that the
point names correspond to existing point names. Then, we call subroutine
<code>perpendicular</code> to calculate the coordinates of the point.
-<pre><a name="NW21HcNW-s2gHc-1" href="#NWD21HcNW-1J"><dfn>&lt;process <tt>perpendicular</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-s2gHc-1" href="#NWDCUvTi-1K"><dfn>&lt;process <tt>perpendicular</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;perpendicular&quot;,$lc);
my $FirstPoint = &amp;get_point($lc);
next LINE if $FirstPoint eq &quot;_undef_&quot;;
@@ -4319,12 +4327,12 @@ point names correspond to existing point names. Then, we call subroutine
my ($x3,$y3,$pSV3,$pS3)=unpack(&quot;d3A*&quot;,$PointTable{$ThirdPoint});
($Px, $Py) = perpendicular($x1,$y1,$x2,$y2,$x3,$y3);
-</pre><p><a name="NWD21HcNW-1K">In the following piece of code we process the </a><code>intersection</code> case of the
+</pre><p><a name="NWDCUvTi-1L">In the following piece of code we process the </a><code>intersection</code> case of the
<code>point</code> specification. We get the four point names and if there is
no error we compute the intersection point by calling subroutine
<code>intersection</code>.
-<pre><a name="NW21HcNW-1uJA3A-1" href="#NWD21HcNW-1K"><dfn>&lt;process <tt>intersection</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-1uJA3A-1" href="#NWDCUvTi-1L"><dfn>&lt;process <tt>intersection</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;intersection&quot;,$lc);
my $FirstPoint = get_point($lc);
next LINE if $FirstPoint eq &quot;_undef_&quot;;
@@ -4343,16 +4351,12 @@ no error we compute the intersection point by calling subroutine
($Px, $Py) = intersection4points($x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4);
-</pre><p><a name="NWD21HcNW-1L">Given two points A and B, the midpoint option computes the coordinates</a>
+</pre><p><a name="NWDCUvTi-1M">Given two points A and B, the midpoint option computes the coordinates</a>
of a third point that lies on the middle of the line segment defined by
these two points. We get the the two points, and then we compute the
-coordinates of the midpoint by means of the simple formula:
-<center>
-m<sub>x</sub>=x<sub>1</sub>+(y<sub>2</sub> - y<sub>1</sub>)/2 <br>
-m<sub>y</sub>=y<sub>1</sub>+(x<sub>2</sub> - x<sub>1</sub>)/2
-</center>
+coordinates of the midpoint with function <code>midpoint</code>.
-<pre><a name="NW21HcNW-3udkns-1" href="#NWD21HcNW-1L"><dfn>&lt;process <tt>midpoint</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3udkns-1" href="#NWDCUvTi-1M"><dfn>&lt;process <tt>midpoint</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;midpoint&quot;,$lc);
my $FirstPoint = &amp;get_point($lc);
next LINE if $FirstPoint eq &quot;_undef_&quot;;
@@ -4361,16 +4365,15 @@ m<sub>y</sub>=y<sub>1</sub>+(x<sub>2</sub> - x<sub>1</sub>)/2
chk_rparen(&quot;No closing parenthesis found&quot;,$lc);
my ($x1,$y1,$pSV1,$pS1)=unpack(&quot;d3A*&quot;,$PointTable{$FirstPoint});
my ($x2,$y2,$pSV2,$pS2)=unpack(&quot;d3A*&quot;,$PointTable{$SecondPoint});
- $Px = $x1 + ($x2 - $x1)/2;
- $Py = $y1 + ($y2 - $y1)/2;
+ ($Px, $Py) = midpoint($x1, $y1, $x2, $y2);
-</pre><p><a name="NWD21HcNW-1M">Given two points A and B and length d, the </a><code>PointOnLine</code> option
+</pre><p><a name="NWDCUvTi-1N">Given two points A and B and length d, the </a><code>PointOnLine</code> option
computes the coordinates of a point that lies d units in the direction from
A towards B. We first get the coordinates of the two points that define
the line and then we get the distance, which can be a number, a variable,
or a pair of points.
-<pre><a name="NW21HcNW-2ahy6i-1" href="#NWD21HcNW-1M"><dfn>&lt;process <tt>pointonline</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2ahy6i-1" href="#NWDCUvTi-1N"><dfn>&lt;process <tt>pointonline</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;pointonline&quot;,$lc);
my $FirstPoint = &amp;get_point($lc);
next LINE if $FirstPoint eq &quot;_undef_&quot;;
@@ -4384,14 +4387,14 @@ or a pair of points.
my ($x2,$y2,$pSV2,$pS2)=unpack(&quot;d3A*&quot;,$PointTable{$SecondPoint});
($Px, $Py) = pointOnLine($x1,$y1,$x2,$y2,$distance);
-</pre><p><a name="NWD21HcNW-1N">The </a><code>circumcircleCenter</code> is used when one wants to compute the coordinates
+</pre><p><a name="NWDCUvTi-1O">The </a><code>circumcircleCenter</code> is used when one wants to compute the coordinates
of the center of circle that passes through the three points
of a triangle defined
by the three arguments of the option. All we do is get the coordinates
of the three points and then we call the subroutine <code>circumCircleCenter</code>
to compute the center.
-<pre><a name="NW21HcNW-2TpCLC-1" href="#NWD21HcNW-1N"><dfn>&lt;process <tt>circumcircleCenter</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2TpCLC-1" href="#NWDCUvTi-1O"><dfn>&lt;process <tt>circumcircleCenter</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;circumCircleCenter&quot;,$lc);
my $FirstPoint = &amp;get_point($lc);
next LINE if $FirstPoint eq &quot;_undef_&quot;;
@@ -4406,12 +4409,12 @@ to compute the center.
($Px, $Py,$r) = &amp;circumCircleCenter($x1,$y1,$x2,$y2,$x3,$y3,$lc);
next LINE if $Px == 0 and $Py == 0 and $r == 0;
-</pre><p><a name="NWD21HcNW-1O">The </a><code>IncircleCenter</code> option is to determine the coordinates of a point
+</pre><p><a name="NWDCUvTi-1P">The </a><code>IncircleCenter</code> option is to determine the coordinates of a point
that is the center of circle that internally touches the sides
of a triangle defined by three given points.
The coordinates are computed by the subroutine <code>IncircleCenter</code>.
-<pre><a name="NW21HcNW-4fhWIW-1" href="#NWD21HcNW-1O"><dfn>&lt;process <tt>IncircleCenter</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4fhWIW-1" href="#NWDCUvTi-1P"><dfn>&lt;process <tt>IncircleCenter</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;IncircleCenter&quot;,$lc);
my $FirstPoint = &amp;get_point($lc);
next LINE if $FirstPoint eq &quot;_undef_&quot;;
@@ -4428,7 +4431,7 @@ The coordinates are computed by the subroutine <code>IncircleCenter</code>.
</pre><p>The <code>ExcircleCenter</code> option is used to define the coordinates of point
that is the center of an excircle of a triangle. We first check
whether there is an opening left parenthesis. Next, we get the names of the
-<a name="NWD21HcNW-1P">three points that define the triangle. Then, we</a>
+<a name="NWDCUvTi-1Q">three points that define the triangle. Then, we</a>
check whether there is a comma. Now we get the names of the two points that
define one side of the triangle. We check whether the two points we
get are of the set of the triangle points. If not we issue
@@ -4437,7 +4440,7 @@ that these two points are not identical. We compute the actual
coordinates by calling the subroutine <code>excircle</code>. Finally, we
make sure there is a closing right parenthesis.
-<pre><a name="NW21HcNW-13KcO0-1" href="#NWD21HcNW-1P"><dfn>&lt;process <tt>ExcircleCenter</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-13KcO0-1" href="#NWDCUvTi-1Q"><dfn>&lt;process <tt>ExcircleCenter</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;ExcircleCenter&quot;,$lc);
my $PointA = get_point($lc);
next LINE if $PointA eq &quot;_undef_&quot;;
@@ -4466,11 +4469,11 @@ make sure there is a closing right parenthesis.
$PointD, $PointE);
chk_rparen(&quot;after coordinates part&quot;,$lc);
-</pre><p> <a name="NWD21HcNW-1Q">The </a><code>shift</code> option allows us to define a point's coordinates relative
+</pre><p> <a name="NWDCUvTi-1R">The </a><code>shift</code> option allows us to define a point's coordinates relative
to the coordinates of an existing point by using two shift parameters. Each
parameter can be either a float, a variable name, or a pair of points.
-<pre><a name="NW21HcNW-aOKf8-1" href="#NWD21HcNW-1Q"><dfn>&lt;process <tt>shift</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a> <a href="#NWD21HcNW-1Z">U-&gt;</a>)</b>
+<pre><a name="NWCUvTi-aOKf8-1" href="#NWDCUvTi-1R"><dfn>&lt;process <tt>shift</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a> <a href="#NWDCUvTi-1a">U-&gt;</a>)</b>
chk_lparen(&quot;shift&quot;,$lc);
my $dist1 = expr($lc);
@@ -4481,7 +4484,7 @@ parameter can be either a float, a variable name, or a pair of points.
$Py = $y1 + $dist2;
chk_rparen(&quot;shift part&quot;,$lc);
-</pre><p><a name="NWD21HcNW-1R">The </a><code>polar</code> option allows us to define a point's coordinates relative
+</pre><p><a name="NWDCUvTi-1S">The </a><code>polar</code> option allows us to define a point's coordinates relative
to the coordinates of an existing point using the polar coordinates of some
other point. We first check whether there is a left parenthesis,
Then we parse the various parts of the <code>polar</code> option.
@@ -4490,7 +4493,7 @@ to transform it into radians, as all trigonometric function expect their
arguments to be radians. Next, we compute the coordinates of the point.
We conclude by checking whether there is a closing parenthesis.
-<pre><a name="NW21HcNW-2GUwzc-1" href="#NWD21HcNW-1R"><dfn>&lt;process <tt>polar</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a> <a href="#NWD21HcNW-1Z">U-&gt;</a>)</b>
+<pre><a name="NWCUvTi-2GUwzc-1" href="#NWDCUvTi-1S"><dfn>&lt;process <tt>polar</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a> <a href="#NWDCUvTi-1a">U-&gt;</a>)</b>
chk_lparen(&quot;polar&quot;,$lc);
my ($R1, $Theta1);
$R1 = expr($lc);
@@ -4517,7 +4520,7 @@ specified angle.
The method to achieve this is to first get the coordinates of points
P and Q and then
<ol>
-<li> <a name="NWD21HcNW-1S">translate origin to P</a></li>
+<li> <a name="NWDCUvTi-1T">translate origin to P</a></li>
<li> rotate about P</li>
<li> translate from P back to origin, etc</li>
</ol>
@@ -4526,7 +4529,7 @@ Next, we parse the point name and the angle. At this point we are able to
compute the coordinates of the rotated point. We conclude by checking
whether there is a closing parenthesis.
-<pre><a name="NW21HcNW-42YuKP-1" href="#NWD21HcNW-1S"><dfn>&lt;process <tt>rotate</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-42YuKP-1" href="#NWDCUvTi-1T"><dfn>&lt;process <tt>rotate</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;rotate&quot;,$lc);
my $Q = lc($PointA);
my $P = get_point($lc);
@@ -4559,10 +4562,10 @@ whether there is a closing parenthesis.
$Py += $yP;
chk_rparen(&quot;after rotate part&quot;,$lc);
-</pre><p> <code><a name="NWD21HcNW-1T">vector(PQ)</a></code> is actually is a shorthand of <code>shift(xQ-xP,yQ-yP)</code>. Thus, it
+</pre><p> <code><a name="NWDCUvTi-1U">vector(PQ)</a></code> is actually is a shorthand of <code>shift(xQ-xP,yQ-yP)</code>. Thus, it
is implemented by borrowing code from the <code>shift</code> modifier.
-<pre><a name="NW21HcNW-3FiNXu-1" href="#NWD21HcNW-1T"><dfn>&lt;process <tt>vector</tt> case&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1I">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-3FiNXu-1" href="#NWDCUvTi-1U"><dfn>&lt;process <tt>vector</tt> case&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1J">&lt;-U</a>)</b>
chk_lparen(&quot;vector&quot;,$lc);
my ($x0,$y0,$pSV0,$pS0) = unpack(&quot;d3A*&quot;,$PointTable{lc($PointA)});
my $P = get_point($lc);
@@ -4584,7 +4587,7 @@ applied to the default point character, i.e., <tt>$\bullet$</tt> or whatever it
has been set to. Here is the syntax we employ:
<pre>
Optional_point_shape_part ::= "[" [ symbol_part ] [","] [ radius_part ]"
-<a name="NWD21HcNW-1U">symbol_part ::= "symbol" "=" symbol</a>
+<a name="NWDCUvTi-1V">symbol_part ::= "symbol" "=" symbol</a>
symbol ::= "circle" "(" expression ")" |
"square" "(" expression ")" |
LaTeX_Code
@@ -4593,7 +4596,7 @@ radius_part ::= "radius" "=" expression
Note that it is possible to have right square bracket in the <tt>LaTeX_Code</tt> but it
has to be escaped (i.e., <tt>\]</tt>).
-<pre><a name="NW21HcNW-48J1W6-1" href="#NWD21HcNW-1U"><dfn>&lt;process optional point shape part&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1H">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-48J1W6-1" href="#NWDCUvTi-1V"><dfn>&lt;process optional point shape part&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1I">&lt;-U</a>)</b>
if (/^(symbol|radius|side)\s*/i) {
my @previous_options = ();
my $number_of_options = 1;
@@ -4655,7 +4658,7 @@ to zero, do not affect the value of the corresponding global variables. To reset
values of the global variables one should use the commane with <code>default</code> as it
only argument. The syntax of the command is as follows:
<center>
-<tt><a name="NWD21HcNW-1V">"ArrowShape" "(" expr [ units ] "," expr "," expr ")"</a></tt> or<br>
+<tt><a name="NWDCUvTi-1W">"ArrowShape" "(" expr [ units ] "," expr "," expr ")"</a></tt> or<br>
<tt>"ArrowShape" "(" "default" ")" </tt>
</center>>
Here <code>units</code> is any valid TeX unit (e.g., "mm", "cm", etc.). Note that if
@@ -4663,7 +4666,7 @@ any of the three expressions is equal to zero, the default value is taken
instead. As direct consequence, if the value of the first expression is zero,
the units part is actually ignored.
-<pre><a name="NW21HcNW-4T61Ms-1" href="#NWD21HcNW-1V"><dfn>&lt;process <tt>ArrowShape</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4T61Ms-1" href="#NWDCUvTi-1W"><dfn>&lt;process <tt>ArrowShape</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;$cmd&quot;,$lc);
if (s/^default//i) {
@@ -4703,7 +4706,7 @@ line-free radius. The point symbol can be either a LaTeX symbol or the word <cod
which corresponds to the default point symbol, i.e., <tt>$\bullet$</tt>. The line-free
radius can be an expression. Here is the complete syntax:
<pre>
- <a name="NWD21HcNW-1W">pointsymbol ::= "pointsymbol" ( symbol [ "," radius])</a>
+ <a name="NWDCUvTi-1X">pointsymbol ::= "pointsymbol" ( symbol [ "," radius])</a>
symbol ::= "default" | circle | square | LaTeX_Code
circle ::= "circle" "(" expression ")"
square ::= "square" "(" expression ")"
@@ -4712,7 +4715,7 @@ radius can be an expression. Here is the complete syntax:
Note that the <tt>LaTeX_Code</tt> can contain the symbols <tt>\,</tt> and
<tt>\)</tt> which are escape sequences for a comma and right parenthesis, respectively.
-<pre><a name="NW21HcNW-iKtUD-1" href="#NWD21HcNW-1W"><dfn>&lt;process <tt>PointSymbol</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-iKtUD-1" href="#NWDCUvTi-1X"><dfn>&lt;process <tt>PointSymbol</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;$cmd&quot;,$lc);
if (s/^default//i) #default point symbol
@@ -4749,7 +4752,7 @@ is as follows:
<pre>
system-cmd ::= "system" "(" string ")"
</pre>
-<a name="NWD21HcNW-1X">where string is just a sequence of characters enclosed in quotation marks.</a>
+<a name="NWDCUvTi-1Y">where string is just a sequence of characters enclosed in quotation marks.</a>
We start by parsing a left parenthesis and then we get the command by
calling the subroutine <code>get_string</code>. If there is an error we skip this
command. Otherwise, we assign to the variable <code>$_</code> what is left. Now we check
@@ -4758,7 +4761,7 @@ execute the command, otherwise we print an error message and skip to the
next input line. Next, we check for closing right parenthesis and a possible
trailing comment.
-<pre><a name="NW21HcNW-4C0pFV-1" href="#NWD21HcNW-1X"><dfn>&lt;process <tt>system</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4C0pFV-1" href="#NWDCUvTi-1Y"><dfn>&lt;process <tt>system</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;$cmd&quot;,$lc);
my ($error, $command, $rest) = get_string($_);
@@ -4794,7 +4797,7 @@ Initially, we parse the <code>text</code>. Since the text may contain parenthese
we assume that the user enters pairs of matching parentheses. Note, that
this is a flaw in the original design of the language, which may be remedied
in future releases of the software. Then, we check the <code>coords</code> part. Next,
-<a name="NWD21HcNW-1Y">if there is a left square bracket, we assume the user has specified the</a>
+<a name="NWDCUvTi-1Z">if there is a left square bracket, we assume the user has specified the</a>
<code>pos-code</code>. We conclude by checking a possible trailing comment.
The next thing we do is to generate the PiCTeX code. The two possible
forms follow:
@@ -4803,7 +4806,7 @@ forms follow:
<tt>\put {TEXT} at Px Py</tt><br>
</center>
-<pre><a name="NW21HcNW-z25eX-1" href="#NWD21HcNW-1Y"><dfn>&lt;process <tt>text</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-z25eX-1" href="#NWDCUvTi-1Z"><dfn>&lt;process <tt>text</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
chk_lparen(&quot;text&quot;,$lc);
my ($level,$text)=(1,&quot;&quot;);
@@ -4819,12 +4822,12 @@ forms follow:
my ($Px, $Py,$dummy,$pos);
$pos=&quot;&quot;;
s/\s*//;
- <a name="NW21HcNW-z25eX-1-u1" href="#NWD21HcNW-1Z"><i>&lt;process coordinates part of text command&gt;</i></a>
+ <a name="NWCUvTi-z25eX-1-u1" href="#NWDCUvTi-1a"><i>&lt;process coordinates part of text command&gt;</i></a>
chk_rcb(&quot;coordinates part of text command&quot;,$lc);
if (s/^\[//)
{
s/\s*//;
- <a name="NW21HcNW-z25eX-1-u2" href="#NWD21HcNW-1a"><i>&lt;process optional part of text command&gt;</i></a>
+ <a name="NWCUvTi-z25eX-1-u2" href="#NWDCUvTi-1b"><i>&lt;process optional part of text command&gt;</i></a>
s/\s*//;
chk_rsb(&quot;optional part of text command&quot;,$lc);
}
@@ -4839,7 +4842,7 @@ forms follow:
}
</pre><p> In this section we define the code that handles the coordinates part
-<a name="NWD21HcNW-1Z">of the </a><code>text</code> command. The code just implements the grammar given above.
+<a name="NWDCUvTi-1a">of the </a><code>text</code> command. The code just implements the grammar given above.
If the first token is a number, we assume this is the x-coordinate. If
it is a variable, we assume its value is the x-coordinate. However, if
it is a point name, we check whether the next token is another point name.
@@ -4848,26 +4851,26 @@ have a single point followed by a comma, we expect to have either a polar
or a shift part, which we process the same we processed them in the point
command.
-<pre><a name="NW21HcNW-Ee8Ug-1" href="#NWD21HcNW-1Z"><dfn>&lt;process coordinates part of text command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1Y">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-Ee8Ug-1" href="#NWDCUvTi-1a"><dfn>&lt;process coordinates part of text command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1Z">&lt;-U</a>)</b>
- if (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
+ if (/^[^\W\d_]\d{0,4}\s*[^,\w]/) {
my $Tcoord = get_point($lc);
my ($x,$y,$pSV,$pS)=unpack(&quot;d3A*&quot;,$PointTable{$Tcoord});
$Px = $x;
$Py = $y;
}
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar/i) {
- s/^([^\W\d_]\d{0,3})//i;
+ elsif (/[^\W\d_]\d{0,4}\s*,\s*shift|polar/i) {
+ s/^([^\W\d_]\d{0,4})//i;
my $PointA = $1;
if (exists($PointTable{lc($PointA)})) {
s/\s*//;
if (s/^,//) {
s/\s*//;
if (s/^shift(?=\W)//i) {
- <a name="NW21HcNW-Ee8Ug-1-u1" href="#NWD21HcNW-1Q"><i>&lt;process <tt>shift</tt> case&gt;</i></a>
+ <a name="NWCUvTi-Ee8Ug-1-u1" href="#NWDCUvTi-1R"><i>&lt;process <tt>shift</tt> case&gt;</i></a>
}
elsif (s/^polar(?=\W)//i) {
- <a name="NW21HcNW-Ee8Ug-1-u2" href="#NWD21HcNW-1R"><i>&lt;process <tt>polar</tt> case&gt;</i></a>
+ <a name="NWCUvTi-Ee8Ug-1-u2" href="#NWDCUvTi-1S"><i>&lt;process <tt>polar</tt> case&gt;</i></a>
}
}
}
@@ -4891,7 +4894,7 @@ input line. If it is a letter we check whether it belongs to one of the
two groups and if it doesn't we issue an error message and continue with the
next input line. If the next character belongs to first group, i.e., it is
either <code>l</code> or <code>r</code>, we store this character into the variable <code>$pos</code>. Next,
-<a name="NWD21HcNW-1a">we check whether there is another letter. If it is a letter, we store it</a>
+<a name="NWDCUvTi-1b">we check whether there is another letter. If it is a letter, we store it</a>
in the variable <code>$np</code>. Now we make sure that this character belongs to the
other group, i.e., it is either <code>b</code>, <code>B</code>, or <code>t</code>. In case it belongs
to the other group, we append the value of <code>$np</code> to the string stored in
@@ -4900,7 +4903,7 @@ next input line. We work similarly for the other case. In order to check
whether a character belongs to some group of characters, we use the user
defined function <code>memberOf</code>.
-<pre><a name="NW21HcNW-RSg70-1" href="#NWD21HcNW-1a"><dfn>&lt;process optional part of text command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-1Y">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-RSg70-1" href="#NWDCUvTi-1b"><dfn>&lt;process optional part of text command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-1Z">&lt;-U</a>)</b>
if (s/^(\w{1})\s*//) {
$pos .= $1;
@@ -4951,7 +4954,7 @@ defined function <code>memberOf</code>.
</pre><p>The <code>const</code> command is used to store values into a comma separated
list of named constants. Constant names have the same format as point names,
i.e., they start with a letter and are followed by up to two digits. The
-<a name="NWD21HcNW-1b">whole operation is performed by a </a><code>do-while</code> construct that checks that
+<a name="NWDCUvTi-1c">whole operation is performed by a </a><code>do-while</code> construct that checks that
there is a valid constant name, a <code>=</code> sign, and an expression. The
<code>do-while</code> construct terminates if the next token isn't a comma. Variable
<code>$Constname</code> is used to store the initial variable name, while we store
@@ -4960,11 +4963,11 @@ we make sure a constant is not redefined (or else it wouldn't be a constant:-).
The last thing we do is to check whether there is a trailing comment.
In case there, we simply ignore itl; otherwise we print a warning message.
-<pre><a name="NW21HcNW-4F0xHm-1" href="#NWD21HcNW-1b"><dfn>&lt;process <tt>const</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-4F0xHm-1" href="#NWDCUvTi-1c"><dfn>&lt;process <tt>const</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
do{
s/\s*//;
PrintErrorMessage(&quot;no identifier found after token const&quot;,$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
+ if $_ !~ s/^([^\W\d_]\d{0,4})//i;
my $Constname = $1;
my $constname = lc($Constname);
if (exists $ConstTable{$constname}) {
@@ -4986,7 +4989,7 @@ In case there, we simply ignore itl; otherwise we print a warning message.
</pre><p>The <code>var</code> command is used to store values into a comma separated
list of named variables. Variable names have the same format as point names,
-<a name="NWD21HcNW-1c">i.e., they start with a letter and are followed by up to two digits. The</a>
+<a name="NWDCUvTi-1d">i.e., they start with a letter and are followed by up to two digits. The</a>
whole operation is performed by a <code>do-while</code> construct that checks that
there is a valid variable name, a <code>=</code> sign, and an expression. The
<code>do-while</code> construct terminates if the next token isn't a comma. The variable
@@ -4995,11 +4998,11 @@ in the variable <code>$varname</code> the lowercase version of the variable name
The last thing we do is to check whether there is a trailing comment.
In case there, we simply ignore itl; otherwise we print a warning message.
-<pre><a name="NW21HcNW-2NFa6I-1" href="#NWD21HcNW-1c"><dfn>&lt;process <tt>var</tt> command&gt;=</dfn></a> <b>(<a href="#NWD21HcNW-q">&lt;-U</a>)</b>
+<pre><a name="NWCUvTi-2NFa6I-1" href="#NWDCUvTi-1d"><dfn>&lt;process <tt>var</tt> command&gt;=</dfn></a> <b>(<a href="#NWDCUvTi-r">&lt;-U</a>)</b>
do{
s/\s*//;
PrintErrorMessage(&quot;no identifier found after token var&quot;,$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
+ if $_ !~ s/^([^\W\d_]\d{0,4})//i;
my $Varname = $1;
my $varname = lc($Varname);
if (exists $ConstTable{$varname}) {
@@ -5020,105 +5023,106 @@ In case there, we simply ignore itl; otherwise we print a warning message.
</pre>
<ul>
-<li><a href="#NWD21HcNW-2"><i>&lt;*&gt;</i></a>: <a href="#NWD21HcNW-2">D1</a>
-<li><a href="#NWD21HcNW-4"><i>&lt;Check for command line arguments&gt;</i></a>: <a href="#NWD21HcNW-2">U1</a>, <a href="#NWD21HcNW-4">D2</a>
-<li><a href="#NWD21HcNW-6"><i>&lt;Check if .m file exists&gt;</i></a>: <a href="#NWD21HcNW-4">U1</a>, <a href="#NWD21HcNW-6">D2</a>
-<li><a href="#NWD21HcNW-8"><i>&lt;Define global variables&gt;</i></a>: <a href="#NWD21HcNW-2">U1</a>, <a href="#NWD21HcNW-8">D2</a>
-<li><a href="#NWD21HcNW-1D"><i>&lt;generate plot area related commands&gt;</i></a>: <a href="#NWD21HcNW-16">U1</a>, <a href="#NWD21HcNW-1D">D2</a>
-<li><a href="#NWD21HcNW-1G"><i>&lt;generate the rest of the code for the <tt>paper</tt> command&gt;</i></a>: <a href="#NWD21HcNW-16">U1</a>, <a href="#NWD21HcNW-1G">D2</a>
-<li><a href="#NWD21HcNW-3"><i>&lt;package <tt>DummyFH</tt> &gt;</i></a>: <a href="#NWD21HcNW-2">U1</a>, <a href="#NWD21HcNW-3">D2</a>
-<li><a href="#NWD21HcNW-t"><i>&lt;process <tt>angle</tt> part of command&gt;</i></a>: <a href="#NWD21HcNW-s">U1</a>, <a href="#NWD21HcNW-t">D2</a>
-<li><a href="#NWD21HcNW-1V"><i>&lt;process <tt>ArrowShape</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1V">D2</a>
-<li><a href="#NWD21HcNW-1E"><i>&lt;process <tt>axis</tt> part&gt;</i></a>: <a href="#NWD21HcNW-16">U1</a>, <a href="#NWD21HcNW-1E">D2</a>
-<li><a href="#NWD21HcNW-1N"><i>&lt;process <tt>circumcircleCenter</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1N">D2</a>
-<li><a href="#NWD21HcNW-1b"><i>&lt;process <tt>const</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1b">D2</a>
-<li><a href="#NWD21HcNW-r"><i>&lt;process <tt>dasharray</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-r">D2</a>
-<li><a href="#NWD21HcNW-s"><i>&lt;process <tt>drawAngleArcOrArrow</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-s">D2</a>
-<li><a href="#NWD21HcNW-v"><i>&lt;process <tt>drawcircle</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-v">D2</a>
-<li><a href="#NWD21HcNW-w"><i>&lt;process <tt>drawcircumcircle</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-w">D2</a>
-<li><a href="#NWD21HcNW-x"><i>&lt;process <tt>drawexcircle</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-x">D2</a>
-<li><a href="#NWD21HcNW-y"><i>&lt;process <tt>drawincircle</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-y">D2</a>
-<li><a href="#NWD21HcNW-z"><i>&lt;process <tt>drawPerpendicular</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-z">D2</a>
-<li><a href="#NWD21HcNW-10"><i>&lt;process <tt>drawpoint</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-10">D2</a>
-<li><a href="#NWD21HcNW-11"><i>&lt;process <tt>drawRightAngle</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-11">D2</a>
-<li><a href="#NWD21HcNW-12"><i>&lt;process <tt>drawsquare</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-12">D2</a>
-<li><a href="#NWD21HcNW-1P"><i>&lt;process <tt>ExcircleCenter</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1P">D2</a>
-<li><a href="#NWD21HcNW-1O"><i>&lt;process <tt>IncircleCenter</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1O">D2</a>
-<li><a href="#NWD21HcNW-13"><i>&lt;process <tt>inputfile*</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-13">D2</a>
-<li><a href="#NWD21HcNW-14"><i>&lt;process <tt>inputfile</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-14">D2</a>
-<li><a href="#NWD21HcNW-1K"><i>&lt;process <tt>intersection</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1K">D2</a>
-<li><a href="#NWD21HcNW-15"><i>&lt;process <tt>linethickness</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-15">D2</a>
-<li><a href="#NWD21HcNW-1L"><i>&lt;process <tt>midpoint</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1L">D2</a>
-<li><a href="#NWD21HcNW-16"><i>&lt;process <tt>paper</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-16">D2</a>
-<li><a href="#NWD21HcNW-1J"><i>&lt;process <tt>perpendicular</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1J">D2</a>
-<li><a href="#NWD21HcNW-1H"><i>&lt;process <tt>point/point*</tt> commands&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1H">D2</a>
-<li><a href="#NWD21HcNW-1M"><i>&lt;process <tt>pointonline</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1M">D2</a>
-<li><a href="#NWD21HcNW-1W"><i>&lt;process <tt>PointSymbol</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1W">D2</a>
-<li><a href="#NWD21HcNW-1R"><i>&lt;process <tt>polar</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1R">D2</a>, <a href="#NWD21HcNW-1Z">U3</a>
-<li><a href="#NWD21HcNW-u"><i>&lt;process <tt>radius</tt> part of command&gt;</i></a>: <a href="#NWD21HcNW-s">U1</a>, <a href="#NWD21HcNW-u">D2</a>
-<li><a href="#NWD21HcNW-1S"><i>&lt;process <tt>rotate</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1S">D2</a>
-<li><a href="#NWD21HcNW-1Q"><i>&lt;process <tt>shift</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1Q">D2</a>, <a href="#NWD21HcNW-1Z">U3</a>
-<li><a href="#NWD21HcNW-1A"><i>&lt;process <tt>showAngle</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1A">D2</a>
-<li><a href="#NWD21HcNW-1B"><i>&lt;process <tt>showArea</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1B">D2</a>
-<li><a href="#NWD21HcNW-1C"><i>&lt;process <tt>showLength</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1C">D2</a>
-<li><a href="#NWD21HcNW-1X"><i>&lt;process <tt>system</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1X">D2</a>
-<li><a href="#NWD21HcNW-1Y"><i>&lt;process <tt>text</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1Y">D2</a>
-<li><a href="#NWD21HcNW-1F"><i>&lt;process <tt>ticks</tt> part&gt;</i></a>: <a href="#NWD21HcNW-16">U1</a>, <a href="#NWD21HcNW-1F">D2</a>
-<li><a href="#NWD21HcNW-17"><i>&lt;process <tt>unit</tt> part&gt;</i></a>: <a href="#NWD21HcNW-16">U1</a>, <a href="#NWD21HcNW-17">D2</a>
-<li><a href="#NWD21HcNW-1c"><i>&lt;process <tt>var</tt> command&gt;</i></a>: <a href="#NWD21HcNW-q">U1</a>, <a href="#NWD21HcNW-1c">D2</a>
-<li><a href="#NWD21HcNW-1T"><i>&lt;process <tt>vector</tt> case&gt;</i></a>: <a href="#NWD21HcNW-1I">U1</a>, <a href="#NWD21HcNW-1T">D2</a>
-<li><a href="#NWD21HcNW-18"><i>&lt;process <tt>xrange</tt> part&gt;</i></a>: <a href="#NWD21HcNW-16">U1</a>, <a href="#NWD21HcNW-18">D2</a>
-<li><a href="#NWD21HcNW-19"><i>&lt;process <tt>yrange</tt> part&gt;</i></a>: <a href="#NWD21HcNW-16">U1</a>, <a href="#NWD21HcNW-19">D2</a>
-<li><a href="#NWD21HcNW-5"><i>&lt;Process command line arguments&gt;</i></a>: <a href="#NWD21HcNW-4">U1</a>, <a href="#NWD21HcNW-5">D2</a>
-<li><a href="#NWD21HcNW-1I"><i>&lt;process coordinates&gt;</i></a>: <a href="#NWD21HcNW-1H">U1</a>, <a href="#NWD21HcNW-1I">D2</a>
-<li><a href="#NWD21HcNW-1Z"><i>&lt;process coordinates part of text command&gt;</i></a>: <a href="#NWD21HcNW-1Y">U1</a>, <a href="#NWD21HcNW-1Z">D2</a>
-<li><a href="#NWD21HcNW-7"><i>&lt;process file&gt;</i></a>: <a href="#NWD21HcNW-2">U1</a>, <a href="#NWD21HcNW-7">D2</a>
-<li><a href="#NWD21HcNW-q"><i>&lt;process input line&gt;</i></a>: <a href="#NWD21HcNW-p">U1</a>, <a href="#NWD21HcNW-q">D2</a>
-<li><a href="#NWD21HcNW-1a"><i>&lt;process optional part of text command&gt;</i></a>: <a href="#NWD21HcNW-1Y">U1</a>, <a href="#NWD21HcNW-1a">D2</a>
-<li><a href="#NWD21HcNW-1U"><i>&lt;process optional point shape part&gt;</i></a>: <a href="#NWD21HcNW-1H">U1</a>, <a href="#NWD21HcNW-1U">D2</a>
-<li><a href="#NWD21HcNW-W"><i>&lt;subroutine <tt>Angle</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-W">D2</a>
-<li><a href="#NWD21HcNW-K"><i>&lt;subroutine <tt>chk_comma</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-K">D2</a>
-<li><a href="#NWD21HcNW-L"><i>&lt;subroutine <tt>chk_comment</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-L">D2</a>
-<li><a href="#NWD21HcNW-G"><i>&lt;subroutine <tt>chk_lcb</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-G">D2</a>
-<li><a href="#NWD21HcNW-E"><i>&lt;subroutine <tt>chk_lparen</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-E">D2</a>
-<li><a href="#NWD21HcNW-I"><i>&lt;subroutine <tt>chk_lsb</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-I">D2</a>
-<li><a href="#NWD21HcNW-H"><i>&lt;subroutine <tt>chk_rcb</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-H">D2</a>
-<li><a href="#NWD21HcNW-F"><i>&lt;subroutine <tt>chk_rparen</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-F">D2</a>
-<li><a href="#NWD21HcNW-J"><i>&lt;subroutine <tt>chk_rsb</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-J">D2</a>
-<li><a href="#NWD21HcNW-S"><i>&lt;subroutine <tt>circumCircleCenter</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-S">D2</a>
-<li><a href="#NWD21HcNW-T"><i>&lt;subroutine <tt>ComputeDist</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-T">D2</a>
-<li><a href="#NWD21HcNW-d"><i>&lt;subroutine <tt>drawAngleArc</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-d">D2</a>
-<li><a href="#NWD21HcNW-e"><i>&lt;subroutine <tt>drawAngleArrow</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-e">D2</a>
-<li><a href="#NWD21HcNW-Z"><i>&lt;subroutine <tt>drawarrows</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-Z">D2</a>
-<li><a href="#NWD21HcNW-b"><i>&lt;subroutine <tt>drawCurve</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-b">D2</a>
-<li><a href="#NWD21HcNW-Y"><i>&lt;subroutine <tt>DrawLineOrArrow</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-Y">D2</a>
-<li><a href="#NWD21HcNW-a"><i>&lt;subroutine <tt>drawlines</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-a">D2</a>
-<li><a href="#NWD21HcNW-c"><i>&lt;subroutine <tt>drawpoints</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-c">D2</a>
-<li><a href="#NWD21HcNW-l"><i>&lt;subroutine <tt>drawsquare</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-l">D2</a>
-<li><a href="#NWD21HcNW-X"><i>&lt;subroutine <tt>excircle</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-X">D2</a>
-<li><a href="#NWD21HcNW-f"><i>&lt;subroutine <tt>expr</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-f">D2</a>
-<li><a href="#NWD21HcNW-N"><i>&lt;subroutine <tt>get_point</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-N">D2</a>
-<li><a href="#NWD21HcNW-i"><i>&lt;subroutine <tt>get_string</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-i">D2</a>
-<li><a href="#NWD21HcNW-V"><i>&lt;subroutine <tt>IncircleCenter</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-V">D2</a>
-<li><a href="#NWD21HcNW-U"><i>&lt;subroutine <tt>intersection4points</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-U">D2</a>
-<li><a href="#NWD21HcNW-j"><i>&lt;subroutine <tt>is_tainted</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-j">D2</a>
-<li><a href="#NWD21HcNW-P"><i>&lt;subroutine <tt>Length</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-P">D2</a>
-<li><a href="#NWD21HcNW-g"><i>&lt;subroutine <tt>memberOf</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-g">D2</a>
-<li><a href="#NWD21HcNW-A"><i>&lt;subroutine <tt>mpp</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-A">D2</a>
-<li><a href="#NWD21HcNW-k"><i>&lt;subroutine <tt>noOfDigits</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-k">D2</a>
-<li><a href="#NWD21HcNW-O"><i>&lt;subroutine <tt>perpendicular</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-O">D2</a>
-<li><a href="#NWD21HcNW-R"><i>&lt;subroutine <tt>pointOnLine</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-R">D2</a>
-<li><a href="#NWD21HcNW-M"><i>&lt;subroutine <tt>print_headers</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-M">D2</a>
-<li><a href="#NWD21HcNW-B"><i>&lt;subroutine <tt>PrintErrorMessage</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-B">D2</a>
-<li><a href="#NWD21HcNW-D"><i>&lt;subroutine <tt>PrintFatalError</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-D">D2</a>
-<li><a href="#NWD21HcNW-C"><i>&lt;subroutine <tt>PrintWarningMessage</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-C">D2</a>
-<li><a href="#NWD21HcNW-p"><i>&lt;subroutine <tt>process_input</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-p">D2</a>
-<li><a href="#NWD21HcNW-o"><i>&lt;subroutine <tt>setLineThickness</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-o">D2</a>
-<li><a href="#NWD21HcNW-n"><i>&lt;subroutine <tt>sp2X</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-n">D2</a>
-<li><a href="#NWD21HcNW-h"><i>&lt;subroutine <tt>tand</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-h">D2</a>
-<li><a href="#NWD21HcNW-Q"><i>&lt;subroutine <tt>triangleArea</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-Q">D2</a>
-<li><a href="#NWD21HcNW-m"><i>&lt;subroutine <tt>X2sp</tt> &gt;</i></a>: <a href="#NWD21HcNW-9">U1</a>, <a href="#NWD21HcNW-m">D2</a>
-<li><a href="#NWD21HcNW-9"><i>&lt;subroutine definitions&gt;</i></a>: <a href="#NWD21HcNW-2">U1</a>, <a href="#NWD21HcNW-9">D2</a>
+<li><a href="#NWDCUvTi-2"><i>&lt;*&gt;</i></a>: <a href="#NWDCUvTi-2">D1</a>
+<li><a href="#NWDCUvTi-4"><i>&lt;Check for command line arguments&gt;</i></a>: <a href="#NWDCUvTi-2">U1</a>, <a href="#NWDCUvTi-4">D2</a>
+<li><a href="#NWDCUvTi-6"><i>&lt;Check if .m file exists&gt;</i></a>: <a href="#NWDCUvTi-4">U1</a>, <a href="#NWDCUvTi-6">D2</a>
+<li><a href="#NWDCUvTi-8"><i>&lt;Define global variables&gt;</i></a>: <a href="#NWDCUvTi-2">U1</a>, <a href="#NWDCUvTi-8">D2</a>
+<li><a href="#NWDCUvTi-1E"><i>&lt;generate plot area related commands&gt;</i></a>: <a href="#NWDCUvTi-17">U1</a>, <a href="#NWDCUvTi-1E">D2</a>
+<li><a href="#NWDCUvTi-1H"><i>&lt;generate the rest of the code for the <tt>paper</tt> command&gt;</i></a>: <a href="#NWDCUvTi-17">U1</a>, <a href="#NWDCUvTi-1H">D2</a>
+<li><a href="#NWDCUvTi-3"><i>&lt;package <tt>DummyFH</tt> &gt;</i></a>: <a href="#NWDCUvTi-2">U1</a>, <a href="#NWDCUvTi-3">D2</a>
+<li><a href="#NWDCUvTi-u"><i>&lt;process <tt>angle</tt> part of command&gt;</i></a>: <a href="#NWDCUvTi-t">U1</a>, <a href="#NWDCUvTi-u">D2</a>
+<li><a href="#NWDCUvTi-1W"><i>&lt;process <tt>ArrowShape</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1W">D2</a>
+<li><a href="#NWDCUvTi-1F"><i>&lt;process <tt>axis</tt> part&gt;</i></a>: <a href="#NWDCUvTi-17">U1</a>, <a href="#NWDCUvTi-1F">D2</a>
+<li><a href="#NWDCUvTi-1O"><i>&lt;process <tt>circumcircleCenter</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1O">D2</a>
+<li><a href="#NWDCUvTi-1c"><i>&lt;process <tt>const</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1c">D2</a>
+<li><a href="#NWDCUvTi-s"><i>&lt;process <tt>dasharray</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-s">D2</a>
+<li><a href="#NWDCUvTi-t"><i>&lt;process <tt>drawAngleArcOrArrow</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-t">D2</a>
+<li><a href="#NWDCUvTi-w"><i>&lt;process <tt>drawcircle</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-w">D2</a>
+<li><a href="#NWDCUvTi-x"><i>&lt;process <tt>drawcircumcircle</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-x">D2</a>
+<li><a href="#NWDCUvTi-y"><i>&lt;process <tt>drawexcircle</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-y">D2</a>
+<li><a href="#NWDCUvTi-z"><i>&lt;process <tt>drawincircle</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-z">D2</a>
+<li><a href="#NWDCUvTi-10"><i>&lt;process <tt>drawPerpendicular</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-10">D2</a>
+<li><a href="#NWDCUvTi-11"><i>&lt;process <tt>drawpoint</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-11">D2</a>
+<li><a href="#NWDCUvTi-12"><i>&lt;process <tt>drawRightAngle</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-12">D2</a>
+<li><a href="#NWDCUvTi-13"><i>&lt;process <tt>drawsquare</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-13">D2</a>
+<li><a href="#NWDCUvTi-1Q"><i>&lt;process <tt>ExcircleCenter</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1Q">D2</a>
+<li><a href="#NWDCUvTi-1P"><i>&lt;process <tt>IncircleCenter</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1P">D2</a>
+<li><a href="#NWDCUvTi-14"><i>&lt;process <tt>inputfile*</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-14">D2</a>
+<li><a href="#NWDCUvTi-15"><i>&lt;process <tt>inputfile</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-15">D2</a>
+<li><a href="#NWDCUvTi-1L"><i>&lt;process <tt>intersection</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1L">D2</a>
+<li><a href="#NWDCUvTi-16"><i>&lt;process <tt>linethickness</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-16">D2</a>
+<li><a href="#NWDCUvTi-1M"><i>&lt;process <tt>midpoint</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1M">D2</a>
+<li><a href="#NWDCUvTi-17"><i>&lt;process <tt>paper</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-17">D2</a>
+<li><a href="#NWDCUvTi-1K"><i>&lt;process <tt>perpendicular</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1K">D2</a>
+<li><a href="#NWDCUvTi-1I"><i>&lt;process <tt>point/point*</tt> commands&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1I">D2</a>
+<li><a href="#NWDCUvTi-1N"><i>&lt;process <tt>pointonline</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1N">D2</a>
+<li><a href="#NWDCUvTi-1X"><i>&lt;process <tt>PointSymbol</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1X">D2</a>
+<li><a href="#NWDCUvTi-1S"><i>&lt;process <tt>polar</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1S">D2</a>, <a href="#NWDCUvTi-1a">U3</a>
+<li><a href="#NWDCUvTi-v"><i>&lt;process <tt>radius</tt> part of command&gt;</i></a>: <a href="#NWDCUvTi-t">U1</a>, <a href="#NWDCUvTi-v">D2</a>
+<li><a href="#NWDCUvTi-1T"><i>&lt;process <tt>rotate</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1T">D2</a>
+<li><a href="#NWDCUvTi-1R"><i>&lt;process <tt>shift</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1R">D2</a>, <a href="#NWDCUvTi-1a">U3</a>
+<li><a href="#NWDCUvTi-1B"><i>&lt;process <tt>showAngle</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1B">D2</a>
+<li><a href="#NWDCUvTi-1C"><i>&lt;process <tt>showArea</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1C">D2</a>
+<li><a href="#NWDCUvTi-1D"><i>&lt;process <tt>showLength</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1D">D2</a>
+<li><a href="#NWDCUvTi-1Y"><i>&lt;process <tt>system</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1Y">D2</a>
+<li><a href="#NWDCUvTi-1Z"><i>&lt;process <tt>text</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1Z">D2</a>
+<li><a href="#NWDCUvTi-1G"><i>&lt;process <tt>ticks</tt> part&gt;</i></a>: <a href="#NWDCUvTi-17">U1</a>, <a href="#NWDCUvTi-1G">D2</a>
+<li><a href="#NWDCUvTi-18"><i>&lt;process <tt>unit</tt> part&gt;</i></a>: <a href="#NWDCUvTi-17">U1</a>, <a href="#NWDCUvTi-18">D2</a>
+<li><a href="#NWDCUvTi-1d"><i>&lt;process <tt>var</tt> command&gt;</i></a>: <a href="#NWDCUvTi-r">U1</a>, <a href="#NWDCUvTi-1d">D2</a>
+<li><a href="#NWDCUvTi-1U"><i>&lt;process <tt>vector</tt> case&gt;</i></a>: <a href="#NWDCUvTi-1J">U1</a>, <a href="#NWDCUvTi-1U">D2</a>
+<li><a href="#NWDCUvTi-19"><i>&lt;process <tt>xrange</tt> part&gt;</i></a>: <a href="#NWDCUvTi-17">U1</a>, <a href="#NWDCUvTi-19">D2</a>
+<li><a href="#NWDCUvTi-1A"><i>&lt;process <tt>yrange</tt> part&gt;</i></a>: <a href="#NWDCUvTi-17">U1</a>, <a href="#NWDCUvTi-1A">D2</a>
+<li><a href="#NWDCUvTi-5"><i>&lt;Process command line arguments&gt;</i></a>: <a href="#NWDCUvTi-4">U1</a>, <a href="#NWDCUvTi-5">D2</a>
+<li><a href="#NWDCUvTi-1J"><i>&lt;process coordinates&gt;</i></a>: <a href="#NWDCUvTi-1I">U1</a>, <a href="#NWDCUvTi-1J">D2</a>
+<li><a href="#NWDCUvTi-1a"><i>&lt;process coordinates part of text command&gt;</i></a>: <a href="#NWDCUvTi-1Z">U1</a>, <a href="#NWDCUvTi-1a">D2</a>
+<li><a href="#NWDCUvTi-7"><i>&lt;process file&gt;</i></a>: <a href="#NWDCUvTi-2">U1</a>, <a href="#NWDCUvTi-7">D2</a>
+<li><a href="#NWDCUvTi-r"><i>&lt;process input line&gt;</i></a>: <a href="#NWDCUvTi-q">U1</a>, <a href="#NWDCUvTi-r">D2</a>
+<li><a href="#NWDCUvTi-1b"><i>&lt;process optional part of text command&gt;</i></a>: <a href="#NWDCUvTi-1Z">U1</a>, <a href="#NWDCUvTi-1b">D2</a>
+<li><a href="#NWDCUvTi-1V"><i>&lt;process optional point shape part&gt;</i></a>: <a href="#NWDCUvTi-1I">U1</a>, <a href="#NWDCUvTi-1V">D2</a>
+<li><a href="#NWDCUvTi-W"><i>&lt;subroutine <tt>Angle</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-W">D2</a>
+<li><a href="#NWDCUvTi-K"><i>&lt;subroutine <tt>chk_comma</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-K">D2</a>
+<li><a href="#NWDCUvTi-L"><i>&lt;subroutine <tt>chk_comment</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-L">D2</a>
+<li><a href="#NWDCUvTi-G"><i>&lt;subroutine <tt>chk_lcb</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-G">D2</a>
+<li><a href="#NWDCUvTi-E"><i>&lt;subroutine <tt>chk_lparen</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-E">D2</a>
+<li><a href="#NWDCUvTi-I"><i>&lt;subroutine <tt>chk_lsb</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-I">D2</a>
+<li><a href="#NWDCUvTi-H"><i>&lt;subroutine <tt>chk_rcb</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-H">D2</a>
+<li><a href="#NWDCUvTi-F"><i>&lt;subroutine <tt>chk_rparen</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-F">D2</a>
+<li><a href="#NWDCUvTi-J"><i>&lt;subroutine <tt>chk_rsb</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-J">D2</a>
+<li><a href="#NWDCUvTi-S"><i>&lt;subroutine <tt>circumCircleCenter</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-S">D2</a>
+<li><a href="#NWDCUvTi-T"><i>&lt;subroutine <tt>ComputeDist</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-T">D2</a>
+<li><a href="#NWDCUvTi-d"><i>&lt;subroutine <tt>drawAngleArc</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-d">D2</a>
+<li><a href="#NWDCUvTi-e"><i>&lt;subroutine <tt>drawAngleArrow</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-e">D2</a>
+<li><a href="#NWDCUvTi-Z"><i>&lt;subroutine <tt>drawarrows</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-Z">D2</a>
+<li><a href="#NWDCUvTi-b"><i>&lt;subroutine <tt>drawCurve</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-b">D2</a>
+<li><a href="#NWDCUvTi-Y"><i>&lt;subroutine <tt>DrawLineOrArrow</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-Y">D2</a>
+<li><a href="#NWDCUvTi-a"><i>&lt;subroutine <tt>drawlines</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-a">D2</a>
+<li><a href="#NWDCUvTi-c"><i>&lt;subroutine <tt>drawpoints</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-c">D2</a>
+<li><a href="#NWDCUvTi-m"><i>&lt;subroutine <tt>drawsquare</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-m">D2</a>
+<li><a href="#NWDCUvTi-X"><i>&lt;subroutine <tt>excircle</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-X">D2</a>
+<li><a href="#NWDCUvTi-f"><i>&lt;subroutine <tt>expr</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-f">D2</a>
+<li><a href="#NWDCUvTi-N"><i>&lt;subroutine <tt>get_point</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-N">D2</a>
+<li><a href="#NWDCUvTi-j"><i>&lt;subroutine <tt>get_string</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-j">D2</a>
+<li><a href="#NWDCUvTi-V"><i>&lt;subroutine <tt>IncircleCenter</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-V">D2</a>
+<li><a href="#NWDCUvTi-U"><i>&lt;subroutine <tt>intersection4points</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-U">D2</a>
+<li><a href="#NWDCUvTi-k"><i>&lt;subroutine <tt>is_tainted</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-k">D2</a>
+<li><a href="#NWDCUvTi-P"><i>&lt;subroutine <tt>Length</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-P">D2</a>
+<li><a href="#NWDCUvTi-g"><i>&lt;subroutine <tt>memberOf</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-g">D2</a>
+<li><a href="#NWDCUvTi-h"><i>&lt;subroutine <tt>midpoint</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-h">D2</a>
+<li><a href="#NWDCUvTi-A"><i>&lt;subroutine <tt>mpp</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-A">D2</a>
+<li><a href="#NWDCUvTi-l"><i>&lt;subroutine <tt>noOfDigits</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-l">D2</a>
+<li><a href="#NWDCUvTi-O"><i>&lt;subroutine <tt>perpendicular</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-O">D2</a>
+<li><a href="#NWDCUvTi-R"><i>&lt;subroutine <tt>pointOnLine</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-R">D2</a>
+<li><a href="#NWDCUvTi-M"><i>&lt;subroutine <tt>print_headers</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-M">D2</a>
+<li><a href="#NWDCUvTi-B"><i>&lt;subroutine <tt>PrintErrorMessage</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-B">D2</a>
+<li><a href="#NWDCUvTi-D"><i>&lt;subroutine <tt>PrintFatalError</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-D">D2</a>
+<li><a href="#NWDCUvTi-C"><i>&lt;subroutine <tt>PrintWarningMessage</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-C">D2</a>
+<li><a href="#NWDCUvTi-q"><i>&lt;subroutine <tt>process_input</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-q">D2</a>
+<li><a href="#NWDCUvTi-p"><i>&lt;subroutine <tt>setLineThickness</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-p">D2</a>
+<li><a href="#NWDCUvTi-o"><i>&lt;subroutine <tt>sp2X</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-o">D2</a>
+<li><a href="#NWDCUvTi-i"><i>&lt;subroutine <tt>tand</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-i">D2</a>
+<li><a href="#NWDCUvTi-Q"><i>&lt;subroutine <tt>triangleArea</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-Q">D2</a>
+<li><a href="#NWDCUvTi-n"><i>&lt;subroutine <tt>X2sp</tt> &gt;</i></a>: <a href="#NWDCUvTi-9">U1</a>, <a href="#NWDCUvTi-n">D2</a>
+<li><a href="#NWDCUvTi-9"><i>&lt;subroutine definitions&gt;</i></a>: <a href="#NWDCUvTi-2">U1</a>, <a href="#NWDCUvTi-9">D2</a>
</ul>
</body></html>
diff --git a/Master/texmf-dist/doc/latex/mathspic/sourcecode.nw b/Master/texmf-dist/doc/latex/mathspic/sourcecode113.nw
index d9c4753ca40..00d7ae8e14a 100644
--- a/Master/texmf-dist/doc/latex/mathspic/sourcecode.nw
+++ b/Master/texmf-dist/doc/latex/mathspic/sourcecode113.nw
@@ -9,16 +9,17 @@ Greece<br>
email: <tt>asyropoulos@yahoo.com</tt>
</address></td>
<td><address>
-<b>R.W.D. Nickalls</b><br>
- Department of Anaesthesia<br>
-Nottingham City Hospital NHS Trust<br>
-Hucknall Road<br>
-Nottingham, NG5-1PB<br>
-United Kingdom<br>
-email: <tt>dicknickalls@compuserve.com</tt>
+<b>R.W.D. Nickalls</b><br/>
+Consultant in Anaesthesia & Intensive Care (retired)<br/>
+c/o Department of Anaesthesia<br/>
+Nottingham University Hospitals<br/>
+City Hospital Campus<br/>
+Hucknall Road<br/>
+Nottingham NG5 1PB, UK<br/>
+email:<tt>dick@nickalls.org</tt>
</address></td>
</table></h2>
-version 1.10 Feb 18, 2007
+version 1.13 Apr 26, 2010
</center>
@ <h3><b>Introduction</b></h3><p>
@@ -53,9 +54,9 @@ few global variables.
<<*>>=
#!/usr/bin/perl
#
-#(c) Copyright 2005-2007
+#(c) Copyright 2005-2010
# Apostolos Syropoulos & R.W.D. Nickalls
-# asyropoulos@yahoo.com dicknickalls@compuserve.com
+# asyropoulos@yahoo.com dick@nickalls.org
#
# This program can be redistributed and/or modified under the terms
# of the LaTeX Project Public License Distributed from CTAN
@@ -167,7 +168,7 @@ for all the switches, and we get the name of the input-file.
else {
$file = $_;
}
- }
+ }my ($xA, $yA, $xB, $yB, $dist)=@_;
die "No input file specified!\n" if $file eq "";
@ In order to check whether the input-file exists, we simply use the
@@ -235,7 +236,7 @@ respectively. Variable [[$LineThickness]] holds the current line thickness (the
default value is 0.4&nbsp;pt).
<<Define global variables>>=
-our $version_number = "1.10 Feb 18, 2007";
+our $version_number = "1.13 Apr 26, 2010";
our $commandLineArgs = join(" ", @ARGV);
our $command = "";
our $curr_in_file = "";
@@ -351,6 +352,8 @@ declaration.
<p> Subroutine [[memberOf]] is used to determine whether a string is a
member of a list of strings.
+<p> Subroutine [[midpoint]] computes the midpoint of two points.
+
<p> Subroutine [[tand]] computes the tangent of an angle, where the
angle is expressed in degrees.
@@ -411,6 +414,7 @@ and yields LaTeX code that draws a square.
<<subroutine <tt>drawAngleArrow</tt> >>
<<subroutine <tt>expr</tt> >>
<<subroutine <tt>memberOf</tt> >>
+ <<subroutine <tt>midpoint</tt> >>
<<subroutine <tt>tand</tt> >>
<<subroutine <tt>get_string</tt> >>
<<subroutine <tt>is_tainted</tt> >>
@@ -827,7 +831,7 @@ and the names of the various files processed/generated.
print OUT "%* -----------------------------------------------\n";
print OUT "%* mathspic (Perl version $version_number)\n";
print OUT "%* A filter program for use with PiCTeX\n";
- print OUT "%* Copyright (c) 2005 A Syropoulos & RWD Nickalls \n";
+ print OUT "%* Copyright (c) 2005-2010 A Syropoulos & RWD Nickalls \n";
print OUT "%* Command line: $0 $commandLineArgs\n";
print OUT "%* Input filename : $source_file\n";
print OUT "%* Output filename: $out_file\n";
@@ -837,7 +841,7 @@ and the names of the various files processed/generated.
print LOG "----\n";
print LOG "$now_string\n";
print LOG "mathspic (Perl version $version_number)\n";
- print LOG "Copyright (c) 2005 A Syropoulos & RWD Nickalls \n";
+ print LOG "Copyright (c) 2005-2010 A Syropoulos & RWD Nickalls \n";
print LOG "Input file = $source_file\n";
print LOG "Output file = $out_file\n";
print LOG "Log file = $log_file\n";
@@ -856,7 +860,7 @@ the string [[_undef_]] to indicate that something is wrong.
my ($lc) = $_[0];
my ($PointName);
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})\s*//i) { #point name
$PointName = $1;
if (!exists($PointTable{lc($PointName)})) {
PrintErrorMessage("Undefined point $PointName",$lc);
@@ -1117,20 +1121,20 @@ is an error the distance is assumed to be equal to zero.
{
return ($1, 1);
}
- elsif (/^[^\W\d_]\d{0,3}[^\W\d_]\d{0,3}/) #it is a pair of IDs?
+ elsif (/^[^\W\d_]\d{0,4}[^\W\d_]\d{0,4}/) #it is a pair of IDs?
{
- s/^([^\W\d_]\d{0,3})//i;
+ s/^([^\W\d_]\d{0,4})//i;
$v1 = $1;
if (!exists($PointTable{lc($v1)})) {
if (exists($VarTable{lc($v1)})) {
return ($VarTable{lc($v1)}, 1);
}
PrintErrorMessage("Point $v1 has not been defined", $lc);
- s/^\s*[^\W\d_]\d{0,3}//i;
+ s/^\s*[^\W\d_]\d{0,4}//i;
return (0,0);
}
$v1 = lc($v1);
- s/^\s*([^\W\d_]\d{0,3})//i;
+ s/^\s*([^\W\d_]\d{0,4})//i;
$v2 = $1;
if (!exists($PointTable{lc($v2)}))
{
@@ -1142,7 +1146,7 @@ is an error the distance is assumed to be equal to zero.
my ($x2,$y2,$pSV2,$pS2) = unpack("d3A*",$PointTable{$v2});
return (Length($x1,$y1,$x2,$y2), 1);
}
- elsif (s/^([^\W\d_]\d{0,3})//i) # it is a single id
+ elsif (s/^([^\W\d_]\d{0,4})//i) # it is a single id
{
$v1 = $1;
if (!exists($VarTable{lc($v1)})) #it isn't a variable
@@ -1462,7 +1466,7 @@ holds the point names.
DRAWLINES:while(1) {
@PP = () ;
while(1) {
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})\s*//i) { #point name
$P = $1;
if (!exists($PointTable{lc($P)})) {
PrintErrorMessage("Undefined point $P",$lc);
@@ -2013,7 +2017,7 @@ sub primitive {
chk_rparen("Missing right parenthesis", $lc);
}
elsif (s/^angle//i) {
- chk_lparen("angle".$lc);
+ chk_lparen("angle",$lc);
my $point_1 = get_point($lc);
my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
my $point_2 = get_point($lc);
@@ -2221,6 +2225,21 @@ sub memberOf {
return $found;
}
+@ The subroutine [[midpoint]] computes the coordinates of the midpoint of two points
+by means of the simple formula:
+<center>
+m<sub>x</sub>=x<sub>1</sub>+(y<sub>2</sub> - y<sub>1</sub>)/2 <br>
+m<sub>y</sub>=y<sub>1</sub>+(x<sub>2</sub> - x<sub>1</sub>)/2
+</center>
+
+<<subroutine <tt>midpoint</tt> >>=
+sub midpoint {
+ my ($x1, $y1, $x2, $y2)=@_;
+ return ($x1 + ($x2 - $x1)/2,
+ $y1 + ($y2 - $y1)/2);
+}
+
+
@ The subroutine [[tand]] computes the tangent of an angle. The angle is
supposed to be in degrees. We simply transform it into radians and then
compute the actual result.
@@ -3348,7 +3367,7 @@ we continue with the next input line.
}
my(@PP);
DRAWPOINTS:while(1) {
- if (s/^([^\W\d_]\d{0,3})//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})//i) { #point name
$P = $1;
if (!exists($PointTable{lc($P)})) {
PrintErrorMessage("Undefined point $P",$lc);
@@ -3409,7 +3428,7 @@ respectively. Finally, we emit the PiCTeX target code.
<<process <tt>drawRightAngle</tt> command>>=
- chk_lparen("drawRightAngle",lc);
+ chk_lparen("drawRightAngle",$lc);
my $point1 = get_point($lc);
next LINE if $point1 eq "_undef_";
my $point2 = get_point($lc);
@@ -3426,34 +3445,23 @@ respectively. Finally, we emit the PiCTeX target code.
#
#actual computation
#
- my $lengthAC = Length($x1, $y1, $x3, $y3);
- my $angleBAC = Angle($x2, $y2, $x1, $y1, $x3, $y3);
- my $line1 = $lengthAC / (1 + tand($angleBAC));
- #
- # determine coordinates of point Q
- #
- my ($xQ, $yQ) = pointOnLine($x1, $y1, $x3, $y3, $line1);
- #
- # determine coordinates of point S
- #
- my $deltax = $xQ - $x2;
- my $deltay = $yQ - $y2;
- my $lengthBQ = sqrt($deltax * $deltax + $deltay * $deltay);
- my $xS = $x2 + ($dist * sqrt(2) * $deltax / $lengthBQ);
- my $yS = $y2 + ($dist * sqrt(2) * $deltay / $lengthBQ);
- #
- # determine coordinates of points S1 and S2
- #
- my ($xS1, $yS1) = pointOnLine($x2, $y2, $x3, $y3, $dist);
- ($xS2, $yS2) = ($xS, $yS);
- #
- # emit PiCTeX code
- #
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $xS1, $yS1, $xS2, $yS2;
- ($xS1, $yS1) = pointOnLine($x2, $y2, $x1, $y1, $dist);
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $xS1, $yS1, $xS2, $yS2;
+ my ($Px, $Py) = pointOnLine($x2, $y2, $x1, $y1, $dist);
+ my ($Qx, $Qy) = pointOnLine($x2, $y2, $x3, $y3, $dist);
+ my ($Tx, $Ty) = midpoint($Px, $Py, $Qx, $Qy);
+ my ($Ux, $Uy) = pointOnLine($x2, $y2, $Tx, $Ty, 2*Length($x2, $y2, $Tx, $Ty));
+ if ($Px == $Ux || $Py == $Uy) {
+ printf OUT "\\putrule from %.5f %.5f to %.5f %.5f \n", $Px,$Py,$Ux,$Uy;
+ }
+ else {
+ printf OUT "\\plot %.5f %.5f\t%.5f %.5f / \n", $Px, $Py,$Ux,$Uy;
+ }
+ if ($Ux == $Qx || $Uy == $Qy) {
+ printf OUT "\\putrule from %.5f %.5f to %.5f %.5f \n", $Ux,$Uy,$Qx,$Qy;
+ }
+ else {
+ printf OUT "\\plot %.5f %.5f\t%.5f %.5f / \n", $Ux, $Uy,$Qx,$Qy;
+ }
+
@ The command [[drawsquare]] has two arguments: a point, which specifies the
coordinates of the point where the square will be placed, and a number, which
@@ -4108,7 +4116,7 @@ plot symbol part.
$pointStar = 0; # default value: he have a point command
$pointStar = 1 if s/^\*//;
chk_lparen("point" . (($pointStar)?"*":""),$lc);
- if (s/^([^\W\d_](?![^\W\d_])\d{0,3})//i) {
+ if (s/^([^\W\d_](?![^\W\d_])\d{0,4})//i) {
#
# Note: the regular expression (foo)(?!bar) means that we are
# looking a foo not followed by a bar. Moreover, the regular
@@ -4237,8 +4245,8 @@ calling the subroutine [[ComputeDist]]. The x-coordinate is stored in the variab
elsif (s/^ExcircleCenter(?=\W)//i) {
<<process <tt>ExcircleCenter</tt> case>>
}
- elsif (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
- m/^([^\W\d_]\d{0,3})\s*/i;
+ elsif (/^[^\W\d_]\d{0,4}\s*[^,\w]/) {
+ m/^([^\W\d_]\d{0,4})\s*/i;
if (exists($PointTable{lc($1)})) {
my $Tcoord = get_point($lc);
my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{$Tcoord});
@@ -4251,8 +4259,8 @@ calling the subroutine [[ComputeDist]]. The x-coordinate is stored in the variab
$Py = expr();
}
}
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar|rotate|vector/i) { #a point?
- s/^([^\W\d_]\d{0,3})//i;
+ elsif (/[^\W\d_]\d{0,4}\s*,\s*shift|polar|rotate|vector/i) { #a point?
+ s/^([^\W\d_]\d{0,4})//i;
my $PointA = $1;
if (exists($PointTable{lc($PointA)})) {
s/\s*//;
@@ -4345,11 +4353,7 @@ no error we compute the intersection point by calling subroutine
@ Given two points A and B, the midpoint option computes the coordinates
of a third point that lies on the middle of the line segment defined by
these two points. We get the the two points, and then we compute the
-coordinates of the midpoint by means of the simple formula:
-<center>
-m<sub>x</sub>=x<sub>1</sub>+(y<sub>2</sub> - y<sub>1</sub>)/2 <br>
-m<sub>y</sub>=y<sub>1</sub>+(x<sub>2</sub> - x<sub>1</sub>)/2
-</center>
+coordinates of the midpoint with function [[midpoint]].
<<process <tt>midpoint</tt> case>>=
chk_lparen("midpoint",$lc);
@@ -4360,8 +4364,7 @@ m<sub>y</sub>=y<sub>1</sub>+(x<sub>2</sub> - x<sub>1</sub>)/2
chk_rparen("No closing parenthesis found",$lc);
my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- $Px = $x1 + ($x2 - $x1)/2;
- $Py = $y1 + ($y2 - $y1)/2;
+ ($Px, $Py) = midpoint($x1, $y1, $x2, $y2);
@ Given two points A and B and length d, the [[PointOnLine]] option
computes the coordinates of a point that lies d units in the direction from
@@ -4849,14 +4852,14 @@ command.
<<process coordinates part of text command>>=
- if (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
+ if (/^[^\W\d_]\d{0,4}\s*[^,\w]/) {
my $Tcoord = get_point($lc);
my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{$Tcoord});
$Px = $x;
$Py = $y;
}
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar/i) {
- s/^([^\W\d_]\d{0,3})//i;
+ elsif (/[^\W\d_]\d{0,4}\s*,\s*shift|polar/i) {
+ s/^([^\W\d_]\d{0,4})//i;
my $PointA = $1;
if (exists($PointTable{lc($PointA)})) {
s/\s*//;
@@ -4963,7 +4966,7 @@ In case there, we simply ignore itl; otherwise we print a warning message.
do{
s/\s*//;
PrintErrorMessage("no identifier found after token const",$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
+ if $_ !~ s/^([^\W\d_]\d{0,4})//i;
my $Constname = $1;
my $constname = lc($Constname);
if (exists $ConstTable{$constname}) {
@@ -4998,7 +5001,7 @@ In case there, we simply ignore itl; otherwise we print a warning message.
do{
s/\s*//;
PrintErrorMessage("no identifier found after token var",$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
+ if $_ !~ s/^([^\W\d_]\d{0,4})//i;
my $Varname = $1;
my $varname = lc($Varname);
if (exists $ConstTable{$varname}) {
diff --git a/Master/texmf-dist/doc/latex/mathspic/sourcecode113.pdf b/Master/texmf-dist/doc/latex/mathspic/sourcecode113.pdf
new file mode 100644
index 00000000000..80222093ad0
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/mathspic/sourcecode113.pdf
Binary files differ
diff --git a/Master/texmf-dist/scripts/mathspic/mathspic.pl b/Master/texmf-dist/scripts/mathspic/mathspic.pl
deleted file mode 100755
index 132517b0b17..00000000000
--- a/Master/texmf-dist/scripts/mathspic/mathspic.pl
+++ /dev/null
@@ -1,3329 +0,0 @@
-#!/usr/bin/perl
-#
-#(c) Copyright 2005 Apostolos Syropoulos & R.W.D. Nickalls
-# apostolo@ocean1.ee.duth.gr dicknickalls@compuserve.com
-# apostolo@obelix.ee.duth.gr
-#
-# This program can be redistributed and/or modified under the terms
-# of the LaTeX Project Public License Distributed from CTAN
-# archives in directory macros/latex/base/lppl.txt; either
-# version 1 of the License, or any later version.
-#
-package DummyFH;
-my $index = 0;
-sub TIEHANDLE {
- my $class = shift;
- my $self= shift;
- bless $self, $class;
-}
-sub READLINE {
- my $self = shift;
- #shift @$self;
- if ($index > $#$self) {
- $index = 0;
- return undef;
- }
- else {
- return $self->[$index++];
- }
-}
-
-package main;
-use Math::Trig;
-our $version_number = "1.00 Feb 14, 2005";
-our $commandLineArgs = join(" ", @ARGV);
-our $command = "";
-our $curr_in_file = "";
-our %PointTable = ();
-our %VarTable = ();
-our %ConstTable = ();
-our $no_errors = 0;
-our $xunits = "1pt";
-our $yunits = "1pt";
-our $units = "pt|pc|in|bp|cm|mm|dd|cc|sp";
-our $defaultsymbol = "\$\\bullet\$";
-our $defaultLFradius = 0;
-use constant PI => atan2(1,1)*4;
-use constant R2D => 180 / PI;
-use constant D2R => PI / 180;
-our $arrowLength = 2;
-our $arrowLengthUnits = "mm";
-our $arrowAngleB = 30;
-our $arrowAngleC = 40;
-our %DimOfPoint = ();
-our $GlobalDimOfPoints = 0;
-our @Macros = ();
-our $LineThickness = 0.4;
-
- sub mpp {
- my $in_line;
- chomp($in_line = shift);
- my $LC = shift;
- my $out_line = $in_line;
- my $macro_name = "";
- my @macro_param = ();
- my $macro_code = "";
- if ($in_line =~ s/^%def\s*//) {
- if ($in_line =~ s/^(\w+)\s*//){
- $macro_name = $1;
- }
- else {
- PrintErrorMessage("No macro name has been found",$LC);
- return ""
- }
- if ($in_line =~ s/^\(\s*//) {
- # do nothing
- }
- else {
- PrintErrorMessage("No left parenthesis after macro name has been found",$LC);
- return "";
- }
- if ($in_line =~ s/^\)//) {
- # Macro has no parameters!
- }
- else {
- MACROS: while (1) {
- if ($in_line =~ s/^(\w+)\s*//) {
- push (@macro_param, $1);
- }
- else {
- PrintErrorMessage("No macro parameter name has been found",$LC);
- return "";
- }
- if ($in_line =~ s/^,\s*//) {
- next MACROS;
- }
- else {
- last MACROS;
- }
- }
- if ($in_line =~ s/^\)//) {
- # do nothing!
- }
- else {
- PrintErrorMessage("No closing parenthesis after macro parameters",$LC);
- return "";
- }
- }
- $in_line =~ s/([^%]+)(%.*)/$1/;
- $macro_code = $in_line;
- push ( @Macros , { 'macro_name' => $macro_name,
- 'macro_code' => $macro_code,
- 'macro_param' => \@macro_param });
- return $out_line;
- }
- elsif ($in_line =~ s/^%undef\s*//) {
- if ($in_line =~ s/^(\w+)//) {
- my $undef_macro = $1;
- for(my $i = $#Macros; $i >= 0; $i--) {
- if ($Macros[$i]->{'macro_name'} eq $undef_macro) {
- splice(@Macros,$i,1);
- }
- }
- }
- return $out_line;
- }
- elsif ($in_line =~ s/^\s*%//) {
- return $out_line;
- }
- else {
- my $comment = $2 if $in_line =~ s/([^%]+)(%.+)/$1/;
- for(my $i = $#Macros; $i >= 0; $i--) {
- my $macro_name = $Macros[$i]->{'macro_name'};
- if ($in_line =~ /&$macro_name/) { ############################
- my $num_of_macro_args = @{$Macros[$i]->{'macro_param'}};
- if ( $num_of_macro_args > 0 ) {
- my $pattern = "&$macro_name\\(";
- foreach my $p ( 1..$num_of_macro_args ) {
- my $comma = ($p == $num_of_macro_args) ? "\\s*" : "\\s*,\\s*";
- $pattern .= "\\s*[^\\s\\)]+$comma";
- }
- $pattern .= "\\)";
- while($in_line =~ /\W*&$macro_name\W+/) {
- if ($in_line =~ /$pattern/) {
- my $before = $`;
- my $after = $';
- my $match = $&;
- my $new_code = $Macros[$i]->{'macro_code'};
- $match =~ s/^&$macro_name\(\s*//;
- $match =~ s/\)$//;
- foreach my $arg ( 0..($num_of_macro_args - 1) ) {
- my $old = $Macros[$i]->{'macro_param'}->[$arg];
- my $comma = ($arg == ($num_of_macro_args - 1)) ? "" : ",";
- $match =~ s/^\s*([^\s,]+)\s*$comma//;
- my $new = $1;
- $new_code =~ s/$old/$new/;
- }
- $in_line = "$before$new_code$after";
- }
- else {
- PrintErrorMessage("Usage of macro &$macro_name does not " .
- "match its definition", $LC);
- return "";
- }
- }
- }
- else {
- my $replacement = $Macros[$i]->{'macro_code'};
- $in_line =~ s/&$macro_name/$replacement/g;
- }
- }
- }
- return "$in_line$comment";
- }
- }
-
- sub PrintErrorMessage {
- my $errormessage = shift;
- my $error_line = shift;
- my ($l,$A);
- $l = 1+length($command)-length;
- $A = substr($command,0,$l);
- $l += 7 +length($error_line);
-
- for my $fh (STDOUT, LOG) {
- print $fh "$curr_in_file", "Line $error_line: $A\n";
- print $fh " " x $l ,$_,"***Error: $errormessage\n";
- }
- if ($comments_on) { #print to output file file
- print OUT "%% *** $curr_in_file", "Line $error_line: $A\n";
- print OUT "%% *** "," " x $l ,$_,"%% ... Error: $errormessage\n";
- }
- $no_errors++;
- }
-
- sub PrintWarningMessage {
- my $warningMessage = shift;
- my $warning_line = shift;
- my ($l,$A);
- $l = 1+length($command)-length;
- $A = substr($command,0,$l);
- $l += 7 +length($warning_line);
-
- for my $fh (STDOUT, LOG) {
- print $fh "$curr_in_file", "Line $warning_line: $A\n";
- print $fh " " x $l ,$_,"***Warning: $warningMessage\n";
- }
- if ($comments_on) { #print to output file file
- print OUT "%% *** $curr_in_file", "Line $warning_line: $A\n";
- print OUT "%% *** "," " x $l ,$_,"%% ... Warning: $warningMessage\n";
- }
- }
-
- sub PrintFatalError {
- my $FatalMessage = shift;
- my $fatal_line = shift;
- my ($l,$A);
- $l = 1+length($command)-length;
- $A = substr($command,0,$l);
- $l += 7 +length($fatal_line);
-
- die "$curr_in_file", "Line $fatal_line: $A\n" .
- (" " x $l) . $_ . "***Fatal Error: $FatalMessage\n";
- }
-
- sub chk_lparen {
- my $token = $_[0];
- my $lc = $_[1];
- s/\s*//;
- if (/^[^\(]/) {
- PrintErrorMessage("Missing ( after $token",$lc);
- }
- else {
- s/^\(\s*//;
- }
- }
-
- sub chk_rparen {
- my $token = $_[0];
- my $lc = $_[1];
- s/\s*//;
- if (s/^\)//) {
- s/\s*//;
- }
- else {
- PrintErrorMessage("Missing ) after $token",$lc);
- }
- }
-
-
- sub chk_lcb {
- my $token = $_[0];
- my $lc = $_[1];
- s/\s*//;
- if ($_ !~ /^\{/) {
- PrintErrorMessage("Missing { after $token",$lc);
- }
- else {
- s/^{\s*//;
- }
- }
-
- sub chk_rcb {
- my $token = $_[0];
- my $lc = $_[1];
- if ($_ !~ /^\s*\}/) {
- PrintErrorMessage("Missing } after $token",$lc);
- }
- else {
- s/^\s*}\s*//;
- }
- }
-
- sub chk_lsb {
- my $token = $_[0];
- my $lc = $_[1];
-
- s/\s*//;
- if ($_ !~ /^\[/) {
- PrintErrorMessage("Missing [ after $token",$lc);
- }
- else {
- s/^\[\s*//;
- }
- }
-
- sub chk_rsb {
- my $token = $_[0];
- my $lc = $_[1];
-
- s/\s*//;
- if ($_ !~ /^\]/) {
- PrintErrorMessage("Missing ] after $token",$lc);
- }
- else {
- s/^\]\s*//;
- }
- }
-
- sub chk_comma {
- my $lc = $_[0];
-
- s/\s*//;
- if (/^[^,]/) {
- PrintErrorMessage("Did not find expected comma",$lc);
- }
- else {
- s/^,\s*//;
- }
- }
-
- sub chk_comment {
- my $lc = $_[0];
-
- s/\s*//;
- if (/^%/) {
- # do nothing!
- }
- elsif (/^[^%]/) {
- PrintWarningMessage("Trailing text is ignored",$lc);
- }
- }
-
- sub print_headers
- {
- my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
- $year+=1900;
- $mon+=1;
- $now_string = "$year/" . ($mon>9 ? "$mon/" : "0$mon/") .
- ($mday>9 ? "$mday " : "0$mday ") .
- ($hour>9 ? "$hour:" : "0$hour:") .
- ($min>9 ? "$min:" : "0$min:") .
- ($sec>9 ? "$sec" : "0$sec");
- print OUT "%* -----------------------------------------------\n";
- print OUT "%* mathspic (Perl version $version_number)\n";
- print OUT "%* A filter program for use with PiCTeX\n";
- print OUT "%* Copyright (c) 2005 A Syropoulos & RWD Nickalls \n";
- print OUT "%* Command line: $0 $commandLineArgs\n";
- print OUT "%* Input filename : $source_file\n";
- print OUT "%* Output filename: $out_file\n";
- print OUT "%* Date & time: $now_string\n";
- print OUT "%* -----------------------------------------------\n";
- #
- print LOG "----\n";
- print LOG "$now_string\n";
- print LOG "mathspic (Perl version $version_number)\n";
- print LOG "Copyright (c) 2005 A Syropoulos & RWD Nickalls \n";
- print LOG "Input file = $source_file\n";
- print LOG "Output file = $out_file\n";
- print LOG "Log file = $log_file\n";
- print LOG "----\n";
- }
-
- sub get_point {
-
- my ($lc) = $_[0];
- my ($PointName);
-
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
- $PointName = $1;
- if (!exists($PointTable{lc($PointName)})) {
- PrintErrorMessage("Undefined point $PointName",$lc);
- return "_undef_";
- }
- else {
- return lc($PointName);
- }
- }
- else {
- PrintErrorMessage("Point name expected",$lc);
- return "_undef_";
- }
- }
-
- sub perpendicular {
- my ($xP, $yP, $xA, $yA, $xB, $yB) = @_;
- my ($xF, $yF, $deltax, $deltay, $m1, $m2, $c1, $c2, $factor);
-
- $deltax = $xA - $xB;
- return ($xA, $yP) if abs($deltax) < 0.0000001;
- $deltay = $yA - $yB;
- return ($xP, $yA) if abs($deltay) < 0.0000001;
- $m1 = $deltay / $deltax;
- eval { $m2 = (-1) / $m1;};
- PrintFatalError("Division by zero",$lc) if $@;
- $c1 = $yA - $m1 * $xA;
- $c2 = $yP - $m2 * $xP;
- eval { $factor = 1 / ($m1 - $m2)};
- PrintFatalError("Division by zero",$lc) if $@;
- return (($c2 - $c1) * $factor, ($m1 * $c2 - $m2 * $c1) * $factor);
- }
-
- sub Length {
- my ($xA, $yA, $xB, $yB)=@_;
- return sqrt(($xB - $xA)**2 + ($yB - $yA)**2);
- }
-
- sub triangleArea {
- my ($xA, $yA, $xB, $yB, $xC, $yC)=@_;
- my ($lenAB, $lenBC, $lenCA, $s);
-
- $lenAB = Length($xA,$yA,$xB,$yB);
- $lenBC = Length($xB,$yB,$xC,$yC);
- $lenCA = Length($xC,$yC,$xA,$yA);
- $s = ($lenAB + $lenBC + $lenCA) / 2;
- return sqrt($s * ($s - $lenAB)*($s - $lenBC)*($s - $lenCA));
- }
-
- sub pointOnLine {
- my ($xA, $yA, $xB, $yB, $dist)=@_;
- my ($deltax, $deltay, $xPol, $yPol);
-
- $deltax = $xB - $xA;
- $deltay = $yB - $yA;
- $xPol = $xA + ($dist * $deltax / &Length($xA,$yA,$xB,$yB));
- $yPol = $yA + ($dist * $deltay / &Length($xA,$yA,$xB,$yB));
- return ($xPol, $yPol);
- }
-
-
-
- sub circumCircleCenter {
- my ($xA, $yA, $xB, $yB, $xC, $yC, $lc)=@_;
- my ($deltay12, $deltax12, $xs12, $ys12);
- my ($deltay23, $deltax23, $xs23, $ys23);
- my ($xcc, $ycc);
- my ($m23, $mr23, $c23, $m12, $mr12, $c12);
- my ($sideA, $sideB, $sideC, $a, $radius);
-
- if (abs(triangleArea($xA, $yA, $xB, $yB, $xC, $yC)) < 0.0000001)
- {
- PrintErrorMessage("Area of triangle is zero!",$lc);
- return (0,0,0);
- }
- $deltay12 = $yB - $yA;
- $deltax12 = $xB - $xA;
- $xs12 = $xA + $deltax12 / 2;
- $ys12 = $yA + $deltay12 / 2;
- #
- $deltay23 = $yC - $yB;
- $deltax23 = $xC - $xB;
- $xs23 = $xB + $deltax23 / 2;
- $ys23 = $yB + $deltay23 / 2;
- #
- CCXYLINE:{
- if (abs($deltay12) < 0.0000001)
- {
- $xcc = $xs12;
- if (abs($deltax23) < 0.0000001)
- {
- $ycc = $ys23;
- last CCXYLINE;
- }
- else
- {
- $m23 = $deltay23 / $deltax23;
- $mr23 = -1 / $m23;
- $c23 = $ys23 - $mr23 * $xs23;
- $ycc = $mr23 * $xs12 + $c23;
- last CCXYLINE;
- }
- }
- if (abs($deltax12) < 0.0000001)
- {
- $ycc = $ys12;
- if (abs($deltay23) < 0.0000001)
- {
- $xcc = $xs23;
- last CCXYLINE;
- }
- else
- {
- $m23 = $deltay23 / $deltax23;
- $mr23 = -1 / $m23;
- $c23 = $ys23 - $mr23 * $xs23;
- $xcc = ($ys12 - $c23) / $mr23;
- last CCXYLINE;
- }
- }
- if (abs($deltay23) < 0.0000001)
- {
- $xcc = $xs23;
- if (abs($deltax12) < 0.0000001)
- {
- $ycc = $ys12;
- last CCXYLINE;
- }
- else
- {
- $m12 = $deltay12 / $deltax12;
- $mr12 = -1 / $m12;
- $c12 = $ys12 - $mr12 * $xs12;
- $ycc = $mr12 * $xcc + $c12;
- last CCXYLINE;
- }
- }
- if (abs($deltax23) < 0.0000001)
- {
- $ycc = $ys23;
- if (abs($deltay12) < 0.0000001)
- {
- $xcc = $xs12;
- last CCXYLINE;
- }
- else
- {
- $m12 = $deltay12 / $deltax12;
- $mr12 = -1 / $m12;
- $c12 = $ys12 - $mr12 * $xs12;
- $xcc = ($ycc - $c12) / $mr12;
- last CCXYLINE;
- }
- }
- $m12 = $deltay12 / $deltax12;
- $mr12 = -1 / $m12;
- $c12 = $ys12 - $mr12 * $xs12;
- #-----
- $m23 = $deltay23 / $deltax23;
- $mr23 = -1 / $m23;
- $c23 = $ys23 - $mr23 * $xs23;
- $xcc = ($c23 - $c12) / ($mr12 - $mr23);
- $ycc = ($c23 * $mr12 - $c12 * $mr23) / ($mr12 - $mr23);
- }
- #
- $sideA = &Length($xA,$yA,$xB,$yB);
- $sideB = &Length($xB,$yB,$xC,$yC);
- $sideC = &Length($xC,$yC,$xA,$yA);
- $a = triangleArea($xA, $yA, $xB, $yB, $xC, $yC);
- $radius = ($sideA * $sideB * $sideC) / (4 * $a);
- #
- return ($xcc, $ycc, $radius);
- }
-
- sub ComputeDist {
- my ($lc) = $_[0];
- my ($v1, $v2);
-
- if (s/^((\+|-)?\d+(\.\d+)?([eE](\+|-)?\d+)?)//) #is it a number?
- {
- return ($1, 1);
- }
- elsif (/^[^\W\d_]\d{0,3}[^\W\d_]\d{0,3}/) #it is a pair of IDs?
- {
- s/^([^\W\d_]\d{0,3})//i;
- $v1 = $1;
- if (!exists($PointTable{lc($v1)})) {
- if (exists($VarTable{lc($v1)})) {
- return ($VarTable{lc($v1)}, 1);
- }
- PrintErrorMessage("Point $v1 has not been defined", $lc);
- s/^\s*[^\W\d_]\d{0,3}//i;
- return (0,0);
- }
- $v1 = lc($v1);
- s/^\s*([^\W\d_]\d{0,3})//i;
- $v2 = $1;
- if (!exists($PointTable{lc($v2)}))
- {
- PrintErrorMessage("Point $v2 has not been defined", $lc);
- return (0,0);
- }
- $v2 = lc($v2);
- my ($x1,$y1,$pSV1,$pS1) = unpack("d3A*",$PointTable{$v1});
- my ($x2,$y2,$pSV2,$pS2) = unpack("d3A*",$PointTable{$v2});
- return (Length($x1,$y1,$x2,$y2), 1);
- }
- elsif (s/^([^\W\d_]\d{0,3})//i) # it is a single id
- {
- $v1 = $1;
- if (!exists($VarTable{lc($v1)})) #it isn't a variable
- {
- PrintErrorMessage("Variable $v1 has not been defined", $lc);
- return (0,0);
- }
- return ($VarTable{lc($v1)}, 1);
- }
- else
- {
- PrintErrorMessage("Unexpected token", $lc);
- return (0,0);
- }
- }
-
- sub intersection4points {
- my ($x1, $y1, $x2, $y2, $x3, $y3, $x4, $y4) = @_;
- my ($deltay12, $deltax12, $deltay34, $deltax34);
- my ($xcc, $ycc, $m34, $c34, $m12, $c12);
-
- $deltay12 = $y2 - $y1;
- $deltax12 = $x2 - $x1;
- #
- $deltay34 = $y4 - $y3;
- $deltax34 = $x4 - $x3;
- I4PXYLINE:{
- if (abs($deltay12) < 0.0000001)
- {
- $ycc = $y1;
- if (abs($deltax34) < 0.0000001)
- {
- $xcc = $x3;
- last I4PXYLINE;
- }
- else
- {
- $m34 = $deltay34 / $deltax34;
- $c34 = $y3 - $m34 * $x3;
- $xcc = ($ycc - $c34) / $m34;
- last I4PXYLINE;
- }
- }
- if (abs($deltax12) < 0.0000001)
- {
- $xcc = $x1;
- if (abs($deltay34) < 0.0000001)
- {
- $ycc = $y3;
- last I4PXYLINE;
- }
- else
- {
- $m34 = $deltay34 / $deltax34;
- $c34 = $y3 - $m34 * $x3;
- $ycc = $m34 * $xcc + $c34;
- last I4PXYLINE;
- }
- }
- if (abs($deltay34) < 0.0000001)
- {
- $ycc = $y3;
- if (abs($deltax12) < 0.0000001)
- {
- $xcc = $x1;
- last I4PXYLINE;
- }
- else
- {
- $m12 = $deltay12 / $deltax12;
- $c12 = $y1 - $m12 * $x1;
- $xcc = ($ycc - $c12) / $m12;
- last I4PXYLINE;
- }
- }
- if (abs($deltax34) < 0.0000001)
- {
- $xcc = $x3;
- if (abs($deltay12) < 0.0000001)
- {
- $ycc = $y1;
- last I4PXYLINE;
- }
- else
- {
- $m12 = $deltay12 / $deltax12;
- $c12 = $y1 - $m12 * $x1;
- $ycc = $m12 * $xcc + $c12;
- last I4PXYLINE;
- }
- }
- $m12 = $deltay12 / $deltax12;
- $c12 = $y1 - $m12 * $x1;
- $m34 = $deltay34 / $deltax34;
- $c34 = $y3 - $m34 * $x3;
- $xcc = ($c34 - $c12) / ($m12 - $m34);
- $ycc = ($c34 * $m12 - $c12 * $m34) / ($m12 - $m34);
- }
- return ($xcc, $ycc);
- }
-
- sub IncircleCenter {
- my ($Ax, $Ay, $Bx, $By, $Cx, $Cy) = @_;
- my ($sideA, $sideB, $sideC);
- my ($ba1, $xA1, $yA1, $cb1, $ac1, $xB1, $yB1, $xC1, $yC1, $a, $s, $r);
-
- #determine the lengths of the sides
- $sideA = Length($Bx, $By, $Cx, $Cy);
- $sideB = Length($Cx, $Cy, $Ax, $Ay);
- $sideC = Length($Ax, $Ay, $Bx, $By);
- #
- $ba1 = ($sideC * $sideA) / ($sideB + $sideC);
- ($xA1, $yA1) = pointOnLine($Bx, $By, $Cx, $Cy, $ba1);
- $cb1 = ($sideA * $sideB) / ($sideC + $sideA);
- ($xB1, $yB1) = pointOnLine($Cx, $Cy, $Ax, $Ay, $cb1);
- $ac1 = ($sideB * $sideC) / ($sideA + $sideB);
- ($xC1, $yC1) = pointOnLine($Ax, $Ay, $Bx, $By, $ac1);
- ($xcenter, $ycenter) = &intersection4points($Ax, $Ay, $xA1, $yA1,
- $Bx, $By, $xB1, $yB1);
- # get radius
- $a = &triangleArea($Ax, $Ay, $Bx, $By, $Cx, $Cy);
- $s = ($sideA + $sideB +$sideC) / 2;
- $r = $a / $s;
- return ($xcenter, $ycenter, $r);
- }
-
- sub Angle {
- my ($Ax, $Ay, $Bx, $By, $Cx, $Cy) = @_;
- my ($RAx, $RAy, $RBx, $RBy, $RCx, $RCy, $deltax, $deltay);
- my ($lineBA, $lineBC, $lineAC, $k, $kk, $angle);
- my ($T, $cosT, $sinT) = (0.3, cos(0.3), sin(0.3));
-
- $RAx = $Ax * $cosT + $Ay * $sinT;
- $RAy = -$Ax * $sinT + $Ay * $cosT;
- $RBx = $Bx * $cosT + $By * $sinT;
- $RBy = -$Bx * $sinT + $By * $cosT;
- $RCx = $Cx * $cosT + $Cy * $sinT;
- $RCy = -$Cx * $sinT + $Cy * $cosT;
- $deltax = $RBx - $RAx;
- $deltay = $RBy - $RAy;
- $lineBA = sqrt($deltax*$deltax + $deltay*$deltay);
- if ($lineBA < 0.0000001)
- {
- return -500;
- }
- $deltax = $RBx - $RCx;
- $deltay = $RBy - $RCy;
- $lineBC = sqrt($deltax*$deltax + $deltay*$deltay);
- if ($lineBC < 0.0000001)
- {
- return -500;
- }
- $deltax = $RAx - $RCx;
- $deltay = $RAy - $RCy;
- $lineAC = sqrt($deltax*$deltax + $deltay*$deltay);
- if ($lineAC < 0.0000001)
- {
- return -500;
- }
- $k = ($lineBA*$lineBA + $lineBC*$lineBC - $lineAC*$lineAC ) /
- (2 * $lineBA * $lineBC);
- $k = -1 if $k < -0.99999;
- $k = 1 if $k > 0.99999;
- $kk = $k * $k;
- if (($kk * $kk) == 1)
- {
- $angle = PI if $k == -1;
- $angle = 0 if $k == 1;
- }
- else
- {
- $angle = (PI / 2) - atan2($k / sqrt(1 - $kk),1);
- }
- return $angle * 180 / PI;
- }
-
- sub excircle {
- my ($A, $B, $C, $D, $E) = @_;
- my ($Ax,$Ay,$Bx,$By,$Dx,$Dy,$Ex,$Ey,$ASVA,$ASA);
- ($Ax,$Ay,$ASVA,$ASA)=unpack("d3A*",$PointTable{$A});
- ($Bx,$By,$ASVA,$ASA)=unpack("d3A*",$PointTable{$B});
- ($Cx,$Cy,$ASVA,$ASA)=unpack("d3A*",$PointTable{$C});
- ($Dx,$Dy,$ASVA,$ASA)=unpack("d3A*",$PointTable{$D});
- ($Ex,$Ey,$ASVA,$ASA)=unpack("d3A*",$PointTable{$E});
- my ($sideA, $sideB, $sideC, $s, $R, $theAdeg, $d);
- my ($Xmypoint, $Ymypoint, $deltax, $deltay, $mylength, $xc, $yc);
-
- $sideA = &Length($Bx, $By, $Cx, $Cy);
- $sideB = &Length($Cx, $Cy, $Ax, $Ay);
- $sideC = &Length($Ax, $Ay, $Bx, $By);
- $s = ($sideA + $sideB + $sideC) / 2;
- $R = triangleArea($Ax, $Ay, $Bx, $By, $Cx, $Cy) /
- ($s - &Length($Dx, $Dy, $Ex, $Ey));
- if (($D eq $A && $E eq $B) || ($D eq $B && $E eq $A))
- {
- $theAdeg = &Angle($Bx, $By, $Cx, $Cy, $Ax, $Ay);
- $Xmypoint = $Cx;
- $Ymypoint = $Cy;
- }
- elsif (($D eq $B && $E eq $C) || ($D eq $C && $E eq $B))
- {
- $theAdeg = &Angle($Cx, $Cy, $Ax, $Ay, $Bx, $By);
- $Xmypoint = $Ax;
- $Ymypoint = $Ay;
- }
- elsif (($D eq $C && $E eq $A) || ($D eq $A && $E eq $C))
- {
- $theAdeg = &Angle($Ax, $Ay, $Bx, $By, $Cx, $Cy);
- $Xmypoint = $Bx;
- $Ymypoint = $By;
- }
- else
- {
- return (0,0,0);
- }
- $d = $R / sin($theAdeg * PI / 180 / 2);
- my ($xIn, $yIn, $rin) = &IncircleCenter($Ax, $Ay, $Bx, $By, $Cx, $Cy);
- $deltax = $xIn - $Xmypoint;
- $deltay = $yIn - $Ymypoint;
- $mylength = sqrt($deltax*$deltax + $deltay*$deltay);
- $xc = $Xmypoint + $d * $deltax / $mylength;
- $yc = $Ymypoint + $d * $deltay / $mylength;
- return ($xc, $yc, $R);
- }
-
- sub DrawLineOrArrow {
- my $draw_Line = shift;
- my $lc = shift;
- my $lineLength = -1;
- my $stacklen = 0;
- my @PP = ();
- # if ($draw_Line != 2) {
- # s/\s*//;
- # if (s/^\[\s*//) { # optional length specifier
- # $lineLength = expr($lc);
- # if ($lineLength <= 0) {
- # PrintErrorMessage("length must greater than zero",$lc);
- # $lineLength = -1;
- # }
- # chk_rsb("optional part",$lc);
- # }
- # }
- chk_lparen("$cmd",$lc);
- DRAWLINES:while(1) {
- @PP = () ;
- while(1) {
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
- $P = $1;
- if (!exists($PointTable{lc($P)})) {
- PrintErrorMessage("Undefined point $P",$lc);
- }
- else {
- push (@PP,$P);
- }
- }
- else {
- $stacklen = @PP;
- if ($draw_Line != 2) {
- if ($stacklen <= 1) {
- PrintErrorMessage("Wrong number of points",$lc);
- }
- else {
- push(@PP,$lc);
- if ($draw_Line == 0) {
- drawarrows(@PP);
- }
- elsif ($draw_Line == 1) {
- drawlines(@PP);
- }
- }
- }
- if (s/^,\s*// and $draw_Line != 2) {
- next DRAWLINES;
- }
- else {
- last DRAWLINES;
- }
- }
- }
- }
- if ($draw_Line == 2) {
- $stacklen = @PP;
- if ($stacklen < 2) {
- PrintErrorMessage("Wrong number of points",$lc);
- }
- elsif ($stacklen % 2 == 0) {
- PrintErrorMessage("Number of points must be odd",$lc);
- }
- else {
- drawCurve(@PP);
- }
- }
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
- }
-
- sub drawarrows {
- my ($NoArgs);
- $NoArgs = @_;
- my ($lc) = $_[$NoArgs-1]; #line number is the last argument
- my ($NumberOfPoints, $p, $q, $r12, $d12);
- my ($px,$py,$pSV,$pS, $qx,$qy,$qSV,$qS);
-
- $NumberOfPoints = $NoArgs - 1;
- LOOP: for(my $i=0; $i < $NumberOfPoints - 1; $i++)
- {
- $p = $_[$i];
- $q = $_[$i+1];
- ($px,$py,$pSV,$pS) = unpack("d3A*",$PointTable{lc($p)});
- ($qx,$qy,$qSV,$qS) = unpack("d3A*",$PointTable{lc($q)});
- $pSV = $defaultLFradius if $pSV == 0;
- $qSV = $defaultLFradius if $qSV == 0;
- $r12 = $pSV + $qSV;
- $d12 = Length($px,$py,$qx,$qy);
- if ($d12 <= $r12)
- {
- if($d12 == 0)
- {
- PrintErrorMessage("points $p and $q are the same", $lc);
- next LOOP;
- }
- PrintWarningMessage("arrow $p$q not drawn: points too close or ".
- "radii too big", $lc);
- next LOOP;
- }
- ($px, $py) = pointOnLine($px, $py, $qx, $qy, $pSV) if $pSV > 0;
- ($qx, $qy) = pointOnLine($qx, $qy, $px, $py, $qSV) if $qSV > 0;
- my ($beta, $gamma);
- $beta = tan($arrowAngleB * D2R / 2);
- $gamma = 2 * tan($arrowAngleC * D2R / 2);
- printf OUT "\\arrow <%.5f%s> [%.5f,%.5f] from %.5f %.5f to %.5f %.5f\n",
- $arrowLength, $arrowLengthUnits, $beta, $gamma, $px, $py, $qx, $qy;
- }
- }
-
- sub drawlines {
- my ($NoArgs);
- $NoArgs = @_;
- my ($lc) = $_[$NoArgs-1]; #line number is the last argument
- my ($NumberOfPoints, $p, $q, $r12, $d12);
- my ($px,$py,$pSV,$pS, $qx,$qy,$qSV,$qS);
-
- $NumberOfPoints = $NoArgs - 1;
- LOOP: for(my $i=0; $i < $NumberOfPoints - 1; $i++)
- {
- $p = $_[$i];
- $q = $_[$i+1];
- ($px,$py,$pSV,$pS) = unpack("d3A*",$PointTable{lc($p)});
- ($qx,$qy,$qSV,$qS) = unpack("d3A*",$PointTable{lc($q)});
- $pSV = $defaultLFradius if $pSV == 0;
- $qSV = $defaultLFradius if $qSV == 0;
- $r12 = $pSV + $qSV;
- $d12 = Length($px,$py,$qx,$qy);
- if ($d12 <= $r12)
- {
- if($d12 == 0)
- {
- PrintErrorMessage("points $p and $q are the same", $lc);
- next LOOP;
- }
- PrintWarningMessage("line $p$q not drawn: points too close or ".
- "radii too big", $lc);
- next LOOP;
- }
- ($px, $py) = pointOnLine($px, $py, $qx, $qy, $pSV) if $pSV > 0;
- ($qx, $qy) = pointOnLine($qx, $qy, $px, $py, $qSV) if $qSV > 0;
- if ($px == $qx || $py == $qy)
- {
- printf OUT "\\putrule from %.5f %.5f to %.5f %.5f %%%% %s%s\n",
- $px,$py,$qx,$qy,$p,$q;
- }
- else
- {
- printf OUT "\\plot %.5f %.5f\t%.5f %.5f / %%%% %s%s\n",
- $px, $py,$qx,$qy,$p,$q;
- }
- }
- }
-
- sub drawCurve {
- my ($NoArgs);
- $NoArgs = @_;
- my ($lc) = $_[$NoArgs-1]; #line number is the last argument
- my ($NumberOfPoints, $p);
-
- $NumberOfPoints = $NoArgs - 1;
- print OUT "\\setquadratic\n\\plot\n";
- for(my $i=0; $i <= $NumberOfPoints; $i++)
- {
- $p = $_[$i];
- my ($px,$py,$pSV,$pS) = unpack("d3A*",$PointTable{lc($p)});
- printf OUT "\t%0.5f %0.5f", $px, $py;
- print OUT (($i == $NumberOfPoints) ? " / %$p\n" : " %$p\n");
- }
- print OUT "\\setlinear\n";
- }
-
- sub drawpoints {
- my ($NumberOfPoints,$p);
- $NumberOfPoints = @_;
- my ($px,$py,$pSV,$pS);
-
- for($i=0; $i < $NumberOfPoints; $i++)
- {
- $p = $_[$i];
- ($px,$py,$pSV,$pS) = unpack("d3A*",$PointTable{lc($p)});
- if ($pS eq "" and $defaultsymbol =~ /circle|square/) {
- $pS = $defaultsymbol;
- }
- POINTSWITCH: {
- if ($pS eq "") # no plot symbol specified
- {
- printf OUT "\\put {%s} at %.5f %.5f %%%% %s\n",
- $defaultsymbol, $px, $py, $p;
- last POINTSWITCH;
- }
- if ($pS eq "circle") # plot symbol is a circle
- {
- my $radius = (defined($DimOfPoint{lc($p)})) ? $DimOfPoint{lc($p)} :
- $GlobalDimOfPoints;
- if ($radius > 0) # draw a circle using the current units
- {
- if ($radius == 1.5) # use \bigcirc
- {
- printf OUT "\\put {\$\\bigcirc\$} at %.5f %.5f %%%% %s\n",
- $px, $py, $p;
- }
- else
- {
- printf OUT "\\circulararc 360 degrees from %.5f %.5f center at %.5f %.5f %%%% %s\n",
- $px+$radius, $py, $px, $py, $p;
- }
- }
- else #use \circ symbol
- {
- printf OUT "\\put {\$\\circ\$} at %.5f %.5f %%%% %s\n",
- $px,$py,$p;
- }
- last POINTSWITCH;
- }
- if ($pS eq "square")
- {
- my $side = (defined($DimOfPoint{lc($p)})) ? $DimOfPoint{lc($p)} :
- $GlobalDimOfPoints;
- printf OUT "\\put {%s} at %.5f %.5f %%%% %s\n",
- drawsquare($side), $px, $py, $p;
- last POINTSWITCH;
- }
- printf OUT "\\put {%s} at %.5f %.5f %%%% %s\n", $pS,$px,$py,$p;
- }
- }
- }
-
- sub drawAngleArc {
- my ($P1, $P2, $P3, $radius, $inout, $direction) = @_;
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$P1});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$P2});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$P3});
-
- my $internalAngle = Angle($x1, $y1, $x2, $y2, $x3, $y3);
- my $externalAngle = 360 - $internalAngle;
- my ($x, $y) = pointOnLine($x2, $y2, $x1, $y1, $radius);
- my $code = "";
- if ($inout eq "internal" and $direction eq "clockwise" ) {
- $code = sprintf "\\circulararc %.5f degrees from %.5f %.5f center at %.5f %.5f\n",
- -1 * $internalAngle, $x, $y, $x2, $y2;
- }
- elsif ($inout eq "internal" and $direction eq "anticlockwise" ) {
- $code = sprintf "\\circulararc %.5f degrees from %.5f %.5f center at %.5f %.5f\n",
- $internalAngle, $x, $y, $x2, $y2;
- }
- elsif ($inout eq "external" and $direction eq "clockwise" ) {
- $code = sprintf "\\circulararc %.5f degrees from %.5f %.5f center at %.5f %.5f\n",
- -1 * $externalAngle, $x, $y, $x2, $y2;
- }
- elsif ($inout eq "external" and $direction eq "anticlockwise" ) {
- $code = sprintf "\\circulararc %.5f degrees from %.5f %.5f center at %.5f %.5f\n",
- $externalAngle, $x, $y, $x2, $y2;
- }
- return $code;
- }
-
- sub drawAngleArrow {
- my ($P1, $P2, $P3, $radius, $inout, $direction) = @_;
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$P1});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$P2});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$P3});
-
- my $code = drawAngleArc($P1, $P2, $P3, $radius, $inout, $direction);
-
- my ($xqp, $yqp) = pointOnLine($x2, $y2, $x1, $y1, $radius);
- my ($deltax, $deltay) = ($x1 - $x2, $y1 - $y2);
- my $AL;
-
- if ($xunits =~ /mm/) {
- $AL = 1;
- }
- elsif ($xunits =~ /cm/) {
- $AL = 0.1;
- }
- elsif ($xunits =~ /pt/) {
- $AL = 2.845;
- }
- elsif ($xunits =~ /bp/) {
- $AL = 2.835;
- }
- elsif ($xunits =~ /pc/) {
- $AL = 0.2371;
- }
- elsif ($xunits =~ /in/) {
- $AL = 0.03937;
- }
- elsif ($xunits =~ /dd/) {
- $AL = 2.659;
- }
- elsif ($xunits =~ /cc/) {
- $AL = 0.2216;
- }
- elsif ($xunits =~ /sp/) {
- $AL = 186467.98;
- }
- my $halfAL = $AL / 2;
- my $d = sqrt($radius * $radius - $halfAL * $halfAL);
- my $alpha = atan2($d / $halfAL, 1) * R2D;
- my $beta = 2 * (90 - $alpha);
- my $thetaqr;
- if (abs($deltay) < 0.00001) {
- if ($deltax > 0 ) {$thetaqr = 0 }
- elsif ($deltax < 0) {$thetaqr = -180}
- }
- else {
- if (abs($deltax) < 0.00001) {
- $thetaqr = 90;
- }
- else {
- $thetaqr = atan2($deltay / $deltax, 1) * R2D;
- }
- }
- my ($xqr, $yqr) = pointOnLine($x2, $y2, $x3, $y3, $radius);
- $deltax = $x3 - $x2;
- $deltay = $y3 - $y2;
- $alpha = atan2(sqrt($radius * $radius - $halfAL * $halfAL) / $halfAL, 1) /
- D2R;
- $beta = 2 * (90 - $alpha);
- LINE2 : {
- if (abs($deltax) < 0.00001) {
- if ($deltay > 0) { $thetaqr = 90 }
- elsif ($deltay < 0) { $thetaqr = - 90 }
- last LINE2;
- }
- else {
- $thetaqr = atan2($deltay / $deltax, 1) * R2D;
- }
- if (abs($deltay) < 0.00001) {
- if ($deltax > 0) { $thetaqr = 0 }
- elsif ($deltax < 0) { $thetaqr = -180 }
- last LINE2;
- }
- else {
- $thetaqr = atan2($deltay / $deltax, 1) * R2D;
- }
- if ($deltax < 0 and $deltay > 0) { $thetaqr += 180 }
- elsif ($deltax < 0 and $deltay < 0) { $thetaqr += 180 }
- elsif ($deltax > 0 and $deltay < 0) { $thetaqr += 360 }
- }
- my $xqrleft = $x2 + $radius * cos(($thetaqr + $beta) * D2R);
- my $yqrleft = $y2 + $radius * sin(($thetaqr + $beta) * D2R);
- my $xqrright = $x2 + $radius * cos(($thetaqr - $beta) * D2R);
- my $yqrright = $y2 + $radius * sin(($thetaqr - $beta) * D2R);
- if ($inout eq "internal" and $direction eq "clockwise") {
- $code .= sprintf "\\arrow <1.5mm> [0.5, 1] from %.5f %.5f to %.5f %.5f\n",
- $xqrleft, $yqrleft, $xqr, $yqr;
- }
- elsif ($inout eq "internal" and $direction eq "anticlockwise") {
- $code .= sprintf "\\arrow <1.5mm> [0.5, 1] from %.5f %.5f to %.5f %.5f\n",
- $xqrright, $yqrright, $xqr, $yqr;
- }
- elsif ($inout eq "external" and $direction eq "clockwise") {
- $code .= sprintf "\\arrow <1.5mm> [0.5, 1] from %.5f %.5f to %.5f %.5f\n",
- $xqrleft, $yqrleft, $xqr, $yqr;
- }
- elsif ($inout eq "external" and $direction eq "anticlockwise") {
- $code .= sprintf "\\arrow <1.5mm> [0.5, 1] from %.5f %.5f to %.5f %.5f\n",
- $xqrright, $yqrright, $xqr, $yqr;
- }
- return $code;
- }
-
- sub expr {
- my $lc = $_[0];
- my($left,$op,$right);
-
- $left = term($lc);
- while ($op = addop()) {
- $right = term($lc);
- if ($op eq '+')
- { $left += $right }
- else
- { $left -= $right }
- }
- return $left;
- }
-
- sub addop {
- s/^([+-])// && $1;
- }
-
- sub term {
- my $lc = $_[0];
- my ($left, $op, $right);
- $left = factor($lc);
- while ($op = mulop()) {
- $right = factor($lc);
- if ($op eq '*')
- { $left *= $right }
- elsif ($op =~ /rem/i) {
- eval {$left %= $right};
- PrintFatalError("Division by zero", $lc) if $@;
- }
- else {
- eval {$left /= $right};
- PrintFatalError("Division by zero", $lc) if $@;
- }
- }
- return $left;
- }
-
- sub mulop {
- (s#^([*/])## || s/^(rem)//i) && lc($1);
- }
-
- sub factor {
- my $lc = $_[0];
- my ($left);
-
- $left = primitive($lc);
- if (s/^\*\*//) {
- $left **= factor($lc);
- }
- return $left;
- }
-
- sub primitive {
- my $lc = $_[0];
- my $val;
- s/\s*//;
- if (s/^\(//) { #is it an expr in parentheses
- $val = expr($lc);
- s/^\)// || PrintErrorMessage("Missing right parenthesis", $lc);
- }
- elsif (s/^-//) { # is it a negated primitive
- $val = - primitive();
- }
- elsif (s/^\+//) { # is it a negated primitive
- $val = primitive();
- }
- elsif (s/^angledeg//i) {
- chk_lparen("angledeg",$lc);
- my $point_1 = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
- my $point_2 = get_point($lc);
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point_2});
- my $point_3 = get_point($lc);
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point_3});
- my $d12 = Length($x1, $y1, $x2, $y2);
- my $d23 = Length($x2, $y2, $x3, $y3);
- my $d31 = Length($x3, $y3, $x1, $y1);
- if ( $d12 == 0 ) {
- PrintErrorMessage("points `$point_1' and `$point_2' are the same", $lc);
- $val = 0;
- }
- elsif ( $d23 == 0 ) {
- PrintErrorMessage("points `$point_2' and `$point_3' are the same", $lc);
- $val = 0;
- }
- elsif ( $d31 == 0 ) {
- PrintErrorMessage("points `$point_1' and `$point_3' are the same", $lc);
- $val = 0;
- }
- else {
- $val = Angle($x1, $y1, $x2, $y2, $x3, $y3);
- $val = 0 if $val == -500;
- }
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^angle//i) {
- chk_lparen("angle".$lc);
- my $point_1 = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
- my $point_2 = get_point($lc);
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point_2});
- my $point_3 = get_point($lc);
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point_3});
- my $d12 = Length($x1, $y1, $x2, $y2);
- my $d23 = Length($x2, $y2, $x3, $y3);
- my $d31 = Length($x3, $y3, $x1, $y1);
- if ( $d12 == 0 ) {
- PrintErrorMessage("points `$point_1' and `$point_2' are the same", $lc);
- $val = 0;
- }
- elsif ( $d23 == 0 ) {
- PrintErrorMessage("points `$point_2' and `$point_3' are the same", $lc);
- $val = 0;
- }
- elsif ( $d31 == 0 ) {
- PrintErrorMessage("points `$point_1' and `$point_3' are the same", $lc);
- $val = 0;
- }
- else {
- $val = Angle($x1, $y1, $x2, $y2, $x3, $y3);
- if ($val == -500) {
- $val = 0;
- }
- else {
- $val = D2R * $val;
- }
- }
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^area//i) {
- chk_lparen("angledeg",$lc);
- my $point_1 = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
- my $point_2 = get_point($lc);
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point_2});
- my $point_3 = get_point($lc);
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point_3});
- $val = triangleArea($x1, $y1, $x2, $y2, $x3, $y3);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^asin//i) {
- chk_lparen("asin");
- $val = expr();
- PrintFatalError("Can't take asin of $val", $lc) if $val < -1 || $val > 1;
- $val = asin($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^acos//i) {
- chk_lparen("acos");
- $val = expr();
- PrintFatalError("Can't take acos of $val", $lc) if $val < -1 || $val > 1 ;
- $val = acos($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^atan//i) {
- chk_lparen("atan");
- $val = expr();
- $val = atan($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^cos//i) {
- chk_lparen("cos");
- $val = expr();
- $val = cos($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^directiondeg//i) {
- chk_lparen("directiondeg",$lc);
- my $point_1 = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
- my $point_2 = get_point($lc);
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point_2});
- my $x3 = $x1+1;
- if ( ($y2 - $y1) >= 0) {
- $val = Angle($x3, $y1, $x1, $y1, $x2, $y2);
- $val = 0 if $val == -500;
- }
- else {
- $val = 360 - Angle($x3, $y1, $x1, $y1, $x2, $y2);
- $val = 0 if $val == -500;
- }
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^direction//i) {
- chk_lparen("direction",$lc);
- my $point_1 = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
- my $point_2 = get_point($lc);
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point_2});
- my $x3 = $x1+1;
- if ( ($y2 - $y1) >= 0) {
- $val = Angle($x3, $y1, $x1, $y1, $x2, $y2);
- $val = 0 if $val == -500;
- $val = D2R * $val;
- }
- else {
- $val = 360 - Angle($x3, $y1, $x1, $y1, $x2, $y2);
- $val = 0 if $val == -500;
- $val = D2R * $val;
- }
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^exp//i) {
- chk_lparen("exp");
- $val = expr();
- $val = exp($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^int//i) {
- chk_lparen("int");
- $val = expr();
- $val = int($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^log//i) {
- chk_lparen("log");
- $val = expr();
- PrintFatalError("Can't take log of $val", $lc) if $val <= 0;
- $val = log($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^sin//i) {
- chk_lparen("sin");
- $val = expr();
- $val = sin($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^sgn//i) {
- chk_lparen("sgn");
- $val = expr();
- if ($val > 0) {
- $val = 1;
- }
- elsif ($val == 0) {
- $val = 0;
- }
- else {
- $val = -1;
- }
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^sqrt//i) {
- chk_lparen("sqrt");
- $val = expr();
- $val = sqrt($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^tan//i) {
- chk_lparen("tan");
- $val = expr();
- $val = sin($val)/cos($val);
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^xcoord//i) {
- chk_lparen("xcoord");
- my $point_name = get_point;
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_name});
- $val = $x1;
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^ycoord//i) {
- chk_lparen("ycoord");
- my $point_name = get_point;
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_name});
- $val = $y1;
- chk_rparen("Missing right parenthesis", $lc);
- }
- elsif (s/^_pi_//i) {
- $val = PI;
- }
- elsif (s/^_e_//i) {
- $val = 2.71828182845905;
- }
- elsif (s/^_linethickness_//i) {
- $val = $LineThickness / $xunits;
- }
- else {
- my $err_code;
- ($val,$err_code) = ComputeDist($lc);
- }
- s/\s*//;
- return $val;
- }
-
- sub memberOf {
- my $elem = shift(@_);
-
- my $found = 0;
- foreach $item (@_){
- if ($item eq $elem){
- $found = 1;
- last;
- }
- }
- return $found;
- }
-
- sub tand {
- my $d = $_[0];
- $d = $d * PI / 180;
- return sin($d)/cos($d);
- }
-
- sub get_string {
- my $string = shift;
- my $lc = shift;
-
- $string =~ s/^\s+//;
- if ($string !~ s/^\"//) {
- PrintErrorMessage("No starting \" found",$lc);
- return (1,$string,$string);
- }
- my @ch = split //,$string;
- my @cmd;
- while (@ch and $ch[0] ne "\"") {
- if ($ch[0] eq "\\" and (defined $ch[1]) and $ch[1] eq "\"") {
- shift @ch;
- push @cmd, $ch[0];
- shift @ch;
- }
- else {
- push @cmd, $ch[0];
- shift @ch;
- }
- }
- if (! defined $ch[0]) {
- PrintErrorMessage("No closing \" found",$lc);
- return (1,join("",@cmd), join("",@ch))
- }
- else {
- shift @ch;
- return (0, join("",@cmd), join("",@ch))
- }
- }
-
- sub is_tainted {
- my $arg = shift;
- my $nada = substr($arg,0,0);
- local $@;
- eval { eval "# $nada"};
- return length($@) != 0;
- }
-
- sub noOfDigits {
- my $num = $_[0];
-
- if ($num =~ /^[\+-]?\d+(?!\.)/) {
- return 0;
- }
- elsif ($num =~ /^[\+-]\d+\.(\d+)?/) {
- return length($1);
- }
- }
-
- sub drawsquare {
- my $s = $_[0];
- #$s *= sqrt(2);
- $s = sprintf "%.5f", $s;
- my $code = "\\setlength{\\unitlength}{$xunits}%\n";
- $code .= "\\begin{picture}($s,$s)\\put(0,0)" .
- "{\\framebox($s,$s){}}\\end{picture}";
- return $code;
- }
-
- sub X2sp {
- my $LT = shift;
- my $units = shift;
-
- if ($units eq "pc") {
- return $LT * 786432;
- }
- elsif ($units eq "pt") {
- return $LT * 65536;
- }
- elsif ($units eq "in") {
- return $LT * 4736286.72;
- }
- elsif ($units eq "bp") {
- return $LT * 65781.76;
- }
- elsif ($units eq "cm") {
- return $LT * 1864679.811023622;
- }
- elsif ($units eq "mm") {
- return $LT * 186467.981102362;
- }
- elsif ($units eq "dd") {
- return $LT * 70124.086430424;
- }
- elsif ($units eq "cc") {
- return $LT * 841489.037165082;
- }
- elsif ($units eq "sp") {
- return $LT;
- }
- }
-
-
- sub sp2X {
- my $LT = shift;
- my $units = shift;
-
- if ($units eq "pc") {
- return $LT / 786432;
- }
- elsif ($units eq "pt") {
- return $LT / 65536;
- }
- elsif ($units eq "in") {
- return $LT / 4736286.72;
- }
- elsif ($units eq "bp") {
- return $LT / 65781.76;
- }
- elsif ($units eq "cm") {
- return $LT / 1864679.811023622;
- }
- elsif ($units eq "mm") {
- return $LT / 186467.981102362;
- }
- elsif ($units eq "dd") {
- return $LT / 70124.086430424;
- }
- elsif ($units eq "cc") {
- return $LT / 841489.037165082;
- }
- elsif ($units eq "sp") {
- return $LT;
- }
- }
-
- sub setLineThickness {
- my $Xunits = shift;
- my $LT = shift;
- $Xunits =~ s/^((\+|-)?\d+(\.\d+)?([eE](\+|-)?\d+)?)//;
- my $xlength = "$1";
- $Xunits =~ s/^\s*($units)//;
- my $x_in_units = $1;
- $LT =~ s/^((\+|-)?\d+(\.\d+)?([eE](\+|-)?\d+)?)//;
- my $LTlength = "$1";
- $LT =~ s/^\s*($units)//;
- my $LT_in_units = $1;
- $LTlength = X2sp($LTlength,$LT_in_units);
- $LTlength = sp2X($LTlength,$x_in_units);
- return $LTlength;
- }
-
- sub process_input {
- my ($INFILE,$currInFile) = @_;
- my $lc = 0;
- my $no_output = 0;
- $curr_in_file = $currInFile;
- LINE: while(<$INFILE>) {
- $lc++;
- chomp($command = $_);
- s/^\s+//;
- if (/^beginSkip\s*/i) {
- $no_output = 1;
- print OUT "%%$_" if $comments_on;
- next LINE;
- }
- elsif (/^endSkip\s*/i) {
- if ($no_output == 0) {
- PrintErrorMessage("endSkip without beginSkip",$lc);
- }
- else {
- $no_output = 0;
- }
- print OUT "%%$_" if $comments_on and !$no_output;
- next LINE;
- }
- elsif ($no_output == 1) {
- next LINE;
- }
- else {
- if (/^[^\\]/) {
- my $out_line = mpp($command,$lc) unless /^\\/; #call macro pre-processor
- $_ = "$out_line\n";
- }
-
- if (/^\s*%/)
- {
- print OUT "$_" if $comments_on;
- }
- elsif (s/^\s*(beginloop(?=\W))//i) {
- s/\s+//;
- my $times = expr($lc);
- print OUT "%% BEGINLOOP $times\n" if $comments_on;
- my @C = ();
- REPEATCOMMS: while (<$INFILE>) {
- if (/^\s*endloop/i) {
- last REPEATCOMMS;
- }
- else {
- push @C, $_;
- }
- }
- if (! /^\s*endloop/i) {
- PrintFatalError("unexpected end of file",$lc);
- }
- else {
- s/^\s*endloop//i;
- for(my $i=1; $i<=$times; $i++) {
- tie *DUMMY, 'DummyFH', \@C;
- process_input(DUMMY, $currInFile);
- untie *DUMMY;
- }
- print OUT "%% ENDLOOP\n" if $comments_on;
- }
- }
- elsif (s/^\s*(ArrowShape(?=\W))//i)
- {
- my $cmd = $1;
- print OUT "%% $cmd$_" if $comments_on;
-
- chk_lparen("$cmd",$lc);
- if (s/^default//i) {
- $arrowLength = 2;
- $arrowLengthUnits = "mm";
- $arrowAngleB = 30;
- $arrowAngleC = 40;
- }
- else {
- my ($LocalArrowLength, $LocalArrowAngleB ,$LocalArrowAngleC) = (0,0,0);
- $LocalArrowLength = expr($lc);
- if (s/^\s*($units)//i) {
- $arrowLengthUnits = "$1";
- }
- else {
- $xunits =~ /(\d+(\.\d+)?)\s*($units)/;
- $LocalArrowLength *= $1;
- $arrowLengthUnits = "$3";
- }
- chk_comma($lc);
- $LocalArrowAngleB = expr($lc);
- chk_comma($lc);
- $LocalArrowAngleC = expr($lc);
- $arrowLength = ($LocalArrowLength == 0 ? 2 : $LocalArrowLength);
- $arrowLengthUnits = ($LocalArrowLength == 0 ? "mm" : $arrowLengthUnits);
- $arrowAngleB = ($LocalArrowAngleB == 0 ? 30 : $LocalArrowAngleB);
- $arrowAngleC = ($LocalArrowAngleC == 0 ? 40 : $LocalArrowAngleC);
- }
- chk_rparen("after $cmd arguments",$lc);
- chk_comment("after $cmd command",$lc);
- print OUT "%% arrowLength = $arrowLength$arrowLengthUnits, ",
- "arrowAngleB = $arrowAngleB ",
- "and arrowAngleC = $arrowAngleC\n" if $comments_on;
-
- }
- elsif (s/^\s*(const(?=\W))//i)
- {
- print OUT "%% $1$_" if $comments_on;
- do{
- s/\s*//;
- PrintErrorMessage("no identifier found after token const",$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
- my $Constname = $1;
- my $constname = lc($Constname);
- if (exists $ConstTable{$constname}) {
- PrintErrorMessage("Redefinition of constant $constname",$lc);
- }
- s/\s*//; #remove leading white space
- PrintErrorMessage("did not find expected = sign",$lc)
- if $_ !~ s/^[=]//i;
- my $val = expr($lc);
- $VarTable{$constname} = $val;
- $ConstTable{$constname} = 1;
- print OUT "%% $Constname = $val\n" if $comments_on;
- }while (s/^,//);
- chk_comment($lc);
- s/\s*//;
- if (/^[^%]/) {
- PrintWarningMessage("Trailing text is ignored",$lc);
- }
-
- }
- elsif (s/^\s*(dasharray(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- chk_lparen($cmd,$lc);
- my @DashArray = ();
- my $dash = "";
- my $dashpattern = "";
- PATTERN: while (1) {
- $dash = sprintf("%.5f", expr($lc));
- if (s/^\s*($units)//i) {
- push (@DashArray, "$dash$1");
- }
- else {
- PrintErrorMessage("Did not found unit after expression", $lc);
- }
- s/\s*//;
- if (/^[^,]/) {
- last PATTERN;
- }
- else {
- s/^,\s*//;
- }
- }
- print OUT "\\setdashpattern <";
- while (@DashArray) {
- $dashpattern .= shift @DashArray;
- $dashpattern .= ",";
- }
- $dashpattern =~ s/,$//;
- print OUT $dashpattern, ">\n";
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
-
- }
- elsif (s/^\s*(drawAngleArc(?=\W))//i or s/^\s*(drawAngleArrow(?=\W))//i )
- {
- my $cmd = $1;
- print OUT "%% $cmd$_" if $comments_on;
-
- chk_lcb($cmd,$lc);
- my ($P1, $P2, $P3);
- if (s/^angle(?=\W)//i) {
- chk_lparen("token angle of command $cmd",$lc);
- $P1 = get_point($lc);
- next LINE if $P1 eq "_undef_";
- $P2 = get_point($lc);
- next LINE if $P2 eq "_undef_";
- $P3 = get_point($lc);
- next LINE if $P3 eq "_undef_";
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$P1});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$P2});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$P3});
- my $Angle = Angle($x1, $y1, $x2, $y2, $x3, $y3);
- if ($Angle <= 0) {
- if ($Angle == 0) {
- PrintErrorMessage("Angle is equal to zero",$lc);
- next LINE;
- }
- elsif ($Angle < -400) {
- PrintErrorMessage("Something is wrong with the points",$lc);
- next LINE;
- }
- }
- chk_rparen("angle part of command $cmd",$lc);
- }
- else {
- PrintErrorMessage("Did not find expected angle part",$lc);
- next LINE;
- }
-
- s/^,\s*// or s/\s*//; #parse optional comma
-
- my $radius;
- if (s/^radius(?=\W)//i) {
- chk_lparen("token radius of command $cmd",$lc);
- $radius = expr($lc);
- chk_rparen("radius part of command $cmd",$lc);
- }
- else {
- PrintErrorMessage("Did not found expected angle part",$lc);
- next LINE;
- }
-
- s/^,\s*// or s/\s*//; #parse optional comma
- my $inout = "";
- if (s/^(internal(?=\W))//i or s/^(external(?=\W))//i) {
- $inout = $1;
- }
- else {
- PrintErrorMessage("Did not find expected 'internal' specifier", $lc);
- next LINE;
- }
- s/^,\s*// or s/\s*//; #parse optional comma
- my $direction = "";
- if (s/^(clockwise(?=\W))//i or s/^(anticlockwise(?=\W))//i) {
- $direction = $1;
- }
- else {
- PrintErrorMessage("Did not find expected 'direction' specifier", $lc);
- next LINE;
- }
- chk_rcb("arguments of $cmd",$lc);
- chk_comment($lc);
- my $code;
- if (lc($cmd) eq "drawanglearc") {
- $code = drawAngleArc($P1, $P2, $P3, $radius, $inout, $direction);
- }
- else {
- $code = drawAngleArrow($P1, $P2, $P3, $radius, $inout, $direction);
- }
- print OUT $code if $code ne "";
-
- }
- elsif (s/^\s*(drawArrow(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- DrawLineOrArrow(0,$lc);
- }
- elsif (s/^\s*(drawcircle(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- chk_lparen("drawcircle",$lc);
- my $Point = get_point($lc);
- next LINE if $Point eq "_undef_";
- chk_comma($lc);
- my $R = expr($lc);
- if ($R <= 0) {
- PrintErrorMessage("Radius must be greater than zero",$lc);
- next LINE;
- }
- my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{lc($Point)});
- printf OUT "\\circulararc 360 degrees from %.5f %.5f center at %.5f %.5f\n",
- $x+$R, $y, $x, $y;
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
-
- }
- elsif (s/^\s*(drawcurve(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- DrawLineOrArrow(2,$lc);
- }
- elsif (s/^\s*(drawcircumcircle(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- chk_lparen("drawcircumcircle",$lc);
- my $point1 = get_point($lc);
- next LINE if $point1 eq "_undef_";
- my $point2 = get_point($lc);
- next LINE if $point2 eq "_undef_";
- my $point3 = get_point($lc);
- next LINE if $point3 eq "_undef_";
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point1});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point2});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point3});
- my ($xc, $yc,$r) = circumCircleCenter($x1,$y1,$x2,$y2,$x3,$y3,$lc);
- next LINE if $xc == 0 and $yc == 0 and $r == 0;
- print OUT "%% circumcircle center = ($xc,$yc), radius = $r\n" if $comments_on;
- printf OUT "\\circulararc 360 degrees from %.5f %.5f center at %.5f %.5f\n",
- $xc+$r, $yc, $xc, $yc;
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
-
- }
- elsif (s/^\s*(drawexcircle(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- chk_lparen("drawexcircle",$lc);
- my $point1 = get_point($lc);
- next LINE if $point1 eq "_undef_";
- my $point2 = get_point($lc);
- next LINE if $point2 eq "_undef_";
- my $point3 = get_point($lc);
- next LINE if $point3 eq "_undef_";
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point1});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point2});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point3});
- if (triangleArea($x1, $y1, $x2, $y2, $x3, $y3) < 0.0001) {
- PrintErrorMessage("Area of triangle is zero!",$lc);
- next LINE;
- }
- chk_comma($lc);
- my $point4 = get_point($lc);
- if (!memberOf($point4, $point1, $point2, $point3)) {
- PrintErrorMessage("Current point isn't a side point",$lc);
- next LINE;
- }
- next LINE if $point4 eq "_undef_";
- my $point5 = get_point($lc);
- next LINE if $point5 eq "_undef_";
- if (!memberOf($point5, $point1, $point2, $point3)) {
- PrintErrorMessage("Current point isn't a side point",$lc);
- next LINE;
- }
- if ($point4 eq $point5) {
- PrintErrorMessage("Side points are identical",$lc);
- next LINE;
- }
- chk_rparen("arguments of $cmd",$lc);
- my ($xc, $yc, $r) = excircle($point1, $point2, $point3,
- $point4, $point5);
- my $R=$r;
- if (s/^\s*\[\s*//) {
- $R += expr($lc);
- if ($R < 0.0001) {
- PrintErrorMessage("Radius has become equal to zero!",$lc);
- next LINE;
- }
- chk_rsb($lc);
- }
- if ($R > (500 / 2.845)) {
- PrintErrorMessage("Radius is greater than 175mm!",$lc);
- next LINE;
- }
- print OUT "%% excircle center = ($xc,$yc) radius = $R\n" if $comments_on;
- printf OUT "\\circulararc 360 degrees from %.5f %.5f center at %.5f %.5f\n",
- $xc+$R, $yc, $xc, $yc;
- chk_comment($lc);
-
- }
- elsif (s/^\s*(drawincircle(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- chk_lparen("drawincircle",$lc);
- my $point1 = get_point($lc);
- next LINE if $point1 eq "_undef_";
- my $point2 = get_point($lc);
- next LINE if $point2 eq "_undef_";
- my $point3 = get_point($lc);
- next LINE if $point3 eq "_undef_";
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point1});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point2});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point3});
- if (triangleArea($x1, $y1, $x2, $y2, $x3, $y3) < 0.0001) {
- PrintErrorMessage("Area of triangle is zero!",$lc);
- next LINE;
- }
- my ($xc, $yc, $r) = IncircleCenter($x1,$y1,$x2,$y2,$x3,$y3);
- my $R=$r;
- if (s/^\s*\[\s*//) {
- $R += expr($lc);
- if ($R < 0.0001) {
- PrintErrorMessage("Radius has become equal to zero!",$lc);
- next LINE;
- }
- chk_rsb($lc);
- }
- if ($R > (500 / 2.845)) {
- PrintErrorMessage("Radius is greater than 175mm!",$lc);
- next LINE;
- }
- print OUT "%% incircle center = ($xc,$yc) radius = $R\n" if $comments_on;
- printf OUT "\\circulararc 360 degrees from %.5f %.5f center at %.5f %.5f\n",
- $xc+$R, $yc, $xc, $yc;
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
-
- }
- elsif (s/^\s*(drawline(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- DrawLineOrArrow(1,$lc);
- }
- elsif (s/^\s*(drawthickarrow(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- print OUT "\\setplotsymbol ({\\usefont{OT1}{cmr}{m}{n}\\large .})%\n";
- print OUT "{\\setbox1=\\hbox{\\usefont{OT1}{cmr}{m}{n}\\large .}%\n";
- print OUT " \\global\\linethickness=0.31\\wd1}%\n";
- DrawLineOrArrow(0,$lc);
- print OUT "\\setlength{\\linethickness}{0.4pt}%\n";
- print OUT "\\setplotsymbol ({\\usefont{OT1}{cmr}{m}{n}\\tiny .})%\n";
- }
- elsif (s/^\s*(drawthickline(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- print OUT "\\setplotsymbol ({\\usefont{OT1}{cmr}{m}{n}\\large .})%\n";
- print OUT "{\\setbox1=\\hbox{\\usefont{OT1}{cmr}{m}{n}\\large .}%\n";
- print OUT " \\global\\linethickness=0.31\\wd1}%\n";
- DrawLineOrArrow(1,$lc);
- print OUT "\\setlength{\\linethickness}{0.4pt}%\n";
- print OUT "\\setplotsymbol ({\\usefont{OT1}{cmr}{m}{n}\\tiny .})%\n";
- }
- elsif (s/^\s*(drawperpendicular(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
-
- chk_lparen($cmd,$lc);
- my $A = get_point($lc);
- next LINE if $A eq "_undef_";
- chk_comma($lc);
- my $B = get_point($lc);
- next LINE if $A eq "_undef_";
- s/\s*//; #ignore white space
- my $C = get_point($lc);
- next LINE if $A eq "_undef_";
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
- #
- #start actual computation
- #
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$A});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$B});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$C});
- my ($xF, $yF) = perpendicular($x1, $y1, $x2, $y2, $x3, $y3);
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $x1, $y1, $xF, $yF;
-
- }
- elsif (s/^\s*(drawpoint(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- my ($stacklen);
- chk_lparen("$cmd",$lc);
- if (/^\)/) {
- PrintErrorMessage("There are no point to draw",$lc);
- next LINE;
- }
- my(@PP);
- DRAWPOINTS:while(1) {
- if (s/^([^\W\d_]\d{0,3})//i) { #point name
- $P = $1;
- if (!exists($PointTable{lc($P)})) {
- PrintErrorMessage("Undefined point $P",$lc);
- next DRAWPOINTS;
- }
- else {
- push (@PP,$P);
- s/\s*//;
- }
- }
- else {
- last DRAWPOINTS;
- }
- }
- drawpoints(@PP);
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
-
- }
- elsif (s/^\s*(drawRightAngle(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
-
- chk_lparen("drawRightAngle",lc);
- my $point1 = get_point($lc);
- next LINE if $point1 eq "_undef_";
- my $point2 = get_point($lc);
- next LINE if $point2 eq "_undef_";
- my $point3 = get_point($lc);
- next LINE if $point3 eq "_undef_";
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point1});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point2});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point3});
- chk_comma($lc);
- my $dist = expr($lc);
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
- #
- #actual computation
- #
- my $lengthAC = Length($x1, $y1, $x3, $y3);
- my $angleBAC = Angle($x2, $y2, $x1, $y1, $x3, $y3);
- my $line1 = $lengthAC / (1 + tand($angleBAC));
- #
- # determine coordinates of point Q
- #
- my ($xQ, $yQ) = pointOnLine($x1, $y1, $x3, $y3, $line1);
- #
- # determine coordinates of point S
- #
- my $deltax = $xQ - $x2;
- my $deltay = $yQ - $y2;
- my $lengthBQ = sqrt($deltax * $deltax + $deltay * $deltay);
- my $xS = $x2 + ($dist * sqrt(2) * $deltax / $lengthBQ);
- my $yS = $y2 + ($dist * sqrt(2) * $deltay / $lengthBQ);
- #
- # determine coordinates of points S1 and S2
- #
- my ($xS1, $yS1) = pointOnLine($x2, $y2, $x3, $y3, $dist);
- ($xS2, $yS2) = ($xS, $yS);
- #
- # emit PiCTeX code
- #
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $xS1, $yS1, $xS2, $yS2;
- ($xS1, $yS1) = pointOnLine($x2, $y2, $x1, $y1, $dist);
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $xS1, $yS1, $xS2, $yS2;
-
- }
- elsif (s/^\s*(drawsquare(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- chk_lparen("drawSquare",$lc);
- my $p = get_point($lc);
- chk_comma($lc);
- my $side = expr($lc);
- $side = $side - (1.1 * $LineThickness/$xunits); #Suggested by RWDN
- my ($x,$y,$pSV,$pS) = unpack("d3A*",$PointTable{$p});
- printf OUT "\\put {%s} at %.5f %.5f %%drawsquare\n", drawsquare($side), $x, $y;
- chk_rparen("arguments of $cmd",$lc);
- chk_comment($lc);
-
- }
- elsif (s/^\s*inputfile\*//i)
- {
- chk_lparen("inputfile*",$lc);
- my $row_in = "";
- if (s/^((\w|-|\.)+)//) {
- $row_in = $1;
- }
- else {
- PrintErrorMessage("No input file name found",$lc);
- next LINE;
- }
- if (!(-e $row_in)) {
- PrintErrorMessage("File $row_in does not exist",$lc);
- next LINE;
- }
- open(ROW, "$row_in")|| die "Can't open file $row_in\n";
- while (defined($in_line=<ROW>)) { print OUT $in_line; }
- print OUT "%% ... end of input file <$row_in>\n";
- close ROW;
- chk_rparen("input file name",$lc);
- chk_comment($lc);
-
-
- }
- elsif (s/^\s*(inputfile(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
-
- chk_lparen("inputfile",$lc);
- my $comm_in = "";
- if (s/^((\w|-|\.)+)//) {
- $comm_in = $1;
- }
- else {
- PrintErrorMessage("No input file name found",$lc);
- next LINE;
- }
- if (!(-e $comm_in)) {
- PrintErrorMessage("File $comm_in does not exist",$lc);
- next LINE;
- }
- chk_rparen("input file name",$lc);
- my $input_times = 1; #default value
- if (s/^\[//) {
- $input_times = expr($lc);
- chk_rsb("optional argument",$lc);
- }
- print OUT "%% ... start of file <$comm_in> loop [$input_times]\n";
- for (my $i=0; $i<int($input_times); $i++) {
- open(COMM,"$comm_in") or die "Can't open file $comm_in\n";
- print OUT "%%% Iteration number: ",$i+1,"\n";
- my $old_file_name = $curr_in_file;
- process_input(COMM,"File $comm_in, ");
- $curr_in_file = $old_file_name;
- close COMM;
- }
- print OUT "%% ... end of file <$comm_in> loop [$input_times]\n";
- chk_comment($lc);
-
- }
- elsif (s/^\s*(linethickness(?=\W))//i)
- {
- my $cmd = $1;
- print OUT "%% $cmd$_" if $comments_on;
- chk_lparen("linethickness", $lc);
- if (s/^default//i) {
- print OUT "\\linethickness=0.4pt\\Linethickness{0.4pt}%%\n";
- print OUT "\\setplotsymbol ({\\usefont{OT1}{cmr}{m}{n}\\tiny .})%\n";
- $LineThickness = setLineThickness($xunits,"0.4pt");
- }
- else {
- my $length = expr($lc);
- if (s/^\s*($units)//i) {
- my $units = $1;
- printf OUT "\\linethickness=%.5f%s\\Linethickness{%.5f%s}%%\n",
- $length, $units, $length, $units;
- $LineThickness = setLineThickness($xunits,"$length$units");
- my $mag;
- if ($units eq "pc") {
- $mag = $length * 12;
- }
- elsif ($units eq "in") {
- $mag = $length * 72.27;
- }
- elsif ($units eq "bp") {
- $mag = $length * 1.00375;
- }
- elsif ($units eq "cm") {
- $mag = $length * 28.45275;
- }
- elsif ($units eq "mm") {
- $mag = $length * 2.845275;
- }
- elsif ($units eq "dd") {
- $mag = $length * 1.07001;
- }
- elsif ($units eq "cc") {
- $mag = $length * 0.08917;
- }
- elsif ($units eq "sp") {
- $mag = $length * 0.000015259;
- }
- elsif ($units eq "pt") {
- $mag = $length;
- }
- $mag = 10 * $mag / 1.00278219;
- printf OUT "\\font\\CM=cmr10 at %.5fpt%%\n", $mag;
- print OUT "\\setplotsymbol ({\\CM .})%\n";
- }
- else {
- PrintErrorMessage("Did not found expect units part",$lc);
- }
- }
- chk_rparen("linethickness", $lc);
- chk_comment($lc);
-
-
- }
- elsif (s/^\s*(paper(?=\W))//i)
- {
- my ($cmd) = $1;
- print OUT "%% $cmd$_" if $comments_on;
- chk_lcb("paper", $lc);
- if (s/^units(?=\W)//i)
- {
-
- chk_lparen("units",$lc);
- if(s/^\)//)
- {
- PrintWarningMessage("Missing value in \"units\"--default is 1pt",
- $lc);
- $xunits = "1pt";
- }
- else {
- $xunits = expr($lc);
- s/\s*//;
- if (s/^($units)//i) {
- $xunits .= "$1";
- $LineThickness = setLineThickness($xunits,"0.4pt");
- }
- elsif(s/^(\w)+//i) {
- PrintErrorMessage("$1 is not a valid mathspic unit",$lc);
- $xunits = "1pt";
- }
- else {
- PrintErrorMessage("No x-units found",$lc);
- $xunits = "1pt";
- }
- s/\s*//; #ignore white space
- if (s/^,//) { # there is a comma so expect an y-units
- s/\s*//; #ignore white space
- $yunits = expr($lc);
- s/\s*//; #ignore white space
- if (s/^($units)//i) {
- $yunits .= "$1";
- }
- elsif(s/^(\w)+//i) {
- PrintErrorMessage("$1 is not a valid mathspic unit",$lc);
- $yunits = "1pt";
- }
- else {
- PrintErrorMessage("No y-units found",$lc);
- $yunits = $xunits;
- }
- }
- else {
- $yunits = $xunits;
- }
- chk_rparen("units",$lc);
- }
-
- $nounits = 0;
- }
- else
- {
- $nounits = 1;
- }
- s/^,\s*// or s/\s*//;
- if (s/^xrange//i)
- {
-
- chk_lparen("xrange",$lc);
- my $ec;
- ($xlow,$ec) = ComputeDist($lc);
- next LINE if $ec == 0;
- chk_comma($lc);
- ($xhigh,$ec) = ComputeDist($lc);
- next LINE if $ec == 0;
- if ($xlow >= $xhigh)
- {
- PrintErrorMessage("xlow >= xhigh in xrange",$lc);
- next LINE;
- }
- chk_rparen("$xhigh",$lc);
-
- $noxrange = 0;
- }
- else
- {
- $noxrange = 1;
- }
- s/^,\s*// or s/\s*//;
- if (s/^yrange//i)
- {
-
- chk_lparen("yrange",$lc);
- my $ec;
- ($ylow,$ec) = ComputeDist($lc);
- next LINE if $ec == 0;
- chk_comma($lc);
- ($yhigh,$ec) = ComputeDist($lc);
- next LINE if $ec == 0;
- if ($ylow >= $yhigh)
- {
- PrintErrorMessage("ylow >= yhigh in yrange",$lc);
- next LINE;
- }
- chk_rparen("$yhigh",$lc);
-
- $noyrange = 0;
- }
- else
- {
- $noyrange = 1;
- }
-
- if (!$nounits)
- {
- printf OUT "\\setcoordinatesystem units <%s,%s>\n",
- $xunits,$yunits;
- }
- if(!$noxrange && !$noyrange)
- {
- printf OUT "\\setplotarea x from %.5f to %.5f, y from %.5f to %.5f\n",
- $xlow, $xhigh, $ylow, $yhigh;
-
- }
-
- s/^,\s*// or s/\s*//;
- $axis = "";
- if (s/^ax[ei]s(?=\W)//i)
- {
-
- chk_lparen("axis",$lc);
- while(/^[^\)]/)
- {
- if (s/^([lrtbxy]{1}\*?)//i)
- {
- $axis .= $1;
- }
- elsif (s/^([^lrtbxy])//i)
- {
- PrintErrorMessage("Non-valid character \"$1\" in axis()",$lc);
- }
- s/\s*//;
- }
- chk_rparen("axis(arguments",$lc);
-
- }
- $axis = uc($axis);
- s/^,\s*// or s/\s*//;
- if (s/^ticks(?=\W)//i)
- {
- chk_lparen("ticks",$lc);
- my $ec;
- ($xticks,$ec) = ComputeDist($lc);
- next LINE if $ec == 0;
- chk_comma($lc);
- ($yticks,$ec) = ComputeDist($lc);
- next LINE if $ec == 0;
- chk_rparen("ticks(arguments",$lc);
-
- }
- else
- {
- $xticks = $yticks = 0;
- }
- chk_rcb("paper", $lc);
- YBRANCH: {
- if (index($axis, "Y")>-1)
- {
- if (index($axis, "Y*")>-1)
- {
- print OUT "\\axis left shiftedto x=0 / \n";
- last YBRANCH;
- }
- if ($yticks > 0)
- {
- if (index($axis, "T")>-1 && index($axis, "B")==-1)
- {
- print OUT "\\axis left shiftedto x=0 ticks numbered from ";
- print OUT "$ylow to -$yticks by $yticks\n from $yticks to ";
- print OUT $yhigh-$yticks," by $yticks /\n";
- }
- elsif (index($axis, "T")==-1 && index($axis, "B")>-1)
- {
- print OUT "\\axis left shiftedto x=0 ticks numbered from ";
- print OUT $ylow+$yticks," to -$yticks by $yticks\n from ";
- print OUT "$yticks to $yhigh by $yticks /\n";
- }
- elsif (index($axis, "T")>-1 && index($axis, "B")>-1)
- {
- print OUT "\\axis left shiftedto x=0 ticks numbered from ";
- print OUT $ylow+$yticks," to -$yticks by $yticks\n from ";
- print OUT "$yticks to ",$yhigh-$yticks," by $yticks /\n";
- }
- else
- {
- print OUT "\\axis left shiftedto x=0 ticks numbered from ";
- print OUT "$ylow to -$yticks by $yticks\n from ";
- print OUT "$yticks to $yhigh by $yticks /\n";
- }
- }
- else
- {
- print OUT "\\axis left shiftedto x=0 /\n";
- }
- }
- }
- XBRANCH: { if (index($axis, "X")>-1)
- {
- if (index($axis, "X*")>-1)
- {
- print OUT "\\axis bottom shiftedto y=0 /\n";
- last XBRANCH;
- }
- if ($xticks > 0)
- {
- if (index($axis, "L")>-1 && index($axis, "R")==1)
- {
- print OUT "\\axis bottom shiftedto y=0 ticks numbered from ";
- print OUT $xlow + $xticks," to -$xticks by $xticks\n from";
- print OUT " $xticks to $xhigh by $xticks /\n";
- }
- elsif (index($axis, "L")==-1 && index($axis, "R")>-1)
- {
- print OUT "\\axis bottom shiftedto y=0 ticks numbered from ";
- print OUT "$xlow to -$xticks by $xticks\n from ";
- print OUT "$xticks to ",$xhigh-$xticks," by $xticks /\n";
- }
- elsif (index($axis, "L")>-1 && index($axis, "R")>-1)
- {
- print OUT "\\axis bottom shiftedto y=0 ticks numbered from ";
- print OUT $xlow + $xticks," to -$xticks by $xticks\n from ";
- print OUT "$xticks to ",$xhigh - $xticks," by $xticks /\n";
- }
- else
- {
- print OUT "\\axis bottom shiftedto y=0 ticks numbered from ";
- print OUT "$xlow to -$xticks by $xticks\n from ";
- print OUT "$xticks to $xhigh by $xticks /\n";
- }
- }
- else
- {
- print OUT "\\axis bottom shiftedto y=0 /\n";
- }
- } }
- LBRANCH: {if (index($axis, "L")>-1)
- {
- if (index($axis, "L")>-1)
- {
- if (index($axis, "L*")>-1)
- {
- print OUT "\\axis left /\n";
- last LBRANCH;
- }
- if ($yticks > 0)
- {
- print OUT "\\axis left ticks numbered from ";
- print OUT "$ylow to $yhigh by $yticks /\n";
- }
- else
- {
- print OUT "\\axis left /\n";
- }
- }
- } }
- RBRANCH: { if (index($axis, "R")>-1)
- {
- if (index($axis, "R*")>-1)
- {
- print OUT "\\axis right /\n";
- last RBRANCH;
- }
- if ($yticks > 0)
- {
- print OUT "\\axis right ticks numbered from $ylow to $yhigh by ";
- print OUT "$yticks /\n";
- }
- else
- {
- print OUT "\\axis right /\n";
- }
- } }
- TBRANCH: { if (index($axis, "T")>-1)
- {
- if (index($axis, "T*")>-1)
- {
- print OUT "\\axis top /\n";
- last TBRANCH;
- }
- if ($xticks > 0)
- {
- print OUT "\\axis top ticks numbered from $xlow to $xhigh by ";
- print OUT "$xticks /\n";
- }
- else
- {
- print OUT "\\axis top /\n";
- }
- } }
- BBRANCH: { if (index($axis, "B")>-1)
- {
- if (index($axis, "B*")>-1)
- {
- print OUT "\\axis bottom /\n";
- last BBRANCH;
- }
- if ($xticks > 0)
- {
- print OUT "\\axis bottom ticks numbered from $xlow to $xhigh by ";
- print OUT "$xticks /\n";
- }
- else
- {
- print OUT "\\axis bottom /\n";
- }
- } }
-
-
- chk_comment($lc);
-
- }
- elsif (s/^\s*(PointSymbol(?=\W))//i)
- {
- my $cmd = $1;
- print OUT "%% $cmd$_" if $comments_on;
-
- chk_lparen("$cmd",$lc);
- if (s/^default//i) #default point symbol
- {
- $defaultsymbol = "\$\\bullet\$";
- }
- elsif (s/^(circle|square)//i) {
- $defaultsymbol = $1;
- chk_lparen($defaultsymbol, $lc);
- $GlobalDimOfPoints = expr($lc);
- chk_rparen("expression", $lc);
- }
- elsif (s/^(((\\,){1}|(\\\)){1}|(\\\s){1}|[^\),\s])+)//) #arbitrary LaTeX point
- {
- $defaultsymbol = $1;
- $defaultsymbol=~ s/\\\)/\)/g;
- $defaultsymbol=~ s/\\,/,/g;
- $defaultsymbol=~ s/\\ / /g;
- }
- else
- {
- PrintErrorMessage("unrecognized point symbol",$lc);
- }
- if (s/\s*,\s*//) {
- $defaultLFradius = expr($lc);
- }
- chk_rparen("after $cmd arguments",$lc);
- chk_comment("after $cmd command",$lc);
-
- }
- elsif (s/^\s*point(?=\W)//i)
- {
- my ($Point_Line);
- chomp($Point_Line=$_);
- my ($pointStar, $PointName, $origPN);
- $pointStar = 0; # default value: he have a point command
- $pointStar = 1 if s/^\*//;
- chk_lparen("point" . (($pointStar)?"*":""),$lc);
- if (s/^([^\W\d_](?![^\W\d_])\d{0,3})//i) {
- #
- # Note: the regular expression (foo)(?!bar) means that we are
- # looking a foo not followed by a bar. Moreover, the regular
- # expression [^\W\d_] means that we are looking for letter.
- #
- $origPN = $1;
- $PointName = lc($1);
- }
- else {
- PrintErrorMessage("Invalid point name",$lc);
- next LINE;
- }
- #if ($pointStar and !exists($PointTable{$PointName})) {
- # PrintWarningMessage("Point $origPN has not been defined",$lc);
- #}
- if (!$pointStar and exists($PointTable{$PointName})) {
- PrintWarningMessage("Point $origPN has been used already",$lc);
- }
- chk_rparen("point" . (($pointStar)?"*":""). "($origPN",$lc);
- chk_lcb("point" . (($pointStar)?"*":""). "($origPN)",$lc);
- my ($Px, $Py);
- if (s/^perpendicular(?=\W)//i) {
- chk_lparen("perpendicular",$lc);
- my $FirstPoint = &get_point($lc);
- next LINE if $FirstPoint eq "_undef_";
- chk_comma($lc);
- my $SecondPoint = &get_point($lc);
- next LINE if $SecondPoint eq "_undef_";
- my $ThirdPoint = &get_point($lc);
- next LINE if $ThirdPoint eq "_undef_";
- chk_rparen("No closing parenthesis found",$lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$ThirdPoint});
- ($Px, $Py) = perpendicular($x1,$y1,$x2,$y2,$x3,$y3);
-
- }
- elsif (s/^intersection(?=\W)//i) {
- chk_lparen("intersection",$lc);
- my $FirstPoint = get_point($lc);
- next LINE if $FirstPoint eq "_undef_";
- my $SecondPoint = get_point($lc);
- next LINE if $SecondPoint eq "_undef_";
- chk_comma($lc);
- my $ThirdPoint = get_point($lc);
- next LINE if $ThirdPoint eq "_undef_";
- my $ForthPoint = get_point($lc);
- next LINE if $ForthPoint eq "_undef_";
- chk_rparen("No closing parenthesis found",$lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$ThirdPoint});
- my ($x4,$y4,$pSV4,$pS4)=unpack("d3A*",$PointTable{$ForthPoint});
- ($Px, $Py) = intersection4points($x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4);
-
-
- }
- elsif (s/^midpoint(?=\W)//i) {
- chk_lparen("midpoint",$lc);
- my $FirstPoint = &get_point($lc);
- next LINE if $FirstPoint eq "_undef_";
- my $SecondPoint = &get_point($lc);
- next LINE if $SecondPoint eq "_undef_";
- chk_rparen("No closing parenthesis found",$lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- $Px = $x1 + ($x2 - $x1)/2;
- $Py = $y1 + ($y2 - $y1)/2;
-
- }
- elsif (s/^pointonline(?=\W)//i) {
- chk_lparen("pointonline",$lc);
- my $FirstPoint = &get_point($lc);
- next LINE if $FirstPoint eq "_undef_";
- my $SecondPoint = &get_point($lc);
- next LINE if $SecondPoint eq "_undef_";
- chk_comma($lc);
- # now get the distance
- my $distance = expr($lc);
- chk_rparen("No closing parenthesis found",$lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- ($Px, $Py) = pointOnLine($x1,$y1,$x2,$y2,$distance);
-
- }
- elsif (s/^circumcircleCenter(?=\W)//i) {
- chk_lparen("circumCircleCenter",$lc);
- my $FirstPoint = &get_point($lc);
- next LINE if $FirstPoint eq "_undef_";
- my $SecondPoint = &get_point($lc);
- next LINE if $SecondPoint eq "_undef_";
- my $ThirdPoint = &get_point($lc);
- next LINE if $ThirdPoint eq "_undef_";
- chk_rparen("No closing parenthesis found",$lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$ThirdPoint});
- ($Px, $Py,$r) = &circumCircleCenter($x1,$y1,$x2,$y2,$x3,$y3,$lc);
- next LINE if $Px == 0 and $Py == 0 and $r == 0;
-
- }
- elsif (s/^IncircleCenter(?=\W)//i) {
- chk_lparen("IncircleCenter",$lc);
- my $FirstPoint = &get_point($lc);
- next LINE if $FirstPoint eq "_undef_";
- my $SecondPoint = &get_point($lc);
- next LINE if $SecondPoint eq "_undef_";
- my $ThirdPoint = &get_point($lc);
- next LINE if $ThirdPoint eq "_undef_";
- chk_rparen("No closing parenthesis found",$lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$ThirdPoint});
- ($Px, $Py, $r) = IncircleCenter($x1,$y1,$x2,$y2,$x3,$y3);
-
- }
- elsif (s/^ExcircleCenter(?=\W)//i) {
- chk_lparen("ExcircleCenter",$lc);
- my $PointA = get_point($lc);
- next LINE if $PointA eq "_undef_";
- my $PointB = get_point($lc);
- next LINE if $PointB eq "_undef_";
- my $PointC = get_point($lc);
- next LINE if $PointC eq "_undef_";
- chk_comma($lc);
- my $PointD = &get_point($lc);
- next LINE if $PointD eq "_undef_";
- if (!memberOf($PointD, $PointA, $PointB, $PointC)) {
- PrintErrorMessage("Current point isn't a side point",$lc);
- next LINE;
- }
- my $PointE = get_point($lc);
- next LINE if $PointE eq "_undef_";
- if (!memberOf($PointE, $PointA, $PointB, $PointC)) {
- PrintErrorMessage("Current point isn't a side point",$lc);
- next LINE;
- }
- if ($PointD eq $PointE) {
- PrintErrorMessage("Side points are identical",$lc);
- next LINE;
- }
- ($Px, $Py, $r) = excircle($PointA, $PointB, $PointC,
- $PointD, $PointE);
- chk_rparen("after coordinates part",$lc);
-
- }
- elsif (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
- m/^([^\W\d_]\d{0,3})\s*/i;
- if (exists($PointTable{lc($1)})) {
- my $Tcoord = get_point($lc);
- my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{$Tcoord});
- $Px = $x;
- $Py = $y;
- }
- else {
- $Px = expr();
- chk_comma($lc);
- $Py = expr();
- }
- }
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar|rotate|vector/i) { #a point?
- s/^([^\W\d_]\d{0,3})//i;
- my $PointA = $1;
- if (exists($PointTable{lc($PointA)})) {
- s/\s*//;
- if (s/^,//) {
- s/\s*//;
- if (s/^shift(?=\W)//i) {
-
- chk_lparen("shift",$lc);
- my $dist1 = expr($lc);
- chk_comma($lc);
- my $dist2 = expr($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{lc($PointA)});
- $Px = $x1 + $dist1;
- $Py = $y1 + $dist2;
- chk_rparen("shift part",$lc);
-
- }
- elsif (s/^polar(?=\W)//i) {
- chk_lparen("polar",$lc);
- my ($R1, $Theta1);
- $R1 = expr($lc);
- chk_comma($lc);
- $Theta1 = expr($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{lc($PointA)});
- s/\s*//;
- if (s/^rad(?=\W)//i) {
- # do nothing!
- }
- elsif (s/^deg(?=\W)//i) {
- $Theta1 = $Theta1 * PI / 180;
- }
- else {
- #$Theta1 = $Theta1 * PI / 180;
- }
- $Px = $x1 + $R1 * cos($Theta1);
- $Py = $y1 + $R1 * sin($Theta1);
- chk_rparen("after polar part",$lc);
-
- }
- elsif (s/^rotate(?=\W)//i) {
- chk_lparen("rotate",$lc);
- my $Q = lc($PointA);
- my $P = get_point($lc);
- next LINE if $P eq "_undef_";
- chk_comma($lc);
- my $Theta1 = expr($lc);
- my ($xP,$yP,$pSV1,$pS1)=unpack("d3A*",$PointTable{$P});
- my ($xQ,$yQ,$pSV2,$pS2)=unpack("d3A*",$PointTable{$Q});
- s/\s*//;
- if (s/^rad(?=\W)//i)
- {
- # do nothing!
- }
- elsif (s/^deg(?=\W)//i)
- {
- $Theta1 = $Theta1 * PI / 180;
- }
- else
- {
- $Theta1 = $Theta1 * PI / 180;
- }
- # shift origin to P
- $xQ -= $xP;
- $yQ -= $yP;
- # do the rotation
- $Px = $xQ * cos($Theta1) - $yQ * sin($Theta1);
- $Py = $xQ * sin($Theta1) + $yQ * cos($Theta1);
- # return origin back to original origin
- $Px += $xP;
- $Py += $yP;
- chk_rparen("after rotate part",$lc);
-
- }
- elsif (s/^vector(?=\W)//i) {
- chk_lparen("vector",$lc);
- my ($x0,$y0,$pSV0,$pS0) = unpack("d3A*",$PointTable{lc($PointA)});
- my $P = get_point($lc);
- my $Q = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1) = unpack("d3A*",$PointTable{$P});
- my ($x2,$y2,$pSV2,$pS2) = unpack("d3A*",$PointTable{$Q});
- $Px = $x0 + $x2 - $x1;
- $Py = $y0 + $y2 - $y1;
- chk_rparen("vector part",$lc);
-
-
- }
- else {
- PrintErrorMessage("unexpected token",$lc);
- next LINE;
- }
- }
- else {
- my ($xA,$yA,$pSVA,$pSA)=unpack("d3A*",$PointTable{lc($PointA)});
- $Px = $xA;
- $Py = $yA;
- }
- }
- else {
- PrintErrorMessage("Undefined point $PointA",$lc);
- next LINE;
- }
- }
- else {
- $Px = expr();
- chk_comma($lc);
- $Py = expr();
- }
-
- chk_rcb("coordinates part",$lc);
- my $sv = $defaultsymbol;
- my $sh = $defaultLFradius;
- my $side_or_radius = undef;
- if (s/^\[\s*//) { # the user has opted to specify the optional part
- if (/^(symbol|radius|side)\s*/i) {
- my @previous_options = ();
- my $number_of_options = 1;
- my $symbol_set = 0;
- while (s/^(symbol|radius)\s*//i and $number_of_options <= 2) {
- my $option = lc($1);
- if (s/^=\s*//) {
- if (memberOf($option,@previous_options)) {
- PrintErrorMessage("Option \"$option\" has been already defined", $lc);
- my $dummy = expr($lc);
- }
- elsif ($option eq "radius") {
- $sh = expr($lc);
- $sv = $defaultsymbol if ! $symbol_set;
- }
- elsif ($option eq "symbol") {
- if (s/^circle\s*//i) {
- $sv = "circle";
- chk_lparen("after token circle",$lc);
- $side_or_radius = expr($lc);
- chk_rparen("expression",$lc);
- }
- elsif (s/^square\s*//i) {
- $sv = "square";
- chk_lparen("after token square",$lc);
- $side_or_radius = expr($lc);
- chk_rparen("expression",$lc);
- }
- elsif (s/^(((\\\]){1}|(\\,){1}|(\\\s){1}|[^\],\s])+)//) {
- $sv = $1;
- $sv =~ s/\\\]/\]/g;
- $sv =~ s/\\,/,/g;
- $sv =~ s/\\ / /g;
- s/\s*//;
- }
- $symbol_set = 1;
- }
- }
- else {
- PrintErrorMessage("unexpected token", $lc);
- next LINE;
- }
- $number_of_options++;
- push (@previous_options, $option);
- s/^,\s*//;
- }
- }
- else {
- PrintErrorMessage("unexpected token", $lc);
- next LINE;
- }
-
- chk_rsb("optional part",$lc);
- }
- # to avoid truncation problems introduced by the pack function, we
- # round each number up to five decimal digits
- $Px = sprintf("%.5f", $Px);
- $Py = sprintf("%.5f", $Py);
- print OUT "%% point$Point_Line \t$origPN = ($Px, $Py)\n" if $comments_on;
- chk_comment($lc);
- $PointTable{$PointName} = pack("d3A*",$Px,$Py,$sh,$sv);
- if (defined($side_or_radius)) {
- $DimOfPoint{$PointName} = $side_or_radius;
- }
-
- }
- elsif (/^\s*setPointNumber(?=\W)/i)
- {
- PrintWarningMessage("Command setPointNumber is ignored",$lc);
- next LINE;
- }
- elsif (s/^\s*(showAngle(?=\W))//i)
- {
- chk_lparen("showangle",$lc);
- my $point_1 = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
- my $point_2 = get_point($lc);
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point_2});
- my $point_3 = get_point($lc);
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point_3});
- my $angle = Angle($x1, $y1, $x2, $y2, $x3, $y3);
- $angle = 0 if $angle == -500;
- printf OUT "%%%% angle(%s%s%s) = %.5f deg ( %.5f rad)\n", $point_1,
- $point_2, $point_3, $angle, $angle*D2R;
- chk_rparen("Missing right parenthesis", $lc);
-
- }
- elsif (s/^\s*(showArea(?=\W))//i)
- {
- chk_lparen("showarea",$lc);
- my $point_1 = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
- my $point_2 = get_point($lc);
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point_2});
- my $point_3 = get_point($lc);
- my ($x3,$y3,$pSV3,$pS3)=unpack("d3A*",$PointTable{$point_3});
- print OUT "%% area($point_1$point_2$point_3) = ",
- triangleArea($x1, $y1, $x2, $y2, $x3, $y3), "\n";
- chk_rparen("Missing right parenthesis", $lc);
-
- }
- elsif (s/^\s*(showLength(?=\W))//i)
- {
- chk_lparen("showlength",$lc);
- my $point_1 = get_point($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
- my $point_2 = get_point($lc);
- my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$point_2});
- print OUT "%% length($point_1$point_2) = ",
- Length($x1, $y1, $x2, $y2), "\n";
- chk_rparen("Missing right parenthesis", $lc);
-
-
- }
- elsif (/^\s*showPoints(?=\W)/i)
- {
- print OUT "%%-------------------------------------------------\n";
- print OUT "%% L I S T O F P O I N T S \n";
- print OUT "%%-------------------------------------------------\n";
- foreach my $p (keys(%PointTable)) {
- my ($x, $y, $pSV, $pS) = unpack("d3A*",$PointTable{$p});
- printf OUT "%%%%\t%s\t= ( %.5f, %.5f ), LF-radius = %.5f, symbol = %s\n",
- $p, $x, $y, $pSV, $pS;
- }
- print OUT "%%-------------------------------------------------\n";
- print OUT "%% E N D O F L I S T O F P O I N T S \n";
- print OUT "%%-------------------------------------------------\n";
- next LINE;
- }
- elsif (/^\s*showVariables(?=\W)/i)
- {
- print OUT "%%-------------------------------------------------\n";
- print OUT "%% L I S T O F V A R I A B L E S \n";
- print OUT "%%-------------------------------------------------\n";
- foreach my $var (keys(%VarTable)) {
- print OUT "%%\t", $var, "\t=\t", $VarTable{$var}, "\n";
- }
- print OUT "%%-------------------------------------------------\n";
- print OUT "%% E N D O F L I S T O F V A R I A B L E S \n";
- print OUT "%%-------------------------------------------------\n";
- next LINE;
- }
- elsif (s/^\s*(system(?=\W))//i)
- {
- print OUT "%% $1$_" if $comments_on;
-
- chk_lparen("$cmd",$lc);
- my ($error, $command, $rest) = get_string($_);
- next LINE if $error == 1;
- $_ = $rest;
- if (! is_tainted($command)) {
- system($command);
- }
- else {
- PrintErrorMessage("String \"$command\" has tainted data", $lc);
- next LINE;
- }
- chk_rparen("after $cmd arguments",$lc);
- chk_comment("after $cmd command",$lc);
-
- }
- elsif (s/^\s*(text(?=\W))//i)
- {
- print OUT "%% $1$_" if $comments_on;
-
- chk_lparen("text",$lc);
- my ($level,$text)=(1,"");
- TEXTLOOP: while (1)
- {
- $level++ if /^\(/;
- $level-- if /^\)/;
- s/^(.)//;
- last TEXTLOOP if $level==0;
- $text .= $1;
- }
- chk_lcb("text part",$lc);
- my ($Px, $Py,$dummy,$pos);
- $pos="";
- s/\s*//;
-
- if (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
- my $Tcoord = get_point($lc);
- my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{$Tcoord});
- $Px = $x;
- $Py = $y;
- }
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar/i) {
- s/^([^\W\d_]\d{0,3})//i;
- my $PointA = $1;
- if (exists($PointTable{lc($PointA)})) {
- s/\s*//;
- if (s/^,//) {
- s/\s*//;
- if (s/^shift(?=\W)//i) {
-
- chk_lparen("shift",$lc);
- my $dist1 = expr($lc);
- chk_comma($lc);
- my $dist2 = expr($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{lc($PointA)});
- $Px = $x1 + $dist1;
- $Py = $y1 + $dist2;
- chk_rparen("shift part",$lc);
-
- }
- elsif (s/^polar(?=\W)//i) {
- chk_lparen("polar",$lc);
- my ($R1, $Theta1);
- $R1 = expr($lc);
- chk_comma($lc);
- $Theta1 = expr($lc);
- my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{lc($PointA)});
- s/\s*//;
- if (s/^rad(?=\W)//i) {
- # do nothing!
- }
- elsif (s/^deg(?=\W)//i) {
- $Theta1 = $Theta1 * PI / 180;
- }
- else {
- #$Theta1 = $Theta1 * PI / 180;
- }
- $Px = $x1 + $R1 * cos($Theta1);
- $Py = $y1 + $R1 * sin($Theta1);
- chk_rparen("after polar part",$lc);
-
- }
- }
- }
- else {
- PrintErrorMessage("undefined point/var",$lc);
- next LINE;
- }
- }
- else {
- $Px = expr();
- chk_comma($lc);
- $Py = expr();
- }
-
- chk_rcb("coordinates part of text command",$lc);
- if (s/^\[//)
- {
- s/\s*//;
-
- if (s/^(\w{1})\s*//) {
- $pos .= $1;
- if (memberOf($pos, "l", "r")) {
- if (s/^(\w{1})\s*//) {
- my $np = $1;
- if (memberOf($np, "t", "b", "B")) {
- $pos .= $np;
- }
- else {
- if (memberOf($np, "l", "r")) {
- PrintErrorMessage("$np can't follow 'l' or 'r'", $lc);
- }
- else {
- PrintErrorMessage("$np is not a valid positioning option", $lc);
- }
- next LINE;
- }
- }
- }
- elsif (memberOf($pos, "t", "b", "B")) {
- if (s/^(\w{1})\s*//) {
- my $np = $1;
- if (memberOf($np, "l", "r")) {
- $pos .= $np;
- }
- else {
- if (memberOf($np, "t", "b", "B")) {
- PrintErrorMessage("$np can't follow 't', 'b', or 'B'", $lc);
- }
- else {
- PrintErrorMessage("$np is not a valid positioning option", $lc);
- }
- next LINE;
- }
- }
- }
- else {
- PrintErrorMessage("$pos is not a valid positioning option", $lc);
- next LINE;
- }
- }
- else {
- PrintErrorMessage("illegal token in optional part of text command",$lc);
- next LINE;
- }
-
- s/\s*//;
- chk_rsb("optional part of text command",$lc);
- }
- chk_comment($lc);
- if ($pos eq "")
- {
- printf OUT "\\put {%s} at %f %f\n", $text, $Px, $Py;
- }
- else
- {
- printf OUT "\\put {%s} [%s] at %f %f\n", $text, $pos, $Px, $Py;
- }
-
- }
- elsif (s/^\s*(var(?=\W))//i)
- {
- print OUT "%% $1$_" if $comments_on;
- do{
- s/\s*//;
- PrintErrorMessage("no identifier found after token var",$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
- my $Varname = $1;
- my $varname = lc($Varname);
- if (exists $ConstTable{$varname}) {
- PrintErrorMessage("Redefinition of constant $varname",$lc);
- }
- s/\s*//; #remove leading white space
- PrintErrorMessage("did not find expected = sign",$lc)
- if $_ !~ s/^[=]//i;
- my $val = expr($lc);
- $VarTable{$varname} = $val;
- print OUT "%% $Varname = $val\n" if $comments_on;
- }while (s/^,//);
- chk_comment($lc);
- s/\s*//;
- if (/^[^%]/) {
- PrintWarningMessage("Trailing text is ignored",$lc);
- }
- }
- elsif (/^\s*\\(.+)/)
- {
- my $line = $1;
- if ($line =~ /^\s+(.+)/)
- {
- print OUT " $line\n";
- }
- else
- {
- print OUT "\\$line\n";
- }
- next LINE;
- }
- elsif (0==length) #empty line
- {
- next LINE;
- }
- else {
- PrintErrorMessage("command not recognized",$lc);
- next LINE;
- }
-
- }
- }
- }
-
-
-our $alarm="";
-our $comments_on=1;
-our $out_file="default";
-our $argc=@ARGV;
-if ($argc == 0 || $argc > 5 ){ # no command line arguments or more than 4
- # arguments
- die "\nmathspic version $version_number\n" .
- "Usage: mathspic [-h] [-b] [-c] [-o <out file>] <in file>\n\n";
-}
-else {
- our $file = "";
- SWITCHES:
- while($_ = $ARGV[0]) {
- shift;
- if (/^-h$/) {
- die "\nThis is mathspic version $version_number\n" .
- "Type \"man mathspic\" for detailed help\n".
- "Usage:\tmathspic [-h] [-b] [-c] [-o <out file>] <in file>\n" .
- "\twhere,\n" .
- "\t[-b]\tenables bell sound if error exists\n" .
- "\t[-c]\tdisables comments in ouput file\n" .
- "\t[-h]\tgives this help listing\n" .
- "\t[-o]\tcreates specified output file\n\n";
- }
- elsif (/^-b$/) {
- $alarm = chr(7);
- }
- elsif (/^-c$/) {
- $comments_on = 0;
- }
- elsif (/^-o$/) {
- die "No output file specified!\n" if !@ARGV;
- $out_file = $ARGV[0];
- shift;
- }
- elsif (/^-\w+/) {
- die "$_: Illegal command line switch!\n";
- }
- else {
- $file = $_;
- }
- }
- die "No input file specified!\n" if $file eq "";
-
- print "This is mathspic version $version_number\n";
-}
- our ($source_file, $log_file);
- if (! -e $file) {
- die "$file: no such file!\n" if (! (-e "$file.m"));
- $source_file = "$file.m";
- }
- else {
- $source_file = $file;
- $file = $1 if $file =~ /(\w[\w-\.]+)\.\w+/;
- }
- $out_file= "$file.mt" if $out_file eq "default";
- $log_file= "$file.mlg";
-
-
- open(IN,"$source_file")||die "Can't open source file: $source_file\n";
- open(OUT,">$out_file")||die "Can't open output file: $out_file\n";
- open(LOG,">$log_file")||die "Can't open log file: $log_file\n";
- print_headers;
- process_input(IN,"");
-
-print $alarm if $no_errors > 0;
-__END__
-
diff --git a/Build/source/texk/texlive/linked_scripts/mathspic/mathspic.pl b/Master/texmf-dist/scripts/mathspic/mathspic113.pl
index 132517b0b17..5c3ed4ec1f9 100644..100755
--- a/Build/source/texk/texlive/linked_scripts/mathspic/mathspic.pl
+++ b/Master/texmf-dist/scripts/mathspic/mathspic113.pl
@@ -1,8 +1,8 @@
#!/usr/bin/perl
#
-#(c) Copyright 2005 Apostolos Syropoulos & R.W.D. Nickalls
-# apostolo@ocean1.ee.duth.gr dicknickalls@compuserve.com
-# apostolo@obelix.ee.duth.gr
+#(c) Copyright 2005-2010 VERSION 1.13 April 26, 2010
+# Apostolos Syropoulos & R.W.D. Nickalls
+# asyropoulos@yahoo.com dick@nickalls.org
#
# This program can be redistributed and/or modified under the terms
# of the LaTeX Project Public License Distributed from CTAN
@@ -30,7 +30,7 @@ sub READLINE {
package main;
use Math::Trig;
-our $version_number = "1.00 Feb 14, 2005";
+our $version_number = "1.13 Apr 26, 2010";
our $commandLineArgs = join(" ", @ARGV);
our $command = "";
our $curr_in_file = "";
@@ -128,47 +128,59 @@ our $LineThickness = 0.4;
}
else {
my $comment = $2 if $in_line =~ s/([^%]+)(%.+)/$1/;
- for(my $i = $#Macros; $i >= 0; $i--) {
- my $macro_name = $Macros[$i]->{'macro_name'};
- if ($in_line =~ /&$macro_name/) { ############################
- my $num_of_macro_args = @{$Macros[$i]->{'macro_param'}};
- if ( $num_of_macro_args > 0 ) {
- my $pattern = "&$macro_name\\(";
- foreach my $p ( 1..$num_of_macro_args ) {
- my $comma = ($p == $num_of_macro_args) ? "\\s*" : "\\s*,\\s*";
- $pattern .= "\\s*[^\\s\\)]+$comma";
- }
- $pattern .= "\\)";
- while($in_line =~ /\W*&$macro_name\W+/) {
- if ($in_line =~ /$pattern/) {
- my $before = $`;
- my $after = $';
- my $match = $&;
- my $new_code = $Macros[$i]->{'macro_code'};
- $match =~ s/^&$macro_name\(\s*//;
- $match =~ s/\)$//;
- foreach my $arg ( 0..($num_of_macro_args - 1) ) {
- my $old = $Macros[$i]->{'macro_param'}->[$arg];
- my $comma = ($arg == ($num_of_macro_args - 1)) ? "" : ",";
- $match =~ s/^\s*([^\s,]+)\s*$comma//;
- my $new = $1;
- $new_code =~ s/$old/$new/;
- }
- $in_line = "$before$new_code$after";
- }
- else {
- PrintErrorMessage("Usage of macro &$macro_name does not " .
- "match its definition", $LC);
- return "";
+ EXPANSIONLOOP: while () {
+ my $org_in_line = $in_line;
+ for(my $i = $#Macros; $i >= 0; $i--) {
+ my $macro_name = $Macros[$i]->{'macro_name'};
+ if ($in_line =~ /&$macro_name\b/) { ############################
+ my $num_of_macro_args = @{$Macros[$i]->{'macro_param'}};
+ if ( $num_of_macro_args > 0 ) {
+ # Macro with parameters
+ my $pattern = "&$macro_name\\(";
+ foreach my $p ( 1..$num_of_macro_args ) {
+ my $comma = ($p == $num_of_macro_args) ? "\\s*" : "\\s*,\\s*";
+ $pattern .= "\\s*[^\\s\\)]+$comma";
+ }
+ $pattern .= "\\)";
+ while($in_line =~ /&$macro_name\b/) {
+ if ($in_line =~ /$pattern/) {
+ my $before = $`;
+ my $after = $';
+ my $match = $&;
+ my $new_code = $Macros[$i]->{'macro_code'};
+ $match =~ s/^&$macro_name\(\s*//;
+ $match =~ s/\)$//;
+ foreach my $arg ( 0..($num_of_macro_args - 1) ) {
+ my $old = $Macros[$i]->{'macro_param'}->[$arg];
+ my $comma = ($arg == ($num_of_macro_args - 1)) ? "" : ",";
+ $match =~ s/^\s*([^\s,]+)\s*$comma//;
+ my $new = $1;
+ # 'g': Parameter may occur several times
+ # in $new_code.
+ # '\b': Substitute only whole words
+ # not x in xA
+ $new_code =~ s/\b$old\b/$new/g;
+ }
+ $in_line = "$before$new_code$after";
+ }
+ else {
+ PrintErrorMessage("Usage of macro &$macro_name does not " .
+ "match its definition", $LC);
+ return "";
+ }
+ }
+ }
+ else {
+ # Macro without parameters
+ my $replacement = $Macros[$i]->{'macro_code'};
+ # '\b': Substitute only whole words
+ # not x in xA
+ $in_line =~ s/&$macro_name\b/$replacement/g;
}
- }
- }
- else {
- my $replacement = $Macros[$i]->{'macro_code'};
- $in_line =~ s/&$macro_name/$replacement/g;
}
- }
- }
+ }
+ last EXPANSIONLOOP if ( $org_in_line eq $in_line );
+ }
return "$in_line$comment";
}
}
@@ -333,7 +345,7 @@ our $LineThickness = 0.4;
print OUT "%* -----------------------------------------------\n";
print OUT "%* mathspic (Perl version $version_number)\n";
print OUT "%* A filter program for use with PiCTeX\n";
- print OUT "%* Copyright (c) 2005 A Syropoulos & RWD Nickalls \n";
+ print OUT "%* Copyright (c) 2005-2010 A Syropoulos & RWD Nickalls \n";
print OUT "%* Command line: $0 $commandLineArgs\n";
print OUT "%* Input filename : $source_file\n";
print OUT "%* Output filename: $out_file\n";
@@ -343,7 +355,7 @@ our $LineThickness = 0.4;
print LOG "----\n";
print LOG "$now_string\n";
print LOG "mathspic (Perl version $version_number)\n";
- print LOG "Copyright (c) 2005 A Syropoulos & RWD Nickalls \n";
+ print LOG "Copyright (c) 2005-2010 A Syropoulos & RWD Nickalls \n";
print LOG "Input file = $source_file\n";
print LOG "Output file = $out_file\n";
print LOG "Log file = $log_file\n";
@@ -355,7 +367,7 @@ our $LineThickness = 0.4;
my ($lc) = $_[0];
my ($PointName);
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})\s*//i) { #point name
$PointName = $1;
if (!exists($PointTable{lc($PointName)})) {
PrintErrorMessage("Undefined point $PointName",$lc);
@@ -538,20 +550,20 @@ our $LineThickness = 0.4;
{
return ($1, 1);
}
- elsif (/^[^\W\d_]\d{0,3}[^\W\d_]\d{0,3}/) #it is a pair of IDs?
+ elsif (/^[^\W\d_]\d{0,4}[^\W\d_]\d{0,4}/) #it is a pair of IDs?
{
- s/^([^\W\d_]\d{0,3})//i;
+ s/^([^\W\d_]\d{0,4})//i;
$v1 = $1;
if (!exists($PointTable{lc($v1)})) {
if (exists($VarTable{lc($v1)})) {
return ($VarTable{lc($v1)}, 1);
}
PrintErrorMessage("Point $v1 has not been defined", $lc);
- s/^\s*[^\W\d_]\d{0,3}//i;
+ s/^\s*[^\W\d_]\d{0,4}//i;
return (0,0);
}
$v1 = lc($v1);
- s/^\s*([^\W\d_]\d{0,3})//i;
+ s/^\s*([^\W\d_]\d{0,4})//i;
$v2 = $1;
if (!exists($PointTable{lc($v2)}))
{
@@ -563,7 +575,7 @@ our $LineThickness = 0.4;
my ($x2,$y2,$pSV2,$pS2) = unpack("d3A*",$PointTable{$v2});
return (Length($x1,$y1,$x2,$y2), 1);
}
- elsif (s/^([^\W\d_]\d{0,3})//i) # it is a single id
+ elsif (s/^([^\W\d_]\d{0,4})//i) # it is a single id
{
$v1 = $1;
if (!exists($VarTable{lc($v1)})) #it isn't a variable
@@ -810,7 +822,7 @@ our $LineThickness = 0.4;
DRAWLINES:while(1) {
@PP = () ;
while(1) {
- if (s/^([^\W\d_]\d{0,3})\s*//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})\s*//i) { #point name
$P = $1;
if (!exists($PointTable{lc($P)})) {
PrintErrorMessage("Undefined point $P",$lc);
@@ -1217,7 +1229,7 @@ our $LineThickness = 0.4;
elsif (s/^-//) { # is it a negated primitive
$val = - primitive();
}
- elsif (s/^\+//) { # is it a negated primitive
+ elsif (s/^\+//) { # is it a positive primitive
$val = primitive();
}
elsif (s/^angledeg//i) {
@@ -1250,7 +1262,7 @@ our $LineThickness = 0.4;
chk_rparen("Missing right parenthesis", $lc);
}
elsif (s/^angle//i) {
- chk_lparen("angle".$lc);
+ chk_lparen("angle",$lc);
my $point_1 = get_point($lc);
my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$point_1});
my $point_2 = get_point($lc);
@@ -1451,6 +1463,13 @@ our $LineThickness = 0.4;
return $found;
}
+ sub midpoint {
+ my ($x1, $y1, $x2, $y2)=@_;
+ return ($x1 + ($x2 - $x1)/2,
+ $y1 + ($y2 - $y1)/2);
+ }
+
+
sub tand {
my $d = $_[0];
$d = $d * PI / 180;
@@ -1709,7 +1728,7 @@ our $LineThickness = 0.4;
do{
s/\s*//;
PrintErrorMessage("no identifier found after token const",$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
+ if $_ !~ s/^([^\W\d_]\d{0,4})//i;
my $Constname = $1;
my $constname = lc($Constname);
if (exists $ConstTable{$constname}) {
@@ -2062,7 +2081,7 @@ our $LineThickness = 0.4;
}
my(@PP);
DRAWPOINTS:while(1) {
- if (s/^([^\W\d_]\d{0,3})//i) { #point name
+ if (s/^([^\W\d_]\d{0,4})//i) { #point name
$P = $1;
if (!exists($PointTable{lc($P)})) {
PrintErrorMessage("Undefined point $P",$lc);
@@ -2087,7 +2106,7 @@ our $LineThickness = 0.4;
my ($cmd) = $1;
print OUT "%% $cmd$_" if $comments_on;
- chk_lparen("drawRightAngle",lc);
+ chk_lparen("drawRightAngle",$lc);
my $point1 = get_point($lc);
next LINE if $point1 eq "_undef_";
my $point2 = get_point($lc);
@@ -2104,34 +2123,23 @@ our $LineThickness = 0.4;
#
#actual computation
#
- my $lengthAC = Length($x1, $y1, $x3, $y3);
- my $angleBAC = Angle($x2, $y2, $x1, $y1, $x3, $y3);
- my $line1 = $lengthAC / (1 + tand($angleBAC));
- #
- # determine coordinates of point Q
- #
- my ($xQ, $yQ) = pointOnLine($x1, $y1, $x3, $y3, $line1);
- #
- # determine coordinates of point S
- #
- my $deltax = $xQ - $x2;
- my $deltay = $yQ - $y2;
- my $lengthBQ = sqrt($deltax * $deltax + $deltay * $deltay);
- my $xS = $x2 + ($dist * sqrt(2) * $deltax / $lengthBQ);
- my $yS = $y2 + ($dist * sqrt(2) * $deltay / $lengthBQ);
- #
- # determine coordinates of points S1 and S2
- #
- my ($xS1, $yS1) = pointOnLine($x2, $y2, $x3, $y3, $dist);
- ($xS2, $yS2) = ($xS, $yS);
- #
- # emit PiCTeX code
- #
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $xS1, $yS1, $xS2, $yS2;
- ($xS1, $yS1) = pointOnLine($x2, $y2, $x1, $y1, $dist);
- printf OUT "\\plot %.5f %.5f %.5f %.5f /\n",
- $xS1, $yS1, $xS2, $yS2;
+ my ($Px, $Py) = pointOnLine($x2, $y2, $x1, $y1, $dist);
+ my ($Qx, $Qy) = pointOnLine($x2, $y2, $x3, $y3, $dist);
+ my ($Tx, $Ty) = midpoint($Px, $Py, $Qx, $Qy);
+ my ($Ux, $Uy) = pointOnLine($x2, $y2, $Tx, $Ty, 2*Length($x2, $y2, $Tx, $Ty));
+ if ($Px == $Ux || $Py == $Uy) {
+ printf OUT "\\putrule from %.5f %.5f to %.5f %.5f \n", $Px,$Py,$Ux,$Uy;
+ }
+ else {
+ printf OUT "\\plot %.5f %.5f\t%.5f %.5f / \n", $Px, $Py,$Ux,$Uy;
+ }
+ if ($Ux == $Qx || $Uy == $Qy) {
+ printf OUT "\\putrule from %.5f %.5f to %.5f %.5f \n", $Ux,$Uy,$Qx,$Qy;
+ }
+ else {
+ printf OUT "\\plot %.5f %.5f\t%.5f %.5f / \n", $Ux, $Uy,$Qx,$Qy;
+ }
+
}
elsif (s/^\s*(drawsquare(?=\W))//i)
@@ -2626,7 +2634,7 @@ our $LineThickness = 0.4;
$pointStar = 0; # default value: he have a point command
$pointStar = 1 if s/^\*//;
chk_lparen("point" . (($pointStar)?"*":""),$lc);
- if (s/^([^\W\d_](?![^\W\d_])\d{0,3})//i) {
+ if (s/^([^\W\d_](?![^\W\d_])\d{0,4})//i) {
#
# Note: the regular expression (foo)(?!bar) means that we are
# looking a foo not followed by a bar. Moreover, the regular
@@ -2693,8 +2701,7 @@ our $LineThickness = 0.4;
chk_rparen("No closing parenthesis found",$lc);
my ($x1,$y1,$pSV1,$pS1)=unpack("d3A*",$PointTable{$FirstPoint});
my ($x2,$y2,$pSV2,$pS2)=unpack("d3A*",$PointTable{$SecondPoint});
- $Px = $x1 + ($x2 - $x1)/2;
- $Py = $y1 + ($y2 - $y1)/2;
+ ($Px, $Py) = midpoint($x1, $y1, $x2, $y2);
}
elsif (s/^pointonline(?=\W)//i) {
@@ -2773,8 +2780,8 @@ our $LineThickness = 0.4;
chk_rparen("after coordinates part",$lc);
}
- elsif (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
- m/^([^\W\d_]\d{0,3})\s*/i;
+ elsif (/^[^\W\d_]\d{0,4}\s*[^,\w]/) {
+ m/^([^\W\d_]\d{0,4})\s*/i;
if (exists($PointTable{lc($1)})) {
my $Tcoord = get_point($lc);
my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{$Tcoord});
@@ -2787,8 +2794,8 @@ our $LineThickness = 0.4;
$Py = expr();
}
}
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar|rotate|vector/i) { #a point?
- s/^([^\W\d_]\d{0,3})//i;
+ elsif (/[^\W\d_]\d{0,4}\s*,\s*shift|polar|rotate|vector/i) { #a point?
+ s/^([^\W\d_]\d{0,4})//i;
my $PointA = $1;
if (exists($PointTable{lc($PointA)})) {
s/\s*//;
@@ -3082,14 +3089,14 @@ our $LineThickness = 0.4;
$pos="";
s/\s*//;
- if (/^[^\W\d_]\d{0,3}\s*[^,\w]/) {
+ if (/^[^\W\d_]\d{0,4}\s*[^,\w]/) {
my $Tcoord = get_point($lc);
my ($x,$y,$pSV,$pS)=unpack("d3A*",$PointTable{$Tcoord});
$Px = $x;
$Py = $y;
}
- elsif (/[^\W\d_]\d{0,3}\s*,\s*shift|polar/i) {
- s/^([^\W\d_]\d{0,3})//i;
+ elsif (/[^\W\d_]\d{0,4}\s*,\s*shift|polar/i) {
+ s/^([^\W\d_]\d{0,4})//i;
my $PointA = $1;
if (exists($PointTable{lc($PointA)})) {
s/\s*//;
@@ -3213,7 +3220,7 @@ our $LineThickness = 0.4;
do{
s/\s*//;
PrintErrorMessage("no identifier found after token var",$lc)
- if $_ !~ s/^([^\W\d_]\d{0,3})//i;
+ if $_ !~ s/^([^\W\d_]\d{0,4})//i;
my $Varname = $1;
my $varname = lc($Varname);
if (exists $ConstTable{$varname}) {
@@ -3279,7 +3286,7 @@ else {
"Usage:\tmathspic [-h] [-b] [-c] [-o <out file>] <in file>\n" .
"\twhere,\n" .
"\t[-b]\tenables bell sound if error exists\n" .
- "\t[-c]\tdisables comments in ouput file\n" .
+ "\t[-c]\tdisables comments in output file\n" .
"\t[-h]\tgives this help listing\n" .
"\t[-o]\tcreates specified output file\n\n";
}
@@ -3300,7 +3307,7 @@ else {
else {
$file = $_;
}
- }
+ }my ($xA, $yA, $xB, $yB, $dist)=@_;
die "No input file specified!\n" if $file eq "";
print "This is mathspic version $version_number\n";
diff --git a/Master/texmf-dist/tex/latex/mathspic/mathspic.sty b/Master/texmf-dist/tex/latex/mathspic/mathspic.sty
index 0efe40d968c..4ba85b33760 100644
--- a/Master/texmf-dist/tex/latex/mathspic/mathspic.sty
+++ b/Master/texmf-dist/tex/latex/mathspic/mathspic.sty
@@ -1,8 +1,8 @@
%%
%% This is file `mathspic.sty',
-%% February 2005
+%% April 26, 2010
%%
-%% (c) copyright 2004-2005 A Syropoulos & RWD Nickalls
+%% (c) copyright 2004-2010 A Syropoulos & RWD Nickalls
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt; either
@@ -11,14 +11,14 @@
%% Please report errors or suggestions for improvement to
%%
%% Apostolos Syropoulos Dick Nickalls
-%% apostolo@obelix.ee.duth.gr dicknickalls@compuserve.com
+%% apostolo@yahoo.com dick@nickalls.org
%%
-\wlog{Package `mathspic' A Syropoulos & RWD Nickalls (Feb 2005)}%
-\typeout{Loading mathsPIC package (c) RWD Nickalls & A Syropoulos 01/02/2005}%
+\wlog{Package `mathspic' A Syropoulos & RWD Nickalls (April 2010)}%
+\typeout{Loading mathsPIC package (c) RWD Nickalls & A Syropoulos April 2010}%
\ProvidesFile{mathspic.sty}%
- [2005/02/01 v1.0 Package `mathspic.sty']%
-\def\fileversion{1.0}
-\def\filedate{2005/02/01}
+ [2010/04/26 v1.13 Package `mathspic.sty']%
+\def\fileversion{1.13}
+\def\filedate{2010/04/26}
\ifx\fiverm\undefined
\newfont\fiverm{cmr5}
\fi
@@ -35,6 +35,7 @@
\input pictexwd
\input postpictex
%%-------------------------------------
+\thispagestyle{empty}% stop page numbers
\endinput
%%
%% End of file `mathspic.sty'.
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index ea804a057d3..094eea80f8f 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -518,6 +518,7 @@ chomp ($Build = `cd $Master/../Build/source && pwd`);
'mathexam', "&MAKEflatten",
'mathmode', "&setup",
'mathpazo', "&MAKEmathpazo",
+ 'mathspic', "&MAKEflatten",
'mathstone', "die 'skipping, requires nonfree Stone fonts'",
'matlab', "die 'skipping, requires nonfree matlab'",
'mdwfonts', "die 'skipping, too many tfm duplicates'",
@@ -1976,7 +1977,7 @@ $standardxmt='\.xmt';
'latexmk' => '\.pl$',
'listings-ext' => '\.sh$',
'match_parens' => '^match_parens$',
- 'mathspic' => '^mathspic\.pl$',
+ 'mathspic' => '^mathspic.*\.pl$',
'mf2pt1' => '\.pl$',
'mkgrkindex' => 'mkgrkindex$',
'mkjobtexmf' => '\.pl$',
@@ -2634,7 +2635,7 @@ sub doscripts {
# For each, give a warning if missing from the Makefile.am in the sources.
# Also, if not already present, create the platform-specific bindir entries.
#
- my $scripts_Makefile = "$Build/$build_scriptsdir/Makefile.am";
+ my $scripts_Makefile = "$Build/$build_scriptsdir/Makefile.in";
chomp (my @platforms = `cd $Master/bin && ls`);
#
for my $s (@scripts) {
@@ -2644,6 +2645,7 @@ sub doscripts {
}
(my $linkname = $s) =~ s/\..*$//;
+ $linkname =~ s/^mathspic[0-9]+$/mathspic/; # version number in name :(
for my $p (@platforms) {
my $platdir = "$TOPDEST/bin/$p";
&xmkdir ($platdir);