Add PlaneShape::getNormal() method.

This commit is contained in:
Andrew Meadows 2014-06-17 10:48:29 -07:00
parent f3fb39574f
commit e75340f8ce
2 changed files with 5 additions and 0 deletions

View file

@ -30,6 +30,10 @@ PlaneShape::PlaneShape(const glm::vec4& coefficients) :
}
}
glm::vec3 PlaneShape::getNormal() const {
return _rotation * UNROTATED_NORMAL;
}
glm::vec4 PlaneShape::getCoefficients() const {
glm::vec3 normal = _rotation * UNROTATED_NORMAL;
return glm::vec4(normal.x, normal.y, normal.z, -glm::dot(normal, _position));

View file

@ -18,6 +18,7 @@ class PlaneShape : public Shape {
public:
PlaneShape(const glm::vec4& coefficients = glm::vec4(0.0f, 1.0f, 0.0f, 0.0f));
glm::vec3 getNormal() const;
glm::vec4 getCoefficients() const;
};