ATCFS
 全て クラス 名前空間 ファイル 関数 変数 型定義 マクロ定義 ページ
Accel.h
[詳解]
1 // Copyright 2018 S520
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met :
6 //
7 // 1. Redistributions of source code must retain the above copyright notice,
8 // this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright notice,
10 // this list of conditions and the following disclaimer in the documentation
11 // and / or other materials provided with the distribution.
12 //
13 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 // DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
17 // ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 
24 #ifndef ACCEL_H_
25 #define ACCEL_H_
26 
30 class Accel {
31  private:
32  float prev_spd_;
33  int prev_time_;
35  float alpha_;
36 
37  void CalcRawAccel(void);
38  void CalcEmaAccel(void);
39 
40  public:
41  const float *TrainSpeed;
42  const int *Time;
43  float raw_accel_;
44  float ema_accel_;
45 
46  Accel(void);
47  virtual ~Accel(void);
48  void Init(void);
49  void Exe(void);
50 };
51 
52 #endif // ACCEL_H_
float ema_accel_
指数移動平均加速度[km/h/s]
Definition: Accel.h:44
float prev_raw_accel_
1フレーム前の生の加速度[km/h/s]
Definition: Accel.h:34
void Init(void)
Initializeで実行する関数
Definition: Accel.cpp:36
void Exe(void)
Elapseで実行する関数
Definition: Accel.cpp:63
float prev_spd_
1フレーム前の列車速度[km/h]
Definition: Accel.h:32
列車の加速度を算出するクラス
Definition: Accel.h:30
const int * Time
ゲーム内時刻[ms]
Definition: Accel.h:42
void CalcEmaAccel(void)
列車の指数移動平均加速度を算出する関数
Definition: Accel.cpp:55
float raw_accel_
生の加速度[km/h/s]
Definition: Accel.h:43
void CalcRawAccel(void)
列車の生の加速度を算出する関数
Definition: Accel.cpp:43
int prev_time_
1フレーム前のゲーム内時刻[ms]
Definition: Accel.h:33
const float * TrainSpeed
列車速度[km/h]
Definition: Accel.h:41
virtual ~Accel(void)
Definition: Accel.cpp:30
Accel(void)
Definition: Accel.cpp:27
float alpha_
平滑化係数(0<α<1)
Definition: Accel.h:35