source: GTP/trunk/App/Games/Jungle_Rumble/src/physic/physics/include/NxSpringDesc.h @ 1378

Revision 1378, 2.9 KB checked in by giegl, 18 years ago (diff)

GTPD - Jungle Rumble - integrate into GTP SVN structure

Line 
1#ifndef NX_PHYSICS_NXSPRINGDESC
2#define NX_PHYSICS_NXSPRINGDESC
3/*----------------------------------------------------------------------------*\
4|
5|                                               Public Interface to NovodeX Technology
6|
7|                                                            www.novodex.com
8|
9\*----------------------------------------------------------------------------*/
10/** \addtogroup physics
11  @{
12*/
13
14#include "Nxp.h"
15/**
16\brief Describes a joint spring.
17
18The spring is implicitly integrated, so even high spring and damper coefficients should be robust.
19
20<h3>Example</h3>
21
22\include NxSpringDesc_NxJointLimitDesc_Example.cpp
23
24@see NxDistanceJoint NxRevoluteJoint NxSphericalJoint NxWheelShape NxMaterial NxMaterialDesc
25*/
26class NxSpringDesc
27        {
28        public:
29       
30        /**
31        \brief spring coefficient
32
33        <b>Range:</b> (-inf,inf)<br>
34        <b>Default:</b> 0
35
36        <b>Platform:</b>
37        \li PC SW: Yes
38        \li PPU  : No
39        \li PS3  : Yes
40        \li XB360: Yes
41        */
42        NxReal spring;
43       
44        /**
45        \brief damper coefficient
46
47        <b>Range:</b> [0,inf)<br>
48        <b>Default:</b> 0
49
50        <b>Platform:</b>
51        \li PC SW: Yes
52        \li PPU  : No
53        \li PS3  : Yes
54        \li XB360: Yes
55        */
56        NxReal damper;
57       
58        /**
59        \brief target value (angle/position) of spring where the spring force is zero.
60
61        <b>Range:</b> Angular: (-PI,PI]<br>
62        <b>Range:</b> Positional: (-inf,inf)<br>
63        <b>Default:</b> 0
64
65        <b>Platform:</b>
66        \li PC SW: Yes
67        \li PPU  : No
68        \li PS3  : Yes
69        \li XB360: Yes
70        */
71        NxReal targetValue;
72
73        /**
74        \brief Initializes the NxSpringDesc with default parameters.
75        */
76        NX_INLINE NxSpringDesc();
77
78        /**
79        \brief Initializes a NxSpringDesc with the given parameters.
80
81        \param[in] spring Spring Coefficient. <b>Range:</b> (-inf,inf)
82        \param[in] damper Damper Coefficient. <b>Range:</b>  [0,inf)
83        \param[in] targetValue Target value (angle/position) of spring where the spring force is zero.
84        <b>Range:</b> Angular: (-PI,PI] Positional: (-inf,inf)
85
86        <b>Platform:</b>
87        \li PC SW: Yes
88        \li PPU  : No
89        \li PS3  : Yes
90        \li XB360: Yes
91        */
92        NX_INLINE NxSpringDesc(NxReal spring, NxReal damper = 0, NxReal targetValue = 0);
93
94        /**
95        \brief (re)sets the structure to the default.   
96        */
97        NX_INLINE void setToDefault();
98
99        /**
100        \brief Returns true if the descriptor is valid.
101
102        \return True if the current settings are valid.
103        */
104        NX_INLINE bool isValid() const;
105        };
106
107NX_INLINE NxSpringDesc::NxSpringDesc()
108        {
109        setToDefault();
110        }
111
112NX_INLINE NxSpringDesc::NxSpringDesc(NxReal s, NxReal d, NxReal t)
113        {
114        spring = s;
115        damper = d;
116        targetValue = t;
117        }
118
119NX_INLINE void NxSpringDesc::setToDefault()
120        {
121        spring = 0;
122        damper = 0;
123        targetValue = 0;
124        }
125
126NX_INLINE bool NxSpringDesc::isValid() const
127        {
128        return (spring >= 0 && damper >= 0);
129        }
130
131/** @} */
132#endif
133
134
135//AGCOPYRIGHTBEGIN
136///////////////////////////////////////////////////////////////////////////
137// Copyright © 2005 AGEIA Technologies.
138// All rights reserved. www.ageia.com
139///////////////////////////////////////////////////////////////////////////
140//AGCOPYRIGHTEND
141
Note: See TracBrowser for help on using the repository browser.