Skip to content
Snippets Groups Projects
Commit 4798912d authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Added array functions, scale calculation function

parent 65112ea4
No related branches found
No related tags found
No related merge requests found
......@@ -34,4 +34,36 @@ std::array<double, 3> extract_triplet(const std::string& str_in, size_t& start)
unsigned ij2index(unsigned i, unsigned j, unsigned Ny) {
return i * Ny + j;
}
\ No newline at end of file
}
std::array<float, 3> operator+=(std::array<float, 3>& lhs, const std::array<float, 3>& rhs){
lhs[0] += rhs[0];
lhs[1] += rhs[1];
lhs[2] += rhs[2];
return lhs;
}
std::array<float, 3> cross(const std::array<float, 3>& v, const std::array<float, 3>& w){
std::array<float, 3> cp;
cp[0] = v[1]*w[2] - v[2]*w[1];
cp[1] = v[2]*w[0] - v[0]*w[2];
cp[2] = v[0]*w[1] - v[1]*w[0];
return cp;
}
std::array<float, 3> operator/=(std::array<float, 3>& v, const float d){
v[0] /= d;
v[1] /= d;
v[2] /= d;
return v;
}
glm::mat4 scale_z(float z0, float factor){
glm::mat4 transf (1.f);
glm::mat4 transf = glm::translate(glm::scale(glm::translate(transf, glm::vec3(0.f,0.f,-z0)), glm::vec3(1.,1.,factor)), glm::vec3(0.,0.,z0));
return transf;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment