This software is published under the GNU General Public License v3.0.



     
Internal movement of a quark.

Coding the dimensional basic

The separate fundamental forces of nature: – the strong interaction, the electromagnetic interaction, the weak interaction and the gravitational interaction – are calculatable with one formula out of one principle. The statistical math of the quantum theory is set aside in favor of a goniometric approach. Gravitation is the only force that matters and the strong force, the electromagnetic force and the weak force can be explained out of gravitation, while gravity itself is only caused by the curvature of a mass, corresponding with a certain amount of bending of spacetime.

The axiom is that the most elementary particle in existence is the dimensional basic (db or ). The itself has no dimensions (no length, no width and no height). The is found everywhere in the universe and is always moving through spacetime, where the speed of the movement of the , in respect to its surroundings, can have any value. The curvature of space on the location of the is infinite while time on the location of the stands still. The behaves like a black hole without dimensions. The is the building block of all that we perceive.

The formula for the extent of spacetime curvature around a is:


In the formula: x, y, z, are coordinates in spacetime [m], Kr = curvature [m-1].

Formula (0) describes the relative lessened extent of curvature of spacetime surrounding the .

The distance between the various s varies in time by movements relative to each other. The direction of movement is being influenced according to gravitational laws. The tracks of movement are being influenced by the curvature of spacetime caused by the s themselves. This means that spacetime surrounding a gets smaller when the s are approaching each other while spacetime surrounding a gets bigger when the s move away from each other.

The is different than other particles in that respect that other particles consist out of multiple s while the itself is a singular particle. Each is a singularity (infinite curvature) on itself while other particles than the are a combination of multiple s and thus a system of multiple singularities.

The observed forces (strong, electromagnetic, weak and gravitation) have the same origin. The cause of these forces are because of the characteristics of a singular . The observed forces are in fact a sum of circular movements that come to exist when multiple s interact with each other.


Figure 1: The tracks of two interacting s on different distances from each other.
(Original: Deflection of the tracks of a photon close to an object with a heavy mass).

     


In figure 1 is shown how the movement tracks of photons react to the event horizon of a black hole. The same regularity applies to a binary black hole system. This is equal to the movement tracks of two s in respect to each other with the difference that the two s have no event horizon. The Pauli principle is never violated because the s have no dimensions, they can approach each other, but can never touch each other. These movement tracks are equal in behavior to Newton’s laws of gravity. On the basis of that information the Borland C computer program ‘Newton’ has been developed. This computer program shows the movement tracks of s in three dimensional spacetime, in which the movement tracks of the s follow the gravitational laws. A three dimensional snapshot with nine interacting s is shown in figure 2. In this figure the Einsteinian bending of spacetime has not been taken into account. The computer program ‘Newton’ gives the possibility to show the time delay in video, as seen by an outside observer thus making clear the principle of time delay.


Figure 2: The movement tracks of nine s during a random time.



The second model that has been developed is the Borland C computer plot program ‘Einstein’. This computer program has been developed to show how spacetime around a is being bend as seen by an outside observer, the extent of bending calculated according to formula (0).br>
Just like one as a singular singularity causes bending of spacetime because of an infinite curvature, a multitude of s will show a stronger bending of spacetime because of a sum of infinite curvatures. As Einstein made clear, we can speak of curbed spacetime instead of linear spacetime. The more mass an object has, the more spacetime bends. In fact mass is the sum of the curvatures of a certain amount of s close to each other. In case of for example three billion s one can speak of three billion times infinite curvature. This makes it possible to isolate infinite numbers in comparison equations and thus mass can be expressed as an absolute number. One can say that a cluster of a certain amount of s will have an absolute number of infinite curvatures. In this way one can speak of mass A with X times infinite curvatures, while mass B has Y times infinite curvatures. The infinities on both sides of the comparison can be done away with and only the absolute proportions of X and Y remain for the respective masses. A cluster of s with an absolute amount of s correlates with the mass of an object and thus a certain extent of bending of spacetime.

The extent of bending of spacetime is calculated using formula (0), where the extent of curvature on a specific position of spacetime is being calculated. A bigger curvature means that spacetime is more bended, whereas a smaller curvature means that spacetime is less bended.

An example of this is shown in figure 3. In figure 3 the plot of a cube of spacetime is shown. The Einsteinian bending of a cube of spacetime is made visual. While figure 3a shows no bending of spacetime because of the absence of a , the bending in a cube of spacetime, and thus deformed distances for an outside observer, in figure 3b have been calculated according to formula (0) because of the position of a in the center of the cube of spacetime. At the center of the six surfaces of the cube of spacetime the distance to the is the smallest, for the outside observer it appears that that piece of spacetime is closer to the than it should be in linear (uncurbed) spacetime, this because of the bending of spacetime, made visual by formula (0). Hence the pointy form of the corners of the cube of spacetime, there the distance to the is the biggest. Because of the bending of spacetime the distance is bigger for the outside observer than it should be according to a linear scale, this again made visual by calculating the extent of bending of spacetime according to formula (0). The closer spacetime is to a , the higher the curvature and the more spacetime will be bend.


Figure 3: The bending of a cube of spacetime under the influence of a .

3a. Uncurbed (linear) cube of spacetime. 3b. Cube of spacetime curbed by the presence of a in the center.


Conclusion: The Newtonian laws represent the straight movement paths as being caused by the bending of spacetime, just like Einstein made clear. Thus Newton’s laws of gravity apply to the movement paths of the or a multitude of s.
Both computer programs together represent the movement and character of the . The reality of the can be simulated by computer programs according to gravitational laws, taking into account the reality of formula (0) and the thereby caused bending of spacetime, with, as seen by an outside observer, the observed bending of spacetime and time delay. A third model, combining the linear Newtonian laws of gravity with Einsteinian bending of space and delay of time should be able to simulate the universe as a whole. Whereas a model with an infinite amount of s is practically not possible, a model with a subset of a large number of s should be possible.

Below the sources codes of the Borland C computer programs ‘Newton’ and ‘Einstein’ can be seen, while not making a choice shows a MS Quick Basic example of movement analysis with which figure 2 has been calculated.


Download article (PDF):
Coding the dimensional basic

Download code (TXT):
dbmove.bas newton.cpp einstein.cpp


Show code:
Program Newton Program Einstein


Borland C Program Newton:

