aboutsummaryrefslogtreecommitdiff
path: root/src/basis.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basis.c')
-rw-r--r--src/basis.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/basis.c b/src/basis.c
index a7ff978..939dc93 100644
--- a/src/basis.c
+++ b/src/basis.c
@@ -21,12 +21,12 @@
#include "reflections.h"
#include "basis.h"
-static double basis_efom(ReflectionContext *rctx, Basis *basis) {
+static double basis_efom(ReflectionList *reflectionlist, Basis *basis) {
int n_indexed, n_counted;
Reflection *cur;
- cur = rctx->reflections;
+ cur = reflectionlist->reflections;
n_indexed = 0;
n_counted = 0;
while ( cur ) {
@@ -80,14 +80,14 @@ static int basis_lfom(ControlContext *ctx, double vx, double vy, double vz) {
lfom = 0;
tol = modulus(vx, vy, vz)/10.0;
- tcentre = ctx->reflectionctx->reflections;
+ tcentre = ctx->reflectionlist->reflections;
do {
for ( j=-20; j<=20; j++ ) {
Reflection *check;
- check = reflection_find_nearest(ctx->reflectionctx, tcentre->x+vx*j, tcentre->y+vy*j, tcentre->z+vz*j);
+ check = reflection_find_nearest(ctx->reflectionlist, tcentre->x+vx*j, tcentre->y+vy*j, tcentre->z+vz*j);
if ( check && (distance3d(check->x, check->y, check->z, tcentre->x+vx*j, tcentre->y+vy*j, tcentre->z+vz*j) < tol) ) {
lfom++;
}
@@ -102,7 +102,7 @@ static int basis_lfom(ControlContext *ctx, double vx, double vy, double vz) {
}
-static ReflectionContext *basis_find_seeds(ControlContext *ctx) {
+static ReflectionList *basis_find_seeds(ControlContext *ctx) {
double tilt_min;
double tilt_max;
@@ -113,7 +113,7 @@ static ReflectionContext *basis_find_seeds(ControlContext *ctx) {
double x, y, z;
Reflection *centre;
int i;
- ReflectionContext *seeds;
+ ReflectionList *seeds;
seeds = reflection_init();
@@ -134,17 +134,17 @@ static ReflectionContext *basis_find_seeds(ControlContext *ctx) {
z = z_temp;
/* Find the point in the middle of the "wedge" */
- scale = reflection_largest_g(ctx->reflectionctx)/4;
+ scale = reflection_largest_g(ctx->reflectionlist)/4;
x *= scale;
y *= scale;
z *= scale;
- reflection_add(ctx->reflectionctx, x, y, z, 1.0, REFLECTION_VECTOR_MARKER_2);
+ reflection_add(ctx->reflectionlist, x, y, z, 1.0, REFLECTION_VECTOR_MARKER_2);
/* Find an "origin" reflection */
- centre = reflection_find_nearest(ctx->reflectionctx, x, y, z);
+ centre = reflection_find_nearest(ctx->reflectionlist, x, y, z);
if ( !centre ) return NULL;
centre->found = 1;
- reflection_add(ctx->reflectionctx, centre->x, centre->y, centre->z, 1.0, REFLECTION_GENERATED);
+ reflection_add(ctx->reflectionlist, centre->x, centre->y, centre->z, 1.0, REFLECTION_GENERATED);
for ( i=1; i<=10; i++ ) {
@@ -160,7 +160,7 @@ static ReflectionContext *basis_find_seeds(ControlContext *ctx) {
accept = 1;
/* Find a "candidate vector" reflection */
- vector = reflection_find_nearest_longer(ctx->reflectionctx, centre->x, centre->y, centre->z, 1e9); /* 0.5 A^-1 */
+ vector = reflection_find_nearest_longer(ctx->reflectionlist, centre->x, centre->y, centre->z, 1e9); /* 0.5 A^-1 */
if ( !vector ) {
printf("BS: Couldn't find enough seeds\n");
return NULL;
@@ -173,7 +173,7 @@ static ReflectionContext *basis_find_seeds(ControlContext *ctx) {
vz = vector->z - centre->z;
/* Proximity test */
- check = reflection_find_nearest_type(ctx->reflectionctx, vx, vy, vz, REFLECTION_NORMAL);
+ check = reflection_find_nearest_type(ctx->reflectionlist, vx, vy, vz, REFLECTION_NORMAL);
if ( check ) {
if ( distance3d(vx, vy, vz, check->x, check->y, check->z) < 1e9 ) {
/* Too close to another seed */
@@ -193,7 +193,7 @@ static ReflectionContext *basis_find_seeds(ControlContext *ctx) {
} while ( !accept );
reflection_add(seeds, vx, vy, vz, 1.0, REFLECTION_NORMAL);
- reflection_add(ctx->reflectionctx, vx, vy, vz, 1.0, REFLECTION_MARKER);
+ reflection_add(ctx->reflectionlist, vx, vy, vz, 1.0, REFLECTION_MARKER);
}
@@ -204,7 +204,7 @@ static ReflectionContext *basis_find_seeds(ControlContext *ctx) {
Basis *basis_find(ControlContext *ctx) {
Basis *basis;
- ReflectionContext *seeds;
+ ReflectionList *seeds;
Reflection *ref;
int i;
@@ -244,7 +244,7 @@ Basis *basis_find(ControlContext *ctx) {
}
- printf("BS: eFOM = %7.3f %%\n", basis_efom(ctx->reflectionctx, basis)*100);
+ printf("BS: eFOM = %7.3f %%\n", basis_efom(ctx->reflectionlist, basis)*100);
return basis;