Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions mcstas-comps/contrib/FlatEllipse_finite_mirror.comp
Original file line number Diff line number Diff line change
Expand Up @@ -255,23 +255,18 @@ MCDISPLAY
for (i = 0; i < s.num_f; i++) {
double step = (s.f[i].ze - s.f[i].zs) / 100;
double cz, rp, rc;
double last_cz = 0;
double last_cz = 0;

cz = s.f[i].zs;

// front line
rp = wFlat (cz, s.f[i]);
line (rp, -half_mirror_sidelength, cz, rp, half_mirror_sidelength, cz);
line (-rp, -half_mirror_sidelength, cz, -rp, half_mirror_sidelength, cz);

for (cz = s.f[i].zs + step; cz < s.f[i].ze; cz += step) {
rp = wFlat (cz - step, s.f[i]);
rc = wFlat (cz, s.f[i]);

line (rp, -half_mirror_sidelength, cz - step, rc, -half_mirror_sidelength, cz);
line (rp, half_mirror_sidelength, cz - step, rc, half_mirror_sidelength, cz);
line (-rp, -half_mirror_sidelength, cz - step, -rc, -half_mirror_sidelength, cz);
line (-rp, half_mirror_sidelength, cz - step, -rc, half_mirror_sidelength, cz);
polygon (4, rp, -half_mirror_sidelength, cz - step, rp, half_mirror_sidelength, cz - step, rc, half_mirror_sidelength, cz, rc, -half_mirror_sidelength,
cz);
polygon (4, -rp, -half_mirror_sidelength, cz - step, -rp, half_mirror_sidelength, cz - step, -rc, half_mirror_sidelength, cz, -rc,
-half_mirror_sidelength, cz);

last_cz = cz;
}
Expand All @@ -280,14 +275,10 @@ MCDISPLAY
// cz to s.f[i].ze
rp = wFlat (last_cz, s.f[i]);
rc = wFlat (s.f[i].ze, s.f[i]);
line (rp, -half_mirror_sidelength, last_cz, rc, -half_mirror_sidelength, s.f[i].ze);
line (rp, half_mirror_sidelength, last_cz, rc, half_mirror_sidelength, s.f[i].ze);
line (-rp, -half_mirror_sidelength, last_cz, -rc, -half_mirror_sidelength, s.f[i].ze);
line (-rp, half_mirror_sidelength, last_cz, -rc, half_mirror_sidelength, s.f[i].ze);

// end line
line (rc, -half_mirror_sidelength, s.f[i].ze, rc, half_mirror_sidelength, s.f[i].ze);
line (-rc, -half_mirror_sidelength, s.f[i].ze, -rc, half_mirror_sidelength, s.f[i].ze);
polygon (4, rp, -half_mirror_sidelength, last_cz, rp, half_mirror_sidelength, last_cz, rc, half_mirror_sidelength, s.f[i].ze, rc, -half_mirror_sidelength,
s.f[i].ze);
polygon (4, -rp, -half_mirror_sidelength, last_cz, -rp, half_mirror_sidelength, last_cz, -rc, half_mirror_sidelength, s.f[i].ze, -rc,
-half_mirror_sidelength, s.f[i].ze);
}
%}

