//Requires other cells' components so computed here private Vector3 ComputeCellCellAdhesion(float radius) { Vector3 f = Vector3.zero; CellPhenotype phenotype = GetComponent <CellBehavior>().phenotype; foreach (GameObject other in this.collidingCells) { if (other && other.GetComponent <CellBehavior>()) { CellMechanics otherMechanics = other.GetComponent <CellBehavior>().phenotype.cellMechanics; CellPhenotype otherPhenotype = other.GetComponent <CellBehavior>().phenotype; float rOther = otherPhenotype.volume.GetRadius(); Vector3 distVec = other.transform.position - this.transform.position; float dist = Vector3.Magnitude(distVec); float maxAdhesiveInteractiveDistance = phenotype.cellMechanics.relativeMaxAdhesionDistance * radius + otherMechanics.relativeMaxAdhesionDistance * rOther; if (dist < maxAdhesiveInteractiveDistance) { f += Mathf.Sqrt(phenotype.cellMechanics.cellCellAdhesionStrength * otherMechanics.cellCellAdhesionStrength) * Mathf.Pow((1f - dist / maxAdhesiveInteractiveDistance), 2) * distVec; } } } return(f); }
private void OnDrawGizmosSelected() { CellPhenotype phenotype = GetComponent <CellBehavior>().phenotype; if (Application.isPlaying && Globals.animationRunning) { Gizmos.color = Color.blue; Gizmos.DrawLine(transform.position, transform.position + phenotype.cellMechanics.fAdhesionCC); Gizmos.color = Color.red; Gizmos.DrawLine(transform.position, transform.position + phenotype.cellMechanics.fAdhesionBM); Gizmos.DrawSphere(transformMatrixBM.MultiplyPoint3x4(cellBMContactVertex), 1f); } //if (basementMembrane) { // Mesh bmMesh = basementMembrane.GetComponent<MeshFilter>().mesh; // Gizmos.color = Color.blue; // foreach (Vector3 vertex in bmMesh.vertices) { // Gizmos.DrawSphere(transformMatrixBM.MultiplyPoint3x4(vertex), 1f); // } //} }
// Update is called once per frame public void FixedUpdate() { if (!Globals.animationRunning) { return; } CellPhenotype phenotype = GetComponent <CellBehavior>().phenotype; float dist; Vector3 distVec; float radius = phenotype.volume.GetRadius(); Vector3 fAdhesionCC = ComputeCellCellAdhesion(radius); MeshFilter [] meshFilters = basementMembrane.GetComponentsInChildren <MeshFilter>(); Vector3 fAdhesionBM = Vector3.zero; foreach (MeshFilter mf in meshFilters) { cellBMContactVertex = GetCellBMContact(mf.mesh, out dist, out distVec); fAdhesionBM += phenotype.cellMechanics.ComputeCellBMAdhesion(radius, dist, distVec); } rb.AddForce(fAdhesionCC + fAdhesionBM, ForceMode.Acceleration); //motility rb.velocity += phenotype.cellMechanics.ComputeMotility(Time.deltaTime); }
public ApoptosisModel(CellPhenotype phenotype) : base() { base.InitParams(); base.phenotype = phenotype; //divided by 1 as it is fixed rate float transitionRateApoptosis = 1f / (8.6f * Globals.timeConst); AddPhase(new PhaseT(0, Globals.A, 1, Color.red)); AddPhase(new PhaseT(1, Globals.D, 1, Color.green)); AddTransitionRate(Globals.A, Globals.D, transitionRateApoptosis, true); }
public FlowCytometry(CellPhenotype phenotype) : base() { base.InitParams(); base.phenotype = phenotype; float G1SRate = (0.00324f * 60f) / Globals.timeConst; float SMRate = (0.00208f * 60f) / Globals.timeConst; float MG1Rate = (0.00333f * 60f) / Globals.timeConst; AddPhase(new PhaseT(0, Globals.G1, 1, Color.red)); AddPhase(new PhaseT(1, Globals.S, 2, Color.green)); AddPhase(new PhaseT(2, Globals.M, 0, Color.blue)); AddTransitionRate(Globals.G1, Globals.S, G1SRate, false); AddTransitionRate(Globals.S, Globals.M, SMRate, false); AddTransitionRate(Globals.M, Globals.G1, MG1Rate, false); }
public Ki67Advanced(CellPhenotype phenotype) : base() { base.InitParams(); base.phenotype = phenotype; float rate01 = 1f / (3.62f * Globals.timeConst); float rate12 = 1f / (13f * Globals.timeConst); float rate20 = 1f / (2.5f * Globals.timeConst); AddPhase(new PhaseT(0, Globals.Ki67Neg, 1, Color.cyan)); AddPhase(new PhaseT(1, Globals.Ki67PosPreMitotic, 2, new Color(1f, 0, 1f))); AddPhase(new PhaseT(3, Globals.Ki67PosPostMitotic, 0, Color.blue)); AddTransitionRate(Globals.Ki67Neg, Globals.Ki67PosPreMitotic, rate01, false); AddTransitionRate(Globals.Ki67PosPreMitotic, Globals.Ki67PosPostMitotic, rate12, true); AddTransitionRate(Globals.Ki67PosPostMitotic, Globals.Ki67Neg, rate20, true); }
public NecrosisModel(CellPhenotype phenotype) : base() { base.InitParams(); base.phenotype = phenotype; //divided by 1 as it is fixed rate float transitionRateNecrosis0 = float.MaxValue; // set high so it's always evaluating against the "arrest" float transitionRateNecrosis1 = 1f / (24f * 60f * Globals.timeConst); // 60 days max AddPhase(new PhaseT(0, Globals.G0, 1, Color.red)); //could be any state AddPhase(new PhaseT(1, Globals.NS, 2, new Color(0.5f, 0.5f, 0.5f))); AddPhase(new PhaseT(2, Globals.NL, 3, new Color(0.2f, 0.2f, 0.2f))); AddPhase(new PhaseT(3, Globals.D, 3, Color.black)); AddTransitionRate(Globals.G0, Globals.NS, -1, false); //not fixed rate, depends on the current conditions AddTransitionRate(Globals.NS, Globals.NL, transitionRateNecrosis0, false); AddTransitionRate(Globals.NL, Globals.D, transitionRateNecrosis1, true); }
public void SetPhenotype(CellPhenotype pt) { this.phenotype = pt; }