Atoms Crowd  7.0.0
MatrixNodes.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsGraph/Globals.h>
11 #include <AtomsGraph/Nodes/UnaryFunctionNode.h>
12 #include <AtomsGraph/Nodes/BinaryFunctionNode.h>
13 #include <AtomsGraph/Nodes/MathNodes.h>
14 #include <AtomsUtils/AtomsMath.h>
15 
16 namespace AtomsGraph
17 {
18 
19  ATOMSGRAPH_EXPORT void registerMatrixNodes();
20 
21  ATOMS_IMPLEMENT_NODE(AddNode<AtomsMath::Matrix>, AddMatrix, ADDMATRIX_NODE_ID)
22 
23  ATOMS_IMPLEMENT_NODE(SubtractNode<AtomsMath::Matrix>, SubtractMatrix, SUBTRACTMATRIX_NODE_ID)
24 
25  ATOMS_IMPLEMENT_NODE(MultiplyNode<AtomsMath::Matrix>, MultiplyMatrix, MULTIPLYMATRIX_NODE_ID)
26 
27  UNARY_DOT_FUNCTION_NODE_DEFINITION(InverseNode, inverse)
28  ATOMS_IMPLEMENT_NODE(InverseNode<AtomsMath::Matrix>, InverseMatrix, INVERSEMATRIX_NODE_ID)
29 
30  UNARY_DOT_FUNCTION_NODE_DEFINITION(TransposeNode, transposed)
31  ATOMS_IMPLEMENT_NODE(TransposeNode<AtomsMath::Matrix>, TransposeMatrix, TRANSPOSEMATRIX_NODE_ID)
32 
33  UNARY_DOT_FUNCTION_NODE_DEFINITION(DeterminantMatrixNode, determinant)
34  ATOMS_IMPLEMENT_NODE(DeterminantMatrixNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, double)>, DeterminantMatrix, DETERMINANTMATRIX_NODE_ID)
35 
36  BINARY_OPERATOR_NODE_DEFINITION_WITH_NAMES(MultiplyScalarMatrixNode, *, matrix, double, out)
37  ATOMS_IMPLEMENT_NODE(MultiplyScalarMatrixNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, double, AtomsMath::Matrix)>, MultiplyScalarMatrix, MULTIPLYSCALARMATRIX_NODE_ID)
38 
39  BINARY_OPERATOR_NODE_DEFINITION_WITH_NAMES(AddScalarMatrixNode, +, matrix, double, out)
40  ATOMS_IMPLEMENT_NODE(AddScalarMatrixNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, double, AtomsMath::Matrix)>, AddScalarMatrix, ADDSCALARMATRIX_NODE_ID)
41 
42  BINARY_OPERATOR_NODE_DEFINITION_WITH_NAMES(DivideScalarMatrixNode, / , matrix, double, out)
43  ATOMS_IMPLEMENT_NODE(DivideScalarMatrixNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, double, AtomsMath::Matrix)>, DivideScalarMatrix, DIVIDESCALARMATRIX_NODE_ID)
44 
45  BINARY_NOREF_DOT_FUNCTION_NODE_DEFINITION_WITH_NAMES(RotateNode, rotate, matrix, vector, out)
46  ATOMS_IMPLEMENT_NODE(RotateNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, AtomsMath::Vector3, AtomsMath::Matrix)>, RotateMatrix, ROTATEMATRIX_NODE_ID)
47 
48  BINARY_NOREF_DOT_FUNCTION_NODE_DEFINITION_WITH_NAMES(SetRotateNode, setEulerAngles, matrix, vector, out)
49  ATOMS_IMPLEMENT_NODE(SetRotateNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, AtomsMath::Vector3, AtomsMath::Matrix)>, SetRotationMatrix, SETROTATEMATRIX_NODE_ID)
50 
51  BINARY_NOREF_DOT_FUNCTION_NODE_DEFINITION_WITH_NAMES(ScaleNode, scale, matrix, vector, out)
52  ATOMS_IMPLEMENT_NODE(ScaleNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, AtomsMath::Vector3, AtomsMath::Matrix)>, ScaleMatrix, SCALEMATRIX_NODE_ID)
53 
54  BINARY_NOREF_DOT_FUNCTION_NODE_DEFINITION_WITH_NAMES(SetScaleNode, setScale, matrix, vector, out)
55  ATOMS_IMPLEMENT_NODE(SetScaleNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, AtomsMath::Vector3, AtomsMath::Matrix)>, SetScaleMatrix, SETSCALEMATRIX_NODE_ID)
56 
57  BINARY_NOREF_DOT_FUNCTION_NODE_DEFINITION_WITH_NAMES(TranslateNode, translate, matrix, vector, out)
58  ATOMS_IMPLEMENT_NODE(TranslateNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, AtomsMath::Vector3, AtomsMath::Matrix)>, TranslateMatrix, TRANSLATEMATRIX_NODE_ID)
59 
60  BINARY_NOREF_DOT_FUNCTION_NODE_DEFINITION_WITH_NAMES(SetTranslationNode, setTranslation, matrix, vector, out)
61  ATOMS_IMPLEMENT_NODE(SetTranslationNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, AtomsMath::Vector3, AtomsMath::Matrix)>, SetTranslationMatrix, SETTRANSLATIONMATRIX_NODE_ID)
62 
63  BINARY_NOREF_DOT_FUNCTION_NODE_DEFINITION_WITH_NAMES(ShearNode, shear, matrix, vector, out)
64  ATOMS_IMPLEMENT_NODE(ShearNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, AtomsMath::Vector3, AtomsMath::Matrix)>, ShearMatrix, SHEARMATRIX_NODE_ID)
65 
66  BINARY_NOREF_DOT_FUNCTION_NODE_DEFINITION_WITH_NAMES(SetShearNode, setShear, matrix, vector, out)
67  ATOMS_IMPLEMENT_NODE(SetShearNode<CONCAT(AtomsMath::Matrix, AtomsMath::Matrix, AtomsMath::Vector3, AtomsMath::Matrix)>, SetShearMatrix, SETSHEARMATRIX_NODE_ID)
68 
69  class ATOMSGRAPH_EXPORT MultiDirMatrixNode :
70  public Node
71  {
72  public:
73 
74  NODE_STANDARD_MEMBERS
75 
77 
78  virtual ~MultiDirMatrixNode();
79 
80  virtual bool compute(const ComputeData* computeData);
81 
82  private:
83 
84  MatrixPort *m_in1;
85 
86  VectorPort *m_in2;
87 
88  VectorPort *m_out;
89  };
90 
91 
92  class ATOMSGRAPH_EXPORT MultiVecMatrixNode :
93  public Node
94  {
95  public:
96 
97  NODE_STANDARD_MEMBERS
98 
100 
101  virtual ~MultiVecMatrixNode();
102 
103  virtual bool compute(const ComputeData* computeData);
104 
105  private:
106 
107  MatrixPort *m_in1;
108 
109  VectorPort *m_in2;
110 
111  VectorPort *m_out;
112  };
113 
114 
115  class ATOMSGRAPH_EXPORT SetAxisAngleMatrixNode :
116  public Node
117  {
118  public:
119 
120  NODE_STANDARD_MEMBERS
121 
123 
124  virtual ~SetAxisAngleMatrixNode();
125 
126  virtual bool compute(const ComputeData* computeData);
127 
128  private:
129 
130  VectorPort *m_in1;
131 
132  DoublePort *m_in2;
133 
134  MatrixPort *m_out;
135  };
136 
137 
138  class ATOMSGRAPH_EXPORT AlignZAxisWithTargetDirMatrixNode :
139  public Node
140  {
141  public:
142 
143  NODE_STANDARD_MEMBERS
144 
146 
148 
149  virtual bool compute(const ComputeData* computeData);
150 
151  private:
152 
153  VectorPort *m_in1;
154 
155  VectorPort *m_in2;
156 
157  MatrixPort *m_out;
158  };
159 
160 
161  class ATOMSGRAPH_EXPORT ComputeLocalFrameMatrixNode :
162  public Node
163  {
164  public:
165 
166  NODE_STANDARD_MEMBERS
167 
169 
170  virtual ~ComputeLocalFrameMatrixNode();
171 
172  virtual bool compute(const ComputeData* computeData);
173 
174  private:
175 
176  VectorPort *m_in1;
177 
178  VectorPort *m_in2;
179 
180  VectorPort *m_in3;
181 
182  MatrixPort *m_out;
183  };
184 
185 
186  class ATOMSGRAPH_EXPORT ComputeRSMatrixNode :
187  public Node
188  {
189  public:
190 
191  NODE_STANDARD_MEMBERS
192 
194 
195  virtual ~ComputeRSMatrixNode();
196 
197  virtual bool compute(const ComputeData* computeData);
198 
199  private:
200 
201  BooleanPort *m_in1;
202 
203  BooleanPort *m_in2;
204 
205  MatrixPort *m_in3;
206 
207  MatrixPort *m_in4;
208 
209  MatrixPort *m_out;
210  };
211 
212 
213  class ATOMSGRAPH_EXPORT ExtractEulerXYZMatrixNode :
214  public Node
215  {
216  public:
217 
218  NODE_STANDARD_MEMBERS
219 
221 
222  virtual ~ExtractEulerXYZMatrixNode();
223 
224  virtual bool compute(const ComputeData* computeData);
225 
226  private:
227 
228  MatrixPort *m_in1;
229 
230  VectorPort *m_out;
231  };
232 
233 
234  class ATOMSGRAPH_EXPORT ExtractEulerZYXMatrixNode :
235  public Node
236  {
237  public:
238 
239  NODE_STANDARD_MEMBERS
240 
242 
243  virtual ~ExtractEulerZYXMatrixNode();
244 
245  virtual bool compute(const ComputeData* computeData);
246 
247  private:
248 
249  MatrixPort *m_in1;
250 
251  VectorPort *m_out;
252  };
253 
254  class ATOMSGRAPH_EXPORT ExtractQuaternionMatrixNode :
255  public Node
256  {
257  public:
258 
259  NODE_STANDARD_MEMBERS
260 
262 
263  virtual ~ExtractQuaternionMatrixNode();
264 
265  virtual bool compute(const ComputeData* computeData);
266 
267  private:
268 
269  MatrixPort *m_in1;
270 
271  QuaternionPort *m_out;
272  };
273 
274  class ATOMSGRAPH_EXPORT ExtractScalingMatrixNode :
275  public Node
276  {
277  public:
278 
279  NODE_STANDARD_MEMBERS
280 
282 
283  virtual ~ExtractScalingMatrixNode();
284 
285  virtual bool compute(const ComputeData* computeData);
286 
287  private:
288 
289  MatrixPort *m_in1;
290 
291  VectorPort *m_out;
292  };
293 
294  class ATOMSGRAPH_EXPORT ExtractScalingAndShearMatrixNode :
295  public Node
296  {
297  public:
298 
299  NODE_STANDARD_MEMBERS
300 
302 
304 
305  virtual bool compute(const ComputeData* computeData);
306 
307  private:
308 
309  MatrixPort *m_in1;
310 
311  VectorPort *m_out1;
312 
313  VectorPort *m_out2;
314  };
315 
316  class ATOMSGRAPH_EXPORT ExtractSHRTMatrixNode :
317  public Node
318  {
319  public:
320 
321  NODE_STANDARD_MEMBERS
322 
324 
325  virtual ~ExtractSHRTMatrixNode();
326 
327  virtual bool compute(const ComputeData* computeData);
328 
329  private:
330 
331  MatrixPort *m_in1;
332 
333  VectorPort *m_out1;
334 
335  VectorPort *m_out2;
336 
337  VectorPort *m_out3;
338 
339  VectorPort *m_out4;
340  };
341 
342  class ATOMSGRAPH_EXPORT RotationMatrixNode :
343  public Node
344  {
345  public:
346 
347  NODE_STANDARD_MEMBERS
348 
350 
351  virtual ~RotationMatrixNode();
352 
353  virtual bool compute(const ComputeData* computeData);
354 
355  private:
356 
357  VectorPort *m_in1;
358 
359  VectorPort *m_in2;
360 
361  MatrixPort *m_out;
362  };
363 
364  class ATOMSGRAPH_EXPORT RotationWithUpDirMatrixNode :
365  public Node
366  {
367  public:
368 
369  NODE_STANDARD_MEMBERS
370 
372 
373  virtual ~RotationWithUpDirMatrixNode();
374 
375  virtual bool compute(const ComputeData* computeData);
376 
377  private:
378 
379  VectorPort *m_in1;
380 
381  VectorPort *m_in2;
382 
383  VectorPort *m_in3;
384 
385  MatrixPort *m_out;
386  };
387 
388  class ATOMSGRAPH_EXPORT SansScalingMatrixNode :
389  public Node
390  {
391  public:
392 
393  NODE_STANDARD_MEMBERS
394 
396 
397  virtual ~SansScalingMatrixNode();
398 
399  virtual bool compute(const ComputeData* computeData);
400 
401  private:
402 
403  MatrixPort *m_in;
404 
405  MatrixPort *m_out;
406  };
407 
408  class ATOMSGRAPH_EXPORT SansScalingAndShearMatrixNode :
409  public Node
410  {
411  public:
412 
413  NODE_STANDARD_MEMBERS
414 
416 
418 
419  virtual bool compute(const ComputeData* computeData);
420 
421  private:
422 
423  MatrixPort *m_in;
424 
425  MatrixPort *m_out;
426  };
427 
428  class ATOMSGRAPH_EXPORT VectorToMatrixNode :
429  public Node
430  {
431  public:
432 
433  NODE_STANDARD_MEMBERS
434 
436 
437  virtual ~VectorToMatrixNode();
438 
439  virtual bool compute(const ComputeData* computeData);
440 
441  private:
442 
443  VectorPort *m_in1;
444 
445  VectorPort *m_in2;
446 
447  VectorPort *m_in3;
448 
449  VectorPort *m_in4;
450 
451  MatrixPort *m_out;
452  };
453 
454  class ATOMSGRAPH_EXPORT MatrixToVectorNode :
455  public Node
456  {
457  public:
458 
459  NODE_STANDARD_MEMBERS
460 
462 
463  virtual ~MatrixToVectorNode();
464 
465  virtual bool compute(const ComputeData* computeData);
466 
467  private:
468 
469  VectorPort *m_out1;
470 
471  VectorPort *m_out2;
472 
473  VectorPort *m_out3;
474 
475  VectorPort *m_out4;
476 
477  MatrixPort *m_in;
478  };
479 
480 }
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: Node.h:21
Definition: MatrixNodes.h:163
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:188
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:215
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:236
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:256
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:318
virtual bool compute(const ComputeData *computeData)
Compute function.
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:276
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:456
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:71
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:94
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: Node.h:31
Generic node port class.
Definition: PortTemplate.h:24
Definition: MatrixNodes.h:344
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:366
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:410
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:390
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:117
virtual bool compute(const ComputeData *computeData)
Compute function.
Definition: MatrixNodes.h:430
virtual bool compute(const ComputeData *computeData)
Compute function.
AtomsGraph namespace.
Definition: PosePort.h:15