-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathknot_vector.h
48 lines (43 loc) · 1.66 KB
/
knot_vector.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "implicit_primitive.h"
/** the knot_vector class manages a vector of knot locations and provides callbacks
in case that points are changed or appended. This is the base class for meta balls
and skeletons.*/
template <typename T>
class knot_vector : public implicit_primitive<T>
{
public:
/// main templated superclass which we want to inherit stuff from
typedef implicit_primitive<T> base;
using typename base::vec_type;
using typename base::pnt_type;
using base::find_control;
using base::add_member_control;
using base::update_member;
protected:
// vector of knot locations
std::vector<pnt_type> points;
/// append a point to the sketelon and call the append callback
void append_point(const pnt_type& p);
//! virtual function: can be overwritten by derived classes for data
/*! updates when points in knot vector are appended or changed. **/
virtual void append_callback(size_t pi) {}
virtual void position_changed_callback(size_t pi) {}
virtual void point_index_selection_callback() {}
/// index of point that can be edited in user interface
unsigned int pnt_idx;
private:
/// point used in user interface for editing of points[pnt_idx]
pnt_type p;
public:
/// construct with empty skeleton
knot_vector();
/// overload to return the type name of this object
std::string get_type_name() const { return "knot_vector"; }
/// reflect members to expose them to serialization
bool self_reflect(cgv::reflect::reflection_handler& rh);
/// implementation of updates needed after members changed
void on_set(void* member_ptr);
/// create gui to edit the points in the knot vector and to allow appending a new point
void create_gui();
};