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






(C) 2024 - Gerhard Jan Smit - Twist Apple