41 precompute_linear_matrices(
Physical *physical,
42 const LinearForceVector &forces) {
45 nassertv(physical->get_physical_node() !=
nullptr);
48 size_t global_force_vec_size = forces.size();
51 size_t local_force_vec_size = physical->get_linear_forces().size();
54 _precomputed_linear_matrices.clear();
55 _precomputed_linear_matrices.reserve(
56 global_force_vec_size + local_force_vec_size);
58 NodePath physical_np(physical->get_physical_node_path());
62 LinearForceVector::const_iterator fi;
63 for (fi = forces.begin(); fi != forces.end(); ++fi) {
65 nassertv((*fi)->get_force_node() !=
nullptr);
67 NodePath force_np = (*fi)->get_force_node_path();
68 _precomputed_linear_matrices.push_back(
69 force_np.get_transform(parent_physical_np)->get_mat());
73 const LinearForceVector &force_vector = physical->get_linear_forces();
74 for (fi = force_vector.begin(); fi != force_vector.end(); ++fi) {
75 nassertv((*fi)->get_force_node() !=
nullptr);
77 NodePath force_np = (*fi)->get_force_node_path();
78 _precomputed_linear_matrices.push_back(
79 force_np.get_transform(parent_physical_np)->get_mat());
89 precompute_angular_matrices(
Physical *physical,
90 const AngularForceVector &forces) {
93 nassertv(physical->get_physical_node() !=
nullptr);
96 size_t global_force_vec_size = forces.size();
99 size_t local_force_vec_size = physical->get_angular_forces().size();
102 _precomputed_angular_matrices.clear();
103 _precomputed_angular_matrices.reserve(
104 global_force_vec_size + local_force_vec_size);
106 NodePath physical_np(physical->get_physical_node_path());
110 AngularForceVector::const_iterator fi;
111 for (fi = forces.begin(); fi != forces.end(); ++fi) {
112 nassertv((*fi)->get_force_node() !=
nullptr);
114 NodePath force_np = (*fi)->get_force_node_path();
115 _precomputed_angular_matrices.push_back(
116 force_np.get_transform(parent_physical_np)->get_mat());
120 const AngularForceVector &force_vector = physical->get_angular_forces();
121 for (fi = force_vector.begin(); fi != force_vector.end(); ++fi) {
122 nassertv((*fi)->get_force_node() !=
nullptr);
124 NodePath force_np = (*fi)->get_force_node_path();
125 _precomputed_angular_matrices.push_back(
126 force_np.get_transform(parent_physical_np)->get_mat());
136 out<<
"BaseIntegrator (id "<<
this<<
")";
147 out<<
""<<
"_precomputed_linear_matrices\n";
148 for (MatrixVector::const_iterator i=_precomputed_linear_matrices.begin();
149 i != _precomputed_linear_matrices.end();
151 out.width(
indent+2); out<<
""; (*i).output(out); out<<
"\n";
163 out<<
""<<
"_precomputed_angular_matrices\n";
164 for (MatrixVector::const_iterator i=_precomputed_angular_matrices.begin();
165 i != _precomputed_angular_matrices.end();
167 out.width(
indent+2); out<<
""; (*i).output(out); out<<
"\n";
178 out.width(
indent); out<<
""; out<<
"BaseIntegrator:\n";
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_parent
Returns the NodePath to the parent of the referenced node: that is, this NodePath,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
virtual void write_precomputed_angular_matrices(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_precomputed_linear_matrices(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Defines a set of physically modeled attributes.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual ~BaseIntegrator()
destructor
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...