Apollo  6.0
Open source self driving car software
target_camera.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
17 #pragma once
18 
20 
21 class TargetCamera : public AbstractCamera {
22  public:
23  TargetCamera();
24 
25  virtual void UpdateWorld();
26 
27  const QVector3D& target_pos(void) const { return target_pos_; }
28  void set_target_pos(float x, float y, float z) {
29  target_pos_.setX(x);
30  target_pos_.setY(y);
31  target_pos_.setZ(z);
32 
33  distance_ = position_.distanceToPoint(target_pos_);
34  }
35 
36  void set_target_pos(const QVector3D& tgt) {
37  target_pos_ = tgt;
38  distance_ = position_.distanceToPoint(target_pos_);
39  }
40 
41  float distance(void) const { return distance_; }
42  void set_distance(float distance) {
43  if (distance < 0.0f) {
44  distance = 0.0f;
45  }
46  distance_ = distance;
47  }
48 
49  void Rotate(float xRotateDegrees, float yRotateDegrees,
50  float zRotateDegrees) {
51  SetAttitude(yRotateDegrees, xRotateDegrees, zRotateDegrees);
52  }
53 
54  private:
55  QVector3D target_pos_;
56 
57  float distance_;
58 };
float distance(void) const
Definition: target_camera.h:41
float x(void) const
Definition: abstract_camera.h:76
virtual void UpdateWorld()
Definition: abstract_camera.h:21
void set_target_pos(const QVector3D &tgt)
Definition: target_camera.h:36
const QVector3D & target_pos(void) const
Definition: target_camera.h:27
void Rotate(float xRotateDegrees, float yRotateDegrees, float zRotateDegrees)
Definition: target_camera.h:49
QVector3D position_
Definition: abstract_camera.h:140
void set_target_pos(float x, float y, float z)
Definition: target_camera.h:28
void set_distance(float distance)
Definition: target_camera.h:42
void SetAttitude(float yawInDegrees, float pitchInDegrees, float rollInDegrees)
Definition: abstract_camera.h:103
float z(void) const
Definition: abstract_camera.h:78
Definition: target_camera.h:21
float y(void) const
Definition: abstract_camera.h:77