Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
datatypes::Ellipse2D Class Reference

A rotated 2-dimensional ellipse in the plane. More...

#include <Ellipse2D.hpp>

Inheritance diagram for datatypes::Ellipse2D:
Inheritance graph
[legend]

Public Types

typedef Point2D::value_type value_type
 The type of the stored x, y coordinates, and the rotation. More...
 

Public Member Functions

 Ellipse2D ()
 Constructor for an all-zero Ellipse2D. More...
 
 Ellipse2D (const Point2D &center, const Point2D &radius, value_type rotation=0.0)
 Constructor with specified center point, radius, and rotation. More...
 
 Ellipse2D (value_type x_center, value_type y_center, value_type x_radius, value_type y_radius, value_type rotation=0.0)
 Constructor with all values given. More...
 
virtual const UINT32 getUsedMemory () const
 
std::string toString () const
 
Accessor methods for information about this ellipse
const Point2DgetCenter () const
 Returns the center point of this Ellipse. More...
 
const Point2DgetRadius () const
 Returns the radius of this Ellipse. More...
 
value_type getRotation () const
 
Setter methods for changing this ellipse
void setCenter (const Point2D &p)
 Sets the center point of this Ellipse2D. More...
 
void setCenter (value_type x, value_type y)
 Sets the center point of this Ellipse2D. More...
 
void setRadius (const Point2D &p)
 Sets the radius of this Ellipse. Must be non-negative. More...
 
void setRadius (value_type x_length, value_type y_width)
 Sets the radius of this Ellipse2D. Must be non-negative. More...
 
void setRotation (value_type r)
 
Geometrical relations to other objects
bool containsPoint (const Point2D &point) const
 Returns true if the given Point2D is inside this ellipse or on its outline. More...
 
- Public Member Functions inherited from datatypes::BasicData
 BasicData ()
 
UINT16 getDatatype ()
 
UINT16 getSourceId ()
 
virtual void setSourceId (UINT16 id)
 
virtual ~BasicData ()
 

Protected Attributes

Point2D m_center
 
Point2D m_radius
 
value_type m_rotation
 
- Protected Attributes inherited from datatypes::BasicData
UINT16 m_datatype
 
UINT16 m_sourceId
 

Private Member Functions

void verifyNumericRanges ()
 

Friends

bool operator!= (const Ellipse2D &, const Ellipse2D &)
 
bool operator== (const Ellipse2D &, const Ellipse2D &)
 

Detailed Description

A rotated 2-dimensional ellipse in the plane.

This ellipse is defined by its center point, the rotation of the ellipse's main (x) axis measured from the global x-axis, and the radius of the ellipse's x- and y-axis.

The rotation denotes the rotation of this ellipse' x-axis compared to the original x-axis. The two radii denote the radius length of this ellipse in the ellipse' coordinate system, i.e. the distance from the center point to each outline.

The size argument must be non-negative. The rotation argument must be in the range [-pi,pi], which can be obtained by using normalizeRadians().

Definition at line 30 of file Ellipse2D.hpp.

Member Typedef Documentation

The type of the stored x, y coordinates, and the rotation.

Definition at line 34 of file Ellipse2D.hpp.

Constructor & Destructor Documentation

datatypes::Ellipse2D::Ellipse2D ( )

Constructor for an all-zero Ellipse2D.

Definition at line 18 of file Ellipse2D.cpp.

datatypes::Ellipse2D::Ellipse2D ( const Point2D center,
const Point2D radius,
value_type  rotation = 0.0 
)

Constructor with specified center point, radius, and rotation.

Note
The radius components must be non-negative, otherwise an assertion will fail.
Parameters
centerThe center point
radiusThe size of the ellipse in the ellipse' coordinate system. Must be non-negative.
rotationThe rotation of the ellipse' coordinate system around its center point in [radians]. Must be in the interval [-pi,pi], which can be obtained by using normalizeRadians().

Definition at line 26 of file Ellipse2D.cpp.

datatypes::Ellipse2D::Ellipse2D ( value_type  x_center,
value_type  y_center,
value_type  x_radius,
value_type  y_radius,
value_type  rotation = 0.0 
)

Constructor with all values given.

Constructor with all values given: x/y of center point, x/y of size (where the x coordinate of the size is in the same direction as the x axis of the coordinate system, rotated by the rotation argument; the y coordinate accordingly), and rotation.

Note
The x_size and y_size must be non-negative.
Parameters
x_centerX-coordinate of center point
y_centerY-coordinate of center point
x_radiusThe radius of the ellipse in X-direction in the ellipse' coordinate system. Must be non-negative.
y_radiusThe radius of the ellipse in Y-direction in the ellipse' coordinate system. Must be non-negative.
rotationThe rotation of the ellipse' coordinate system around its center point in [radians]. Must be in the interval [-pi,pi], which can be obtained by using normalizeRadians().

Definition at line 37 of file Ellipse2D.cpp.

Member Function Documentation

bool datatypes::Ellipse2D::containsPoint ( const Point2D point) const

Returns true if the given Point2D is inside this ellipse or on its outline.

(Note: This function is relatively cheap - it needs two sinus operations, four multiplications and a bunch of comparisons.)

Definition at line 66 of file Ellipse2D.cpp.

const Point2D& datatypes::Ellipse2D::getCenter ( ) const
inline

Returns the center point of this Ellipse.

Definition at line 88 of file Ellipse2D.hpp.

const Point2D& datatypes::Ellipse2D::getRadius ( ) const
inline

Returns the radius of this Ellipse.

The returned radius denotes the radius of the ellipse in x-direction Point2D::getX() and y-direction Point2D::getY(), where the x-direction is rotated against the original x-axis by getRotation().

Definition at line 97 of file Ellipse2D.hpp.

value_type datatypes::Ellipse2D::getRotation ( ) const
inline

Returns the rotation angle of this Ellipse2D in [radians], counter clock wise.

The rotation of the ellipse' coordinate system around its center point. Must be in the interval [-pi,pi]

Definition at line 104 of file Ellipse2D.hpp.

virtual const UINT32 datatypes::Ellipse2D::getUsedMemory ( ) const
inlinevirtual

Implements datatypes::BasicData.

Reimplemented in datatypes::Circle2D.

Definition at line 82 of file Ellipse2D.hpp.

void datatypes::Ellipse2D::setCenter ( const Point2D p)
inline

Sets the center point of this Ellipse2D.

Definition at line 113 of file Ellipse2D.hpp.

void datatypes::Ellipse2D::setCenter ( value_type  x,
value_type  y 
)
inline

Sets the center point of this Ellipse2D.

Definition at line 116 of file Ellipse2D.hpp.

void datatypes::Ellipse2D::setRadius ( const Point2D p)

Sets the radius of this Ellipse. Must be non-negative.

Definition at line 49 of file Ellipse2D.cpp.

void datatypes::Ellipse2D::setRadius ( value_type  x_length,
value_type  y_width 
)

Sets the radius of this Ellipse2D. Must be non-negative.

Definition at line 54 of file Ellipse2D.cpp.

void datatypes::Ellipse2D::setRotation ( value_type  r)

Sets the rotation angle of this Ellipse in [radians], counter clock wise.

The rotation of the ellipse' coordinate system around its center point. Must be in the interval [-pi,pi], which can be obtained by using normalizeRadians().

Definition at line 60 of file Ellipse2D.cpp.

std::string datatypes::Ellipse2D::toString ( ) const

Definition at line 145 of file Ellipse2D.cpp.

void datatypes::Ellipse2D::verifyNumericRanges ( )
private

Definition at line 107 of file Ellipse2D.cpp.

Friends And Related Function Documentation

bool operator!= ( const Ellipse2D b1,
const Ellipse2D b2 
)
friend

Definition at line 170 of file Ellipse2D.hpp.

bool operator== ( const Ellipse2D b1,
const Ellipse2D b2 
)
friend

Definition at line 161 of file Ellipse2D.hpp.

Member Data Documentation

Point2D datatypes::Ellipse2D::m_center
protected

Definition at line 36 of file Ellipse2D.hpp.

Point2D datatypes::Ellipse2D::m_radius
protected

Definition at line 37 of file Ellipse2D.hpp.

value_type datatypes::Ellipse2D::m_rotation
protected

Definition at line 38 of file Ellipse2D.hpp.


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


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30