Blender V4.3
Scene.hpp
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Ruben Smits
2 *
3 * SPDX-License-Identifier: LGPL-2.1-or-later */
4
9#ifndef SCENE_HPP_
10#define SCENE_HPP_
11
12#include "eigen_types.hpp"
13
14#include "WorldObject.hpp"
15#include "ConstraintSet.hpp"
16#include "Solver.hpp"
17
18#include <map>
19
20namespace iTaSC {
21
22class SceneLock;
23
24class Scene {
25 friend class SceneLock;
26public:
33
34
35 Scene();
36 virtual ~Scene();
37
38 bool addObject(const std::string& name, Object* object, UncontrolledObject* base=&Object::world, const std::string& baseFrame="");
39 bool addConstraintSet(const std::string& name, ConstraintSet* task,const std::string& object1,const std::string& object2,const std::string& ee1="",const std::string& ee2="");
40 bool addSolver(Solver* _solver);
41 bool addCache(Cache* _cache);
42 bool initialize();
43 bool update(double timestamp, double timestep, unsigned int numsubstep=1, bool reiterate=false, bool cache=true, bool interpolate=true);
44 bool setParam(SceneParam paramId, double value);
45
46 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
47
48private:
49 e_matrix m_A,m_B,m_Atemp,m_Wq,m_Jf,m_Jq,m_Ju,m_Cf,m_Cq,m_Jf_inv;
50 e_matrix6 m_Vf,m_Uf;
51 e_vector m_Wy,m_ydot,m_qdot,m_xdot;
52 e_vector6 m_Sf,m_tempf;
53 double m_minstep;
54 double m_maxstep;
55 unsigned int m_ncTotal,m_nqTotal,m_nuTotal,m_nsets;
56 std::vector<bool> m_ytask;
57
58 Solver* m_solver;
59 Cache* m_cache;
60
61
62 struct Object_struct{
63 Object* object;
65 unsigned int baseFrameIndex;
66 Range constraintrange;
67 Range jointrange;
68 Range coordinaterange; // Xu range of base when object is controlled
69 // Xu range of object when object is uncontrolled
70
71 Object_struct(Object* _object,UncontrolledObject* _base,unsigned int _baseFrameIndex,Range nq_range,Range nc_range,Range nu_range):
72 object(_object),base(_base),baseFrameIndex(_baseFrameIndex),constraintrange(nc_range),jointrange(nq_range),coordinaterange(nu_range)
73 {};
74 };
75 typedef std::map<std::string,Object_struct*> ObjectMap;
76
77 struct ConstraintSet_struct{
78 ConstraintSet* task;
79 ObjectMap::iterator object1;
80 ObjectMap::iterator object2;
81 Range constraintrange;
82 Range featurerange;
83 unsigned int ee1index;
84 unsigned int ee2index;
85 ConstraintSet_struct(ConstraintSet* _task,
86 ObjectMap::iterator _object1,unsigned int _ee1index,
87 ObjectMap::iterator _object2,unsigned int _ee2index,
88 Range nc_range,Range coord_range):
89 task(_task),
90 object1(_object1),object2(_object2),
91 constraintrange(nc_range),featurerange(coord_range),
92 ee1index(_ee1index), ee2index(_ee2index)
93 {};
94 };
95 typedef std::map<std::string,ConstraintSet_struct*> ConstraintMap;
96
97 ObjectMap objects;
98 ConstraintMap constraints;
99
100 static bool getConstraintPose(ConstraintSet* constraint, void *_param, KDL::Frame& _pose);
101};
102
103}
104
105#endif /* SCENE_HPP_ */
represents a frame transformation in 3D space (rotation + translation)
Definition frames.hpp:526
bool addSolver(Solver *_solver)
Definition Scene.cpp:213
bool setParam(SceneParam paramId, double value)
Definition Scene.cpp:97
bool addConstraintSet(const std::string &name, ConstraintSet *task, const std::string &object1, const std::string &object2, const std::string &ee1="", const std::string &ee2="")
Definition Scene.cpp:181
virtual ~Scene()
Definition Scene.cpp:83
bool update(double timestamp, double timestep, unsigned int numsubstep=1, bool reiterate=false, bool cache=true, bool interpolate=true)
Definition Scene.cpp:310
bool addCache(Cache *_cache)
Definition Scene.cpp:223
bool initialize()
Definition Scene.cpp:233
bool addObject(const std::string &name, Object *object, UncontrolledObject *base=&Object::world, const std::string &baseFrame="")
Definition Scene.cpp:112
#define e_vector
#define e_vector6
#define e_matrix6
#define e_matrix
struct blender::compositor::@172::@174 task