Ocean
Ocean::Geometry::Grid Class Reference

This class implements the basic data of an planar grid. More...

Public Member Functions

 Grid ()
 Creates a new invalid grid element. More...
 
 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))
 Creates a new Grid by a plane2world transformation. More...
 
 Grid (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, 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. More...
 
 Grid (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, 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. More...
 
 Grid (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, 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 the plane into points defined in the world coordinate system. More...
 
const HomogenousMatrix4plane2worldTransformation () const
 Returns the transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system. More...
 
const HomogenousMatrix4grid2planeTransformation () const
 Returns the transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system. More...
 
const HomogenousMatrix4virtualGrid2planeTransformation () const
 Returns the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system. More...
 
HomogenousMatrix4 virtualPlane2worldTransformation () const
 Returns a transformation that transforms points defined in a coordinate system of the virtual plane into points defined in the world coordinate system. More...
 
HomogenousMatrix4 grid2worldTransformation () const
 Returns the transformation that transform points defined in a coordinate system of the grid into points defined in the world coordinate system. More...
 
HomogenousMatrix4 virtualGrid2worldTransformation () const
 Returns the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the world coordinate system. More...
 
const Vector2lowerGridCorner () const
 Returns the lower grid corner defined in the grid coordinate system of the visualization bounding box of the grid. More...
 
const Vector2upperGridCorner () const
 Returns the upper grid corner defined in the grid coordinate system of the visualization bounding box of the grid. More...
 
void setPlane2worldTransformation (const HomogenousMatrix4 &newTransformation)
 Sets the transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system. More...
 
void setGrid2planeTransformation (const HomogenousMatrix4 &newTransformation)
 Sets the transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system. More...
 
bool setVirtualGrid2planeTransformation (const HomogenousMatrix4 &newTransformation)
 Sets the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system. More...
 
void setLowerGridCorner (const Vector2 &newCorner)
 Sets the lower grid corner defined in the plane coordinate system of the visualization bounding box of the grid. More...
 
void setUpperGridCorner (const Vector2 &newCorner)
 Sets the upper grid corner defined in the plane coordinate system of the visualization bounding box of the grid. More...
 
bool isValid () const
 Returns whether the grid is valid. More...
 
void setInvalid ()
 Sets the grid to invalid. More...
 
bool areVirtualAndPhysicalGridIdentical () const
 Returns whether the physical and virtual grid transformations are identical. More...
 
void clipByImageBoundingBox (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, 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. More...
 
bool image2world (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Vector2 &imageCoordinate, Vector3 &worldCoordinate) const
 Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the world coordinate system. More...
 
bool image2plane (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Vector2 &imageCoordinate, Vector3 &planeCoordinate) const
 Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the plane coordinate system. More...
 
template<bool tVirtual>
bool image2grid (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Vector2 &imageCoordinate, Vector2 &gridCoordinate) const
 Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the grid coordinate system. More...
 
Vector2 world2image (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Vector3 &worldCoordinate) const
 Convert an point on the plane defined in a coordinate system of the world into an point defined in the camera image coordinate system. More...
 
Vector2 world2imageIF (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &poseIF, const Vector3 &worldCoordinate) const
 Convert an point on the plane defined in a coordinate system of the world into an point defined in the camera image coordinate system. More...
 
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 the plane coordinate system. More...
 
template<bool tVirtual>
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 the grid coordinate system. More...
 
Vector2 plane2image (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Vector3 &planeCoordinate) const
 Convert an point on the plane defined in a coordinate system of the plane into an point defined in the camera image coordinate system. More...
 
Vector2 plane2imageIF (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &poseIF, const Vector3 &planeCoordinate) const
 Convert an point on the plane defined in a coordinate system of the plane into an point defined in the camera image coordinate system. More...
 
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 the world coordinate system. More...
 
template<bool tVirtual>
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 the grid coordinate system. More...
 
template<bool tVirtual>
Vector2 grid2image (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Vector2 &gridCoordinate) const
 Convert an point on the plane defined in a coordinate system of the grid into an point defined in the camera image coordinate system. More...
 
template<bool tVirtual>
Vector2 grid2imageIF (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &poseIF, const Vector2 &gridCoordinate) const
 Convert an point on the plane defined in a coordinate system of the grid into an point defined in the camera image coordinate system. More...
 
template<bool tVirtual>
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 world coordinate system. More...
 
template<bool tVirtual>
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 plane coordinate system. More...
 
bool operator== (const Grid &grid) const
 Returns whether two grids are identical. More...
 
bool operator!= (const Grid &grid) const
 Returns whether two grids are not identical. More...
 

Static Public Member Functions

static bool determineVirtualGridTransformationsByFourImagePoints (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, 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 points defined in the world coordinate system. More...
 
static bool determineVirtualGridTransformationByPlane2WorldTransformation (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, const Vectors2 &imagePoints, const HomogenousMatrix4 &previousPlane2worldTransformation, HomogenousMatrix4 &plane2worldTransformation, HomogenousMatrix4 &virtualGrid2planeTransformation)
 Determines a virtualGrid2plane transformation by a plane2world transformation and four given image points. More...
 
static Vector2 grid2nearestNode (const Vector2 &gridCoordinate)
 Determine the nearest integer grid node from a given grid coordinate. More...
 
static bool hasTransformationShearComponent (const HomogenousMatrix4 &transformation)
 Returns whether a given transformation has shear component in x/y direction. More...
 
static bool determineTransformationWithoutShearComponent (const HomogenousMatrix4 &transformationWithShearComponent, HomogenousMatrix4 &resultTransformation)
 Determines a transformation without a shear component from a given transformation with shear component. More...
 
static bool isInFrontOfCamera (const HomogenousMatrix4 &pose, const Vector3 &worldCoordinate)
 Returns whether a given world coordinate is in front of the camera. More...
 
static bool isInFrontOfCameraIF (const HomogenousMatrix4 &poseIF, const Vector3 &worldCoordinate)
 Returns whether a given world coordinate is in front of the camera. More...
 

Protected Member Functions

void adjustGridCornersInXDirectionByImageLines (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, 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 projected grid edge in x direction and a finite image line of an image bounding box edge that clips the grid. More...
 
void adjustGridCornersInYDirectionByImageLines (const PinholeCamera &pinholeCamera, const HomogenousMatrix4 &pose, 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 projected grid edge in y direction and a finite image line of an image bounding box edge that clips the grid. More...
 

Static Protected Member Functions

static bool clipWorldLineInFrontOfCameraBinarySearchIF (const HomogenousMatrix4 &poseIF, const FiniteLine3 &lineToClip, FiniteLine3 &resultingLine)
 Clips a finite line in world coordinates, that the start and end point lie in front of the camera. More...
 

Protected Attributes

HomogenousMatrix4 worldTplane
 Transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system. More...
 
HomogenousMatrix4 planeTgrid
 Transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system. More...
 
HomogenousMatrix4 planeTvirtualGrid
 Transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system. More...
 
Vector2 gridLowerCorner
 Lower grid corner of the visualization bounding box of the grid defined in the grid coordinate system. More...
 
Vector2 gridUpperCorner
 Upper grid corner of the visualization bounding box of the grid defined in the grid coordinate system . More...
 

Detailed Description

This class implements the basic data of an planar grid.

There are 3 coordinate systems: (1) world coordinates:

  • describe points in the world system (2) plane coordinates:
  • describe points in the plane of the grid
  • the z coordinate is zero, if the point lies directly in the plane (3) grid coordinates:
  • describe points in the grid refer to the plane
  • the grid center must not be identical with the plane center
  • the following sketch shows a top-view of the grid:
         y
         ^
          |   o - o - o - o - o
          |   |   |   |   |   |
          |   o - o - o - p - o
          |   |   |   |   |   |
          |   o - o - c - o - o
          |   |   |   |   |   |
          |   o - o - o - o - o
          |   |   |   |   |   |
          |   o - o - o - o - o
          |
         z---------------------> x
    
  • the z coordinate is always zero, so in following the grid coordinates are represent as a Vector2

This class holds 3 transformations: (1) plane2world transformation:

  • transforms points defined in a coordinate system of the plane into points defined in the world coordinate system
  • all axes must be perpendicular to each other
  • the z axis always describe the normal of the plane (2) grid2plane transformation:
  • transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system
  • all axes must be perpendicular to each other
  • the z axis is always (0, 0, 1) (3) virtualGrid2plane transformation
  • transforms points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system
  • the z axis is always (0, 0, 1)
  • the x and y axes must be perpendicular to the z axis
  • the x axis must not be perpendicular to the y axis to skew the grid

The grid holds an visualization bounding box defined in plane coordinates.

This class implements convert functions to convert point from one coordinate system to an other.

Constructor & Destructor Documentation

◆ Grid() [1/5]

Ocean::Geometry::Grid::Grid ( )
inline

Creates a new invalid grid element.

◆ Grid() [2/5]

Ocean::Geometry::Grid::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) 
)
inlineexplicit

Creates a new Grid by a plane2world transformation.

Whether the virtualGrid2plane transformation is set, the grid2plane transformation is set to the same matrix. If the grid2plane transformation should be set, the virtualGrid2plane transformation can be set to the appropriate matrix.

Parameters
plane2worldTransformationTransformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system
virtualGrid2planeTransformationOptional transformation that transforms points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system
lowerCornerOptional lower corner of the grid bounding box for visualization in plane coordinates
upperCornerOptional upper corner of the grid bounding box for visualization in plane coordinates

◆ Grid() [3/5]

Ocean::Geometry::Grid::Grid ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
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.

The bounding box is adjusted, so the rectangle plus a border lies inside. The border has a size of the half average length of two neighboring projected plane points. If the virtualGrid2plane transformation is set, the grid2plane transformation is set to the same matrix. If the grid2plane transformation should be set, the virtualGrid2plane transformation can be set to the appropriate matrix.

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
imagePointsThe image points to adjust the bounding box, size must be four
plane2worldTransformationTransformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system
virtualGrid2planeTransformationOptional transformation that transforms points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system
clipBoundingBoxOptional flag to clip the grid lower and upper grid corners by an image bounding box around the camera frame

◆ Grid() [4/5]

Ocean::Geometry::Grid::Grid ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
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.

The four image points must define a convex polygon. If additionally four grid coordinates are given, the virtualGrid2plane transformation is set, too. The four grid coordinates must be given in the same order (clockwise or counter clockwise) like the four image points! The grid coordinates are only used for determine the shear of the virtualGrid2plane transformation, the lower and upper grid corners are not adjust! If no grid could be determined from the four image points, a invalid grid is create.

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
imagePointsThe four image points (must be in clockwise or counterclockwise order)
gridCoordinatesOptional four grid coordinates (must be in clockwise or counterclockwise order)
previousPlane2worldTransformationOptional 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
clipBoundingBoxOptional flag to clip the grid lower and upper grid corners by an image bounding box around the camera frame

◆ Grid() [5/5]

Ocean::Geometry::Grid::Grid ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
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 the plane into points defined in the world coordinate system.

The virtualGrid2plane transformation is adjusted by four given image points. The virtual grid is sheared that the four points define a rectangle on the virtual grid in the best case.

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
plane2worldTransformationTransformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system
imagePointsThe four image points (must be in clockwise or counterclockwise order)
clipBoundingBoxOptional flag to clip the grid lower and upper grid corners by an image bounding box around the camera frame

Member Function Documentation

◆ adjustGridCornersInXDirectionByImageLines()

void Ocean::Geometry::Grid::adjustGridCornersInXDirectionByImageLines ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const FiniteLine2 gridBoundingBoxEdgeImageCoordinate,
const FiniteLine2 imageBoundingBoxEdgeImageCoordinate 
)
protected

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.

Beware: The grid edge must be have a orientation of (1, 0) in grid coordinates

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
gridBoundingBoxEdgeImageCoordinateThe finite image line of a grid edge in x direction
imageBoundingBoxEdgeImageCoordinateThe finite image line of image bounding box edge that clips the grid

◆ adjustGridCornersInYDirectionByImageLines()

void Ocean::Geometry::Grid::adjustGridCornersInYDirectionByImageLines ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const FiniteLine2 gridBoundingBoxEdgeImageCoordinate,
const FiniteLine2 imageBoundingBoxEdgeImageCoordinate 
)
protected

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.

Beware: The grid edge must be have a orientation of (0, 1) in grid coordinates

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
gridBoundingBoxEdgeImageCoordinateThe finite image line of a grid edge in y direction
imageBoundingBoxEdgeImageCoordinateThe finite image line of image bounding box edge that clips the grid

◆ areVirtualAndPhysicalGridIdentical()

bool Ocean::Geometry::Grid::areVirtualAndPhysicalGridIdentical ( ) const

Returns whether the physical and virtual grid transformations are identical.

Returns
True, if so

◆ clipByImageBoundingBox()

void Ocean::Geometry::Grid::clipByImageBoundingBox ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
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.

This bounding box is defined by a given camera, a pose and a border size factor. The image bounding box will have the following bounds: Left: -width * factor Right width + width * factor Top: -height * factor Bottom: height + height * factor

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
borderSizeFactorthe factor for the width and height for the border around the camera frame, Range [0, infinity)
insideGridCoordinatesOptional grid coordinates that must lie inside the new clipped grid

◆ clipWorldLineInFrontOfCameraBinarySearchIF()

static bool Ocean::Geometry::Grid::clipWorldLineInFrontOfCameraBinarySearchIF ( const HomogenousMatrix4 poseIF,
const FiniteLine3 lineToClip,
FiniteLine3 resultingLine 
)
staticprotected

Clips a finite line in world coordinates, that the start and end point lie in front of the camera.

A binary search is determine the possible start and end point who are in front of the camera. If both points lie behind the camera, the line is not adjusted.

Parameters
poseIFInverted flipped pose to be applied
lineToClipThe finite line to clip
resultingLineThe resulting clipped line if succeeded
Returns
True, if succeeded

◆ determineTransformationWithoutShearComponent()

static bool Ocean::Geometry::Grid::determineTransformationWithoutShearComponent ( const HomogenousMatrix4 transformationWithShearComponent,
HomogenousMatrix4 resultTransformation 
)
static

Determines a transformation without a shear component from a given transformation with shear component.

The x and y axes of the given transformation with shear component must be orthogonal to the z axis. The resulting transformation has the same z axis and translation like the given transformation.

Parameters
transformationWithShearComponentTransformation with shear component
resultTransformationResulting transformation without a shear component
Returns
True, if succeeded

◆ determineVirtualGridTransformationByPlane2WorldTransformation()

static bool Ocean::Geometry::Grid::determineVirtualGridTransformationByPlane2WorldTransformation ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const Vectors2 imagePoints,
const HomogenousMatrix4 previousPlane2worldTransformation,
HomogenousMatrix4 plane2worldTransformation,
HomogenousMatrix4 virtualGrid2planeTransformation 
)
static

Determines a virtualGrid2plane transformation by a plane2world transformation and four given image points.

Furthermore an adjusted plane2world transformation is determined which is the previous plane2world transformation rotated around the plane normal that the bisection of the x and y axis of the virtual and non virtual grid transformation have the same orientation.

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
imagePointsThe four image points to determine the transformations (must be in clockwise or counterclockwise order)
previousPlane2worldTransformationPrevious plane2world transformation
plane2worldTransformationThe new plane2world transformation that is a rotation of the previous plane2world transformation around the plane normal
virtualGrid2planeTransformationThe determined virtualGrid2plane transformation
Returns
True, if succeeded

◆ determineVirtualGridTransformationsByFourImagePoints()

static bool Ocean::Geometry::Grid::determineVirtualGridTransformationsByFourImagePoints ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const Vector2 imagePoints,
const Vector2 gridCoordinates = nullptr,
const HomogenousMatrix4 previousPlane2worldTransformation = nullptr,
HomogenousMatrix4 plane2worldTransformation = nullptr,
HomogenousMatrix4 virtualGrid2planeTransformation = nullptr 
)
static

Determine the transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system.

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. The four grid coordinates must be given in the same order (clockwise or counter clockwise) like the four image points! If no grid coordinates are given, the resulting virtualGrid2plane transformation equals to the grid2plane transformation. 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.

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
imagePointsThe four image points to determine the transformations (must be in clockwise or counterclockwise order)
gridCoordinatesOptional four grid coordinates (must be in clockwise or counterclockwise order)
previousPlane2worldTransformationOptional previous plane2world transformation
plane2worldTransformationOptional resulting plane2world transformation
virtualGrid2planeTransformationOptional resulting virtualGrid2plane transformation
Returns
True, if the Transformations could be determined

◆ grid2image()

template<bool tVirtual>
Vector2 Ocean::Geometry::Grid::grid2image ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const Vector2 gridCoordinate 
) const
inline

