16 #include "Base/Util/Assert.h"
31 for (
int i = 0; i < n; ++i)
45 addTriangle(v1, v2, v3);
46 addTriangle(v3, v4, v1);
52 addQuad(vs.at(i1), vs.at(i2), vs.at(i3), vs.at(i4));
57 ASSERT(is.size() >= 3);
58 for (
unsigned i = 0; i + 2 < is.size(); ++i)
60 addTriangle(vs.at(is.at(i)), vs.at(is.at(1 + i)), vs.at(is.at(2 + i)));
62 addTriangle(vs.at(is.at(i)), vs.at(is.at(2 + i)), vs.at(is.at(1 + i)));
67 ASSERT(is.size() >= 3);
68 const auto& ctr = vs.at(is.at(0));
69 for (
unsigned i = 0; i + 2 < is.size(); ++i)
70 addTriangle(ctr, vs.at(is.at(1 + i)), vs.at(is.at(2 + i)));
78 using namespace GeometricID;
81 case BaseShape::Plane:
87 case BaseShape::Sphere:
90 case BaseShape::Column:
93 case BaseShape::Icosahedron:
96 case BaseShape::Dodecahedron:
99 case BaseShape::TruncatedBox:
102 case BaseShape::Bipyramid4:
105 case BaseShape::Ripple:
121 ASSERT(!ns || nv == ns->count());
125 for (
int i = 0; i < nv; i += 3) {
139 nm =
cross((v1 - v0), (v2 - v0));
160 auto it = m_geometries.find(key);
161 if (m_geometries.end() != it) {
162 if (
auto g = it->second.lock())
172 emit deletingGeometry(&g);
173 m_geometries.erase(g.
m_key);
GeometryHandle getGeometry(GeometricID::Key)
void geometryDeleted(Geometry const &)
static Mesh makeMesh(const Vertices &vs, Vertices const *ns=nullptr)
QVector< Vert_Normal > Mesh
static Mesh meshColumn(float ratio_Rt_Rb, float numSides)
static Mesh meshBipyramid4(float rH, float alpha, float H)
static Mesh meshTruncBox(float tD)
Geometry(GeometricID::Key)
static Mesh meshDodecahedron()
static Mesh meshIcosahedron()
static Mesh meshSphere(float cut, float baseShift=0.0f, float removedTop=0.0f)
std::vector< unsigned > Indices
static Mesh meshRipple(float numSides, float ratio_asymmetry_W)
Vector3D cross(const Vector3D &v1, const Vector3D &v2)
std::shared_ptr< Geometry > GeometryHandle
GeometryStore & geometryStore()
std::weak_ptr< Geometry > GeometryRef
Real shapes will be parameterized by BaseShape enum and possibly two floats.
void addTriangle(const Vector3D &, const Vector3D &, const Vector3D &)
void addStrip(const Vertices &, const Indices &)
void addQuad(const Vector3D &, const Vector3D &, const Vector3D &, const Vector3D &)
void addVertex(const Vector3D &, int n=1)
void addFan(const Vertices &, const Indices &)