Ocean
Loading...
Searching...
No Matches
Grid.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_GEOMETRY_GRID_H
9#define META_OCEAN_GEOMETRY_GRID_H
10
12
17
18namespace Ocean
19{
20
21namespace Geometry
22{
23
24/**
25 * This class implements the basic data of an planar grid.
26 * There are 3 coordinate systems:
27 * (1) world coordinates:
28 * - describe points in the world system
29 * (2) plane coordinates:
30 * - describe points in the plane of the grid
31 * - the z coordinate is zero, if the point lies directly in the plane
32 * (3) grid coordinates:
33 * - describe points in the grid refer to the plane
34 * - the grid center must not be identical with the plane center
35 * - the following sketch shows a top-view of the grid:
36 * <pre>
37 * y
38 * ^
39 * | o - o - o - o - o
40 * | | | | | |
41 * | o - o - o - p - o
42 * | | | | | |
43 * | o - o - c - o - o
44 * | | | | | |
45 * | o - o - o - o - o
46 * | | | | | |
47 * | o - o - o - o - o
48 * |
49 * z---------------------> x
50 * </pre>
51 * - the z coordinate is always zero, so in following the grid coordinates are represent as a Vector2
52 *
53 * This class holds 3 transformations:
54 * (1) plane2world transformation:
55 * - transforms points defined in a coordinate system of the plane into points defined in the world coordinate system
56 * - all axes must be perpendicular to each other
57 * - the z axis always describe the normal of the plane
58 * (2) grid2plane transformation:
59 * - transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system
60 * - all axes must be perpendicular to each other
61 * - the z axis is always (0, 0, 1)
62 * (3) virtualGrid2plane transformation
63 * - transforms points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system
64 * - the z axis is always (0, 0, 1)
65 * - the x and y axes must be perpendicular to the z axis
66 * - the x axis must not be perpendicular to the y axis to skew the grid
67 *
68 * The grid holds an visualization bounding box defined in plane coordinates.
69 *
70 * This class implements convert functions to convert point from one coordinate system to an other.
71 * @ingroup geometry
72 */
73class OCEAN_GEOMETRY_EXPORT Grid
74{
75 public:
76
77 /**
78 * Creates a new invalid grid element.
79 */
80 Grid() = default;
81
82 /**
83 * Creates a new Grid by a plane2world transformation.
84 * Whether the virtualGrid2plane transformation is set, the grid2plane transformation is set to the same matrix.
85 * If the grid2plane transformation should be set, the virtualGrid2plane transformation can be set to the appropriate matrix.
86 * @param plane2worldTransformation Transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system
87 * @param virtualGrid2planeTransformation Optional transformation that transforms points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system
88 * @param lowerCorner Optional lower corner of the grid bounding box for visualization in plane coordinates
89 * @param upperCorner Optional upper corner of the grid bounding box for visualization in plane coordinates
90 */
91 inline explicit Grid(const HomogenousMatrix4& plane2worldTransformation, const HomogenousMatrix4& virtualGrid2planeTransformation = HomogenousMatrix4(true), const Vector2& lowerCorner = Vector2(-0.5, -0.5), const Vector2& upperCorner = Vector2(0.5, 0.5));
92
93 /**
94 * Creates a new Grid by a plane2world transformation and four image points defining a rectangle.
95 * The bounding box is adjusted, so the rectangle plus a border lies inside.
96 * The border has a size of the half average length of two neighboring projected plane points.
97 * If the virtualGrid2plane transformation is set, the grid2plane transformation is set to the same matrix.
98 * If the grid2plane transformation should be set, the virtualGrid2plane transformation can be set to the appropriate matrix.
99 * @param pinholeCamera The pinhole camera profile to be applied
100 * @param world_T_camera The camera pose to be applied, transforming camera to world
101 * @param imagePoints The image points to adjust the bounding box, size must be four
102 * @param plane2worldTransformation Transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system
103 * @param virtualGrid2planeTransformation Optional transformation that transforms points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system
104 * @param clipBoundingBox Optional flag to clip the grid lower and upper grid corners by an image bounding box around the camera frame
105 */
106 Grid(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vectors2& imagePoints, const HomogenousMatrix4& plane2worldTransformation, const HomogenousMatrix4& virtualGrid2planeTransformation = HomogenousMatrix4(true), const bool clipBoundingBox = false);
107
108 /**
109 * Creates a new Grid by four given image points using vanishing projection.
110 * The four image points must define a convex polygon.
111 * If additionally four grid coordinates are given, the virtualGrid2plane transformation is set, too.
112 * The four grid coordinates must be given in the same order (clockwise or counter clockwise) like the four image points!
113 * The grid coordinates are only used for determine the shear of the virtualGrid2plane transformation, the lower and upper grid corners are not adjust!
114 * If no grid could be determined from the four image points, a invalid grid is create.
115 * @param pinholeCamera The pinhole camera profile to be applied
116 * @param world_T_camera The camera pose to be applied, transforming camera to world
117 * @param imagePoints The four image points (must be in clockwise or counterclockwise order)
118 * @param gridCoordinates Optional four grid coordinates (must be in clockwise or counterclockwise order)
119 * @param previousPlane2worldTransformation Optional Transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system to adapt the plane translation
120 * @param clipBoundingBox Optional flag to clip the grid lower and upper grid corners by an image bounding box around the camera frame
121 */
122 Grid(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vectors2& imagePoints, const Vector2* gridCoordinates = nullptr, const HomogenousMatrix4* previousPlane2worldTransformation = nullptr, const bool clipBoundingBox = false);
123
124 /**
125 * Creates a new Grid by a given transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system.
126 * The virtualGrid2plane transformation is adjusted by four given image points.
127 * The virtual grid is sheared that the four points define a rectangle on the virtual grid in the best case.
128 * @param pinholeCamera The pinhole camera profile to be applied
129 * @param world_T_camera The camera pose to be applied, transforming camera to world
130 * @param plane2worldTransformation Transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system
131 * @param imagePoints The four image points (must be in clockwise or counterclockwise order)
132 * @param clipBoundingBox Optional flag to clip the grid lower and upper grid corners by an image bounding box around the camera frame
133 */
134 Grid(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const HomogenousMatrix4& plane2worldTransformation, const Vectors2& imagePoints, const bool clipBoundingBox = false);
135
136 /**
137 * Returns the transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system.
138 * @return The plane transformation
139 */
140 inline const HomogenousMatrix4& plane2worldTransformation() const;
141
142 /**
143 * Returns the transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system.
144 * @return The grid transformation.
145 */
146 inline const HomogenousMatrix4& grid2planeTransformation() const;
147
148 /**
149 * Returns the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system.
150 * @return The virtual grid transformation
151 */
152 inline const HomogenousMatrix4& virtualGrid2planeTransformation() const;
153
154 /**
155 * Returns a transformation that transforms points defined in a coordinate system of the virtual plane into points defined in the world coordinate system.
156 * The virtual plane has the orientation scale and depth of the normal plane while an optional shear component is extracted from the virtual grid if the virtual grid has a shear component.<br>
157 * @return The virtual plane transformation
158 */
160
161 /**
162 * Returns the transformation that transform points defined in a coordinate system of the grid into points defined in the world coordinate system.
163 * @return The grid transformation
164 */
165 inline HomogenousMatrix4 grid2worldTransformation() const;
166
167 /**
168 * Returns the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the world coordinate system.
169 * @return The virtual grid transformation
170 */
171 inline HomogenousMatrix4 virtualGrid2worldTransformation() const;
172
173 /**
174 * Returns the lower grid corner defined in the grid coordinate system of the visualization bounding box of the grid.
175 * @return lower grid corner
176 */
177 inline const Vector2& lowerGridCorner() const;
178
179 /**
180 * Returns the upper grid corner defined in the grid coordinate system of the visualization bounding box of the grid.
181 * @return upper grid corner
182 */
183 inline const Vector2& upperGridCorner() const;
184
185 /**
186 * Sets the transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system.
187 * @param newTransformation New transformation to set
188 */
189 inline void setPlane2worldTransformation(const HomogenousMatrix4& newTransformation);
190
191 /**
192 * Sets the transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system.
193 * The transformation that transforms points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system is also set to the same matrix.
194 * @param newTransformation New transformation to set
195 */
196 inline void setGrid2planeTransformation(const HomogenousMatrix4& newTransformation);
197
198 /**
199 * Sets the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system.
200 * The transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system is also set:
201 * If the given matrix is not valid, the grid2plane transformation will also be invalid.
202 * If the given matrix is valid, the grid2plane transformation will be set without the shear of the virtual transformation and a scale which is an average of the x and y scale.
203 * @param newTransformation New transformation to set
204 * @return True, if succeeded
205 */
207
208 /**
209 * Sets the lower grid corner defined in the plane coordinate system of the visualization bounding box of the grid.
210 * If the lower grid corner is set to a value higher than the upper corner, the grid will be invalid.
211 * @param newCorner New lower grid corner
212 */
213 inline void setLowerGridCorner(const Vector2& newCorner);
214
215 /**
216 * Sets the upper grid corner defined in the plane coordinate system of the visualization bounding box of the grid.
217 * If the upper grid corner is set to a value smaller than the lower corner, the grid will be invalid.
218 * @param newCorner New upper grid corner
219 */
220 inline void setUpperGridCorner(const Vector2& newCorner);
221
222 /**
223 * Returns whether the grid is valid.
224 * The grid is valid, whether the lower grid corner is smaller than the upper grid corner, the 3 transformation are valid matrices and:
225 * the x, y and z axis of the plane2world and grid2plane transformation are orthogonal to each other and the x and y axis of the virtualGrid2plane transformation are orthogonal to the z axis.
226 * @return True, if so
227 */
228 bool isValid() const;
229
230 /**
231 * Sets the grid to invalid.
232 * All transformations will be set to invalid transformations.
233 * The upper grid corner will be set higher as the lower grid corner.
234 */
236
237 /**
238 * Returns whether the physical and virtual grid transformations are identical.
239 * @return True, if so
240 */
242
243 /**
244 * Clips the grid bounding box and adjusts the lower and upper grid corner by an image bounding box.
245 * This bounding box is defined by a given camera, a pose and a border size factor.
246 * The image bounding box will have the following bounds:
247 * Left: -width * factor
248 * Right width + width * factor
249 * Top: -height * factor
250 * Bottom: height + height * factor
251 * @param pinholeCamera The pinhole camera profile to be applied
252 * @param world_T_camera The camera pose to be applied, transforming camera to world
253 * @param borderSizeFactor the factor for the width and height for the border around the camera frame, Range [0, infinity)
254 * @param insideGridCoordinates Optional grid coordinates that must lie inside the new clipped grid
255 */
256 void clipByImageBoundingBox(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Scalar borderSizeFactor = Scalar(2.0), const Vectors2& insideGridCoordinates = Vectors2());
257
258 /**
259 * Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the world coordinate system.
260 * The grid must be valid!
261 * @param pinholeCamera The pinhole camera profile to be applied
262 * @param world_T_camera The camera pose to be applied, transforming camera to world
263 * @param imageCoordinate Image coordinate which will be converted
264 * @param worldCoordinate resulting world coordinate, if the conversion was successful
265 * @return True, if the conversion was successful
266 */
267 bool image2world(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector2& imageCoordinate, Vector3& worldCoordinate) const;
268
269 /**
270 * Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the plane coordinate system.
271 * The grid must be valid!
272 * @param pinholeCamera The pinhole camera profile to be applied
273 * @param world_T_camera The camera pose to be applied, transforming camera to world
274 * @param imageCoordinate Image coordinate which will be converted
275 * @param planeCoordinate resulting plane coordinate, if the conversion was successful
276 * @return True, if the conversion was successful
277 */
278 bool image2plane(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector2& imageCoordinate, Vector3& planeCoordinate) const;
279
280 /**
281 * Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the grid coordinate system.
282 * The grid must be valid!
283 * @param pinholeCamera The pinhole camera profile to be applied
284 * @param world_T_camera The camera pose to be applied, transforming camera to world
285 * @param imageCoordinate Image coordinate which will be converted
286 * @param gridCoordinate resulting grid coordinate, if the conversion was successful
287 * @tparam tVirtual Indicate whether the virtual grid is used
288 * @return True, if the conversion was successful
289 */
290 template <bool tVirtual>
291 bool image2grid(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector2& imageCoordinate, Vector2& gridCoordinate) const;
292
293 /**
294 * Convert an point on the plane defined in a coordinate system of the world into an point defined in the camera image coordinate system.
295 * The grid must be valid!
296 * @param pinholeCamera The pinhole camera profile to be applied
297 * @param world_T_camera The camera pose to be applied, transforming camera to world
298 * @param worldCoordinate World coordinate which will be converted
299 * @return resulting image coordinate
300 */
301 inline Vector2 world2image(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector3& worldCoordinate) const;
302
303 /**
304 * Convert an point on the plane defined in a coordinate system of the world into an point defined in the camera image coordinate system.
305 * The grid must be valid!
306 * @param pinholeCamera The pinhole camera profile to be applied
307 * @param flippedCamera_T_world Inverted flipped pose to be applied
308 * @param worldCoordinate World coordinate which will be converted
309 * @return resulting image coordinate
310 */
311 inline Vector2 world2imageIF(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& flippedCamera_T_world, const Vector3& worldCoordinate) const;
312
313 /**
314 * Convert an point on the plane defined in a coordinate system of the world into an point defined in the plane coordinate system.
315 * The grid must be valid!
316 * @param worldCoordinate World coordinate which will be converted
317 * @return resulting plane coordinate
318 */
319 inline Vector3 world2plane(const Vector3& worldCoordinate) const;
320
321 /**
322 * Convert an point on the plane defined in a coordinate system of the world into an point defined in the grid coordinate system.
323 * The grid must be valid!
324 * @param worldCoordinate World coordinate which will be converted
325 * @tparam tVirtual Indicate whether the virtual grid is used
326 * @return resulting grid coordinate
327 */
328 template <bool tVirtual>
329 inline Vector2 world2grid(const Vector3& worldCoordinate) const;
330
331 /**
332 * Convert an point on the plane defined in a coordinate system of the plane into an point defined in the camera image coordinate system.
333 * The grid must be valid!
334 * @param pinholeCamera The pinhole camera profile to be applied
335 * @param world_T_camera The camera pose to be applied, transforming camera to world
336 * @param planeCoordinate Plane coordinate which will be converted
337 * @return resulting image coordinate
338 */
339 inline Vector2 plane2image(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector3& planeCoordinate) const;
340
341 /**
342 * Convert an point on the plane defined in a coordinate system of the plane into an point defined in the camera image coordinate system.
343 * The grid must be valid!
344 * @param pinholeCamera The pinhole camera profile to be applied
345 * @param flippedCamera_T_world inverted flipped pose to be applied
346 * @param planeCoordinate Plane coordinate which will be converted
347 * @return resulting image coordinate
348 */
349 inline Vector2 plane2imageIF(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& flippedCamera_T_world, const Vector3& planeCoordinate) const;
350
351 /**
352 * Convert an point on the plane defined in a coordinate system of the plane into an point defined in the world coordinate system.
353 * The grid must be valid!
354 * @param planeCoordinate Plane coordinate which will be converted
355 * @return resulting world coordinate
356 */
357 inline Vector3 plane2world(const Vector3& planeCoordinate) const;
358
359 /**
360 * Convert an point on the plane defined in a coordinate system of the plane into an point defined in the grid coordinate system.
361 * The grid must be valid!
362 * @param planeCoordinate Plane coordinate which will be converted
363 * @tparam tVirtual Indicate whether the virtual grid is used
364 * @return resulting grid coordinate
365 */
366 template <bool tVirtual>
367 inline Vector2 plane2grid(const Vector3& planeCoordinate) const;
368
369 /**
370 * Convert an point on the plane defined in a coordinate system of the grid into an point defined in the camera image coordinate system.
371 * The grid must be valid!
372 * @param pinholeCamera The pinhole camera profile to be applied
373 * @param world_T_camera The camera pose to be applied, transforming camera to world
374 * @param gridCoordinate Grid coordinate which will be converted
375 * @tparam tVirtual Indicate whether the virtual grid is used
376 * @return resulting image coordinate
377 */
378 template <bool tVirtual>
379 inline Vector2 grid2image(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector2& gridCoordinate) const;
380
381 /**
382 * Convert an point on the plane defined in a coordinate system of the grid into an point defined in the camera image coordinate system.
383 * The grid must be valid!
384 * @param pinholeCamera The pinhole camera profile to be applied
385 * @param flippedCamera_T_world Inverted flipped pose to be applied
386 * @param gridCoordinate Grid coordinate which will be converted
387 * @tparam tVirtual Indicate whether the virtual grid is used
388 * @return resulting image coordinate
389 */
390 template <bool tVirtual>
391 inline Vector2 grid2imageIF(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& flippedCamera_T_world, const Vector2& gridCoordinate) const;
392
393 /**
394 * Convert an point on the plane defined in a coordinate system of the grid into an point defined in the world coordinate system.
395 * The grid must be valid!
396 * @param gridCoordinate Grid coordinate which will be converted
397 * @tparam tVirtual Indicate whether the virtual grid is used
398 * @return resulting world coordinate
399 */
400 template <bool tVirtual>
401 inline Vector3 grid2world(const Vector2& gridCoordinate) const;
402
403 /**
404 * Convert an point on the plane defined in a coordinate system of the grid into an point defined in the plane coordinate system.
405 * The grid must be valid!
406 * @param gridCoordinate Grid coordinate which will be converted
407 * @tparam tVirtual Indicate whether the virtual grid is used
408 * @return resulting plane coordinate
409 */
410 template <bool tVirtual>
411 inline Vector3 grid2plane(const Vector2& gridCoordinate) const;
412
413 /**
414 * Returns whether two grids are identical.
415 * @param grid Right grid
416 * @return True, if so
417 */
418 inline bool operator==(const Grid& grid) const;
419
420 /**
421 * Returns whether two grids are not identical.
422 * @param grid Right grid
423 * @return True, if so
424 */
425 inline bool operator!=(const Grid& grid) const;
426
427 /**
428 * Determine the transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system.
429 * If additionally four grid coordinates are given, the transformation that transforms points defined in a coordinate system of the grid/virtual grid into points defined in the plane coordinate system by four given image points are determined, too.
430 * The four grid coordinates must be given in the same order (clockwise or counter clockwise) like the four image points!
431 * If no grid coordinates are given, the resulting virtualGrid2plane transformation equals to the grid2plane transformation.
432 * If a previous plane2world transformation is given, the new one will be oriented at the same translation, otherwise the origin of the new plane2world transformation will be set to a distance of 1 from the camera.
433 * @param pinholeCamera The pinhole camera profile to be applied
434 * @param world_T_camera The camera pose to be applied, transforming camera to world
435 * @param imagePoints The four image points to determine the transformations (must be in clockwise or counterclockwise order)
436 * @param gridCoordinates Optional four grid coordinates (must be in clockwise or counterclockwise order)
437 * @param previousPlane2worldTransformation Optional previous plane2world transformation
438 * @param plane2worldTransformation Optional resulting plane2world transformation
439 * @param virtualGrid2planeTransformation Optional resulting virtualGrid2plane transformation
440 * @return True, if the Transformations could be determined
441 */
442 static bool determineVirtualGridTransformationsByFourImagePoints(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector2* imagePoints, const Vector2* gridCoordinates = nullptr, const HomogenousMatrix4* previousPlane2worldTransformation = nullptr, HomogenousMatrix4* plane2worldTransformation = nullptr, HomogenousMatrix4* virtualGrid2planeTransformation = nullptr);
443
444 /**
445 * Determines a virtualGrid2plane transformation by a plane2world transformation and four given image points.
446 * Furthermore an adjusted plane2world transformation is determined which is the previous plane2world transformation rotated around the plane normal
447 * that the bisection of the x and y axis of the virtual and non virtual grid transformation have the same orientation.
448 * @param pinholeCamera The pinhole camera profile to be applied
449 * @param world_T_camera The camera pose to be applied, transforming camera to world
450 * @param imagePoints The four image points to determine the transformations (must be in clockwise or counterclockwise order)
451 * @param previousPlane2worldTransformation Previous plane2world transformation
452 * @param plane2worldTransformation The new plane2world transformation that is a rotation of the previous plane2world transformation around the plane normal
453 * @param virtualGrid2planeTransformation The determined virtualGrid2plane transformation
454 * @return True, if succeeded
455 */
456 static bool determineVirtualGridTransformationByPlane2WorldTransformation(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vectors2& imagePoints, const HomogenousMatrix4& previousPlane2worldTransformation, HomogenousMatrix4& plane2worldTransformation, HomogenousMatrix4& virtualGrid2planeTransformation);
457
458 /**
459 * Determine the nearest integer grid node from a given grid coordinate.
460 * An x or y value from >= 2.5 to < 3.5 is rounded to 3.0.
461 * @param gridCoordinate Grid coordinate to get the nearest node from
462 * @return Nearest node in grid coordinates
463 */
464 static inline Vector2 grid2nearestNode(const Vector2& gridCoordinate);
465
466 /**
467 * Returns whether a given transformation has shear component in x/y direction.
468 * The x and y axes of the given transformation must be orthogonal to the z axis.
469 * @param transformation The transformation to check
470 * @return True, if so
471 */
472 static inline bool hasTransformationShearComponent(const HomogenousMatrix4& transformation);
473
474 /**
475 * Determines a transformation without a shear component from a given transformation with shear component.
476 * The x and y axes of the given transformation with shear component must be orthogonal to the z axis.
477 * The resulting transformation has the same z axis and translation like the given transformation.
478 * @param transformationWithShearComponent Transformation with shear component
479 * @param resultTransformation Resulting transformation without a shear component
480 * @return True, if succeeded
481 */
482 static bool determineTransformationWithoutShearComponent(const HomogenousMatrix4& transformationWithShearComponent, HomogenousMatrix4& resultTransformation);
483
484 /**
485 * Returns whether a given world coordinate is in front of the camera.
486 * @param world_T_camera Current camera pose, transforming camera to world
487 * @param worldCoordinate World coordinate to be checked
488 * @return True, if so
489 */
490 static inline bool isInFrontOfCamera(const HomogenousMatrix4& world_T_camera, const Vector3& worldCoordinate);
491
492 /**
493 * Returns whether a given world coordinate is in front of the camera.
494 * @param flippedCamera_T_world Current inverted flipped camera pose
495 * @param worldCoordinate World coordinate to be checked
496 * @return True, if so
497 */
498 static inline bool isInFrontOfCameraIF(const HomogenousMatrix4& flippedCamera_T_world, const Vector3& worldCoordinate);
499
500 protected:
501
502 /**
503 * Adjust the lower and upper grid corner in x direction by a given finite image line that is a projected grid edge in x direction and a finite image line of an image bounding box edge that clips the grid.
504 * Beware: The grid edge must be have a orientation of (1, 0) in grid coordinates
505 * @param pinholeCamera The pinhole camera profile to be applied
506 * @param world_T_camera The camera pose to be applied, transforming camera to world
507 * @param gridBoundingBoxEdgeImageCoordinate The finite image line of a grid edge in x direction
508 * @param imageBoundingBoxEdgeImageCoordinate The finite image line of image bounding box edge that clips the grid
509 */
510 void adjustGridCornersInXDirectionByImageLines(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const FiniteLine2& gridBoundingBoxEdgeImageCoordinate, const FiniteLine2& imageBoundingBoxEdgeImageCoordinate);
511
512 /**
513 * Adjust the lower and upper grid corner in y direction by a given finite image line that is a projected grid edge in y direction and a finite image line of an image bounding box edge that clips the grid.
514 * Beware: The grid edge must be have a orientation of (0, 1) in grid coordinates
515 * @param pinholeCamera The pinhole camera profile to be applied
516 * @param world_T_camera The camera pose to be applied, transforming camera to world
517 * @param gridBoundingBoxEdgeImageCoordinate The finite image line of a grid edge in y direction
518 * @param imageBoundingBoxEdgeImageCoordinate The finite image line of image bounding box edge that clips the grid
519 */
520 void adjustGridCornersInYDirectionByImageLines(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const FiniteLine2& gridBoundingBoxEdgeImageCoordinate, const FiniteLine2& imageBoundingBoxEdgeImageCoordinate);
521
522 /**
523 * Clips a finite line in world coordinates, that the start and end point lie in front of the camera.
524 * A binary search is determine the possible start and end point who are in front of the camera.
525 * If both points lie behind the camera, the line is not adjusted.
526 * @param flippedCamera_T_world Inverted flipped pose to be applied
527 * @param lineToClip The finite line to clip
528 * @param resultingLine The resulting clipped line if succeeded
529 * @return True, if succeeded
530 */
531 static bool clipWorldLineInFrontOfCameraBinarySearchIF(const HomogenousMatrix4& flippedCamera_T_world, const FiniteLine3& lineToClip, FiniteLine3& resultingLine);
532
533 protected:
534
535 /// Transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system, invalid until set.
536 HomogenousMatrix4 world_T_plane_ = HomogenousMatrix4(false);
537
538 /// Transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system, invalid until set.
539 HomogenousMatrix4 plane_T_grid_ = HomogenousMatrix4(false);
540
541 /// Transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system, invalid until set.
542 HomogenousMatrix4 plane_T_virtualGrid_ = HomogenousMatrix4(false);
543
544 /// Lower grid corner of the visualization bounding box of the grid defined in the grid coordinate system, an empty box until set.
545 Vector2 gridLowerCorner_ = Vector2(1, 1);
546
547 /// Upper grid corner of the visualization bounding box of the grid defined in the grid coordinate system, an empty box until set.
548 Vector2 gridUpperCorner_ = Vector2(-1, -1);
549};
550
551inline Grid::Grid(const HomogenousMatrix4& plane2worldTransformation, const HomogenousMatrix4& virtualGrid2planeTransformation, const Vector2& lowerCorner, const Vector2& upperCorner) :
552 world_T_plane_(plane2worldTransformation),
553 gridLowerCorner_(lowerCorner),
554 gridUpperCorner_(upperCorner)
555{
556 // sets the physical and virtual grid2plane transformation
558}
559
561{
562 return world_T_plane_;
563}
564
566{
567 return plane_T_grid_;
568}
569
574
579
584
585inline const Vector2& Grid::lowerGridCorner() const
586{
587 return gridLowerCorner_;
588}
589
590inline const Vector2& Grid::upperGridCorner() const
591{
592 return gridUpperCorner_;
593}
594
595inline void Grid::setPlane2worldTransformation(const HomogenousMatrix4& newTransformation)
596{
597 ocean_assert(newTransformation.isValid());
598
599 world_T_plane_ = newTransformation;
600}
601
602inline void Grid::setGrid2planeTransformation(const HomogenousMatrix4& newTransformation)
603{
604 ocean_assert(newTransformation.isValid());
605
606 plane_T_grid_ = newTransformation;
607 plane_T_virtualGrid_ = newTransformation;
608}
609
610inline void Grid::setLowerGridCorner(const Vector2& newCorner)
611{
612 gridLowerCorner_ = newCorner;
613}
614
615inline void Grid::setUpperGridCorner(const Vector2& newCorner)
616{
617 gridUpperCorner_ = newCorner;
618}
619
620template <bool tVirtual>
621bool Grid::image2grid(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector2& imageCoordinate, Vector2& gridCoordinate) const
622{
623 ocean_assert(isValid());
624 ocean_assert(pinholeCamera.isValid() && world_T_camera.isValid());
625
626 Vector3 planeCoordinate;
627 if (!image2plane(pinholeCamera, world_T_camera, imageCoordinate, planeCoordinate))
628 {
629 return false;
630 }
631
632 gridCoordinate = plane2grid<tVirtual>(planeCoordinate);
633
634 return true;
635}
636
637inline Vector2 Grid::world2image(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector3& worldCoordinate) const
638{
639 ocean_assert(isValid());
640 ocean_assert(pinholeCamera.isValid() && world_T_camera.isValid());
641 //ocean_assert(Plane3(world_T_plane_).isInPlane(worldCoordinate, Numeric::eps()));
642
643 return pinholeCamera.projectToImageDamped(world_T_camera, worldCoordinate, pinholeCamera.hasDistortionParameters());
644}
645
646inline Vector2 Grid::world2imageIF(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& flippedCamera_T_world, const Vector3& worldCoordinate) const
647{
648 ocean_assert(isValid());
649 ocean_assert(pinholeCamera.isValid() && flippedCamera_T_world.isValid());
650 //ocean_assert(Plane3(world_T_plane_).isInPlane(worldCoordinate, Numeric::eps()));
651
652 return pinholeCamera.projectToImageDampedIF(flippedCamera_T_world, worldCoordinate, pinholeCamera.hasDistortionParameters());
653}
654
655inline Vector3 Grid::world2plane(const Vector3& worldCoordinate) const
656{
657 ocean_assert(isValid());
658 ocean_assert(Plane3(world_T_plane_).isInPlane(worldCoordinate, Numeric::eps()));
659
660 return world_T_plane_.inverted() * worldCoordinate;
661}
662
663template <bool tVirtual>
664inline Vector2 Grid::world2grid(const Vector3& worldCoordinate) const
665{
666 ocean_assert(isValid());
667
668 return plane2grid<tVirtual>(world2plane(worldCoordinate));
669}
670
671inline Vector2 Grid::plane2image(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector3& planeCoordinate) const
672{
673 ocean_assert(isValid());
674 ocean_assert(pinholeCamera.isValid() && world_T_camera.isValid());
675
676 return world2image(pinholeCamera, world_T_camera, plane2world(planeCoordinate));
677}
678
679inline Vector2 Grid::plane2imageIF(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& flippedCamera_T_world, const Vector3& planeCoordinate) const
680{
681 ocean_assert(isValid());
682 ocean_assert(pinholeCamera.isValid() && flippedCamera_T_world.isValid());
683
684 return world2imageIF(pinholeCamera, flippedCamera_T_world, plane2world(planeCoordinate));
685}
686
687inline Vector3 Grid::plane2world(const Vector3& planeCoordinate) const
688{
689 ocean_assert(isValid());
690
691 return world_T_plane_ * planeCoordinate;
692}
693
694template <bool tVirtual>
695inline Vector2 Grid::plane2grid(const Vector3& planeCoordinate) const
696{
697 ocean_assert(isValid());
698
699 const Vector3 gridCoordinate = tVirtual ? plane_T_virtualGrid_.inverted() * planeCoordinate : plane_T_grid_.inverted() * planeCoordinate;
700 //ocean_assert(Numeric::isEqualEps(gridCoordinate.z()));
701
702 return Vector2(gridCoordinate.x(), gridCoordinate.y());
703}
704
705template <bool tVirtual>
706inline Vector2 Grid::grid2image(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& world_T_camera, const Vector2& gridCoordinate) const
707{
708 ocean_assert(isValid());
709 ocean_assert(pinholeCamera.isValid() && world_T_camera.isValid());
710
711 return world2image(pinholeCamera, world_T_camera, grid2world<tVirtual>(gridCoordinate));
712}
713
714template <bool tVirtual>
715inline Vector2 Grid::grid2imageIF(const PinholeCamera& pinholeCamera, const HomogenousMatrix4& flippedCamera_T_world, const Vector2& gridCoordinate) const
716{
717 ocean_assert(isValid());
718 ocean_assert(pinholeCamera.isValid() && flippedCamera_T_world.isValid());
719
720 return world2imageIF(pinholeCamera, flippedCamera_T_world, grid2world<tVirtual>(gridCoordinate));
721}
722
723template <bool tVirtual>
724inline Vector3 Grid::grid2world(const Vector2& gridCoordinate) const
725{
726 ocean_assert(isValid());
727
728 return plane2world(grid2plane<tVirtual>(gridCoordinate));
729}
730
731template <bool tVirtual>
732inline Vector3 Grid::grid2plane(const Vector2& gridCoordinate) const
733{
734 ocean_assert(isValid());
735
736 if constexpr (tVirtual)
737 {
738 return plane_T_virtualGrid_ * Vector3(gridCoordinate, 0);
739 }
740 else
741 {
742 return plane_T_grid_ * Vector3(gridCoordinate, 0);
743 }
744}
745
751
752inline bool Grid::operator!=(const Grid& grid) const
753{
754 return !(*this == grid);
755}
756
757inline Vector2 Grid::grid2nearestNode(const Vector2& gridCoordinate)
758{
759 return Vector2(Scalar(Numeric::round32(gridCoordinate.x())), Scalar(Numeric::round32(gridCoordinate.y())));
760}
761
763{
764 return !transformation.xAxis().isOrthogonal(transformation.yAxis());
765}
766
767inline bool Grid::isInFrontOfCamera(const HomogenousMatrix4& world_T_camera, const Vector3& worldCoordinate)
768{
769 return isInFrontOfCameraIF(PinholeCamera::standard2InvertedFlipped(world_T_camera), worldCoordinate);
770}
771
772inline bool Grid::isInFrontOfCameraIF(const HomogenousMatrix4& flippedCamera_T_world, const Vector3& worldCoordinate)
773{
774 return (flippedCamera_T_world * worldCoordinate).z() > Scalar(0.0001);
775}
776
777}
778
779}
780
781#endif // META_OCEAN_GEOMETRY_GRID_H
static HomogenousMatrixT4< U > standard2InvertedFlipped(const HomogenousMatrixT4< U > &world_T_camera)
Transforms a standard homogenous 4x4 viewing (extrinsic camera) matrix into an inverted and flipped c...
Definition Camera.h:779
This class implements an finite line in 3D space.
Definition FiniteLine3.h:66
This class implements the basic data of an planar grid.
Definition Grid.h:74
Vector3 grid2plane(const Vector2 &gridCoordinate) const
Convert an point on the plane defined in a coordinate system of the grid into an point defined in the...
Definition Grid.h:732
Grid(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vectors2 &imagePoints, const HomogenousMatrix4 &plane2worldTransformation, const HomogenousMatrix4 &virtualGrid2planeTransformation=HomogenousMatrix4(true), const bool clipBoundingBox=false)
Creates a new Grid by a plane2world transformation and four image points defining a rectangle.
bool image2plane(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vector2 &imageCoordinate, Vector3 &planeCoordinate) const
Convert an point defined in a coordinate system of the camera image into an point on the plane define...
bool operator!=(const Grid &grid) const
Returns whether two grids are not identical.
Definition Grid.h:752
const HomogenousMatrix4 & virtualGrid2planeTransformation() const
Returns the transformation that transform points defined in a coordinate system of the virtual grid i...
Definition Grid.h:570
bool image2world(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vector2 &imageCoordinate, Vector3 &worldCoordinate) const
Convert an point defined in a coordinate system of the camera image into an point on the plane define...
Vector2 plane2grid(const Vector3 &planeCoordinate) const
Convert an point on the plane defined in a coordinate system of the plane into an point defined in th...
Definition Grid.h:695
Vector2 gridLowerCorner_
Lower grid corner of the visualization bounding box of the grid defined in the grid coordinate system...
Definition Grid.h:545
Vector2 plane2image(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vector3 &planeCoordinate) const
Convert an point on the plane defined in a coordinate system of the plane into an point defined in th...
Definition Grid.h:671
HomogenousMatrix4 plane_T_grid_
Transformation that transforms points defined in a coordinate system of the grid into points defined ...
Definition Grid.h:539
Grid(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vectors2 &imagePoints, const Vector2 *gridCoordinates=nullptr, const HomogenousMatrix4 *previousPlane2worldTransformation=nullptr, const bool clipBoundingBox=false)
Creates a new Grid by four given image points using vanishing projection.
static Vector2 grid2nearestNode(const Vector2 &gridCoordinate)
Determine the nearest integer grid node from a given grid coordinate.
Definition Grid.h:757
Vector2 plane2imageIF(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const Vector3 &planeCoordinate) const
Convert an point on the plane defined in a coordinate system of the plane into an point defined in th...
Definition Grid.h:679
const HomogenousMatrix4 & plane2worldTransformation() const
Returns the transformation that transforms points defined in a coordinate system of the plane into po...
Definition Grid.h:560
void setInvalid()
Sets the grid to invalid.
Vector2 grid2image(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vector2 &gridCoordinate) const
Convert an point on the plane defined in a coordinate system of the grid into an point defined in the...
Definition Grid.h:706
Vector3 world2plane(const Vector3 &worldCoordinate) const
Convert an point on the plane defined in a coordinate system of the world into an point defined in th...
Definition Grid.h:655
HomogenousMatrix4 virtualPlane2worldTransformation() const
Returns a transformation that transforms points defined in a coordinate system of the virtual plane i...
static bool isInFrontOfCamera(const HomogenousMatrix4 &world_T_camera, const Vector3 &worldCoordinate)
Returns whether a given world coordinate is in front of the camera.
Definition Grid.h:767
Grid(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const HomogenousMatrix4 &plane2worldTransformation, const Vectors2 &imagePoints, const bool clipBoundingBox=false)
Creates a new Grid by a given transformation that transforms points defined in a coordinate system of...
static bool determineTransformationWithoutShearComponent(const HomogenousMatrix4 &transformationWithShearComponent, HomogenousMatrix4 &resultTransformation)
Determines a transformation without a shear component from a given transformation with shear componen...
void setLowerGridCorner(const Vector2 &newCorner)
Sets the lower grid corner defined in the plane coordinate system of the visualization bounding box o...
Definition Grid.h:610
void adjustGridCornersInXDirectionByImageLines(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const FiniteLine2 &gridBoundingBoxEdgeImageCoordinate, const FiniteLine2 &imageBoundingBoxEdgeImageCoordinate)
Adjust the lower and upper grid corner in x direction by a given finite image line that is a projecte...
Vector3 plane2world(const Vector3 &planeCoordinate) const
Convert an point on the plane defined in a coordinate system of the plane into an point defined in th...
Definition Grid.h:687
bool areVirtualAndPhysicalGridIdentical() const
Returns whether the physical and virtual grid transformations are identical.
bool isValid() const
Returns whether the grid is valid.
Vector2 world2grid(const Vector3 &worldCoordinate) const
Convert an point on the plane defined in a coordinate system of the world into an point defined in th...
Definition Grid.h:664
HomogenousMatrix4 world_T_plane_
Transformation that transforms points defined in a coordinate system of the plane into points defined...
Definition Grid.h:536
Grid()=default
Creates a new invalid grid element.
bool image2grid(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vector2 &imageCoordinate, Vector2 &gridCoordinate) const
Convert an point defined in a coordinate system of the camera image into an point on the plane define...
Definition Grid.h:621
const Vector2 & lowerGridCorner() const
Returns the lower grid corner defined in the grid coordinate system of the visualization bounding box...
Definition Grid.h:585
HomogenousMatrix4 plane_T_virtualGrid_
Transformation that transform points defined in a coordinate system of the virtual grid into points d...
Definition Grid.h:542
HomogenousMatrix4 virtualGrid2worldTransformation() const
Returns the transformation that transform points defined in a coordinate system of the virtual grid i...
Definition Grid.h:580
Vector3 grid2world(const Vector2 &gridCoordinate) const
Convert an point on the plane defined in a coordinate system of the grid into an point defined in the...
Definition Grid.h:724
Vector2 world2imageIF(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const Vector3 &worldCoordinate) const
Convert an point on the plane defined in a coordinate system of the world into an point defined in th...
Definition Grid.h:646
bool setVirtualGrid2planeTransformation(const HomogenousMatrix4 &newTransformation)
Sets the transformation that transform points defined in a coordinate system of the virtual grid into...
static bool determineVirtualGridTransformationByPlane2WorldTransformation(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vectors2 &imagePoints, const HomogenousMatrix4 &previousPlane2worldTransformation, HomogenousMatrix4 &plane2worldTransformation, HomogenousMatrix4 &virtualGrid2planeTransformation)
Determines a virtualGrid2plane transformation by a plane2world transformation and four given image po...
Vector2 world2image(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vector3 &worldCoordinate) const
Convert an point on the plane defined in a coordinate system of the world into an point defined in th...
Definition Grid.h:637
static bool determineVirtualGridTransformationsByFourImagePoints(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Vector2 *imagePoints, const Vector2 *gridCoordinates=nullptr, const HomogenousMatrix4 *previousPlane2worldTransformation=nullptr, HomogenousMatrix4 *plane2worldTransformation=nullptr, HomogenousMatrix4 *virtualGrid2planeTransformation=nullptr)
Determine the transformation that transforms points defined in a coordinate system of the plane into ...
Vector2 grid2imageIF(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &flippedCamera_T_world, const Vector2 &gridCoordinate) const
Convert an point on the plane defined in a coordinate system of the grid into an point defined in the...
Definition Grid.h:715
void setGrid2planeTransformation(const HomogenousMatrix4 &newTransformation)
Sets the transformation that transforms points defined in a coordinate system of the grid into points...
Definition Grid.h:602
static bool clipWorldLineInFrontOfCameraBinarySearchIF(const HomogenousMatrix4 &flippedCamera_T_world, const FiniteLine3 &lineToClip, FiniteLine3 &resultingLine)
Clips a finite line in world coordinates, that the start and end point lie in front of the camera.
const Vector2 & upperGridCorner() const
Returns the upper grid corner defined in the grid coordinate system of the visualization bounding box...
Definition Grid.h:590
const HomogenousMatrix4 & grid2planeTransformation() const
Returns the transformation that transforms points defined in a coordinate system of the grid into poi...
Definition Grid.h:565
void clipByImageBoundingBox(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const Scalar borderSizeFactor=Scalar(2.0), const Vectors2 &insideGridCoordinates=Vectors2())
Clips the grid bounding box and adjusts the lower and upper grid corner by an image bounding box.
void setPlane2worldTransformation(const HomogenousMatrix4 &newTransformation)
Sets the transformation that transforms points defined in a coordinate system of the plane into point...
Definition Grid.h:595
bool operator==(const Grid &grid) const
Returns whether two grids are identical.
Definition Grid.h:746
void setUpperGridCorner(const Vector2 &newCorner)
Sets the upper grid corner defined in the plane coordinate system of the visualization bounding box o...
Definition Grid.h:615
HomogenousMatrix4 grid2worldTransformation() const
Returns the transformation that transform points defined in a coordinate system of the grid into poin...
Definition Grid.h:575
static bool hasTransformationShearComponent(const HomogenousMatrix4 &transformation)
Returns whether a given transformation has shear component in x/y direction.
Definition Grid.h:762
Vector2 gridUpperCorner_
Upper grid corner of the visualization bounding box of the grid defined in the grid coordinate system...
Definition Grid.h:548
static bool isInFrontOfCameraIF(const HomogenousMatrix4 &flippedCamera_T_world, const Vector3 &worldCoordinate)
Returns whether a given world coordinate is in front of the camera.
Definition Grid.h:772
void adjustGridCornersInYDirectionByImageLines(const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &world_T_camera, const FiniteLine2 &gridBoundingBoxEdgeImageCoordinate, const FiniteLine2 &imageBoundingBoxEdgeImageCoordinate)
Adjust the lower and upper grid corner in y direction by a given finite image line that is a projecte...
HomogenousMatrixT4< T > inverted() const noexcept
Returns the inverted of this matrix.
Definition HomogenousMatrix4.h:1569
VectorT3< T > yAxis() const
Returns the y-axis of the transformation which is the second vector of the upper left 3x3 rotation ma...
Definition HomogenousMatrix4.h:1361
VectorT3< T > xAxis() const
Returns the x-axis of the transformation which is the first vector of the upper left 3x3 rotation mat...
Definition HomogenousMatrix4.h:1354
bool isValid() const
Returns whether this matrix is a valid homogeneous transformation.
Definition HomogenousMatrix4.h:1800
static constexpr int32_t round32(const T value)
Returns the rounded 32 bit integer value of a given value.
Definition Numeric.h:2073
static constexpr T eps()
Returns a small epsilon.
VectorT2< T > projectToImageDampedIF(const HomogenousMatrixT4< T > &flippedCamera_T_world, const VectorT3< T > &objectPoint, const bool distortImagePoint, const T dampingFactor=T(1), const T zoom=T(1)) const
Projects a 3D object point to the 2D image plane of the camera by a given inverse extrinsic camera ma...
bool isValid() const
Returns whether this camera is valid.
Definition PinholeCamera.h:1762
bool hasDistortionParameters() const
Returns whether this camera object has specified distortion parameters.
Definition PinholeCamera.h:1445
VectorT2< T > projectToImageDamped(const HomogenousMatrixT4< T > &world_T_camera, const VectorT3< T > &objectPoint, const bool distortImagePoint, const T dampingFactor=T(1), const T zoom=T(1)) const
Projects a 3D object point to the 2D image plane of the camera by a given extrinsic camera matrix.
Definition PinholeCamera.h:2275
const T & x() const noexcept
Returns the x value.
Definition Vector2.h:703
const T & y() const noexcept
Returns the y value.
Definition Vector2.h:715
const T & y() const noexcept
Returns the y value.
Definition Vector3.h:816
bool isOrthogonal(const VectorT3< T > &right) const
Returns whether two vectors are orthogonal.
Definition Vector3.h:798
const T & x() const noexcept
Returns the x value.
Definition Vector3.h:804
std::vector< Vector2 > Vectors2
Definition of a vector holding Vector2 objects.
Definition Vector2.h:64
PlaneT3< Scalar > Plane3
Definition of the Plane3 object, depending on the OCEAN_MATH_USE_SINGLE_PRECISION either with single ...
Definition Plane3.h:31
float Scalar
Definition of a scalar type.
Definition Math.h:129
VectorT3< Scalar > Vector3
Definition of a 3D vector.
Definition Vector3.h:29
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition Vector2.h:28
The namespace covering the entire Ocean framework.
Definition Accessor.h:15