Expand Down
7 changes: 1 addition & 6 deletions mcstas-comps/contrib/Mirror_Curved_Bispectral.comp
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,6 @@ TRACE
MCDISPLAY
%{


/*
if (xcenter==0){

Expand Down Expand Up @@ -788,13 +787,9 @@ MCDISPLAY
}

for (j = 0; j < n_lines; j++) {
line (x_plot[j], -ypos[j], zpos[j], x_plot[j + 1], -ypos[j + 1], zpos[j + 1]);
line (x_plot[j], ypos[j], zpos[j], x_plot[j + 1], ypos[j + 1], zpos[j + 1]);
polygon (4, x_plot[j], -ypos[j], zpos[j], x_plot[j], ypos[j], zpos[j], x_plot[j + 1], ypos[j + 1], zpos[j + 1], x_plot[j + 1], -ypos[j + 1], zpos[j + 1]);
}

line (x_plot[0], -ypos[0], zpos[0], x_plot[0], ypos[0], zpos[0]);
line (x_plot[50], -ypos[50], zpos[50], x_plot[50], ypos[50], zpos[50]);

// printf("ypos0=%f xpos0=%f ypos50=%f xpos50=%f",ypos[0], x_plot[0], ypos[50], x_plot[50]);

/* double xmax, xmin, ymax, ymin;
Expand Down
5 changes: 1 addition & 4 deletions mcstas-comps/contrib/Mirror_Elliptic.comp
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,12 @@ MCDISPLAY

delta_z = (zmax - zmin) / 99;
xi = -beta1 * sqrt (1 - zmin * zmin / alpha2);
line (xi, -yheight, zmin, xi, yheight, zmin);
zi = zmin;
/* printf("delta_z : %f / xi : %f / zi : %f\n",delta_z,xi,zi); */
do {
zf = zi + delta_z;
xf = -beta1 * sqrt (1 - zf * zf / alpha2);
line (xi, yheight, zi, xf, yheight, zf);
line (xf, yheight, zf, xf, -yheight, zf);
line (xf, -yheight, zf, xi, -yheight, zi);
polygon (4, xi, -yheight, zi, xi, yheight, zi, xf, yheight, zf, xf, -yheight, zf);
xi = xf;
zi = zf;
} while (zf <= zmax);
Expand Down
7 changes: 1 addition & 6 deletions mcstas-comps/contrib/Mirror_Elliptic_Bispectral.comp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ TRACE
MCDISPLAY
%{


double xstart;
double xend;
double xprime_start;
Expand Down Expand Up @@ -491,13 +490,9 @@ MCDISPLAY
}

for (j = 0; j < n_lines; j++) {
line (x_plot[j], -ypos[j], zpos[j], x_plot[j + 1], -ypos[j + 1], zpos[j + 1]);
line (x_plot[j], ypos[j], zpos[j], x_plot[j + 1], ypos[j + 1], zpos[j + 1]);
polygon (4, x_plot[j], -ypos[j], zpos[j], x_plot[j], ypos[j], zpos[j], x_plot[j + 1], ypos[j + 1], zpos[j + 1], x_plot[j + 1], -ypos[j + 1], zpos[j + 1]);
}

line (x_plot[0], -ypos[0], zpos[0], x_plot[0], ypos[0], zpos[0]);
line (x_plot[50], -ypos[50], zpos[50], x_plot[50], ypos[50], zpos[50]);

// printf("ypos0=%f xpos0=%f ypos50=%f xpos50=%f",ypos[0], x_plot[0], ypos[50], x_plot[50]);

/* double xmax, xmin, ymax, ymin;
Expand Down
5 changes: 1 addition & 4 deletions mcstas-comps/contrib/Mirror_Parabolic.comp
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,11 @@ MCDISPLAY

delta0 = xwidth / 99;
xi = xwidth + xshift;
line (xi, -yheight, 0, xi, yheight, 0);
do {
xf = xi - delta0;
zi = gamma1 * xi * xi + beta1;
zf = gamma1 * xf * xf + beta1;
line (xi, yheight, zi, xf, yheight, zf);
line (xi, -yheight, zi, xf, -yheight, zf);
line (xf, yheight, zf, xf, -yheight, zf);
polygon (4, xi, -yheight, zi, xi, yheight, zi, xf, yheight, zf, xf, -yheight, zf);
xi = xf;
} while (xf >= xshift);
%}
Expand Down
2 changes: 1 addition & 1 deletion mcstas-comps/contrib/Mirror_conic.comp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ TRACE

MCDISPLAY
%{
rectangle ("yz", 0, 0, length / 2, length, yheight);
polygon (4, 0.0, -yheight / 2, 0.0, 0.0, -yheight / 2, length, 0.0, yheight / 2, length, 0.0, yheight / 2, 0.0);
%}

END
10 changes: 10 additions & 0 deletions mcstas-comps/contrib/SupermirrorFlat.comp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,16 @@ MCDISPLAY
for (i = 0; i < n; i++) {
m = sm.geo.afvi[i].nfvi;
ifvi1 = sm.geo.afvi[i].ifvi;
if (m == 3) {
polygon (3, vp1[ifvi1[0]].x, vp1[ifvi1[0]].y, vp1[ifvi1[0]].z, vp1[ifvi1[1]].x, vp1[ifvi1[1]].y, vp1[ifvi1[1]].z, vp1[ifvi1[2]].x, vp1[ifvi1[2]].y,
vp1[ifvi1[2]].z);
continue;
}
if (m == 4) {
polygon (4, vp1[ifvi1[0]].x, vp1[ifvi1[0]].y, vp1[ifvi1[0]].z, vp1[ifvi1[1]].x, vp1[ifvi1[1]].y, vp1[ifvi1[1]].z, vp1[ifvi1[2]].x, vp1[ifvi1[2]].y,
vp1[ifvi1[2]].z, vp1[ifvi1[3]].x, vp1[ifvi1[3]].y, vp1[ifvi1[3]].z);
continue;
}
k1 = ifvi1[0];
for (j = 1; j < m; j++) {
k2 = ifvi1[j];
Expand Down
Loading