-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMedidas.cpp
More file actions
44 lines (39 loc) · 1.17 KB
/
Medidas.cpp
File metadata and controls
44 lines (39 loc) · 1.17 KB
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
#include "Medidas.h"
#include <stdio.h>
#include <limits>
Medidas::Medidas() {
limite = std::numeric_limits < GLfloat > ::max();
menor = limite / 2;
maior = -limite / 2;
orientacao = horizontal;
}
Medidas::~Medidas() {
// TODO Auto-generated destructor stub
}
void Medidas::setup(GLfloat max, GLint novaOrientacao) {
limite = max;
menor = limite;
maior = -limite;
orientacao = novaOrientacao;
}
void Medidas::addEnvoltorio(GLfloat pontos[][3], GLint nPontos) {
for (GLint i = 0; i < nPontos; ++i) {
if (pontos[i][orientacao] > maior)
maior = pontos[i][orientacao];
if (pontos[i][orientacao] < menor)
menor = pontos[i][orientacao];
}
}
void Medidas::varia(GLfloat* variar[], GLint nVariar, GLfloat taxaVariacao) {
for (GLint i = 0; i < nVariar; ++i) {
GLfloat p = *(variar[i]);
*(variar[i]) = *(variar[i]) - (maior - menor) * taxaVariacao;
//confere dominio
//if(*(variar[i])<0) *(variar[i])=0;
//else if(*(variar[i])>limite) *(variar[i])=limite;
//printf("Nova posição: p=%f-(%f-%f)*(%f) = %f \n", p, maior,menor, taxaVariacao, *(variar[i]));
}
}
void Medidas::varia(GLfloat* ponto, GLfloat taxaDeVariacao) {
(*ponto) = (*ponto) + 20 * taxaDeVariacao;
}