A csúcsok kiértékelése
void Bezier::updateBaseMesh() {
size_t resolution = 50;
mesh.clear();
std::vector<BaseMesh::VertexHandle> handles, tri;
size_t n = degree[0], m = degree[1];
std::vector<double> coeff_u, coeff_v;
for (size_t i = 0; i < resolution; ++i) {
double u = (double)i / (double)(resolution - 1);
bernstein(n, u, coeff_u);
for (size_t j = 0; j < resolution; ++j) {
double v = (double)j / (double)(resolution - 1);
bernstein(m, v, coeff_v);
Vector p(0.0, 0.0, 0.0);
for (size_t k = 0, index = 0; k <= n; ++k)
for (size_t l = 0; l <= m; ++l, ++index)
p += control_points[index] * coeff_u[k] * coeff_v[l];
handles.push_back(mesh.add_vertex(p));
}
}
Object::updateBaseMesh();
}