@@ -608,10 +608,22 @@ Cell* Cell::divide( )
608608 normalize( &rand_vec );
609609 rand_vec *= radius; // multiply direction times the displacement
610610 */
611-
612- std::vector<double > rand_vec = cell_division_orientation ();
613- rand_vec = rand_vec- phenotype.geometry .polarity *(rand_vec[0 ]*state.orientation [0 ]+
614- rand_vec[1 ]*state.orientation [1 ]+rand_vec[2 ]*state.orientation [2 ])*state.orientation ;
611+
612+ std::vector<double > rand_vec;
613+ if ( this ->functions .cell_division_direction_function )
614+ {
615+ rand_vec = this ->functions .cell_division_direction_function ( this );
616+ if ( default_microenvironment_options.simulate_2D == true ) // ensure vec in XY plane
617+ { rand_vec[2 ] = 0.0 ; }
618+ normalize ( &rand_vec ); // ensure normalized
619+ }
620+ else
621+ {
622+ rand_vec = cell_division_orientation ();
623+ rand_vec = rand_vec- phenotype.geometry .polarity *(rand_vec[0 ]*state.orientation [0 ]+
624+ rand_vec[1 ]*state.orientation [1 ]+rand_vec[2 ]*state.orientation [2 ])*state.orientation ;
625+ }
626+
615627 rand_vec *= phenotype.geometry .radius ;
616628
617629 child->assign_position (position[0 ] + rand_vec[0 ],
@@ -1362,6 +1374,7 @@ void Cell::ingest_cell( Cell* pCell_to_eat )
13621374 pCell_to_eat->functions .update_phenotype = NULL ;
13631375 pCell_to_eat->functions .contact_function = NULL ;
13641376 pCell_to_eat->functions .cell_division_function = NULL ;
1377+ pCell_to_eat->functions .cell_division_direction_function = NULL ;
13651378
13661379 // should set volume fuction to NULL too!
13671380 pCell_to_eat->functions .volume_update_function = NULL ;
@@ -1613,6 +1626,7 @@ void Cell::fuse_cell( Cell* pCell_to_fuse )
16131626 pCell_to_fuse->functions .update_phenotype = NULL ;
16141627 pCell_to_fuse->functions .contact_function = NULL ;
16151628 pCell_to_fuse->functions .cell_division_function = NULL ;
1629+ pCell_to_fuse->functions .cell_division_direction_function = NULL ;
16161630 pCell_to_fuse->functions .volume_update_function = NULL ;
16171631
16181632 // remove all adhesions
@@ -1653,6 +1667,7 @@ void Cell::lyse_cell( void )
16531667 functions.update_phenotype = NULL ;
16541668 functions.contact_function = NULL ;
16551669 functions.cell_division_function = NULL ;
1670+ functions.cell_division_direction_function = NULL ;
16561671
16571672 // remove all adhesions
16581673
@@ -1750,6 +1765,13 @@ void display_ptr_as_bool( void (*ptr)(Cell*,Cell*), std::ostream& os )
17501765 os << " false" ;
17511766 return ;
17521767}
1768+ void display_ptr_as_bool ( std::vector<double > (*ptr)(Cell*), std::ostream& os )
1769+ {
1770+ if ( ptr )
1771+ { os << " true" ; return ; }
1772+ os << " false" ;
1773+ return ;
1774+ }
17531775
17541776void display_cell_definitions ( std::ostream& os )
17551777{
@@ -1836,6 +1858,8 @@ void display_cell_definitions( std::ostream& os )
18361858 os << std::endl;
18371859 os << " \t\t cell division function: " ; display_ptr_as_bool ( pCF->cell_division_function , std::cout );
18381860 os << std::endl;
1861+ os << " \t\t cell division direction function: " ; display_ptr_as_bool ( pCF->cell_division_direction_function , std::cout );
1862+ os << std::endl;
18391863
18401864 // summarize motility
18411865
0 commit comments