Changeset 269
- Timestamp:
- 12/16/14 01:51:06 (10 years ago)
- Location:
- cpp/frams
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/Makefile-GDK
r247 r269 5 5 include frams/Makefile-GDK-files 6 6 7 GDK_TESTS=genoconv_test gdk_test geno_test genooper_test genooper_test_fTest neuro_test loader_test serial_test multiline_f0_test f0_variants_test full_props part_shapes neuro_layout_test geometry_apices_test geometry_info_test geometry_surface_test geometry_volume_test7 GDK_TESTS=genoconv_test gdk_test geno_test genooper_test genooper_test_fTest neuro_test loader_test serial_test multiline_f0_test f0_variants_test full_props shapeconvert part_shapes neuro_layout_test geometry_apices_test geometry_info_test geometry_surface_test geometry_volume_test 8 8 9 9 gdk_tests: $(GDK_TESTS) 10 10 11 11 GDK_BUILD_CONFIG= -include frams/config/gdk_build_config.h 12 CXXFLAGS= -I$(CURDIR) - DLINUX $(GDK_BUILD_CONFIG) -Wno-parentheses -Wno-overloaded-virtual -Wno-format -g12 CXXFLAGS= -I$(CURDIR) -std=gnu++11 -DLINUX $(GDK_BUILD_CONFIG) -Wno-parentheses -Wno-overloaded-virtual -Wno-format -g 13 13 14 14 ############################################# … … 47 47 $(CXX) $(FULL_PROPS_OBJS) $(LDFLAGS) -o $@ 48 48 49 shapeconvert: $(SHAPECONVERT_OBJS) 50 $(CXX) $(SHAPECONVERT_OBJS) $(LDFLAGS) -o $@ 51 49 52 part_shapes: $(PART_SHAPES_OBJS) 50 53 $(CXX) $(PART_SHAPES_OBJS) $(LDFLAGS) -o $@ -
cpp/frams/Makefile-GDK-files
r247 r269 47 47 FULL_PROPS_OBJS= frams/_demos/full_props.o frams/errmgr/stdouterr.o frams/virtfile/virtfile.o frams/virtfile/stdiofile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS) 48 48 49 SHAPECONVERT_OBJS= frams/_demos/shapeconvert.o frams/errmgr/stdouterr.o frams/virtfile/virtfile.o frams/virtfile/stdiofile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) $(GENMAN_GDK_OBJS) 50 49 51 SERIAL_TEST_OBJS= frams/_demos/serial_test.o frams/virtfile/virtfile.o $(GDK_OBJS) $(GENOCONV_GDK_OBJS) 50 52 -
cpp/frams/model/model.cpp
r247 r269 29 29 f0map=0; 30 30 f0genoknown=1; 31 shape=SHAPE_UNKNOWN; 31 32 } 32 33 … … 874 875 int i,k; 875 876 int ret=1; 877 shape=SHAPE_UNKNOWN; 876 878 if ((parts.size()==0)&&(neurons.size()==0)) return 0; 877 879 if (parts.size()==0) … … 903 905 if (p->p.y+p->size > bbmax.y) bbmax.y=p->p.y+p->size; 904 906 if (p->p.z+p->size > bbmax.z) bbmax.z=p->p.z+p->size; 907 if (shape==SHAPE_UNKNOWN) 908 shape=(p->shape==Part::SHAPE_DEFAULT)?SHAPE_OLD:SHAPE_NEW; 909 else if (shape!=SHAPE_ILLEGAL) 910 { 911 if ((p->shape==Part::SHAPE_DEFAULT) ^ (shape==SHAPE_OLD)) 912 { 913 shape=SHAPE_ILLEGAL; 914 FMprintf("Model","internalCheck",FMLV_WARN,"Inconsistent part shapes (mixed old and new shapes)"); 915 } 916 } 905 917 } 906 918 size=bbmax-bbmin; … … 983 995 i,(const char*)geno.getName()); 984 996 ret=0; 997 } 998 if (shape!=SHAPE_ILLEGAL) 999 { 1000 if ((j->shape==Joint::SHAPE_DEFAULT) ^ (shape==SHAPE_OLD)) 1001 { 1002 shape==SHAPE_ILLEGAL; 1003 FMprintf("Model","internalCheck",FMLV_WARN,"Inconsistent joint shapes (mixed old and new shapes)"); 1004 } 985 1005 } 986 1006 } … … 1082 1102 } 1083 1103 } 1104 if (shape==SHAPE_ILLEGAL) 1105 ret=0; 1084 1106 return ret; 1085 1107 } … … 1258 1280 tmpp-=j->part1->p; 1259 1281 j->d=j->part2->o.revTransform(tmpp); 1282 } 1283 } 1284 1285 void Model::buildUsingNewShapes(const Model& old, Part::Shape default_shape, float thickness) 1286 { 1287 for(int i=0;i<old.getJointCount();i++) 1288 { 1289 Joint *oj=old.getJoint(i); 1290 Part *p = addNewPart(default_shape); 1291 p->p=(oj->part1->p+oj->part2->p)/2; 1292 Orient o; 1293 o.lookAt(oj->part1->p-oj->part2->p); 1294 p->rot=o.getAngles(); 1295 p->scale.x=oj->part1->p.distanceTo(oj->part2->p)/2; 1296 p->scale.y = thickness; 1297 p->scale.z = thickness; 1298 } 1299 for(int i=0;i<old.getPartCount();i++) 1300 { 1301 Part *op=old.getPart(i); 1302 for(int j=0;j<old.getJointCount();j++) 1303 { 1304 Joint *oj=old.getJoint(j); 1305 if ((oj->part1==op)||(oj->part2==op)) 1306 { 1307 for(int j2=j+1;j2<old.getJointCount();j2++) 1308 { 1309 Joint *oj2=old.getJoint(j2); 1310 if ((oj2->part1==op)||(oj2->part2==op)) 1311 { 1312 Joint *newj=addNewJoint(getPart(j),getPart(j2),Joint::SHAPE_SOLID); 1313 } 1314 } 1315 break; 1316 } 1317 } 1260 1318 } 1261 1319 } -
cpp/frams/model/model.h
r258 r269 117 117 118 118 int checklevel; 119 120 public: 121 enum Shape {SHAPE_UNKNOWN,SHAPE_ILLEGAL,SHAPE_OLD,SHAPE_NEW}; 122 protected: 123 Shape shape; 119 124 120 125 void updateNeuroRefno(); // set Neuro::refno for all neurons … … 150 155 int isValid() const {return buildstatus==valid;} 151 156 int getErrorPosition(bool includingwarnings=false); 157 Shape getShape() {return shape;} 152 158 153 159 void updateRefno(); // set ::refno for all elements … … 387 393 388 394 void disturb(double amount); 395 396 void buildUsingNewShapes(const Model& src_old_shapes, Part::Shape default_shape = Part::SHAPE_CYLINDER, float thickness = 0.2); 389 397 390 398 #ifdef EASYMAPDEBUG -
cpp/frams/model/modelparts.h
r247 r269 70 70 static SString getDefaultStyle(); 71 71 Part(double _mass,double _size,double _density,double _friction,double _ingest,double _assim) 72 :PartBase(getDefaultStyle()),mass(_mass),size(_size),density(_density),friction(_friction),ingest(_ingest),assim(_assim)72 :PartBase(getDefaultStyle()),mass(_mass),size(_size),density(_density),friction(_friction),ingest(_ingest),assim(_assim) 73 73 {} 74 74 void defassign(); … … 86 86 paInt shape;///default=old framsticks compatible, do not mix with shapes>0 87 87 enum Shape {SHAPE_DEFAULT=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3}; 88 double mass,size,density,friction,ingest,assim ;88 double mass,size,density,friction,ingest,assim,hollow; 89 89 Pt3D scale; 90 90 Pt3D food;
Note: See TracChangeset
for help on using the changeset viewer.