8#define PI (3.14159265358979323846)
19 constexpr Range() : min(0), max(0) {}
20 constexpr Range(T min, T max) : min(min), max(max) {}
30 constexpr Size() : width(0), height(0) {}
31 constexpr Size(
size_t width,
size_t height) : width(width), height(height) {}
32 bool operator==(
const Size& other) {
return width == other.width && height == other.height; }
44 constexpr SizeF() : width(0), height(0) {}
45 constexpr SizeF(
double width,
double height) : width(width), height(height) {}
46 bool operator==(
const SizeF& other);
62 bool operator==(
const ROI& other) {
return width == other.width && height == other.height; }
75 constexpr ProfileROI() : xAxisCenter(0), width(0), height(0) {}
76 constexpr ProfileROI(
double xAxisCenter,
double width,
double height)
77 : xAxisCenter(xAxisCenter), width(width), height(height)
96 double translateY,
double translateZ)
101 translate(translateX, translateY, translateZ);
120 enum class Axis { X, Y, Z };
128 void rotate(
double theta, Axis rotationAxis)
130 const double radians{theta * PI / 180.0};
131 const double cosValue{cos(radians)};
132 const double sinValue{sin(radians)};
134 switch (rotationAxis) {
137 double rotationXMatrix[3][3] = {
138 {1, 0, 0}, {0, cosValue, -sinValue}, {0, sinValue, cosValue}};
139 multiMatrix(rotationXMatrix);
143 double rotationYMatrix[3][3] = {
144 {cosValue, 0, sinValue}, {0, 1, 0}, {-sinValue, 0, cosValue}};
145 multiMatrix(rotationYMatrix);
149 double rotationZMatrix[3][3] = {
150 {cosValue, -sinValue, 0}, {sinValue, cosValue, 0}, {0, 0, 1}};
151 multiMatrix(rotationZMatrix);
175 const double EPSILON = 1e-15;
176 double identityRotation[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
177 double zeroTranslation[3] = {0, 0, 0};
178 auto isApprox0 = [EPSILON](
double d) {
return std::fabs(d) <= EPSILON; };
180 for (
int row = 0; row < 3; row++) {
181 for (
int col = 0; col < 3; col++) {
182 if (!isApprox0(
rotation[row][col] - identityRotation[row][col])) {
188 for (
int row = 0; row < 3; row++) {
189 if (!isApprox0(
translation[row] - zeroTranslation[row])) {
197 double rotation[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}};
200 void multiMatrix(
const double rotationMatrix[3][3])
202 double tempRotation[3][3];
203 memcpy(&tempRotation, &
rotation, 9 *
sizeof(
double));
205 for (
int row = 0; row < 3; row++) {
206 for (
int col = 0; col < 3; col++) {
207 rotation[row][col] = rotationMatrix[row][0] * tempRotation[0][col] +
208 rotationMatrix[row][1] * tempRotation[1][col] +
209 rotationMatrix[row][2] * tempRotation[2][col];
217enum struct IpAssignmentMethod { Unknown, DHCP = 4, Static, LLA };
222enum struct Platform { Windows, Tx2_Ubuntu16, Tx2_Ubuntu18, Nx, Rk3399, Zynq, Rk3588, OtherLinux };
224inline static std::string ipAssignmentMethodToString(IpAssignmentMethod type)
227 case IpAssignmentMethod::Static:
229 case IpAssignmentMethod::DHCP:
231 case IpAssignmentMethod::LLA:
233 case IpAssignmentMethod::Unknown:
Describes the region of interest (ROI) of a laser profiler.
double height
The Z-axis height (in mm) of the ROI.
double width
The X-axis width (in mm) of the ROI.
double xAxisCenter
The position (in mm) of the ROI's center on the X-axis.
Describes a region of interest (ROI).
unsigned upperLeftY
The row coordinate of the upper-left corner of the ROI.
unsigned upperLeftX
The column coordinate of the upper-left corner of the ROI.
Describes a two-dimensional size with a width and a height using double-precision floating-point numb...
Describes a two-dimensional size with a width and a height.