26 for (
int i = 0; i < n; ++i)
40 addTriangle(v1, v2, v3);
41 addTriangle(v3, v4, v1);
47 addQuad(vs.at(i1), vs.at(i2), vs.at(i3), vs.at(i4));
53 for (
unsigned i = 0; i + 2 < is.size(); ++i)
55 addTriangle(vs.at(is.at(i)), vs.at(is.at(1 + i)), vs.at(is.at(2 + i)));
57 addTriangle(vs.at(is.at(i)), vs.at(is.at(2 + i)), vs.at(is.at(1 + i)));
63 auto& ctr = vs.at(is.at(0));
64 for (
unsigned i = 0; i + 2 < is.size(); ++i)
65 addTriangle(ctr, vs.at(is.at(1 + i)), vs.at(is.at(2 + i)));
72 using namespace GeometricID;
75 case BaseShape::Plane:
81 case BaseShape::Sphere:
84 case BaseShape::Column:
87 case BaseShape::Icosahedron:
90 case BaseShape::Dodecahedron:
93 case BaseShape::TruncatedBox:
96 case BaseShape::Cuboctahedron:
99 case BaseShape::Ripple:
115 ASSERT(!ns || nv == ns->count());
119 for (
int i = 0; i < nv; i += 3) {
120 const Vector3D &v0 = vs.at(0 + i), v1 = vs.at(1 + i), v2 = vs.at(2 + i);
129 nm =
cross((v1 - v0), (v2 - v0));
150 auto it = m_geometries.find(key);
151 if (m_geometries.end() != it) {
152 if (
auto g = it->second.lock())
162 emit deletingGeometry(&g);
163 m_geometries.erase(g.
m_key);
Defines the macro ASSERT.
#define ASSERT(condition)
void geometryDeleted(Geometry const &)
GeometryHandle getGeometry(GeometricID::Key)
Geometry(GeometricID::Key)
static Mesh meshTruncBox(float tD)
static Mesh meshSphere(float cut, float baseShift=0.0f, float removedTop=0.0f)
static Mesh meshCuboctahedron(float rH, float alpha, float H)
std::vector< unsigned > Indices
static Mesh meshIcosahedron()
static Mesh makeMesh(const Vertices &vs, Vertices const *ns=nullptr)
static Mesh meshColumn(float ratio_Rt_Rb, float numSides)
static Mesh meshDodecahedron()
QVector< Vert_Normal > Mesh
static Mesh meshRipple(float numSides, float ratio_asymmetry_W)
std::shared_ptr< Geometry > GeometryHandle
std::weak_ptr< Geometry > GeometryRef
Vector3D cross(const Vector3D &v1, const Vector3D &v2)
GeometryStore & geometryStore()
static constexpr double nm
void addVertex(const Vector3D &, int n=1)
void addStrip(const Vertices &, const Indices &)
void addTriangle(const Vector3D &, const Vector3D &, const Vector3D &)
void addFan(const Vertices &, const Indices &)
void addQuad(const Vector3D &, const Vector3D &, const Vector3D &, const Vector3D &)