summaryrefslogtreecommitdiff
path: root/sys/src/cmd/plot/libplot/frame.c
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/plot/libplot/frame.c
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/plot/libplot/frame.c')
-rwxr-xr-xsys/src/cmd/plot/libplot/frame.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/src/cmd/plot/libplot/frame.c b/sys/src/cmd/plot/libplot/frame.c
new file mode 100755
index 000000000..bbc37a17c
--- /dev/null
+++ b/sys/src/cmd/plot/libplot/frame.c
@@ -0,0 +1,16 @@
+#include "mplot.h"
+void frame(double xs, double ys, double xf, double yf){
+ register double osidex, osidey;
+ osidex = e1->sidex;
+ osidey = e1->sidey;
+ e1->left = e0->left + xs * e0->sidex;
+ e1->bottom = e0->bottom + ys * e0->sidey;
+ e1->sidex = (xf-xs)*e0->sidex;
+ e1->sidey = (yf-ys)*e0->sidey;
+ e1->scalex *= (e1->sidex / osidex);
+ e1->scaley *= (e1->sidey / osidey);
+ e1->quantum=e0->quantum/sqrt(e1->scalex*e1->scalex +
+ e1->scaley*e1->scaley);
+ if(e1->quantum < .01)
+ e1->quantum = .01;
+}