#include "plugins.h"
|
#include <stdlib.h>
|
#include "general.h"
|
#include "vertex.h"
|
#include "cell.h"
|
char plugin_name[] = "Nucleus";
|
char plugin_description[]= "This plugin adds nucleus to the center of the vesicle. For now only vertexmove constraint is implemented.";
|
char plugin_author[] = "SAMO PENIC";
|
|
ts_plugin_details *init (){
|
ts_plugin_details *details=(ts_plugin_details *)calloc(1,sizeof(ts_plugin_details));
|
details->name = plugin_name;
|
return details;
|
}
|
|
ts_bool vm_hard_constraint(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *ovtx){
|
// TODO: Maybe faster if checks only nucleus-neighboring cells
|
// Nucleus penetration check:
|
//#define SQ(x) x*x
|
if(vesicle->R_nucleus>0.0){
|
if ((vtx->x-vesicle->nucleus_center[0])*(vtx->x-vesicle->nucleus_center[0])+ (vtx->y-vesicle->nucleus_center[1])*(vtx->y-vesicle->nucleus_center[1]) + (vtx->z-vesicle->nucleus_center[2])*(vtx->z-vesicle->nucleus_center[2]) < vesicle->R_nucleus){
|
return TS_FAIL;
|
}
|
} else if(vesicle->R_nucleusX>0.0){
|
if ((vtx->x-vesicle->nucleus_center[0])*(vtx->x-vesicle->nucleus_center[0])/vesicle->R_nucleusX + (vtx->y-vesicle->nucleus_center[1])*(vtx->y-vesicle->nucleus_center[1])/vesicle->R_nucleusY + (vtx->z-vesicle->nucleus_center[2])*(vtx->z-vesicle->nucleus_center[2])/vesicle->R_nucleusZ < 1.0){
|
return TS_FAIL;
|
}
|
|
}
|
|
return TS_SUCCESS;
|
}
|