Rumba C++ SDK
MatrixCurve.h
Go to the documentation of this file.
1 /*
2 
3  *
4  ***
5  *****
6  ********************* Mercenaries Engineering SARL
7  ***************** Copyright (C) 2018
8  *************
9  ********* http://www.mercenaries-engineering.com
10  ***********
11  **** ****
12  ** **
13 
14 */
15 #pragma once
16 
17 #include "Mesh.h"
18 
19 namespace maquina
20 {
22 
29  {
30  public:
31 
33  enum class MainAxis {
34  X = 0,
35  Y = 1,
36  Z = 2,
37  MX = 3,
38  MY = 4,
39  MZ = 5
40  };
41 
43  enum class CurveType {
44  ConstrainedBezier = 0,
45  Bezier,
46  Spline
47  };
48 
50  enum class OrientationMode {
51  Free = 0,
52  Constrained
53  };
54 
57 
60  MatrixCurve();
61 
63  MatrixCurve(const BufferConstM44d& matrices, CurveType type, OrientationMode mode, MainAxis main_axis = MainAxis::X);
64 
66 
67  MatrixCurve(const Value &v);
68 
70 
73 
76  const BufferConstM44d read_matrices() const;
77 
79  BufferM44d write_matrices();
80 
81  CurveType type() const;
82 
83  OrientationMode mode() const;
84 
85  MainAxis main_axis() const;
86 
88 
91 
94  Imath::M44d evaluate(double u) const;
95 
98  Mesh tessellate(double start, double end, int samples, bool uniform) const;
99 
101  double length(
102  double start,
103  double end,
104  double error = 0.001
105  ) const;
106 
108  double param_from_length(
109  double length,
110  double error = 0.001,
111  int max_try = 100
112  ) const;
113 
115 
116  double closest(
117  const Imath::V3d& p,
118  Imath::M44d* r = nullptr,
119  double error = 0.001,
120  int max_try = 10
121  ) const;
122 
124 
127 
129  MatrixCurve(std::shared_ptr<Impl> impl) { _impl=impl; }
130  };
131 }
Definition: ImathFrame.h:42
Definition: ImathFrame.h:43
OrientationMode
Definition: MatrixCurve.h:50
A mesh value.
Definition: Mesh.h:33
A readonly buffer for basic types like floats, integers, Imath::V3f, Imath::M44f..
Definition: Buffer.h:42
void error(const char *format, const Args &... args)
Log an error message using the Rumba logger.
Definition: Logger.h:50
A value with geometrical attributes. Base of all shape values.
Definition: Shape.h:25
This version of the SDK is unstable, i-e, it may change with no warning.
Definition: AddCurveAction.h:20
A Matrix curve value.
Definition: MatrixCurve.h:28
#define MAQUINA_EXPORT
Definition: Export.h:31
static const MatrixCurve default_value
The default value.
Definition: MatrixCurve.h:126
A writable buffer for basic types like floats, integers, Imath::V3f, Imath::M44f..
Definition: Buffer.h:111
CurveType
Definition: MatrixCurve.h:43
MainAxis
< Set the control matrix axis used to define the curve
Definition: MatrixCurve.h:33
Base class of all Rumba values.
Definition: Value.h:34