00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "common.h"
00027
00028 #include <stdio.h>
00029 #include <math.h>
00030
00031 #include "vmath.h"
00032 #include "plot3.h"
00033 #include "bu.h"
00034 #include "bn.h"
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 void
00050 tp_3vector(FILE *plotfp, fastf_t *from, fastf_t *to, double fromheadfract, double toheadfract)
00051 {
00052 register fastf_t len;
00053 register fastf_t hooklen;
00054 vect_t diff;
00055 vect_t c1, c2;
00056 vect_t h1, h2;
00057 vect_t backup;
00058 point_t tip;
00059
00060 pdv_3line(plotfp, from, to);
00061
00062
00063 VSUB2(diff, to, from);
00064 if ((len = MAGNITUDE(diff)) < SMALL) return;
00065 VSCALE(diff, diff, 1/len);
00066 bn_vec_ortho(c1, diff);
00067 VCROSS(c2, c1, diff);
00068
00069 if (!ZERO(fromheadfract)) {
00070 hooklen = fromheadfract*len;
00071 VSCALE(backup, diff, -hooklen);
00072
00073 VSCALE(h1, c1, hooklen);
00074 VADD3(tip, from, h1, backup);
00075 pdv_3move(plotfp, from);
00076 pdv_3cont(plotfp, tip);
00077
00078 VSCALE(h2, c2, hooklen);
00079 VADD3(tip, from, h2, backup);
00080 pdv_3move(plotfp, tip);
00081 }
00082 if (!ZERO(toheadfract)) {
00083 hooklen = toheadfract*len;
00084 VSCALE(backup, diff, -hooklen);
00085
00086 VSCALE(h1, c1, hooklen);
00087 VADD3(tip, to, h1, backup);
00088 pdv_3move(plotfp, to);
00089 pdv_3cont(plotfp, tip);
00090
00091 VSCALE(h2, c2, hooklen);
00092 VADD3(tip, to, h2, backup);
00093 pdv_3move(plotfp, tip);
00094 }
00095
00096 if (!ZERO(fromheadfract) || !ZERO(toheadfract))
00097 pdv_3cont(plotfp, to);
00098
00099 }
00100
00101 void
00102 PL_FORTRAN(f3vect, F3VECT)(FILE **fp, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz, float *fl , float *tl)
00103 {
00104 point_t from, to;
00105
00106 VSET(from, *fx, *fy, *fz);
00107 VSET(to, *tx, *ty, *tz);
00108 tp_3vector(*fp, from, to, *fl, *tl);
00109 }
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120