1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
2 | // Copyright (C) 1999-2015 Maciej Komosinski and Szymon Ulatowski. |
---|
3 | // See LICENSE.txt for details. |
---|
4 | |
---|
5 | #ifndef _MODELPARTS_H_ |
---|
6 | #define _MODELPARTS_H_ |
---|
7 | |
---|
8 | #include <frams/util/3d.h> |
---|
9 | #include <frams/genetics/genoconv.h> |
---|
10 | |
---|
11 | #include <frams/util/extvalue.h> |
---|
12 | #include <frams/util/list.h> |
---|
13 | #include <frams/util/sstring.h> |
---|
14 | #include <frams/util/sstringutils.h> |
---|
15 | #include <frams/param/param.h> |
---|
16 | #include <frams/param/syntparam.h> |
---|
17 | #include <frams/util/usertags.h> |
---|
18 | #include <frams/param/paramtabobj.h> |
---|
19 | |
---|
20 | #include <stdio.h> |
---|
21 | |
---|
22 | //#define MODEL_V1_COMPATIBLE |
---|
23 | |
---|
24 | class Model; |
---|
25 | class IRange; |
---|
26 | class MultiRange; |
---|
27 | |
---|
28 | typedef UserTags<Model,void*,5> ModelUserTags; |
---|
29 | |
---|
30 | /** Common base for model elements. */ |
---|
31 | class PartBase |
---|
32 | { |
---|
33 | public: |
---|
34 | SString vis_style; |
---|
35 | PartBase(const SString& s):vis_style(s),mapped(0) {} |
---|
36 | ~PartBase(); |
---|
37 | static SString getDefaultStyle(){return SString("none");} |
---|
38 | MultiRange *mapped; |
---|
39 | enum PartBaseFlags { Selected=1 }; |
---|
40 | int flags; |
---|
41 | Model *owner; ///< backlink to the model |
---|
42 | |
---|
43 | SString info; |
---|
44 | |
---|
45 | Model &getModel() const {return *owner;} |
---|
46 | |
---|
47 | ModelUserTags userdata; |
---|
48 | |
---|
49 | void notifyMappingChange(); |
---|
50 | |
---|
51 | void clearMapping(); |
---|
52 | MultiRange* getMapping() {return mapped;} |
---|
53 | void setMapping(const IRange &mr); |
---|
54 | void addMapping(const IRange &mr); |
---|
55 | void setMapping(const MultiRange &mr); |
---|
56 | void addMapping(const MultiRange &mr); |
---|
57 | |
---|
58 | void setInfo(const SString& name,const SString& value); |
---|
59 | void setInfo(const SString& name,int value); |
---|
60 | void setInfo(const SString& name,double value); |
---|
61 | SString getInfo(const SString& name); |
---|
62 | }; |
---|
63 | |
---|
64 | /// Part is the only real physical object in the Framsticks creature. |
---|
65 | /// You can use this class for querying and adjusting constructed |
---|
66 | /// model properties |
---|
67 | class Part: public PartBase |
---|
68 | { |
---|
69 | friend class Model; |
---|
70 | static SString getDefaultStyle(); |
---|
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) |
---|
73 | {} |
---|
74 | void defassign(); |
---|
75 | public: |
---|
76 | // base properties - have special meaning and therefore are often accessed directly for convenience |
---|
77 | Pt3D p; ///< 3d coordinates of the part |
---|
78 | Orient o; ///< orientation in 3d space (rotation matrix) |
---|
79 | /// ParamInterface object is preferred way to get/set other properties. |
---|
80 | Param extraProperties(); |
---|
81 | Param properties(); |
---|
82 | paInt refno; |
---|
83 | Pt3D rot;///< rotation angles |
---|
84 | |
---|
85 | /// |
---|
86 | paInt shape;///default=old Framsticks compatible, do not mix with shapes>0 |
---|
87 | enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_ELLIPSOID=1, SHAPE_CUBOID=2, SHAPE_CYLINDER=3}; |
---|
88 | double mass,size,density,friction,ingest,assim,hollow; |
---|
89 | Pt3D scale; |
---|
90 | Pt3D food; |
---|
91 | //SList points; // collistion points |
---|
92 | //Slist neurons; // "select * from owner->neurons where part=this" ;-) |
---|
93 | |
---|
94 | Pt3D vcolor; |
---|
95 | double vsize; |
---|
96 | |
---|
97 | Part(enum Shape s=SHAPE_BALL_AND_STICK); |
---|
98 | Part(const Part& src):PartBase(getDefaultStyle()) {operator=(src);} |
---|
99 | void operator=(const Part& src); |
---|
100 | |
---|
101 | void setPositionAndRotationFromAxis(const Pt3D &p1,const Pt3D &p2); |
---|
102 | void setOrient(const Orient &o);///< set part.o and calculates part.rot (rotation angles) |
---|
103 | void setRot(const Pt3D &r);///< set part.rot (rotation angles) and calculate part.o |
---|
104 | |
---|
105 | static Param& getStaticParam(); |
---|
106 | }; |
---|
107 | |
---|
108 | /// Imaginary connection between two parts. |
---|
109 | /// Joint has no mass nor intertia but can transfer forces. |
---|
110 | class Joint: public PartBase |
---|
111 | { |
---|
112 | friend class Model; |
---|
113 | SString getDefaultStyle(); |
---|
114 | Joint(double _stamina,double _stif,double _rotstif,double _d) |
---|
115 | :PartBase(getDefaultStyle()),stamina(_stamina),stif(_stif),rotstif(_rotstif) |
---|
116 | {d=Pt3D(_d,0,0);} |
---|
117 | void defassign(); |
---|
118 | void resetDeltaMarkers(); |
---|
119 | public: |
---|
120 | // base properties: |
---|
121 | paInt p1_refno,p2_refno; ///< parts' reference numbers |
---|
122 | |
---|
123 | Part *part1,*part2; ///< references to parts |
---|
124 | class Pt3D d; ///< position delta between parts |
---|
125 | class Pt3D rot; ///< orientation delta between parts expressed as 3 angles |
---|
126 | enum Shape {SHAPE_BALL_AND_STICK=0, SHAPE_FIXED=1}; |
---|
127 | paInt shape;///< ball-and-stick=old Framsticks compatible, creates a physical rod between parts (cylinder or cuboid), do not mix with shape>0, fixed=merge parts into one physical entity |
---|
128 | |
---|
129 | Joint(); |
---|
130 | Joint(const Joint& src):PartBase(getDefaultStyle()) {operator=(src);} |
---|
131 | void operator=(const Joint& src); |
---|
132 | |
---|
133 | /** connect two parts with this joint. |
---|
134 | p2 position will be adjusted if delta option is in effect. |
---|
135 | @see isDelta() |
---|
136 | */ |
---|
137 | void attachToParts(Part* p1,Part* p2); |
---|
138 | /// @see attachToParts(Part*,Part*) |
---|
139 | void attachToParts(int p1,int p2); |
---|
140 | |
---|
141 | /** discard delta information but don't disable delta flag. |
---|
142 | delta will be calculated from parts positions during final consistency check. |
---|
143 | */ |
---|
144 | void resetDelta(); |
---|
145 | |
---|
146 | /** enable or disable delta option. |
---|
147 | delta value is not changed. |
---|
148 | */ |
---|
149 | void useDelta(bool use); |
---|
150 | |
---|
151 | /** @return true if delta option is in effect. |
---|
152 | @see useDelta(), resetDelta(), useDelta() |
---|
153 | */ |
---|
154 | bool isDelta(); |
---|
155 | |
---|
156 | /// ParamInterface object is preferred way to get/set other properties. |
---|
157 | Param extraProperties(); |
---|
158 | Param properties(); |
---|
159 | |
---|
160 | // do not touch these: |
---|
161 | paInt refno; ///< this joint's reference number |
---|
162 | double stamina; |
---|
163 | double stif,rotstif; ///< stiffness for moving and bending forces |
---|
164 | class Orient o; ///< orientation delta between parts as rotation matrix |
---|
165 | /** flag: generated f0 should include delta data. |
---|
166 | set by 'singlestep' if j: attributes use delta option */ |
---|
167 | bool usedelta; |
---|
168 | Pt3D vcolor; |
---|
169 | |
---|
170 | static Param& getStaticParam(); |
---|
171 | }; |
---|
172 | |
---|
173 | #define JOINT_DELTA_MARKER 99999.0 |
---|
174 | |
---|
175 | ////////////////// NN ///////////////// |
---|
176 | |
---|
177 | class NeuroClass; |
---|
178 | |
---|
179 | typedef UserTags<NeuroClass,void*,5> NeuroClassUserTags; |
---|
180 | |
---|
181 | /** Information about neuron class. |
---|
182 | */ |
---|
183 | class NeuroClass |
---|
184 | { |
---|
185 | bool ownedvectordata; |
---|
186 | void operator=(const NeuroClass& nosuchthich){} |
---|
187 | public: |
---|
188 | SString name,longname,description; |
---|
189 | ParamEntry *props; |
---|
190 | bool ownedprops;//< destructor will free props using ParamObject::freeParamTab |
---|
191 | paInt prefinputs,prefoutput; |
---|
192 | paInt preflocation; |
---|
193 | int *vectordata; |
---|
194 | paInt visualhints; |
---|
195 | |
---|
196 | //void *impl; |
---|
197 | int impl_count; |
---|
198 | bool active; |
---|
199 | int genactive; |
---|
200 | NeuroClassUserTags userdata; |
---|
201 | |
---|
202 | ////////////////////// |
---|
203 | ~NeuroClass(); |
---|
204 | NeuroClass(); |
---|
205 | NeuroClass(ParamEntry *_props,SString _description, |
---|
206 | int _prefinputs,int _prefoutput,int _preflocation,int *_vectordata,bool own_vd=1,int vhints=0); |
---|
207 | /** class name for use in Neuro::setClassName(), Neuro::setDetails() (former 'moredata' field), |
---|
208 | eg. "N","-",G" */ |
---|
209 | const SString& getName() {return name;} |
---|
210 | /** human friendly name, eg. "Neuron","Link","Gyroscope" */ |
---|
211 | const SString& getLongName() {return longname;} |
---|
212 | /** long description */ |
---|
213 | const SString& getDescription() {return description;} |
---|
214 | ParamEntry* getParamTab() {return props;} |
---|
215 | |
---|
216 | /** NeuroClass specific properties, recognized by all neurons of this class */ |
---|
217 | Param getProperties() {return Param(props);} |
---|
218 | |
---|
219 | /** preferred number of inputs, -1 = no preference (any number will go). |
---|
220 | extra inputs may be ignored by the object (depends on the class). |
---|
221 | */ |
---|
222 | int getPreferredInputs() {return (int)prefinputs;} |
---|
223 | |
---|
224 | /** @return 0 if this object doesn't provide useful output signal. */ |
---|
225 | int getPreferredOutput() {return (int)prefoutput;} |
---|
226 | |
---|
227 | /** @return 0 if the object doesn't need any assignment to the body element. |
---|
228 | @return 1 = it likes to be attached to the Part ( @see Neuro::attachToPart() ) |
---|
229 | @return 2 = the object prefers to have the Joint ( @see Neuro::attachToJoint() ) |
---|
230 | */ |
---|
231 | int getPreferredLocation() {return (int)preflocation;} |
---|
232 | /** vector drawing to be used in neuro net diagram. |
---|
233 | interpretation: |
---|
234 | { |
---|
235 | LEN = datalength (excluding this number) |
---|
236 | NL = number_of_lines |
---|
237 | line#1 -> NS = number_of_segments, x1,y1, x2,y2, ... xNS-1,yNS-1, |
---|
238 | ... |
---|
239 | line#NL -> NS = number_of_segments, x1,y1, x2,y2, ... xNS-1,yNS-1, |
---|
240 | } |
---|
241 | */ |
---|
242 | int* getSymbolGlyph() |
---|
243 | {return vectordata;} |
---|
244 | void setSymbolGlyph(int *data,bool owned=1) |
---|
245 | {if (vectordata&&ownedvectordata) delete []vectordata; |
---|
246 | vectordata=data; ownedvectordata=owned;} |
---|
247 | /** additional information about how the neuron should be drawn |
---|
248 | used by structure view (and maybe some other components). |
---|
249 | return value is defined by the enum Hint |
---|
250 | @see enum Hint |
---|
251 | */ |
---|
252 | int getVisualHints() |
---|
253 | {return (int)visualhints;} |
---|
254 | |
---|
255 | enum Hint |
---|
256 | /** don't draw neurons of this class */ |
---|
257 | { Invisible=1, |
---|
258 | /** don't draw classname label below the neuron */ |
---|
259 | DontShowClass=2, |
---|
260 | /** draw the neuron at the first part when attached to joint (default is in the middle) */ |
---|
261 | AtFirstPart=4, |
---|
262 | /** draw the neuron at the second part when attached to joint (default is in the middle) */ |
---|
263 | AtSecondPart=8, |
---|
264 | /** use effector colour for this neuro unit */ |
---|
265 | EffectorClass=16, |
---|
266 | /** use receptor colour for this neuro unit */ |
---|
267 | ReceptorClass=32, |
---|
268 | V1BendMuscle=64, |
---|
269 | V1RotMuscle=128, |
---|
270 | LinearMuscle=256 |
---|
271 | }; |
---|
272 | |
---|
273 | /** textual summary, automatically generated from other properties (like the neuro class tooltip) */ |
---|
274 | SString getSummary(); |
---|
275 | }; |
---|
276 | |
---|
277 | class Neuro; |
---|
278 | |
---|
279 | #ifdef MODEL_V1_COMPATIBLE |
---|
280 | class NeuroItem; |
---|
281 | |
---|
282 | /** for compatibility with old Neuro/NeuroItem */ |
---|
283 | class OldItems |
---|
284 | { |
---|
285 | Neuro &neuro; |
---|
286 | SList syntitems; ///< to be deleted |
---|
287 | SList items; |
---|
288 | int listok; |
---|
289 | public: |
---|
290 | OldItems(Neuro &n):neuro(n),listok(0) {} |
---|
291 | ~OldItems() {freelist();} |
---|
292 | void buildlist(); |
---|
293 | void freelist(); |
---|
294 | |
---|
295 | int getItemCount(); |
---|
296 | NeuroItem *getNeuroItem(int i); |
---|
297 | NeuroItem *addNewNeuroItem(); |
---|
298 | int findNeuroItem(NeuroItem *n); |
---|
299 | }; |
---|
300 | #endif |
---|
301 | |
---|
302 | /** Single processing unit in Framsticks NN. */ |
---|
303 | class Neuro: public PartBase |
---|
304 | { |
---|
305 | friend class Model; |
---|
306 | static SString getDefaultStyle(); |
---|
307 | |
---|
308 | struct NInput { Neuro *n; double weight; SString *info; |
---|
309 | NInput(Neuro *_n,double w,SString *i=0):n(_n),weight(w),info(i) {} }; |
---|
310 | |
---|
311 | SListTempl<NInput> inputs; |
---|
312 | |
---|
313 | NeuroClass *myclass; |
---|
314 | bool knownclass; |
---|
315 | SString myclassname, myclassparams; |
---|
316 | /** set myclass and make knownclass=true */ |
---|
317 | void checkClass(); |
---|
318 | SString** inputInfo(int i); |
---|
319 | void defassign(); |
---|
320 | |
---|
321 | public: |
---|
322 | enum NeuroFlags { HoldState=2 }; |
---|
323 | Param properties(); |
---|
324 | Param extraProperties(); |
---|
325 | |
---|
326 | void setInputInfo(int i,const SString& name,const SString &value); |
---|
327 | void setInputInfo(int i,const SString& name,int value); |
---|
328 | void setInputInfo(int i,const SString& name,double value); |
---|
329 | SString getInputInfo(int i); |
---|
330 | SString getInputInfo(int i,const SString& name); |
---|
331 | |
---|
332 | NeuroClass* getClass(); |
---|
333 | void setClass(NeuroClass*); |
---|
334 | |
---|
335 | SString getClassParams() {return myclassparams;} |
---|
336 | void setClassParams(const SString& cp) {myclassparams=cp;} |
---|
337 | |
---|
338 | SString getClassName(); |
---|
339 | void setClassName(const SString& clazz); |
---|
340 | |
---|
341 | /** return neuro unit details encoded as <CLASS> ":" <PROPERTIES> |
---|
342 | |
---|
343 | new Neuro can be created as root object (without parent) or can be |
---|
344 | the child of existing Neuro. Children of the Neuro are its inputs. |
---|
345 | Standard Framsticks neuron calculates the sum of all input units - other processing |
---|
346 | units don't have to treat them equally and can even ignore some of them. |
---|
347 | There are hints about expected inputs in the class database, @see getClass |
---|
348 | |
---|
349 | Application should not assume anything about classes and its properties |
---|
350 | except for two standard classes: (information about all current classes |
---|
351 | can be retrieved with getClass/getClassProperties methods) |
---|
352 | - getClassName()="N" is the standard Framsticks neuron, accepts any number of inputs, |
---|
353 | compatible with old Neuro object |
---|
354 | - getClassName()="-" is the neuron link, compatible with old Neuro-Neuro link |
---|
355 | (NeuroItem with empty details) |
---|
356 | Empty details defaults to "-" if the parent unit is specified, |
---|
357 | and "N" if the unit has no parent. |
---|
358 | */ |
---|
359 | SString getDetails(); |
---|
360 | |
---|
361 | /** details = classname + ":" + classparams |
---|
362 | @see getDetails() |
---|
363 | */ |
---|
364 | void setDetails(const SString&); |
---|
365 | |
---|
366 | #define STATRICKCLASS Neuro |
---|
367 | PARAMGETDEF(details) {arg1->setString(getDetails());} |
---|
368 | PARAMSETDEF(details) {setDetails(arg1->getString());return PSET_CHANGED;} |
---|
369 | PARAMGETDEF(inputCount); |
---|
370 | PARAMPROCDEF(p_getInputNeuroDef); |
---|
371 | PARAMPROCDEF(p_getInputNeuroIndex); |
---|
372 | PARAMPROCDEF(p_getInputWeight); |
---|
373 | PARAMGETDEF(classObject); |
---|
374 | #undef STATRICKCLASS |
---|
375 | |
---|
376 | ///@param handle_defaults_when_saving see SyntParam |
---|
377 | SyntParam classProperties(bool handle_defaults_when_saving=true); |
---|
378 | // base properties: |
---|
379 | paInt refno; ///< unique reference number (former 'neuro' refno) |
---|
380 | |
---|
381 | paInt part_refno; ///< can be used by some items as the part ref# |
---|
382 | paInt joint_refno; ///< can be used by some items as the joint ref# |
---|
383 | |
---|
384 | Pt3D pos,rot; ///< default = zero |
---|
385 | |
---|
386 | ModelUserTags userdata; |
---|
387 | |
---|
388 | Neuro(); |
---|
389 | Neuro(double _state,double _inertia,double _force,double _sigmo); |
---|
390 | Neuro(const Neuro& src):PartBase(getDefaultStyle()) {operator=(src);} |
---|
391 | |
---|
392 | ~Neuro(); |
---|
393 | |
---|
394 | void operator=(const Neuro& src); |
---|
395 | |
---|
396 | /** Attach this Neuro to the specified Part or detach it from the body if p==NULL. |
---|
397 | Neuro can be attached to either Part or Joint, but not both. |
---|
398 | @see getPart() |
---|
399 | */ |
---|
400 | void attachToPart(Part* p) {part=p; joint=0;} |
---|
401 | |
---|
402 | /** Attach this Neuro to the specified Joint or detach it from the body if p==NULL. |
---|
403 | Neuro can be attached to either Part or Joint, but not both. |
---|
404 | @see getJoint() |
---|
405 | */ |
---|
406 | void attachToJoint(Joint* j) {joint=j; part=0;} |
---|
407 | |
---|
408 | void attachToPart(int i); |
---|
409 | void attachToJoint(int i); |
---|
410 | |
---|
411 | /** @return Part the Neuro is attached to, or NULL if it has no defined location on the body. |
---|
412 | @see attachToPart() |
---|
413 | */ |
---|
414 | Part *getPart() {return part;} |
---|
415 | |
---|
416 | /** @return Joint the Neuro is attached to, or NULL if it has no defined location on the body. |
---|
417 | @see attachToJoint() |
---|
418 | */ |
---|
419 | Joint *getJoint() {return joint;} |
---|
420 | |
---|
421 | int isOldEffector(); |
---|
422 | int isOldReceptor(); |
---|
423 | int isOldNeuron(); |
---|
424 | int isNNConnection(); |
---|
425 | |
---|
426 | /** @return the number of inputs connected to this Neuro. |
---|
427 | Functions like getInput(), getInputWeight() will accept connection number [0..InputCount-1] |
---|
428 | */ |
---|
429 | int getInputCount() const {return inputs.size();} |
---|
430 | |
---|
431 | /// @return the number of output connections (including possible self-connections) |
---|
432 | int getOutputsCount() const; |
---|
433 | |
---|
434 | /** @return the Neuro connected as i-th input */ |
---|
435 | Neuro* getInput(int i) const {return (i>=inputs.size())?0:inputs(i).n;} |
---|
436 | /** @return the Neuro connected as i-th input. |
---|
437 | @param weight |
---|
438 | */ |
---|
439 | Neuro* getInput(int i,double &weight) const; |
---|
440 | /** @return connectin weight for i-th input */ |
---|
441 | double getInputWeight(int i) const; |
---|
442 | /** change connection weight for i-th input */ |
---|
443 | void setInputWeight(int i,double weight); |
---|
444 | /** connect i-th input with another neuron */ |
---|
445 | void setInput(int i,Neuro*n); |
---|
446 | /** connect i-th input with another neuron */ |
---|
447 | void setInput(int i,Neuro*n,double weight); |
---|
448 | /** add new input. @return its reference number */ |
---|
449 | int addInput(Neuro* child,double weight=1.0,const SString* info=0); |
---|
450 | /** @return reference number [0..InputCount-1] of the input |
---|
451 | or -1 if 'child' is not connected with this Neuro.*/ |
---|
452 | int findInput(Neuro* child) const; |
---|
453 | void removeInput(paInt refno); |
---|
454 | /** @return reference number of the child connection, like findInput() */ |
---|
455 | int removeInput(Neuro* child); |
---|
456 | |
---|
457 | int findInputs(SList& result,const char* classname=0,const Part* part=0,const Joint* joint=0) const; |
---|
458 | int findOutputs(SList& result,const char* classname=0,const Part* part=0,const Joint* joint=0) const; |
---|
459 | |
---|
460 | /* class database retrieval */ |
---|
461 | static int getClassCount(); |
---|
462 | /** @return Neuro class name. |
---|
463 | @param classindex 0 .. getClassCount() |
---|
464 | */ |
---|
465 | static SString getClassName(int classindex); |
---|
466 | static NeuroClass* getClass(int classindex); |
---|
467 | static NeuroClass* getClass(const SString& classname); |
---|
468 | static int getClassIndex(const NeuroClass*nc); |
---|
469 | |
---|
470 | #ifdef MODEL_V1_COMPATIBLE |
---|
471 | friend class OldItems; |
---|
472 | paInt neuro_refno; ///< parent ref# (called neuro_refno for compatibility with old Neuro class), @see moredata |
---|
473 | paInt conn_refno; ///< the other neuron ref# in N-N connections, can be used by some other items |
---|
474 | double weight; ///< weight of the N-N connection and (all?) receptors |
---|
475 | double inertia,force,sigmo; //!!! |
---|
476 | |
---|
477 | /** @deprecated provided only for compatibility with old Neuro/NeuroItem classes. |
---|
478 | use getInputCount() instead. @sa getInputCount() */ |
---|
479 | int getItemCount() {return oldItems().getItemCount();} |
---|
480 | |
---|
481 | /** @deprecated provided only for compatibility with old Neuro/NeuroItem classes. |
---|
482 | use getInput() instead. @sa getInput() */ |
---|
483 | NeuroItem* getNeuroItem(int i) {return oldItems().getNeuroItem(i);} |
---|
484 | #endif |
---|
485 | |
---|
486 | protected: |
---|
487 | #ifdef MODEL_V1_COMPATIBLE |
---|
488 | /** old Neuro compatibility */ |
---|
489 | OldItems* olditems; |
---|
490 | OldItems& oldItems() {if (!olditems) olditems=new OldItems(*this); return *olditems;} |
---|
491 | void invalidateOldItems() {if (olditems) olditems->freelist();} |
---|
492 | #endif |
---|
493 | |
---|
494 | public: |
---|
495 | |
---|
496 | // not really private, but you should not access those directly |
---|
497 | double state; |
---|
498 | |
---|
499 | /** may reference parent neuron if parentcount is exacty 1. parent is invalid otherwise. @sa parentcount */ |
---|
500 | Neuro *parent; |
---|
501 | int parentcount; ///< @sa parent |
---|
502 | |
---|
503 | Part *part; ///< link to the Part |
---|
504 | Joint *joint; ///< link to the Joint - required by some objects (eg.muscles) |
---|
505 | Orient o; ///< rotation matrix calculated from "rot" |
---|
506 | static ParamEntry emptyParamTab[]; |
---|
507 | static Param& getStaticParam(); |
---|
508 | }; |
---|
509 | |
---|
510 | #ifdef MODEL_V1_COMPATIBLE |
---|
511 | class NeuroItem; |
---|
512 | |
---|
513 | /// for compatibility with old NeuroItem class. |
---|
514 | class NeuroItem: public Neuro |
---|
515 | { |
---|
516 | public: |
---|
517 | NeuroItem() {} |
---|
518 | }; |
---|
519 | #endif |
---|
520 | |
---|
521 | class NeuroExt: public Neuro |
---|
522 | { |
---|
523 | public: |
---|
524 | #define STATRICKCLASS NeuroExt |
---|
525 | PARAMGETDEF(neuroclass); |
---|
526 | PARAMSETDEF(neuroclass); |
---|
527 | #undef STATRICKCLASS |
---|
528 | static ParamEntry *getParamTab(); |
---|
529 | }; |
---|
530 | |
---|
531 | class NeuroConn |
---|
532 | { |
---|
533 | void defassign(); |
---|
534 | public: |
---|
535 | int n1_refno,n2_refno; |
---|
536 | double weight; |
---|
537 | SString info; |
---|
538 | NeuroConn(); |
---|
539 | }; |
---|
540 | |
---|
541 | extern ParamEntry f0_part_paramtab[],f0_joint_paramtab[],f0_nodeltajoint_paramtab[],f0_neuro_paramtab[],f0_neuroconn_paramtab[],f0_neuroitem_paramtab[]; |
---|
542 | |
---|
543 | #endif |
---|