8 PUBLIC void ps3d_Preambel(FILE *fp, float view[3], float axis[3], char *projtype);
9 PUBLIC void PS_DrawSimplifiedBox(float X,float Y, float Z, float T, float P, FILE *fp);
12 PUBLIC void ps3d_Preambel(FILE *fp, float view[3], float axis[3], char *projtype)
14 fprintf(fp,"%%!PS\n");
15 fprintf(fp,"%%%%Title: RNA DotPlot\n");
16 fprintf(fp,"%%%%Creator: RNAfold V.01.002c - by Oymolon\n");
17 fprintf(fp,"%%%%CreationDate: %s", time_stamp());
18 /* fprintf(fp,"%%%%BoundingBox: 66 211 518 662\n"); */
19 fprintf(fp,"%%%%Pages: 1\n");
20 fprintf(fp,"%%%%EndComments: Geil eyh !?\n");
21 fprintf(fp,"%%Viewing vector\n");
22 fprintf(fp,"/v1 { %f } def\n", view[0]);
23 fprintf(fp,"/v2 { %f } def\n", view[1]);
24 fprintf(fp,"/v3 { %f } def\n", view[2]);
25 fprintf(fp,"/a1 { %f } def\n", axis[0]);
26 fprintf(fp,"/a2 { %f } def\n", axis[1]);
27 fprintf(fp,"/a3 { %f } def\n", axis[2]);
28 fprintf(fp,"%%Define some coefficients for the projections.\n");
29 fprintf(fp,"/y1a { v2 a3 mul v3 a2 mul sub } def\n");
30 fprintf(fp,"/y2a { v3 a1 mul v1 a3 mul sub } def\n");
31 fprintf(fp,"/y3a { v1 a2 mul v2 a1 mul sub } def\n");
32 fprintf(fp,"/ya_len { y1a y1a mul y2a y2a mul y3a y3a mul add add sqrt } def\n");
33 fprintf(fp,"/x1a { v2 y3a mul v3 y2a mul sub } def\n");
34 fprintf(fp,"/x2a { v3 y1a mul v1 y3a mul sub } def\n");
35 fprintf(fp,"/x3a { v1 y2a mul v2 y1a mul sub } def\n");
36 fprintf(fp,"/xa_len { x1a x1a mul x2a x2a mul x3a x3a mul add add sqrt } def\n");
37 fprintf(fp,"/x1 { x1a xa_len div } def\n");
38 fprintf(fp,"/x2 { x2a xa_len div } def\n");
39 fprintf(fp,"/x3 { x3a xa_len div } def\n");
40 fprintf(fp,"/y1 { y1a ya_len div } def\n");
41 fprintf(fp,"/y2 { y2a ya_len div } def\n");
42 fprintf(fp,"/y3 { y3a ya_len div } def\n");
43 fprintf(fp,"/sx { v1 v3 div } def\n");
44 fprintf(fp,"/sy { v2 v3 div } def\n");
45 fprintf(fp,"/v_len { v1 v1 mul v2 v2 mul v3 v3 mul add add sqrt } def\n");
46 fprintf(fp,"/u_len { v1 v1 mul v2 v2 mul add sqrt } def\n");
47 fprintf(fp,"/u1 { v2 u_len div } def\n");
48 fprintf(fp,"/u2 { v1 neg u_len div } def\n");
49 fprintf(fp,"/w1 { v1 v3 mul neg u_len div v_len div } def\n");
50 fprintf(fp,"/w2 { v2 v3 mul neg u_len div v_len div } def\n");
51 fprintf(fp,"/w3 { v1 v1 mul v2 v2 mul add u_len div v_len div } def\n");
52 fprintf(fp,"%%Projection Operators\n");
53 fprintf(fp,"%% Projection onto x-y plane in direction v\n");
54 fprintf(fp,"/ProjXY { dup sx mul 4 -1 roll exch sub \n");
55 fprintf(fp," 3 1 roll sy mul sub \n");
56 fprintf(fp," } def \n");
57 fprintf(fp,"%% Normal Projection onto a plane normal to (v1,v2,v3!=0)\n");
58 fprintf(fp,"/Projnn { w3 mul 3 1 roll dup w2 mul 3 1 roll u2 mul exch \n");
59 fprintf(fp," dup w1 mul 3 1 roll u1 mul add 4 1 roll add add \n");
60 fprintf(fp," } def \n");
61 fprintf(fp,"%% General Normal Projection\n");
62 fprintf(fp,"/ProjN { dup y3 mul 4 1 roll x3 mul 3 1 roll dup \n");
63 fprintf(fp," y2 mul 5 1 roll x2 mul 3 1 roll dup y1 mul \n");
64 fprintf(fp," 6 1 roll x1 mul add add 4 1 roll add add \n");
65 fprintf(fp," } def\n");
66 fprintf(fp,"/Proj { Proj%s } def\n", projtype);
67 fprintf(fp,"/L3 { Proj lineto } def\n");
68 fprintf(fp,"/RL3 { Proj rlineto } def\n");
69 fprintf(fp,"/M3 { Proj moveto } def\n");
70 fprintf(fp,"/RM3 { Proj rmoveto } def\n");
71 fprintf(fp,"%% end 3D macros\n\n");
74 PUBLIC void PS_DrawSimplifiedBox(float X,float Y, float Z, float T, float P, FILE *fp)
79 t = X+t1+2*p1; /* approximate size */
81 fprintf(fp,"/scaling_factor { %f } def \n", 400./t);
82 fprintf(fp,"%f %f %f Proj \n", X+t1, Y+t1, Z+t1);
83 fprintf(fp,"scaling_factor mul 2 div 300 sub neg exch \n" );
84 fprintf(fp,"scaling_factor mul 2 div 400 sub neg translate \n");
85 fprintf(fp,"scaling_factor dup scale\n");
86 fprintf(fp,"newpath\n");
87 fprintf(fp,"%f setlinewidth\n",lw);
88 fprintf(fp,"0 0 0 M3\n");
89 fprintf(fp,"%f %f %f L3\n", X , 0. , 0. );
90 fprintf(fp,"%f %f %f L3\n", X+t1 , t1 , 0. );
91 fprintf(fp,"%f %f %f L3\n", X+t1 , Y+t1 , 0. );
92 fprintf(fp,"%f %f %f L3\n", t1 , Y+t1 , 0. );
93 fprintf(fp,"%f %f %f L3\n", 0. , Y , 0. );
94 fprintf(fp,"%f %f %f L3\n", 0. , 0. , 0. );
95 fprintf(fp,"%f %f %f L3\n", 0. , 0. , Z );
96 fprintf(fp,"%f %f %f L3\n", 0. , t1 , Z+t1 );
97 fprintf(fp,"%f %f %f L3\n", 0. , Y+t1 , Z+t1 );
98 fprintf(fp,"%f %f %f L3\n", 0. , Y+t1 , t1 );
99 fprintf(fp,"%f %f %f L3\n", 0. , Y , 0. );
100 fprintf(fp,"%f %f %f L3\n", 0. , 0. , 0. );
101 fprintf(fp,"stroke\n");
102 fprintf(fp,"%f %f %f M3\n", t1 , Y+t1 , 0. );
103 fprintf(fp,"%f %f %f L3\n", 0. , Y+t1 , t1 );
104 fprintf(fp,"stroke\n");
105 fprintf(fp,"%f %f %f M3\n", X+t1 , t1 , 0. );
106 fprintf(fp,"%f %f %f L3\n", X+t1 , 0. , t1 );
107 fprintf(fp,"%f %f %f L3\n", X+t1 , 0. , Z+t1 );
108 fprintf(fp,"%f %f %f L3\n", X+t1 , Y , Z+t1 );
109 fprintf(fp,"%f %f %f L3\n", X+t1 , Y+t1 , Z );
110 fprintf(fp,"%f %f %f L3\n", X+t1 , Y+t1 , 0. );
111 fprintf(fp,"%f %f %f L3\n", X+t1 , t1 , 0. );
112 fprintf(fp,"stroke\n");
113 fprintf(fp,"%f %f %f M3\n", X+t1 , 0. , Z+t1 );
114 fprintf(fp,"%f %f %f L3\n", t1 , 0. , Z+t1 );
115 fprintf(fp,"%f %f %f L3\n", 0. , t1 , Z+t1 );
116 fprintf(fp,"stroke\n");
117 fprintf(fp,"%f %f %f M3\n", X+t1 , Y , Z+t1 );
118 fprintf(fp,"%f %f %f L3\n", X , Y+t1 , Z+t1 );
119 fprintf(fp,"%f %f %f L3\n", 0. , Y+t1 , Z+t1 );
120 fprintf(fp,"stroke\n");
121 fprintf(fp,"%f %f %f M3\n", X , 0. , 0. );
122 fprintf(fp,"%f %f %f L3\n", X+t1 , 0. , t1 );
123 fprintf(fp,"stroke\n");
124 fprintf(fp,"%f %f %f M3\n", 0. , 0. , Z );
125 fprintf(fp,"%f %f %f L3\n", t1 , 0. , Z+t1 );
126 fprintf(fp,"stroke\n");
127 fprintf(fp,"%f %f %f M3\n", X+t1 , Y+t1 , Z );
128 fprintf(fp,"%f %f %f L3\n", X , Y+t1 , Z+t1 );
129 fprintf(fp,"stroke\n");
130 fprintf(fp,"%f %f %f M3\n", 0. , 0. , 0. );
131 fprintf(fp,"%f %f %f RL3\n", -p1 , -p1 , -p1 );
132 fprintf(fp,"stroke\n");
133 fprintf(fp,"%f %f %f M3\n", X+t1 , Y+t1 , 0. );
134 fprintf(fp,"%f %f %f RL3\n", p1 , p1 , -p1 );
135 fprintf(fp,"stroke\n");
136 fprintf(fp,"%f %f %f M3\n", X+t1 , 0. , Z+t1 );
137 fprintf(fp,"%f %f %f RL3\n", p1 , -p1 , p1 );
138 fprintf(fp,"stroke\n");
139 fprintf(fp,"%f %f %f M3\n", 0. , Y+t1 , Z+t1 );
140 fprintf(fp,"%f %f %f RL3\n", -p1 , p1 , p1 );
141 fprintf(fp,"stroke\n");
142 fprintf(fp,"showpage\n");