DI-Guy SDK Documentation  13.1
diguyChainSettings.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2015 VT MAK
4  ** All rights reserved.
5  *********************************************************************/
6 
7 
8 /*********************************************************************
9  **
10  *t diguyChainSettings
11  **
12  */
13 
14 #ifndef __diguyChainSettings_H
15 #define __diguyChainSettings_H
16 
17 
18 #ifdef SWIG
19 %module diguyChainSettings
20 #else
21 #define CPLUSPLUS_ONLY
22 #endif
23 
24 #ifdef CPLUSPLUS_ONLY
25 class bdiScenarioChainSettings;
26 #endif
27 
28 
29 #include <declspec_diguy.h>
30 
37 /****************************************************************************/
38 class BDI_DECLSPEC_diguy diguyChainSettings
39 {
40 
41 public:
42 
43 /*****************************************************************************/
53  /*l
54  *b Returns:
55  **
56  ** name of this object; this value will never be NULL
57  */
58  const char* get_name();
59 
60  /*l
61  *b Description:
62  **
63  ** This function sets the name of this object.
64  **
65  *b Returns:
66  **
67  ** 0 on success, -1 on failure
68  */
69  int set_name(const char* name);
70 
71 
72 /*****************************************************************************/
78  /*l
79  *b Description:
80  **
81  ** This function sets how many masses will in a chain using these
82  ** settings.
83  **
84  ** The default is 80 masses.
85  **
86  *b Arguments:
87  **
88  *a num_masses - number of masses
89  */
90  void set_num_masses(int num_masses);
91 
92  /*l
93  *b Returns:
94  **
95  ** number of masses; see set_num_masses()
96  */
97  int get_num_masses();
98 
99  /*l
100  *b Description:
101  **
102  ** This function sets which chain mass will be connected to the
103  ** chain's associated character when a chain using these settings is
104  ** created or reset.
105  **
106  ** Pass -1 for no mass to be connected.
107  **
108  ** The default is chain mass 0.
109  **
110  *b Arguments:
111  **
112  *a chain_mass_index - index of chain mass
113  */
114  void set_index_of_chain_mass_connected_to_character(int chain_mass_index);
115 
116  /*l
117  *b Returns:
118  **
119  ** which mass to connect on reset; see
120  ** set_index_of_chain_mass_connected_to_character()
121  */
122  int get_index_of_chain_mass_connected_to_character();
123 
124  /*l
125  *b Description:
126  **
127  ** This function sets the dt of the chain simulation using these
128  ** settings.
129  **
130  ** Higher dt values will provide faster simulations at the risk of
131  ** instabilities. Conversely, lower dt values result in more
132  ** simulation computational overhead, but the simulation will be more
133  ** stable.
134  **
135  ** The default is 0.002 seconds.
136  **
137  *b Arguments:
138  **
139  *a simulation_dt - dt of each simulation time step, in seconds
140  */
141  void set_simulation_dt(float simulation_dt);
142 
143  /*l
144  *b Returns:
145  **
146  ** dt of chain simulation; see set_simulation_dt()
147  */
148  float get_simulation_dt();
149 
150  /*l
151  *b Description:
152  **
153  ** This function sets the mass of each chain mass of the chain
154  ** simulation using these settings.
155  **
156  ** Heavier mass will result in chain masses that have more momentum
157  ** when moving.
158  **
159  ** The default is 0.5 kg.
160  **
161  *b Arguments:
162  **
163  *a mass - mass of each chain mass, in kg
164  */
165  void set_mass(float mass);
166 
167  /*l
168  *b Returns:
169  **
170  ** mass of each chain mass; see set_mass()
171  */
172  float get_mass();
173 
174  /*l
175  *b Description:
176  **
177  ** This function sets the nominal length of the springs connecting
178  ** adjacent chain masses of the chain simulation using these
179  ** settings.
180  **
181  ** Adjacent chain masses will try to keep this distance between them.
182  ** A longer spring length will result in a longer chain.
183  **
184  ** The default is 0.2 meters
185  **
186  *b Arguments:
187  **
188  *a spring_length - nominal length between adjacent chain masses,
189  *a in meters
190  */
191  void set_spring_length(float spring_length);
192 
193  /*l
194  *b Returns:
195  **
196  ** nominal length between adjacent chain masses;
197  ** see set_spring_length()
198  */
199  float get_spring_length();
200 
201  /*l
202  *b Description:
203  **
204  ** This function sets the spring constant of the springs connecting
205  ** adjacent chain masses of the chain simulation using these
206  ** settings.
207  **
208  ** A higher spring constant will result in a more rigid chain, as
209  ** adjacent masses will try to maintain their nominal spring length
210  ** between them, as set by set_spring_length().
211  **
212  ** A hose would have a high spring constant, while a "slinky" would
213  ** have a low spring constant.
214  **
215  ** This spring constant only applies between adjacent masses.
216  **
217  ** The default is 10000.
218  **
219  *b Arguments:
220  **
221  *a spring_k - spring constant of springs between adjacent masses
222  */
223  void set_spring_k(float spring_k);
224 
225  /*l
226  *b Returns:
227  **
228  ** spring constant of springs between adjacent masses; see
229  ** set_spring_k()
230  */
231  float get_spring_k();
232 
233  /*l
234  *b Description:
235  **
236  ** This function sets the damping constant of the springs connecting
237  ** adjacent chain masses of the chain simulation using these
238  ** settings.
239  **
240  ** A higher damping constant will result in a chain that doesn't
241  ** oscillate as much; movement between masses will quickly die down.
242  **
243  ** A hose would have a high damping constant, while a "slinky" would
244  ** have a low damping constant.
245  **
246  ** The default is 15.
247  **
248  *b Arguments:
249  **
250  *a damping constant of springs between adjacent masses
251  */
252  void set_spring_b(float spring_b);
253 
254  /*l
255  *b Returns:
256  **
257  ** damping constant of springs between adjacent masses; see
258  ** set_spring_b()
259  */
260  float get_spring_b();
261 
262  /*l
263  *b Description:
264  **
265  ** This function sets the nominal length of the springs connecting
266  ** '2nd neighbor' chain masses of the chain simulation using these
267  ** settings.
268  **
269  ** 2nd neighbor chain masses are two masses apart instead of one.
270  ** (Adjacent masses are one mass apart.)
271  **
272  ** A longer 2nd neighbor spring length will result in a chain that is
273  ** stiffer and doesn't droop. A lower value will result in a chain
274  ** that can droop a lot from mass to mass.
275  **
276  ** A garden hose would have a high 2nd neighbor spring length, while
277  ** a metal chain made of linked chain links would have a low 2nd
278  ** neighbor spring length.
279  **
280  ** The default is 0.8 meters
281  **
282  *b Arguments:
283  **
284  *a spring_length - nominal length between adjacent chain masses,
285  *a in meters
286  */
287  void set_neighbor2_spring_length(float neighbor2_spring_length);
288 
289  /*l
290  *b Returns:
291  **
292  ** nominal distance between each mass and its '2nd neighbor'; see
293  ** set_neighbor2_spring_length()
294  */
295  float get_neighbor2_spring_length();
296 
297  /*l
298  *b Description:
299  **
300  ** This function sets the spring constant of springs connecting 2nd
301  ** neighbor chain masses of the chain simulation using these
302  ** settings.
303  **
304  ** See set_spring_k() for a discussion of what this value means.
305  **
306  ** The default is 600.
307  **
308  *b Arguments:
309  **
310  *a neighbor2_spring_k - spring constant of springs between
311  ** 2nd neighbor masses
312  */
313  void set_neighbor2_spring_k(float neighbor2_spring_k);
314 
315  /*l
316  *b Returns:
317  **
318  ** spring constant of springs between 2nd neighbor masses; see
319  ** set_neighbor2_spring_k()
320  */
321  float get_neighbor2_spring_k();
322 
323  /*l
324  *b Description:
325  **
326  ** This function sets the damping constant of springs connecting 2nd
327  ** neighbor chain masses of the chain simulation using these
328  ** settings.
329  **
330  ** See set_spring_b() for a discussion of what this value means.
331  **
332  ** The default is 5.
333  **
334  *b Arguments:
335  **
336  *a neighbor2_spring_b - damping constant of springs between
337  ** 2nd neighbor masses
338  */
339  void set_neighbor2_spring_b(float neighbor2_spring_b);
340 
341  /*l
342  *b Returns:
343  **
344  ** damping constant of springs between 2nd neighbor masses; see
345  ** set_neighbor2_spring_b()
346  */
347  float get_neighbor2_spring_b();
348 
349  /*l
350  *b Description:
351  **
352  ** This function sets the spring constant of the ground model.
353  **
354  ** A higher spring constant will result in a harder ground that
355  ** bounces chain masses higher when they come in contact with the
356  ** ground. Also, chain masses will not sink as far into the ground
357  ** when they come to rest.
358  **
359  ** A tile floor would have a high spring constant, while a mattress
360  ** would have a low spring constant.
361  **
362  ** The default is 5000.
363  **
364  *b Arguments:
365  **
366  *a ground_k - spring constant of ground model
367  */
368  void set_ground_k(float ground_k);
369 
370  /*l
371  *b Returns:
372  **
373  ** spring constant of ground model; see set_ground_k()
374  */
375  float get_ground_k();
376 
377  /*l
378  *b Description:
379  **
380  ** This function sets the damping constant of the ground model.
381  **
382  ** A higher damping constant will result in a ground that absorbs
383  ** impacts and doesn't bounce masses as much when they hit the
384  ** ground.
385  **
386  ** A tile floor would have a low damping constant, while an exercise
387  ** mat would have a high damping constant.
388  **
389  ** The default is 100.
390  **
391  *b Arguments:
392  **
393  *a ground_b - vertical damping constant of ground model
394  */
395  void set_ground_b(float ground_b);
396 
397  /*l
398  *b Returns:
399  **
400  ** vertical damping constant of ground model; see set_ground_b()
401  */
402  float get_ground_b();
403 
404  /*l
405  *b Description:
406  **
407  ** This function sets how much the ground model slows down masses
408  ** that are sliding on it.
409  **
410  ** A higher lateral damping constant will quickly slow down masses
411  ** sliding along the ground.
412  **
413  ** Dirt or grass ground would have a high lateral damping constant.
414  ** Ice would have a very low damping constant.
415  **
416  ** The default is 0.5.
417  **
418  *b Arguments:
419  **
420  *a ground_lateral_b - lateral damping constant of ground model
421  */
422  void set_ground_lateral_b(float ground_lateral_b);
423 
424  /*l
425  *b Returns:
426  **
427  ** lateral damping constant of ground model; see
428  ** set_ground_lateral_b()
429  */
430  float get_ground_lateral_b();
431 
432  /*l
433  *b Description:
434  **
435  ** This function sets how slow a mass in contact with the ground must
436  ** go in order for the mass to stop moving and "stick" to the ground.
437  ** This is a simple form of "stiction".
438  **
439  ** A mass will unstick if the force being applied to it exceeds the
440  ** stiction release force as set by
441  ** set_ground_stiction_release_force().
442  **
443  ** The default is 0.05 m/s.
444  **
445  *b Arguments:
446  **
447  *a ground_stiction_engage_vel - velocity at stiction will engage
448  */
449  void set_ground_stiction_engage_vel(float ground_stiction_engage_vel);
450 
451  /*l
452  *b Returns:
453  **
454  ** velocity at stiction will engage; see
455  ** set_ground_stiction_engage_vel()
456  */
457  float get_ground_stiction_engage_vel();
458 
459  /*l
460  *b Description:
461  **
462  ** This function sets how much force is required to cause a mass that
463  ** has stuck to the ground because of stiction to be released.
464  **
465  ** The default is 10 newtons.
466  **
467  *b Arguments:
468  **
469  *a ground_stiction_release_force - force at which masses will
470  *a release from stiction
471  */
472  void set_ground_stiction_release_force(float ground_stiction_release_force);
473 
474  /*l
475  *b Returns:
476  **
477  ** force at which masses will release from stiction; see
478  ** set_ground_stiction_release_force()
479  */
480  float get_ground_stiction_release_force();
481 
482  /*l
483  *b Description:
484  **
485  ** This function sets the height of the ground model. Chain masses
486  ** below this height will be repelled upward based on their mass and
487  ** the ground spring and damping constants.
488  **
489  ** Currently the ground is a level plane.
490  **
491  ** The default is 0 meters.
492  **
493  *b Arguments:
494  **
495  *a ground_height - height of the ground model, in meters
496  */
497  void set_ground_height(float ground_height);
498 
499  /*l
500  *b Returns:
501  **
502  ** height of the ground model; see set_ground_height()
503  */
504  float get_ground_height();
505 
506  /*l
507  *b Description:
508  **
509  ** This function sets the damping constant caused by air resistance.
510  **
511  ** A higher air damping constant will result in chains that don't
512  ** swing as much. A low air damping constant will result in chains
513  ** that swing freely for a long time.
514  **
515  ** Water would have a very high "air" damping constant. A clock
516  ** pendulum would have a very low air damping constant.
517  **
518  ** The default is 0.1.
519  **
520  *b Arguments:
521  **
522  *a air_b - damping constant of air, or air resistance
523  */
524  void set_air_b(float air_b);
525 
526  /*l
527  *b Returns:
528  **
529  ** damping constant of air; see set_air_b()
530  */
531  float get_air_b();
532 
533  /*l
534  *b Description:
535  **
536  ** This function sets how strongly link masses will be accelerated in
537  ** the gravity direction, typically downward.
538  **
539  ** The default is (0, 0, -9.8), in meters per second squared.
540  **
541  *b Arguments:
542  **
543  *a x, y, z - accelerations due to gravity
544  */
545  void set_gravity(float x, float y, float z);
546 
547  /*l
548  *b Returns:
549  **
550  ** x, y, and z components of gravity; see set_gravity()
551  */
552  void get_gravity(float* x, float* y, float* z);
553 
554 
555 /*****************************************************************************/
561  /*l
562  *b Description:
563  **
564  ** This function sets the radius of the chain visual.
565  **
566  ** The default is 0.05 meters.
567  **
568  *b Arguments:
569  **
570  *a radius - radius of chain visual, in meters
571  */
572  void set_radius(float radius);
573 
574  /*l
575  *b Returns:
576  **
577  ** radius of chain visual; see set_radius()
578  */
579  float get_radius();
580 
581  /*l
582  *b Description:
583  **
584  ** This function sets the ambient color of the chain visual. Passed
585  ** values should be between 0 and 1.
586  **
587  ** The default values are (0.4, 0.4, 0.4, 1).
588  **
589  *b Arguments:
590  **
591  *a r, g, b, a - red, green, blue, and alpha components
592  */
593  void set_ambient_color(float r, float g, float b, float a);
594 
595  /*l
596  *b Description:
597  **
598  ** This function gets the ambient color of the chain visual. Values
599  ** are returned via the passed pointers.
600  **
601  *b Arguments:
602  **
603  *a r, g, b, a - red, green, blue, and alpha components
604  */
605  void get_ambient_color(float* r, float* g, float* b, float* a);
606 
607  /*l
608  *b Description:
609  **
610  ** This function sets the diffuse color of the chain visual. Passed
611  ** values should be between 0 and 1.
612  **
613  ** The default values are (1, 1, 1, 1).
614  **
615  *b Arguments:
616  **
617  *a r, g, b, a - red, green, blue, and alpha components
618  */
619  void set_diffuse_color(float r, float g, float b, float a);
620 
621  /*l
622  *b Description:
623  **
624  ** This function gets the diffuse color of the chain visual. Values
625  ** are returned via the passed pointers.
626  **
627  *b Arguments:
628  **
629  *a r, g, b, a - red, green, blue, and alpha components
630  */
631  void get_diffuse_color(float* r, float* g, float* b, float* a);
632 
633  /*l
634  *b Description:
635  **
636  ** This function sets the specular color of the chain visual. Passed
637  ** values should be between 0 and 1.
638  **
639  ** The default values are (1, 1, 1, 1).
640  **
641  *b Arguments:
642  **
643  *a r, g, b, a - red, green, blue, and alpha components
644  */
645  void set_specular_color(float r, float g, float b, float a);
646 
647  /*l
648  *b Description:
649  **
650  ** This function gets the specular color of the chain visual. Values
651  ** are returned via the passed pointers.
652  **
653  *b Arguments:
654  **
655  *a r, g, b, a - red, green, blue, and alpha components
656  */
657  void get_specular_color(float* r, float* g, float* b, float* a);
658 
659  /*l
660  *b Description:
661  **
662  ** This function sets the shininess of the chain visual.
663  **
664  ** The default is 20.
665  **
666  *b Arguments:
667  **
668  *a shininess - the shininess of the chain visual
669  */
670  void set_shininess(float shininess);
671 
672  /*l
673  *b Returns:
674  **
675  ** the shininess of the chain visual; see set_shininess()
676  */
677  float get_shininess();
678 
679  /*l
680  *b Description:
681  **
682  ** This function sets the filename of the texture that will be used
683  ** for the chain visual.
684  **
685  ** Common textures are:
686  **
687  *- - "chain_link.rgba"
688  *- - "firefighter_hose2.rgb"
689  **
690  ** The default is "" (no texture).
691  **
692  *b Arguments:
693  **
694  *a texture_filename - filename of texture of chain visual
695  */
696  void set_texture_filename(const char* texture_filename);
697 
698  /*l
699  *b Returns:
700  **
701  ** filename of texture of chain visual; see set_texture_filename()
702  */
703  const char* get_texture_filename();
704 
705  /*l
706  *b Description:
707  **
708  ** This function sets how many times the texture will be repeated
709  ** along the length of the chain.
710  **
711  ** The default is 1 rep.
712  **
713  *b Arguments:
714  **
715  *a num_texture_repetitions - how many times texture will be
716  *a repeated on chain visual
717  */
718  void set_num_texture_repetitions(int num_texture_repetitions);
719 
720  /*l
721  *b Returns:
722  **
723  ** how many times texture will be repeated on chain visual; see
724  ** set_num_texture_repetitions()
725  */
726  int get_num_texture_repetitions();
727 
728  /*l
729  *b Description:
730  **
731  ** This function sets what the "cross section" of the chain visual
732  ** will be.
733  **
734  ** See the documentation for diguyChainCrossSection for information
735  ** on what the different cross sections mean.
736  **
737  ** The default is DIGUY_CHAIN_CROSS_SECTION_SQUARE.
738  **
739  *b Arguments:
740  **
741  *a cs - cross section of the chain visual
742  */
743  void set_cross_section(diguyChainCrossSection cs);
744 
745  /*l
746  *b Returns:
747  **
748  ** cross section type of chain visual; see set_cross_section()
749  */
750  diguyChainCrossSection get_cross_section();
751 
752  /*l
753  *b Description:
754  **
755  ** Set the shape that will be attached to the beginning end of the
756  ** chain. Options are:
757  **
758  *- - "chain_cap_firehose_nozzle"
759  *- - "chain_cap_fuel_hose_nozzle"
760  *- - "chain_cap_taser_probe"
761  *- - "chain_cap_chain_hook"
762  **
763  ** The default is "" (no begin cap).
764  **
765  *b Arguments:
766  **
767  *a appearance_begin_cap - name of begin cap
768  */
769  void set_appearance_begin_cap(const char* appearance_begin_cap);
770 
771  /*l
772  *b Returns:
773  **
774  ** name of cap appearance at beginning of chain; see
775  ** set_appearance_begin_cap()
776  */
777  const char* get_appearance_begin_cap();
778 
779  /*l
780  *b Description:
781  **
782  ** Sets the shape that will be attached to the end of the chain. See
783  ** set_appearance_begin_cap().
784  **
785  ** The default is "" (no end cap).
786  **
787  *b Arguments:
788  **
789  *a appearance_end_cap - name of end cap
790  */
791  void set_appearance_end_cap(const char* appearance_end_cap);
792 
793  /*l
794  *b Returns:
795  **
796  ** name of cap appearance at end of chain; see
797  ** set_appearance_end_cap()
798  */
799  const char* get_appearance_end_cap();
800 
801 
802 /*****************************************************************************/
808  /*l
809  *b Description:
810  **
811  ** For chains with the DIGUY_CHAIN_CROSS_SECTION_COIL cross section,
812  ** sets the number of coil windings of the chain.
813  **
814  ** The default is 4 coils.
815  **
816  *b Arguments:
817  **
818  *a num_coils - number of coil windings
819  */
820  void set_num_coils(int num_coils);
821 
822  /*l
823  *b Returns:
824  **
825  ** number of coils for chain visual of type
826  ** DIGUY_CHAIN_CROSS_SECTION_COIL; see set_num_coils()
827  */
828  int get_num_coils();
829 
830  /*l
831  *b Description:
832  **
833  ** Sets how thick the coil will be.
834  **
835  ** The default is 0.02 meters.
836  **
837  *b Arguments:
838  **
839  *a coil_thickness - thickness of coil
840  */
841  void set_coil_thickness(float coil_thickness);
842 
843  /*l
844  *b Returns:
845  **
846  ** thickness of coils for chain visual of type
847  ** DIGUY_CHAIN_CROSS_SECTION_COIL; see set_coil_thickness()
848  */
849  float get_coil_thickness();
850 
851  /*l
852  *b Description:
853  **
854  ** Sets at which mass in the coil the thickness of the coil will
855  ** reach its full radius.
856  **
857  ** The default is 6.
858  **
859  *b Arguments:
860  **
861  *a coil_taper_begin_mass_count - chain mass at which to begin taper
862  */
863  void set_coil_taper_begin_mass_count(int coil_taper_begin_mass_count);
864 
865  /*l
866  *b Returns:
867  **
868  ** mass at which the coil will reach its full radius at the beginning
869  ** of chain; see set_coil_taper_begin_mass_count()
870  */
871  int get_coil_taper_begin_mass_count();
872 
873  /*l
874  *b Description:
875  **
876  ** Similar to set_coil_taper_begin_mass_count(), but for the end of
877  ** the chain.
878  **
879  ** The default is 0.
880  **
881  *b Arguments:
882  **
883  *a coil_taper_end_mass_count - chain mass at which to end taper
884  */
885  void set_coil_taper_end_mass_count(int coil_taper_end_mass_count);
886 
887  /*l
888  *b Returns:
889  **
890  ** mass at which the coil will reach its full radius at end of chain;
891  ** see set_coil_taper_end_mass_count()
892  */
893  int get_coil_taper_end_mass_count();
894 
899 #ifdef CPLUSPLUS_ONLY
900 
901  bdiScenarioChainSettings* get_scripted_object() {return m_scripted_object;}
902 
903 private:
904 
905  /*l
906  ** A private constructor.
907  */
908  diguyChainSettings(bdiScenarioChainSettings* scripted_object);
909 
910  /*l
911  ** A private destructor.
912  */
914 
915  /*l
916  ** A pointer to internal data.
917  */
918  bdiScenarioChainSettings* m_scripted_object;
919 
920  friend class bdiScenarioChainSettings;
921 
922 #endif
923 
924 };
925 
926 
927 #endif /* __diguyChainSettings_H */
928 
929 
930 /*********************************************************************
931  ** Copyright (c) 1992-2015 VT MAK
932  ** All rights reserved.
933  *********************************************************************/
934 
Definition: diguyChainSettings.h:34
diguyChainCrossSection
This enumeration lists which cross-sections are available for DI-Guy chain simulation visuals...
Definition: diguy_constants.h:761