Convert an point on the plane defined in a coordinate system of the grid into an point defined in the camera image coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
gridCoordinateGrid coordinate which will be converted
Template Parameters
tVirtualIndicate whether the virtual grid is used
Returns
resulting image coordinate

◆ grid2imageIF()

template<bool tVirtual>
Vector2 Ocean::Geometry::Grid::grid2imageIF ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 poseIF,
const Vector2 gridCoordinate 
) const
inline

Convert an point on the plane defined in a coordinate system of the grid into an point defined in the camera image coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseIFInverted flipped pose to be applied
gridCoordinateGrid coordinate which will be converted
Template Parameters
tVirtualIndicate whether the virtual grid is used
Returns
resulting image coordinate

◆ grid2nearestNode()

Vector2 Ocean::Geometry::Grid::grid2nearestNode ( const Vector2 gridCoordinate)
inlinestatic

Determine the nearest integer grid node from a given grid coordinate.

An x or y value from >= 2.5 to < 3.5 is rounded to 3.0.

Parameters
gridCoordinateGrid coordinate to get the nearest node from
Returns
Nearest node in grid coordinates

◆ grid2plane()

template<bool tVirtual>
Vector3 Ocean::Geometry::Grid::grid2plane ( const Vector2 gridCoordinate) const
inline

Convert an point on the plane defined in a coordinate system of the grid into an point defined in the plane coordinate system.

The grid must be valid!

Parameters
gridCoordinateGrid coordinate which will be converted
Template Parameters
tVirtualIndicate whether the virtual grid is used
Returns
resulting plane coordinate

◆ grid2planeTransformation()

const HomogenousMatrix4 & Ocean::Geometry::Grid::grid2planeTransformation ( ) const
inline

Returns the transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system.

Returns
The grid transformation.

◆ grid2world()

template<bool tVirtual>
Vector3 Ocean::Geometry::Grid::grid2world ( const Vector2 gridCoordinate) const
inline

Convert an point on the plane defined in a coordinate system of the grid into an point defined in the world coordinate system.

The grid must be valid!

Parameters
gridCoordinateGrid coordinate which will be converted
Template Parameters
tVirtualIndicate whether the virtual grid is used
Returns
resulting world coordinate

◆ grid2worldTransformation()

HomogenousMatrix4 Ocean::Geometry::Grid::grid2worldTransformation ( ) const
inline

Returns the transformation that transform points defined in a coordinate system of the grid into points defined in the world coordinate system.

Returns
The grid transformation

◆ hasTransformationShearComponent()

bool Ocean::Geometry::Grid::hasTransformationShearComponent ( const HomogenousMatrix4 transformation)
inlinestatic

Returns whether a given transformation has shear component in x/y direction.

The x and y axes of the given transformation must be orthogonal to the z axis.

Parameters
transformationThe transformation to check
Returns
True, if so

◆ image2grid()

template<bool tVirtual>
bool Ocean::Geometry::Grid::image2grid ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const Vector2 imageCoordinate,
Vector2 gridCoordinate 
) const

Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the grid coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
imageCoordinateImage coordinate which will be converted
gridCoordinateresulting grid coordinate, if the conversion was successful
Template Parameters
tVirtualIndicate whether the virtual grid is used
Returns
True, if the conversion was successful

◆ image2plane()

bool Ocean::Geometry::Grid::image2plane ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const Vector2 imageCoordinate,
Vector3 planeCoordinate 
) const

Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the plane coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
imageCoordinateImage coordinate which will be converted
planeCoordinateresulting plane coordinate, if the conversion was successful
Returns
True, if the conversion was successful

◆ image2world()

bool Ocean::Geometry::Grid::image2world ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const Vector2 imageCoordinate,
Vector3 worldCoordinate 
) const

Convert an point defined in a coordinate system of the camera image into an point on the plane defined in the world coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
imageCoordinateImage coordinate which will be converted
worldCoordinateresulting world coordinate, if the conversion was successful
Returns
True, if the conversion was successful

◆ isInFrontOfCamera()

bool Ocean::Geometry::Grid::isInFrontOfCamera ( const HomogenousMatrix4 pose,
const Vector3 worldCoordinate 
)
inlinestatic

Returns whether a given world coordinate is in front of the camera.

Parameters
poseCurrent camera pose
worldCoordinateWorld coordinate to be checked
Returns
True, if so

◆ isInFrontOfCameraIF()

bool Ocean::Geometry::Grid::isInFrontOfCameraIF ( const HomogenousMatrix4 poseIF,
const Vector3 worldCoordinate 
)
inlinestatic

Returns whether a given world coordinate is in front of the camera.

Parameters
poseIFCurrent inverted flipped camera pose
worldCoordinateWorld coordinate to be checked
Returns
True, if so

◆ isValid()

bool Ocean::Geometry::Grid::isValid ( ) const

Returns whether the grid is valid.

The grid is valid, whether the lower grid corner is smaller than the upper grid corner, the 3 transformation are valid matrices and: 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.

Returns
True, if so

◆ lowerGridCorner()

const Vector2 & Ocean::Geometry::Grid::lowerGridCorner ( ) const
inline

Returns the lower grid corner defined in the grid coordinate system of the visualization bounding box of the grid.

Returns
lower grid corner

◆ operator!=()

bool Ocean::Geometry::Grid::operator!= ( const Grid grid) const
inline

Returns whether two grids are not identical.

Parameters
gridRight grid
Returns
True, if so

◆ operator==()

bool Ocean::Geometry::Grid::operator== ( const Grid grid) const
inline

Returns whether two grids are identical.

Parameters
gridRight grid
Returns
True, if so

◆ plane2grid()

template<bool tVirtual>
Vector2 Ocean::Geometry::Grid::plane2grid ( const Vector3 planeCoordinate) const
inline

Convert an point on the plane defined in a coordinate system of the plane into an point defined in the grid coordinate system.

The grid must be valid!

Parameters
planeCoordinatePlane coordinate which will be converted
Template Parameters
tVirtualIndicate whether the virtual grid is used
Returns
resulting grid coordinate

◆ plane2image()

Vector2 Ocean::Geometry::Grid::plane2image ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const Vector3 planeCoordinate 
) const
inline

Convert an point on the plane defined in a coordinate system of the plane into an point defined in the camera image coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
planeCoordinatePlane coordinate which will be converted
Returns
resulting image coordinate

◆ plane2imageIF()

Vector2 Ocean::Geometry::Grid::plane2imageIF ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 poseIF,
const Vector3 planeCoordinate 
) const
inline

Convert an point on the plane defined in a coordinate system of the plane into an point defined in the camera image coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseIFinverted flipped pose to be applied
planeCoordinatePlane coordinate which will be converted
Returns
resulting image coordinate

◆ plane2world()

Vector3 Ocean::Geometry::Grid::plane2world ( const Vector3 planeCoordinate) const
inline

Convert an point on the plane defined in a coordinate system of the plane into an point defined in the world coordinate system.

The grid must be valid!

Parameters
planeCoordinatePlane coordinate which will be converted
Returns
resulting world coordinate

◆ plane2worldTransformation()

const HomogenousMatrix4 & Ocean::Geometry::Grid::plane2worldTransformation ( ) const
inline

Returns the transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system.

Returns
The plane transformation

◆ setGrid2planeTransformation()

void Ocean::Geometry::Grid::setGrid2planeTransformation ( const HomogenousMatrix4 newTransformation)
inline

Sets the transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system.

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.

Parameters
newTransformationNew transformation to set

◆ setInvalid()

void Ocean::Geometry::Grid::setInvalid ( )

Sets the grid to invalid.

All transformations will be set to invalid transformations. The upper grid corner will be set higher as the lower grid corner.

◆ setLowerGridCorner()

void Ocean::Geometry::Grid::setLowerGridCorner ( const Vector2 newCorner)
inline

Sets the lower grid corner defined in the plane coordinate system of the visualization bounding box of the grid.

If the lower grid corner is set to a value higher than the upper corner, the grid will be invalid.

Parameters
newCornerNew lower grid corner

◆ setPlane2worldTransformation()

void Ocean::Geometry::Grid::setPlane2worldTransformation ( const HomogenousMatrix4 newTransformation)
inline

Sets the transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system.

Parameters
newTransformationNew transformation to set

◆ setUpperGridCorner()

void Ocean::Geometry::Grid::setUpperGridCorner ( const Vector2 newCorner)
inline

Sets the upper grid corner defined in the plane coordinate system of the visualization bounding box of the grid.

