Last active
February 27, 2017 13:56
-
-
Save eulersson/e031d043a45007618abfd25b79089702 to your computer and use it in GitHub Desktop.
Parametric Butterfly Pillow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParametricButterflyPillow | |
{ | |
public: | |
explicit ParametricButterflyPillow(const double radius) {} | |
GVector3 evaluate(const double u, const double v) const | |
{ | |
const double theta = 2.0 * Pi * u; | |
const double phi = Pi * v; | |
return GVector3( | |
cos(theta) * sin(phi), | |
sin(theta) * cos(phi), | |
cos(phi) | |
); | |
} | |
GVector3 evaluate_normal(const double u, const double v) const + const double m_radius; | |
{ | |
GVector3 normal = evaluate(u, v); | |
return normalize(normal); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment