Newton Dynamics  4.00
ndMultiBodyVehicleRotor.h
1 /* Copyright (c) <2003-2019> <Julio Jerez, Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 *
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 *
19 * 3. This notice may not be removed or altered from any source distribution.
20 */
21 
22 #ifndef __D_MULTIBODY_VEHICLE_ROTOR_H__
23 #define __D_MULTIBODY_VEHICLE_ROTOR_H__
24 
25 #include "ndNewtonStdafx.h"
26 #include "ndJointBilateralConstraint.h"
27 
29 {
30  public:
31  ndMultiBodyVehicleRotor(ndBodyKinematic* const motor, ndWorld* const world);
32 
33  dFloat32 GetRpm() const;
34  dFloat32 GetMaxRpm() const;
35  bool GetStart() const;
36 
37  D_NEWTON_API void SetStart(bool startkey);
38  D_NEWTON_API void SetThrottle(dFloat32 param);
39  D_NEWTON_API void SetMaxRpm(dFloat32 maxRpm);
40  D_NEWTON_API void SetIdleRpm(dFloat32 idleRpm);
41  D_NEWTON_API void SetEngineTorque(dFloat32 torque);
42  D_NEWTON_API void SetGasValve(dFloat32 radPerSeconds);
43 
44  private:
45  void JacobianDerivative(ndConstraintDescritor& desc);
46  dFloat32 CalculateAcceleration(ndConstraintDescritor& desc);
47 
48  dFloat32 m_omega;
49  dFloat32 m_maxOmega;
50  dFloat32 m_idleOmega;
51  dFloat32 m_throttle;
52  dFloat32 m_gasValve;
53  dFloat32 m_engineTorque;
54  bool m_startEngine;
55 };
56 
57 inline dFloat32 ndMultiBodyVehicleRotor::GetRpm() const
58 {
59  return m_omega * dFloat32 (9.55f);
60 }
61 
62 inline dFloat32 ndMultiBodyVehicleRotor::GetMaxRpm() const
63 {
64  return m_maxOmega * dFloat32(9.55f);
65 }
66 
67 inline bool ndMultiBodyVehicleRotor::GetStart() const
68 {
69  return m_startEngine;
70 }
71 
72 #endif
ndConstraintDescritor
Definition: ndConstraint.h:174
ndJointBilateralConstraint
Definition: ndJointBilateralConstraint.h:43
ndBodyKinematic
Definition: ndBodyKinematic.h:37
ndMultiBodyVehicleRotor
Definition: ndMultiBodyVehicleRotor.h:29
ndWorld
Definition: ndWorld.h:45