49 c_vector<double, SPACE_DIM> random_vector;
51 c_vector<double, SPACE_DIM> parent_coords;
54 c_vector<double, SPACE_DIM> daughter_coords;
61 random_vector(0) = 0.5*separation*random_direction;
62 c_vector<double, SPACE_DIM> proposed_new_parent_coords;
64 proposed_new_parent_coords(0) = parent_coords(0) - random_vector(0);
65 c_vector<double, SPACE_DIM> proposed_new_daughter_coords = zero_vector<double>(SPACE_DIM);
66 proposed_new_daughter_coords = parent_coords + random_vector;
68 if ((proposed_new_parent_coords(0) >= 0.0) && (proposed_new_daughter_coords(0) >= 0.0))
71 parent_coords = proposed_new_parent_coords;
72 daughter_coords = proposed_new_daughter_coords;
76 proposed_new_daughter_coords = parent_coords + 2.0*random_vector;
77 while (proposed_new_daughter_coords(0) < 0.0)
80 random_vector(0) = 0.5*separation*fresh_random_direction;
81 proposed_new_daughter_coords = parent_coords + random_vector;
83 daughter_coords = proposed_new_daughter_coords;
87 assert(daughter_coords(0) >= 0.0);
88 assert(parent_coords(0) >= 0.0);
100 random_angle *= 2.0*M_PI;
102 random_vector(0) = 0.5*separation*cos(random_angle);
103 random_vector(1) = 0.5*separation*sin(random_angle);
105 c_vector<double, SPACE_DIM> proposed_new_parent_coords = zero_vector<double>(SPACE_DIM);
106 proposed_new_parent_coords = parent_coords - random_vector;
107 c_vector<double, SPACE_DIM> proposed_new_daughter_coords;
108 proposed_new_daughter_coords = parent_coords + random_vector;
110 if ((proposed_new_parent_coords(1) >= 0.0) && (proposed_new_daughter_coords(1) >= 0.0))
113 parent_coords = proposed_new_parent_coords;
114 daughter_coords = proposed_new_daughter_coords;
118 proposed_new_daughter_coords = parent_coords + 2.0*random_vector;
119 while (proposed_new_daughter_coords(1) < 0.0)
122 random_angle *= 2.0*M_PI;
124 random_vector(0) = separation*cos(random_angle);
125 random_vector(1) = separation*sin(random_angle);
126 proposed_new_daughter_coords = parent_coords + random_vector;
128 daughter_coords = proposed_new_daughter_coords;
132 assert(daughter_coords(1) >= 0.0);
133 assert(parent_coords(1) >= 0.0);
138 EXCEPTION(
"CryptCentreBasedDivisionRule is not implemented for SPACE_DIM == 3");
146 std::pair<c_vector<double, SPACE_DIM>, c_vector<double, SPACE_DIM> > positions(parent_coords, daughter_coords);