-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArrow.h
53 lines (44 loc) · 1.79 KB
/
Arrow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef _ARROW_3D_H
#define _ARROW_3D_H
#include <GL/freeglut.h>
#include <math.h>
#include <stdio.h>
#include "Vector3D.h"
#include "Vector4D.h"
#include "Object3D.h"
namespace GLScene
{
/**
* TArrow class
* Params: length
* Params: thickness
* Params: position (default (0,0,0))
* The arrow is centered to it's position and initial direction is (1,1,1)
*/
class TArrow : public TObject3D
{
private:
GLfloat len;
GLfloat len2;
GLfloat thickness;
GLfloat angle;
TVector3D axe_angle;
TVector3D reduced_pos;
void ComputeParameters(bool normalize = true);
protected:
public:
TArrow(GLfloat _len, GLfloat _thickness, TVector3D *pos = NULL);
virtual ~TArrow();
void SetPosition(const TVector3D *pos, bool normalize = true) { position = *pos; ComputeParameters(normalize); }
void SetPosition(GLfloat pos[], bool normalize = true) { position = pos; ComputeParameters(normalize); }
void SetPosition(std::initializer_list<GLfloat> list, bool normalize = true);
void SetPosition(GLfloat x, GLfloat y, GLfloat z, bool normalize = true) { position = {x, y, z}; ComputeParameters(normalize); }
void SetDirection(const TVector3D *pos, bool normalize = true) { direction = *pos; ComputeParameters(normalize); }
void SetDirection(GLfloat pos[], bool normalize = true) { direction = pos; ComputeParameters(normalize); }
void SetDirection(std::initializer_list<GLfloat> list, bool normalize = true);
void SetDirection(GLfloat x, GLfloat y, GLfloat z, bool normalize = true) { direction = {x, y, z}; ComputeParameters(normalize); }
void DoDisplay(TDisplayMode mode = dmRender);
};
} // namespace GLScene
//---------------------------------------------------------------------------
#endif // _ARROW_3D_H