Flow Visualisation
FlowArrow.h
Go to the documentation of this file.
1 //
2 // FlowArrow.h
3 // flowviz
4 //
5 // Created by Johann Götz on 04.06.15.
6 // Copyright (c) 2015 Johann Götz. All rights reserved.
7 //
8 
9 #ifndef __flowviz__FlowArrow__
10 #define __flowviz__FlowArrow__
11 
12 #include <stdio.h>
13 
14 #include "glm.hpp"
15 
16 #include "VertexGeometry.h"
17 #include "Geometry.h"
18 #include "flow.h"
19 #include "FlowField.h"
20 
21 namespace flowiz {
22 
27  class FlowArrow
28  {
29  private:
34  const float StreamletIntegrationLength = 10.0f;
35 
39  const float StreamletSamplingLength = 0.5f;
40 
44  objects::VertexGeometry m_vertexGeometry;
45 
49  render::Geometry *m_geometry;
50 
51  glm::vec3 m_handlePoint;
52  float m_transparency;
53  float m_thickness;
54  int m_tBirth;
55  int m_tDeath;
56  bool m_birthed;
57  bool m_died;
59  float m_currentTime;
61  std::vector<MoveAnimation> m_moveAnimations;
63  MoveAnimation m_moveAnimation;
64  TransparencyAnimation m_transparencyAnimation;
74  glm::vec2 sampleVectorField(glm::vec2 position, FlowField *flowField);
75 
76  int mod(int a, int b);
77 
78  public:
79  FlowArrow();
80  ~FlowArrow();
81 
86 
91 
97  void generateIntegrationVertexData(glm::uvec2 handlePosition, FlowField *flowField);
98 
103  void update(float time);
105 
106  void move(glm::vec3 position);
107  void scale(glm::vec3 scale);
108 
109  void addMoveAnimation(glm::vec3 position, float time);
110  void addMoveAnimation(glm::vec3 position, float time, int startTime);
111  void addTransparencyAnimation(float transparency, float time);
112 
113  int get_birthTime() { return m_tBirth; }
114  void set_birthTime(int tBirth) { m_tBirth = tBirth; }
115  int get_deathTime() { return m_tDeath; }
116  void set_deathTime(int deathTime) { m_tDeath = deathTime; }
117 
118  glm::vec3 get_handlePoint() { return m_handlePoint; }
119  float get_size();
120 
121  bool isSquare();
122 
123  bool isAlive() { return m_currentTime >= m_tBirth && m_currentTime <= m_tDeath; }
124  bool isAlive(int timestep) { return timestep >= m_tBirth && timestep <= m_tDeath; }
125 
131  void propagateTo(int timestep, FlowField *flowField);
132 
136  glm::vec2 get_positionAtTime(int timestep);
137  };
138 
139 }
140 
141 #endif /* defined(__flowviz__FlowArrow__) */
Additional information for movement animations.
Definition: flow.h:32
void propagateTo(int timestep, FlowField *flowField)
increases lifetime to the specified timestep
Definition: FlowArrow.cpp:480
void set_deathTime(int deathTime)
Definition: FlowArrow.h:116
Stores all model information.
Definition: VertexGeometry.h:22
~FlowArrow()
Definition: FlowArrow.cpp:21
Definition: type_mat2x2.hpp:38
void update(float time)
updates all time dependened actions
Definition: FlowArrow.cpp:314
glm::vec2 get_positionAtTime(int timestep)
Returns position at specified timestep.
Definition: FlowArrow.cpp:552
Represents a 2D vector field The vectors are stored inside two.
Definition: FlowField.h:30
void addMoveAnimation(glm::vec3 position, float time)
Definition: FlowArrow.cpp:411
void generateCircleGeometryData()
Generates Circle geometry.
Definition: FlowArrow.cpp:77
void set_birthTime(int tBirth)
Definition: FlowArrow.h:114
bool isAlive(int timestep)
Definition: FlowArrow.h:124
void scale(glm::vec3 scale)
Definition: FlowArrow.cpp:401
Additional information for transparency animations.
Definition: flow.h:43
int get_birthTime()
Definition: FlowArrow.h:113
The graphical representation of an Arrow Creates and manages position, movement and lifetime of an ar...
Definition: FlowArrow.h:27
Definition: type_mat2x2.hpp:39
Represents a 3D Object in OpenGL.
Definition: Geometry.h:26
void move(glm::vec3 position)
Definition: FlowArrow.cpp:390
void addTransparencyAnimation(float transparency, float time)
Definition: FlowArrow.cpp:439
void generateNormalizedVertexData()
Generates a standard rectangle and maps an arrow on top of it.
Definition: FlowArrow.cpp:30
bool isSquare()
Definition: FlowArrow.cpp:463
render::Geometry * get_geometry()
Definition: FlowArrow.cpp:380
void generateIntegrationVertexData(glm::uvec2 handlePosition, FlowField *flowField)
Generates vertex data using Runge-Kutta-Integration Calculates Streamlet path from a handle point and...
Definition: FlowArrow.cpp:129
float get_size()
Definition: FlowArrow.cpp:449
int get_deathTime()
Definition: FlowArrow.h:115
glm::vec3 get_handlePoint()
Definition: FlowArrow.h:118
Definition: DistanceMap.h:16
bool isAlive()
Definition: FlowArrow.h:123
FlowArrow()
Definition: FlowArrow.cpp:16