0// (C) 1996 G.J. Smit, Nijmegen, Nederland
1// This software is published under the GNU General Public License v3.0
2// www.dbphysics.com
3// The program 'Newton' is a n-body model where simultaneously for the positions of multiple dimensional basics (theoretical infinite curvature) moving through space time interact with each other according to newtonian laws.
4
5#include
6#include
7#include
8#include
9#include
10#include
11#include
12
13FILE *bestand; // Pointer voor geopend bestand.
14char b_naam[12]; // Naam van actief bestand.
15char b_test; // Controle voor bestaan bestand.
16char toets; // Variabele voor ingedrukte toets.
17int t1,t2,t3,t4; // Tellers voor lussen.
18int stap,dim,deel; // Aantal stappen, dimensies en deeltjes.
19int spoor; // Lengte afbeelding in tijd per deeltje.
20int prog; // Programma einde.
21int i_temp; // Tijdelijk opslag integer.
22int midd; // Middelpunt in tekening aan/uit.
23int modus; // Kleur per deel/diepte.
24float w_g, w_x, w_y; // Windowgrootte, x en y co�rdinaatgrootte.
25float x_max, y_max; // Aantal pixels op beeldscherm.
26float t_frag, grens; // Tijdfragmentatie en grenswaarde ruimte.
27float r_o, r_n; // Bereik willekeurige beginco�rdinaten.
28float fzx, fzy, fzz; // Zwaartekracht per as.
29float g_temp; // Grenswaarde wisseling.
30float f_temp; // Tijdelijk opslag float.
31float midx, midy; // Middelpunt berekening-variabelen.
32float diepte; // Kleur-diepte variabele.
33float huge x3[251][4]; // Maximaal 250 x3d-co�rdinaten.
34float huge y3[251][4]; // Maximaal 250 y3d-co�rdinaten.
35float huge z3[251][4]; // Maximaal 250 z3d-co�rdinaten.
36float huge x2[251][30]; // Maximaal 30 x2d-co�rdinaten per deeltje.
37float huge y2[251][30]; // Maximaal 30 y2d-co�rdinaten per deeltje.
38
39void theorie(void) // Rekenkundig variabele verhoudingen.
40{ detectgraph(&t1, &t2);
41 initgraph(&t1, &t2, "..\\bgi");
42 setcolor(7);
43 for(t1=0; t1<20; t1++)
44 { line(x_max/2+200-t1*10, y_max/2, x_max/2, y_max/2+t1*10);
45 line(x_max/2-t1*10, y_max/2, x_max/2, y_max/2+200-t1*10);
46 line(x_max/2-200+t1*10, y_max/2, x_max/2, y_max/2-t1*10);
47 line(x_max/2+t1*10, y_max/2, x_max/2, y_max/2-200+t1*10);
48 }
49 getch();
50 closegraph();
51}
52
53void varbestand(void) // Variabele waarden bestand inlezen.
54{ bestand=fopen(b_naam,"r");
55 if(bestand==NULL) b_test=0;
56 else
57 { fscanf(bestand, "%d%d%f%f%f%f", &stap, &deel, &r_o, &r_n, &t_frag, &grens);
58 if(grens!=0) w_g=1.5*grens;
59 b_test=1;
60 }
61 fclose(bestand);
62}
63
64void menuopbeeld(void)
65{ clrscr();
66 textcolor(10);
67 printf("[b]estandsnaam ");
68 if(b_test==0) printf("-"); else printf("+");
69 printf(" : %s\n\n", b_naam);
70 printf("[c]o�rdinaten\n");
71 printf("[w]illekeur : %f\n", r_o);
72 printf("[r]ichting : %f\n\n", r_n);
73 printf("[t]ijdfragmentatie : %f\n", t_frag);
74 printf("[g]rens : %f\n\n", grens);
75 printf("[s]tappen : %d\n", stap);
76 printf("[d]eel : %d\n\n", deel);
77 printf("[v]enster : %f\n", w_g);
78 printf("[p]rojectie : %d\n", spoor);
79 printf("[m]iddelpunt : ");
80 if(midd==0) printf("uit\n"); else printf("aan\n");
81 printf("[k]leurmodus : ");
82 if(modus==0) printf("deel\n\n\n"); else printf("diepte\n\n\n");
83 printf("[R]ekenen [E]n [T]ekenen [S]toppen\n\n");
84}
85
86void menuvraag(void)
87{ toets=getch();
88 if(toets==98) { printf("Nieuwe bestandsnaam? ");
89 scanf("%s", &b_naam); }
90 if(toets==99) { printf("Invoer co�rdinaten, nog programmeren...");
91 getch(); }
92 if(toets==119) { f_temp=r_o; printf("Maximale willekeur? ");
93 scanf("%f", &r_o);
94 if(r_o<0||r_o==0||r_o>30000) r_o=f_temp; }
95 if(toets==114) { f_temp=r_n; printf("Maximale richting? ");
96 scanf("%f", &r_n);
97 if(r_n<0||r_o==0||r_o>2500) r_o=f_temp; }
98 if(toets==116) { f_temp=t_frag; printf("Nieuwe tijdfragmentatie? ");
99 scanf("%f", &t_frag);
100 if(t_frag<0||t_frag==0||t_frag>1) t_frag=f_temp; }
101 if(toets==103) { f_temp=grens; printf("Grens van ruimte? ");
102 scanf("%f", &grens);
103 if(grens<0||grens>32500) grens=f_temp; }
104 if(toets==115) { i_temp=stap; printf("Aantal stappen? ");
105 scanf("%d", &stap);
106 if(stap<1||stap>32500) stap=i_temp; }
107 if(toets==100) { i_temp=deel; printf("Aantal deeltjes? ");
108 scanf("%d", &deel);
109 if(deel<2||deel>250) deel=i_temp; }
110 if(toets==118) { f_temp=w_g; printf("Venstergrootte? ");
111 scanf("%f", &w_g);
112 if(w_g<0||w_g==0||w_g>32500) w_g=f_temp; }
113 if(toets==112) { i_temp=spoor; printf("Aantal fragmenten? ");
114 scanf("%d", &spoor);
115 if(spoor<0||spoor>30) spoor=i_temp; }
116 if(toets==109) { if(midd==0) midd=1; else midd=0; }
117 if(toets==107) { if(modus==0) modus=1; else modus=0; }
118}
119
120void willekeur(void)
121{ for(t1=0;t1
122 { x3[t1][0]=2*(random(32767)*r_o/32767)-r_o;
123 y3[t1][0]=2*(random(32767)*r_o/32767)-r_o;
124 z3[t1][0]=2*(random(32767)*r_o/32767)-r_o;
125 x3[t1][1]=x3[t1][0]+2*(random(32767)*r_n/32767)-r_n;
126 y3[t1][1]=y3[t1][0]+2*(random(32767)*r_n/32767)-r_n;
127 z3[t1][1]=z3[t1][0]+2*(random(32767)*r_n/32767)-r_n;
128 }
129}
130
131void reken(void) // Kaal [R]ekenen, snelste routine.
132{ // Bestand voor co�rdinaten openen.
133 bestand=fopen(b_naam,"w");
134 fprintf(bestand, "%d %d %f %f %f %f", stap, deel, r_o, r_n, t_frag, grens);
135 for(t1=0;t1
136 fprintf(bestand, " %f %f %f", x3[t1][1], y3[t1][1], z3[t1][1]);
137
138 // Co�rdinaten berekenen, schrijven naar disk en naar tekst-beeldscherm.
139 for(t1=0;t1
140 { for(t2=0;t2
141 { x3[t2][3]=0;
142 y3[t2][3]=0;
143 z3[t2][3]=0;
144 }
145 for(t2=0;t2
146 { x3[t2][2]=x3[t2][1]-x3[t2][0];
147 y3[t2][2]=y3[t2][1]-y3[t2][0];
148 z3[t2][2]=z3[t2][1]-z3[t2][0];
149 for(t3=t2;t3
150 { fzx=x3[t3][1]-x3[t2][1];
151 fzy=y3[t3][1]-y3[t2][1];
152 fzz=z3[t3][1]-z3[t2][1];
153 if(fzx!=0) { fzx=1/fzx; x3[t2][3]=x3[t2][3]+fzx;
154 x3[t3][3]=x3[t3][3]-fzx; }
155 if(fzy!=0) { fzy=1/fzy; y3[t2][3]=y3[t2][3]+fzy;
156 y3[t3][3]=y3[t3][3]-fzy; }
157 if(fzz!=0) { fzz=1/fzz; z3[t2][3]=z3[t2][3]+fzz;
158 z3[t3][3]=z3[t3][3]-fzz; }
159 }
160 x3[t2][0]=x3[t2][1];
161 y3[t2][0]=y3[t2][1];
162 z3[t2][0]=z3[t2][1];
163 x3[t2][1]=x3[t2][0]+x3[t2][2]+x3[t2][3];
164 y3[t2][1]=y3[t2][0]+y3[t2][2]+y3[t2][3];
165 z3[t2][1]=z3[t2][0]+z3[t2][2]+z3[t2][3];
166 }
167 for(t2=0;t2
168 fprintf(bestand, " %f %f %f", x3[t2][1], y3[t2][1], z3[t2][1]);
169 putchar(13); printf("%d",t1+1);
170 }
171 fclose(bestand);
172 b_test=1;
173}
174
175void rekenmetopties(void) // [R]ekenen met grens en/of t_frag aan.
176{ // Bestand voor co�rdinaten openen.
177 bestand=fopen(b_naam,"w");
178 fprintf(bestand, "%d %d %f %f %f %f", stap, deel, r_o, r_n, t_frag, grens);
179 for(t1=0;t1
180 fprintf(bestand, " %f %f %f", x3[t1][1], y3[t1][1], z3[t1][1]);
181
182 // Co�rdinaten berekenen, schrijven naar disk en naar tekst-beeldscherm.
183 for(t1=0;t1
184 { for(t2=0;t2
185 { x3[t2][3]=0;
186 y3[t2][3]=0;
187 z3[t2][3]=0;
188 }
189 for(t2=0;t2
190 { x3[t2][2]=x3[t2][1]-x3[t2][0];
191 y3[t2][2]=y3[t2][1]-y3[t2][0];
192 z3[t2][2]=z3[t2][1]-z3[t2][0];
193 for(t3=t2;t3
194 { fzx=x3[t3][1]-x3[t2][1];
195 fzy=y3[t3][1]-y3[t2][1];
196 fzz=z3[t3][1]-z3[t2][1];
197 if(fzx!=0) { fzx=1/fzx; x3[t2][3]=x3[t2][3]+fzx;
198 x3[t3][3]=x3[t3][3]-fzx; }
199 if(fzy!=0) { fzy=1/fzy; y3[t2][3]=y3[t2][3]+fzy;
200 y3[t3][3]=y3[t3][3]-fzy; }
201 if(fzz!=0) { fzz=1/fzz; z3[t2][3]=z3[t2][3]+fzz;
202 z3[t3][3]=z3[t3][3]-fzz; }
203 }
204 // Bewerk co�rdinaten als t_frag ongelijk aan 1.
205 if(t_frag!=1)
206 { x3[t2][2]=x3[t2][2]*t_frag; x3[t2][3]=x3[t2][3]*t_frag;
207 y3[t2][2]=y3[t2][2]*t_frag; y3[t2][3]=y3[t2][3]*t_frag;
208 z3[t2][2]=z3[t2][2]*t_frag; z3[t2][3]=z3[t2][3]*t_frag;
209 }
210 // Bepaal de nieuwe co�rdinaten.
211 x3[t2][0]=x3[t2][1];
212 y3[t2][0]=y3[t2][1];
213 z3[t2][0]=z3[t2][1];
214 x3[t2][1]=x3[t2][0]+x3[t2][2]+x3[t2][3];
215 y3[t2][1]=y3[t2][0]+y3[t2][2]+y3[t2][3];
216 z3[t2][1]=z3[t2][0]+z3[t2][2]+z3[t2][3];
217 // Test grensoverschrijding.
218 if(grens>0)
219 { if(x3[t2][1]<-grens||x3[t2][1]>grens)
220 { g_temp=x3[t2][1]; x3[t2][1]=-x3[t2][0]; x3[t2][0]=-g_temp; }
221 if(y3[t2][1]<-grens||y3[t2][1]>grens)
222 { g_temp=y3[t2][1]; y3[t2][1]=-y3[t2][0]; y3[t2][0]=-g_temp; }
223 if(z3[t2][1]<-grens||z3[t2][1]>grens)
224 { g_temp=z3[t2][1]; z3[t2][1]=-z3[t2][0]; z3[t2][0]=-g_temp; }
225 }
226 }
227 for(t2=0;t2
228 fprintf(bestand, " %f %f %f", x3[t2][1], y3[t2][1], z3[t2][1]);
229 putchar(13); printf("%d",t1+1);
230 }
231 fclose(bestand);
232 b_test=1;
233}
234
235void rekenenteken(void) // [E]n.
236{ detectgraph(&t1, &t2);
237 initgraph(&t1, &t2, "..\\bgi");
238 w_x=(x_max+1)/(w_g*2); w_y=(y_max+1)/(w_g*2);
239 printf(" |%d|%d|%f|%f|%f|%f|%f|%d|%s",
240 stap, deel, r_o, r_n, t_frag, grens, w_g, spoor, b_naam);
241 gotoxy(0,0);
242 midd=0; spoor=0; modus=0;
243
244 // Bestand voor co�rdinaten openen.
245 bestand=fopen(b_naam,"w");
246 fprintf(bestand, "%d %d %f %f %f %f", stap, deel, r_o, r_n, t_frag, grens);
247 for(t1=0;t1
248 fprintf(bestand, " %f %f %f", x3[t1][1], y3[t1][1], z3[t1][1]);
249
250 // Co�rdinaten berekenen, schrijven naar disk en naar grafisch beeldscherm.
251 for(t1=0;t1
252 { for(t2=0;t2
253 { x3[t2][3]=0;
254 y3[t2][3]=0;
255 z3[t2][3]=0;
256 }
257 for(t2=0;t2
258 { x3[t2][2]=x3[t2][1]-x3[t2][0];
259 y3[t2][2]=y3[t2][1]-y3[t2][0];
260 z3[t2][2]=z3[t2][1]-z3[t2][0];
261 for(t3=t2;t3
262 { fzx=x3[t3][1]-x3[t2][1];
263 fzy=y3[t3][1]-y3[t2][1];
264 fzz=z3[t3][1]-z3[t2][1];
265 if(fzx!=0) { fzx=1/fzx; x3[t2][3]=x3[t2][3]+fzx;
266 x3[t3][3]=x3[t3][3]-fzx; }
267 if(fzy!=0) { fzy=1/fzy; y3[t2][3]=y3[t2][3]+fzy;
268 y3[t3][3]=y3[t3][3]-fzy; }
269 if(fzz!=0) { fzz=1/fzz; z3[t2][3]=z3[t2][3]+fzz;
270 z3[t3][3]=z3[t3][3]-fzz; }
271 }
272 // Bewerk co�rdinaten als t_frag ongelijk aan 1.
273 if(t_frag!=1)
274 { x3[t2][2]=x3[t2][2]*t_frag; x3[t2][3]=x3[t2][3]*t_frag;
275 y3[t2][2]=y3[t2][2]*t_frag; y3[t2][3]=y3[t2][3]*t_frag;
276 z3[t2][2]=z3[t2][2]*t_frag; z3[t2][3]=z3[t2][3]*t_frag;
277 }
278 // Bepaal de nieuwe co�rdinaten.
279 x3[t2][0]=x3[t2][1];
280 y3[t2][0]=y3[t2][1];
281 z3[t2][0]=z3[t2][1];
282 x3[t2][1]=x3[t2][0]+x3[t2][2]+x3[t2][3];
283 y3[t2][1]=y3[t2][0]+y3[t2][2]+y3[t2][3];
284 z3[t2][1]=z3[t2][0]+z3[t2][2]+z3[t2][3];
285 // Test grensoverschrijding.
286 if(grens>0)
287 { if(x3[t2][1]<-grens||x3[t2][1]>grens)
288 { g_temp=x3[t2][1]; x3[t2][1]=-x3[t2][0]; x3[t2][0]=-g_temp; }
289 if(y3[t2][1]<-grens||y3[t2][1]>grens)
290 { g_temp=y3[t2][1]; y3[t2][1]=-y3[t2][0]; y3[t2][0]=-g_temp; }
291 if(z3[t2][1]<-grens||z3[t2][1]>grens)
292 { g_temp=z3[t2][1]; z3[t2][1]=-z3[t2][0]; z3[t2][0]=-g_temp; }
293 }
294 }
295 for(t2=0;t2
296 fprintf(bestand, " %f %f %f", x3[t2][1], y3[t2][1], z3[t2][1]);
297 for(t2=0;t2
298 { x2[t2][0]=y3[t2][1]-.5*x3[t2][1];
299 y2[t2][0]=z3[t2][1]+.5*x3[t2][1];
300 x2[t2][0]=x_max/2-w_x*x2[t2][0];
301 y2[t2][0]=y_max/2-w_y*y2[t2][0];
302 putpixel(x2[t2][0],y2[t2][0],2+t2);
303 }
304 putchar(13); printf("%d",t1+1);
305 }
306 putchar(13); printf("Klaar");
307 fclose(bestand);
308 b_test=1;
309 getch();
310 closegraph();
311}
312
313void geendisk(void) // [A]lleen rekenen en tekenen.
314{ detectgraph(&t1, &t2);
315 initgraph(&t1, &t2, "..\\bgi");
316 w_x=(x_max+1)/(w_g*2); w_y=(y_max+1)/(w_g*2);
317 if(modus!=0) diepte=255/(w_g*2);
318
319 printf(" |%d|%d|%f|%f|%f|%f|%f|%d|XXXXXX",
320 stap, deel, r_o, r_n, t_frag, grens, w_g, spoor);
321 gotoxy(0,0);
322
323 // Co�rdinaten berekenen, schrijven naar grafisch beeldscherm.
324 for(t1=0;t1
325 { for(t2=0;t2
326 { x3[t2][3]=0;
327 y3[t2][3]=0;
328 z3[t2][3]=0;
329 }
330 putchar(13);printf("%d", t1);
331 if(midd>0) { midx=0; midy=0; }
332 for(t2=0;t2
333 { x3[t2][2]=x3[t2][1]-x3[t2][0];
334 y3[t2][2]=y3[t2][1]-y3[t2][0];
335 z3[t2][2]=z3[t2][1]-z3[t2][0];
336 for(t3=t2;t3
337 { fzx=x3[t3][1]-x3[t2][1];
338 fzy=y3[t3][1]-y3[t2][1];
339 fzz=z3[t3][1]-z3[t2][1];
340 if(fzx!=0) { fzx=1/fzx; x3[t2][3]=x3[t2][3]+fzx;
341 x3[t3][3]=x3[t3][3]-fzx; }
342 if(fzy!=0) { fzy=1/fzy; y3[t2][3]=y3[t2][3]+fzy;
343 y3[t3][3]=y3[t3][3]-fzy; }
344 if(fzz!=0) { fzz=1/fzz; z3[t2][3]=z3[t2][3]+fzz;
345 z3[t3][3]=z3[t3][3]-fzz; }
346 }
347 // Bewerk co�rdinaten als t_frag ongelijk aan 1.
348 if(t_frag!=1)
349 { x3[t2][2]=x3[t2][2]*t_frag; x3[t2][3]=x3[t2][3]*t_frag;
350 y3[t2][2]=y3[t2][2]*t_frag; y3[t2][3]=y3[t2][3]*t_frag;
351 z3[t2][2]=z3[t2][2]*t_frag; z3[t2][3]=z3[t2][3]*t_frag;
352 }
353 // Bepaal de nieuwe co�rdinaten.
354 x3[t2][0]=x3[t2][1];
355 y3[t2][0]=y3[t2][1];
356 z3[t2][0]=z3[t2][1];
357 x3[t2][1]=x3[t2][0]+x3[t2][2]+x3[t2][3];
358 y3[t2][1]=y3[t2][0]+y3[t2][2]+y3[t2][3];
359 z3[t2][1]=z3[t2][0]+z3[t2][2]+z3[t2][3];
360 // Test grensoverschrijding.
361 if(grens>0)
362 { if(x3[t2][1]<-grens||x3[t2][1]>grens)
363 { g_temp=x3[t2][1]; x3[t2][1]=-x3[t2][0]; x3[t2][0]=-g_temp; }
364 if(y3[t2][1]<-grens||y3[t2][1]>grens)
365 { g_temp=y3[t2][1]; y3[t2][1]=-y3[t2][0]; y3[t2][0]=-g_temp; }
366 if(z3[t2][1]<-grens||z3[t2][1]>grens)
367 { g_temp=z3[t2][1]; z3[t2][1]=-z3[t2][0]; z3[t2][0]=-g_temp; }
368 }
369 }
370 for(t2=0;t2
371 { x2[t2][0]=y3[t2][1]-.5*x3[t2][1];
372 y2[t2][0]=z3[t2][1]+.5*x3[t2][1];
373 if(midd>0)
374 { midx=midx+x2[t2][0];
375 midy=midy+y2[t2][0];
376 }
377 }
378 if(midd>0) { midx=midx/deel; midy=midy/deel; }
379 for(t2=0;t2
380 { if(midd>0)
381 { x2[t2][0]=x_max/2+midx-w_x*x2[t2][0];
382 y2[t2][0]=y_max/2+midy-w_y*y2[t2][0];
383 }
384 else
385 { x2[t2][0]=x_max/2-w_x*x2[t2][0];
386 y2[t2][0]=y_max/2-w_y*y2[t2][0];
387 }
388 if(modus==0) putpixel(x2[t2][0],y2[t2][0],2+t2);
389 else putpixel(x2[t2][0],y2[t2][0],1+(x3[t2][1]+w_g)*diepte);
390 if(spoor>0)
391 { if(t1
392 { x2[t2][spoor-1-t1]=x2[t2][0]; y2[t2][spoor-1-t1]=y2[t2][0]; }
393 else
394 { putpixel(x2[t2][spoor-1],y2[t2][spoor-1],0);
395 for(t3=spoor-1;t3>0;t3--)
396 { x2[t2][t3]=x2[t2][t3-1]; y2[t2][t3]=y2[t2][t3-1]; }
397 }
398 }
399 }
400 putchar(13); printf("%d",t1+1);
401 }
402 putchar(13); printf("Klaar");
403 getch();
404 closegraph();
405}
406
407void teken(void)
408{ detectgraph(&t1, &t2);
409 initgraph(&t1, &t2, "..\\bgi");
410 // Berekenen hoeveelheid pixels per ��nheid.
411 w_x=(x_max+1)/(w_g*2); w_y=(y_max+1)/(w_g*2);
412
413 bestand=fopen(b_naam,"r");
414 fscanf(bestand, "%d%d%f%f%f%f", &stap, &deel, &r_o, &r_n, &t_frag, &grens);
415 printf(" |%d|%d|%f|%f|%f|%f|%f|%d|%s",
416 stap, deel, r_o, r_n, t_frag, grens, w_g, spoor, b_naam);
417
418 if(modus!=0) diepte=255/(w_g*2);
419 for(t1=0;t1
420 { putchar(13);printf("%d", t1);
421 if(midd>0) { midx=0; midy=0; }
422 for(t2=0;t2
423 fscanf(bestand, "%f%f%f", &x3[t2][1], &y3[t2][1], &z3[t2][1]);
424 for(t2=0;t2
425 { x2[t2][0]=y3[t2][1]-.5*x3[t2][1];
426 y2[t2][0]=z3[t2][1]+.5*x3[t2][1];
427 if(midd>0)
428 { midx=midx+x2[t2][0];
429 midy=midy+y2[t2][0];
430 }
431 }
432 if(midd>0) { midx=midx/deel; midy=midy/deel; }
433 for(t2=0;t2
434 { if(midd>0)
435 { x2[t2][0]=x_max/2+midx-w_x*x2[t2][0];
436 y2[t2][0]=y_max/2+midy-w_y*y2[t2][0];
437 }
438 else
439 { x2[t2][0]=x_max/2-w_x*x2[t2][0];
440 y2[t2][0]=y_max/2-w_y*y2[t2][0];
441 }
442 if(modus==0) putpixel(x2[t2][0],y2[t2][0],2+t2);
443 else putpixel(x2[t2][0],y2[t2][0],1+(x3[t2][1]+w_g)*diepte);
444 if(spoor>0)
445 { if(t1
446 { x2[t2][spoor-1-t1]=x2[t2][0]; y2[t2][spoor-1-t1]=y2[t2][0]; }
447 else
448 { putpixel(x2[t2][spoor-1],y2[t2][spoor-1],0);
449 for(t3=spoor-1;t3>0;t3--)
450 { x2[t2][t3]=x2[t2][t3-1]; y2[t2][t3]=y2[t2][t3-1]; }
451 }
452 }
453 }
454 }
455 putchar(13); printf("Klaar");
456 fclose(bestand);
457 getch();
458 closegraph();
459}
460
461void main(void)
462{ // Beginwaarden zetten.
463 stap=250; deel=3; r_o=100; r_n=.0001; t_frag=1; grens=0; w_g=500; spoor=0;
464 midd=0; spoor=0; modus=0;
465 clrscr(); textcolor(10);
466
467 // Grafische modus bepalen.
468 detectgraph(&t1, &t2);
469 initgraph(&t1, &t2, "..\\bgi");
470 x_max=getmaxx(); y_max=getmaxy();
471 closegraph();
472
473 // Test of standaard bestand bestaat.
474 strcpy(b_naam, "bestand.xyz");
475 b_test=0;
476 varbestand();
477
478 // Begin programma-lus.
479 prog=1;
480 do
481 { menuopbeeld();
482 toets=0;
483 menuvraag();
484 // [b]estandsnaam.
485 if(toets==98) varbestand();
486 // [R]eken.
487 if(toets==82)
488 { if(b_test==1)
489 { printf("Bestand %s overschrijven? [j/n] ", b_naam);
490 i_temp=getch();
491 putchar(13); printf(" ");
492 putchar(13);
493 if(i_temp==106) b_test=0;
494 }
495 if(b_test==0)
496 { willekeur();
497 if(grens>0||t_frag!=1) rekenmetopties(); else reken();
498 }
499 }
500 if(toets==69)
501 { if(b_test==1)
502 { printf("Bestand %s overschrijven? [j/n] ", b_naam);
503 i_temp=getch();
504 putchar(13); printf(" ");
505 putchar(13);
506 if(i_temp==106) b_test=0;
507 }
508 if(b_test==0)
509 { willekeur();
510 rekenenteken();
511 }
512 }
513 // [T]eken.
514 if(toets==84) teken();
515 if(toets==65) { willekeur(); geendisk(); }
516 if(toets==81) theorie();
517 if(toets==63) { printf("Bedacht en geschreven door G.J.Smit.");
518 getch(); }
519 if(toets==83) prog=0;
520 } while(prog>0);
521}






(C) 2025 - Gerhard Jan Smit - DB Universe