15 #include "Base/Util/Assert.h"
23 int const sides = qRound(numSides);
24 bool const smooth = (0 == sides);
25 int const slices = smooth ? 4 *
SLICES : sides;
29 float const H = 2 * R;
30 float const asymmetry = ratio_asymmetry_W * 2 * R;
32 Vertices vfront(slices), vback(slices);
37 vfront[1] =
Vector3D(-R, asymmetry, H);
41 vback[1] =
Vector3D(R, asymmetry, H);
43 }
else if (numSides == 0) {
45 for (
int s = 0; s < slices; ++s) {
46 auto th =
static_cast<float>(M_PI * s / (slices + 1));
47 float y = -R * cosf(th);
48 float z = R * (1.0f + cosf(2 *
static_cast<float>(M_PI) * y / (2 * R)));
54 int const nv = (3 + 3 + 6) * slices;
60 for (
int s = 0; s < slices; ++s) {
61 int s1 = s, s2 = (s + 1) % slices;
70 vs.
addQuad(vfront.at(s2), vfront.at(s1), vback.at(s1), vback.at(s2));
73 ASSERT(vs.count() == nv);
static Mesh makeMesh(const Vertices &vs, Vertices const *ns=nullptr)
QVector< Vert_Normal > Mesh
static Mesh meshRipple(float numSides, float ratio_asymmetry_W)
void addTriangle(const Vector3D &, const Vector3D &, const Vector3D &)
void addQuad(const Vector3D &, const Vector3D &, const Vector3D &, const Vector3D &)