Public Member Functions | Private Attributes
karto::CoordinateConverter Class Reference

#include <CoordinateConverter.h>

List of all members.

Public Member Functions

 CoordinateConverter ()
BoundingBox2 GetBoundingBox () const
const Vector2dGetOffset () const
kt_double GetResolution () const
kt_double GetScale () const
const Size2< kt_int32s > & GetSize () const
Vector2d GridToWorld (const Vector2i &rGrid, kt_bool flipY=false) const
void SetOffset (const Vector2d &rOffset)
void SetResolution (kt_double resolution)
void SetScale (kt_double scale)
void SetSize (const Size2< kt_int32s > &rSize)
KARTO_DEPRECATED kt_double Transform (kt_double value)
Vector2i WorldToGrid (const Vector2d &rWorld, kt_bool flipY=false) const

Private Attributes

Vector2d m_Offset
kt_double m_Scale
Size2< kt_int32sm_Size

Detailed Description

Convert coordinates between world and grid coordinates. In world coordinates, 1.0 = 1 meter, whereas in grid coordinates, 1 = 1 pixel! The conversion from pixels to meters is 1.0 meter = 1 pixel / scale.

Definition at line 40 of file CoordinateConverter.h.


Constructor & Destructor Documentation

Constructs a converter with a scale of 20.0 (conversion: 1 pixel = 0.05 meters)

Definition at line 46 of file CoordinateConverter.h.


Member Function Documentation

Gets the bounding box

Returns:
bounding box

Definition at line 184 of file CoordinateConverter.h.

Gets the offset

Returns:
offset

Definition at line 130 of file CoordinateConverter.h.

Gets the resolution

Returns:
resolution

Definition at line 166 of file CoordinateConverter.h.

Gets the scale

Returns:
scale

Definition at line 112 of file CoordinateConverter.h.

Gets the size

Returns:
size

Definition at line 157 of file CoordinateConverter.h.

Vector2d karto::CoordinateConverter::GridToWorld ( const Vector2i rGrid,
kt_bool  flipY = false 
) const [inline]

Converts the given grid coordinate to world coordinates

Parameters:
rGridgrid coordinate
flipYwhether to flip the y-coordinate (useful for drawing applications with inverted y-coordinates)
Returns:
equivalent world coordinate of given grid coordinate

Definition at line 91 of file CoordinateConverter.h.

void karto::CoordinateConverter::SetOffset ( const Vector2d rOffset) [inline]

Sets the offset

Parameters:
rOffsetnew offset

Definition at line 139 of file CoordinateConverter.h.

Sets the resolution

Parameters:
resolutionnew resolution

Definition at line 175 of file CoordinateConverter.h.

Sets the scale

Parameters:
scale

Definition at line 121 of file CoordinateConverter.h.

void karto::CoordinateConverter::SetSize ( const Size2< kt_int32s > &  rSize) [inline]

Sets the size

Parameters:
rSizenew size

Definition at line 148 of file CoordinateConverter.h.

Scales the given value

Parameters:
valuevalue to scale
Returns:
scaled value

Definition at line 57 of file CoordinateConverter.h.

Vector2i karto::CoordinateConverter::WorldToGrid ( const Vector2d rWorld,
kt_bool  flipY = false 
) const [inline]

Converts the given world coordinate to grid coordinates

Parameters:
rWorldworld coordinate
flipYwhether to flip the y-coordinate (useful for drawing applications with inverted y-coordinates)
Returns:
equivalent grid coordinate of given world coordinate

Definition at line 68 of file CoordinateConverter.h.


Member Data Documentation

Definition at line 202 of file CoordinateConverter.h.

Definition at line 200 of file CoordinateConverter.h.

Definition at line 199 of file CoordinateConverter.h.


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


nav2d_karto
Author(s): Sebastian Kasperski
autogenerated on Sun Apr 2 2017 04:05:24