De Casteljau algorithm evaluating a cubic (third degree) curve from the given control points A
, B
, and C
. Works for both 2D and 3D.
{
unsigned int steps = 20;
std::vector<vec3> points;
std::cout << "first point: " << points.front() << ", last point: " << points.back() << std::endl;
std::vector<unsigned int> indices;
for (unsigned int i = 0; i < points.size() - 1; ++i) {
indices.push_back(i);
indices.push_back(i + 1);
}
curve->update_element_buffer(indices);
curve->set_impostor_type(easy3d::LinesDrawable::CYLINDER);
curve->set_line_width(5);
viewer.add_drawable(curve);
}
void update_vertex_buffer(const std::vector< vec3 > &vertices, bool dynamic=false)
Creates/Updates a single buffer.
Definition: drawable.cpp:142
The drawable for rendering a set of line segments, e.g., edges of a mesh, vector fields.
Definition: drawable_lines.h:40
void set_uniform_coloring(const vec4 &color)
Definition: state.cpp:89
void cubic(const Point_t &A, const Point_t &B, const Point_t &C, const Point_t &D, std::vector< Point_t > &curve, unsigned int bezier_steps=4, bool include_end=false)
De Casteljau algorithm evaluating a cubic (third degree) curve from the given control points A,...
Definition: curve.h:131
Vec< 3, float > vec3
A 3D point/vector of float type.
Definition: types.h:45