If the upper grid corner is set to a value smaller than the lower corner, the grid will be invalid.

Parameters
newCornerNew upper grid corner

◆ setVirtualGrid2planeTransformation()

bool Ocean::Geometry::Grid::setVirtualGrid2planeTransformation ( const HomogenousMatrix4 newTransformation)

Sets the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system.

The transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system is also set: If the given matrix is not valid, the grid2plane transformation will also be invalid. 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.

Parameters
newTransformationNew transformation to set
Returns
True, if succeeded

◆ upperGridCorner()

const Vector2 & Ocean::Geometry::Grid::upperGridCorner ( ) const
inline

Returns the upper grid corner defined in the grid coordinate system of the visualization bounding box of the grid.

Returns
upper grid corner

◆ virtualGrid2planeTransformation()

const HomogenousMatrix4 & Ocean::Geometry::Grid::virtualGrid2planeTransformation ( ) const
inline

Returns the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system.

Returns
The virtual grid transformation

◆ virtualGrid2worldTransformation()

HomogenousMatrix4 Ocean::Geometry::Grid::virtualGrid2worldTransformation ( ) const
inline

Returns the transformation that transform points defined in a coordinate system of the virtual grid into points defined in the world coordinate system.

Returns
The virtual grid transformation

◆ virtualPlane2worldTransformation()

HomogenousMatrix4 Ocean::Geometry::Grid::virtualPlane2worldTransformation ( ) const

Returns a transformation that transforms points defined in a coordinate system of the virtual plane into points defined in the world coordinate system.

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.

Returns
The virtual plane transformation

◆ world2grid()

template<bool tVirtual>
Vector2 Ocean::Geometry::Grid::world2grid ( const Vector3 worldCoordinate) const
inline

Convert an point on the plane defined in a coordinate system of the world into an point defined in the grid coordinate system.

The grid must be valid!

Parameters
worldCoordinateWorld coordinate which will be converted
Template Parameters
tVirtualIndicate whether the virtual grid is used
Returns
resulting grid coordinate

◆ world2image()

Vector2 Ocean::Geometry::Grid::world2image ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 pose,
const Vector3 worldCoordinate 
) const
inline

Convert an point on the plane defined in a coordinate system of the world into an point defined in the camera image coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseThe pose to be applied
worldCoordinateWorld coordinate which will be converted
Returns
resulting image coordinate

◆ world2imageIF()

Vector2 Ocean::Geometry::Grid::world2imageIF ( const PinholeCamera pinholeCamera,
const HomogenousMatrix4 poseIF,
const Vector3 worldCoordinate 
) const
inline

Convert an point on the plane defined in a coordinate system of the world into an point defined in the camera image coordinate system.

The grid must be valid!

Parameters
pinholeCameraThe pinhole camera profile to be applied
poseIFInverted flipped pose to be applied
worldCoordinateWorld coordinate which will be converted
Returns
resulting image coordinate

◆ world2plane()

Vector3 Ocean::Geometry::Grid::world2plane ( const Vector3 worldCoordinate) const
inline

Convert an point on the plane defined in a coordinate system of the world into an point defined in the plane coordinate system.

The grid must be valid!

Parameters
worldCoordinateWorld coordinate which will be converted
Returns
resulting plane coordinate

Field Documentation

◆ gridLowerCorner

Vector2 Ocean::Geometry::Grid::gridLowerCorner
protected

Lower grid corner of the visualization bounding box of the grid defined in the grid coordinate system.

◆ gridUpperCorner

Vector2 Ocean::Geometry::Grid::gridUpperCorner
protected

Upper grid corner of the visualization bounding box of the grid defined in the grid coordinate system .

◆ planeTgrid

HomogenousMatrix4 Ocean::Geometry::Grid::planeTgrid
protected

Transformation that transforms points defined in a coordinate system of the grid into points defined in the plane coordinate system.

◆ planeTvirtualGrid

HomogenousMatrix4 Ocean::Geometry::Grid::planeTvirtualGrid
protected

Transformation that transform points defined in a coordinate system of the virtual grid into points defined in the plane coordinate system.

◆ worldTplane

HomogenousMatrix4 Ocean::Geometry::Grid::worldTplane
protected

Transformation that transforms points defined in a coordinate system of the plane into points defined in the world coordinate system.


The documentation for this class was generated from the following file: