Changeset 1249 for cpp/frams/genetics/f4/f4_general.cpp
- Timestamp:
- 05/21/23 23:16:51 (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/genetics/f4/f4_general.cpp
r1241 r1249 12 12 #include <frams/model/model.h> // for min and max attributes 13 13 #include <common/nonstd_math.h> 14 #include <algorithm> // std::min, std::max 14 15 15 16 #ifdef DMALLOC … … 46 47 anglepos = nangle; 47 48 commacount = 0; 48 childcount = 0;49 stickchildcount = 0; 49 50 P = newP; 50 51 rolling = 0; … … 65 66 //firstend = ndad->lastend; 66 67 //OM = ndad->OM; 67 ndad-> childcount++;68 ndad->stickchildcount++; 68 69 } 69 70 if (ndad->type == CELL_NEURON) … … 76 77 // adjust lastend 77 78 //lastend = firstend + ((Orient)OM * (Pt3D(1,0,0) * P.len)); 78 mz= 1;79 P.muscle_bend_range = 1; 79 80 } 80 81 … … 96 97 anglepos = nangle; 97 98 commacount = 0; 98 childcount = 0;99 stickchildcount = 0; 99 100 P = newP; 100 101 rolling = 0; … … 115 116 //firstend = ndad->lastend; 116 117 //OM = ndad->OM; 117 ndad-> childcount++;118 ndad->stickchildcount++; 118 119 } 119 120 if (ndad->type == CELL_NEURON) … … 126 127 // adjust lastend 127 128 //lastend = firstend + ((Orient)OM * (Pt3D(1,0,0) * P.len)); 128 mz= 1;129 P.muscle_bend_range = 1; 129 130 } 130 131 … … 548 549 549 550 550 void f4_Cell::adjustRec() 551 { 552 //f4_OrientMat rot; 553 int i; 554 555 if (recProcessedFlag) 551 void f4_Cell::adjustRecur() 552 { 553 if (recurProcessedFlag) 556 554 // already processed 557 555 return; 558 556 559 557 // mark it processed 560 rec ProcessedFlag = 1;558 recurProcessedFlag = true; 561 559 562 560 // make sure its parent is processed first 563 561 if (dadlink != NULL) 564 dadlink->adjustRec ();562 dadlink->adjustRecur(); 565 563 566 564 // count children 567 childcount = 0;568 for (i = 0; i < org->cell_count; i++)565 stickchildcount = 0; 566 for (int i = 0; i < org->cell_count; i++) 569 567 { 570 568 if (org->C[i]->dadlink == this) 571 569 if (org->C[i]->type == CELL_STICK) 572 childcount++; 573 } 570 stickchildcount++; 571 } 572 573 if (dadlink == NULL) 574 P.muscle_bend_range = 1.0; 575 else 576 P.muscle_bend_range = 1.0 / std::max(1, dadlink->stickchildcount); //bend range in f1: 0, 1 (line XX[|]) -> 100%, 2 (Y-shape X(X[|],X)) -> 50%, 3 (cross X(X[|],X,X)) -> 33% 577 //MacKo 2023-05: but shouldn't this formula ^^ also take commacount into consideration, like in f1? 574 578 575 579 if (type == CELL_STICK) … … 580 584 // rotation due to rolling 581 585 xrot = rolling; 582 mz = 1;583 586 } 584 587 else … … 589 592 Padj.propagateAlong(false); 590 593 591 // rot = Orient_1;594 //f4_OrientMat rot = Orient_1; 592 595 593 596 // rotation due to rolling … … 612 615 // rotation in world coordinates 613 616 //OM = ((f4_OrientMat)dadlink->OM) * OM; 614 mz = dadlink->mz / dadlink->childcount;615 617 } 616 618 //Pt3D lastoffset = (Orient)OM * (Pt3D(1,0,0)*P.len); … … 737 739 // reset recursive traverse flags 738 740 for (int i = 0; i < cell_count; i++) 739 C[i]->rec ProcessedFlag = 0;741 C[i]->recurProcessedFlag = false; 740 742 // process every cell 741 743 for (int i = 0; i < cell_count; i++) 742 C[i]->adjustRec ();744 C[i]->adjustRecur(); 743 745 744 746 //DB( printf("Cell simulation done, %d cells. \n", nc); ) 745 747 746 748 if (PRINT_CELLS_DEVELOPMENT) print_cells("Final"); 749 if (PRINT_CELLS_DEVELOPMENT) 750 for (int i = 0; i < cell_count; i++) 751 printf("%d,%d,dad=%d\tstick_children=%d\tcommas=%d\t|:range=%g\n", i, C[i]->nr, C[i]->dadlink ? C[i]->dadlink->nr : -1, C[i]->stickchildcount, C[i]->commacount, C[i]->P.muscle_bend_range); 747 752 748 753 return errorcode;
Note: See TracChangeset
for help on using the changeset viewer.