Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Friends
datatypes::Ellipse2D Class Reference

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

#include <Ellipse2D.hpp>

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

List of all members.

Public Types

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

Public Member Functions

 Ellipse2D ()
 Constructor for an all-zero Ellipse2D.
 Ellipse2D (const Point2D &center, const Point2D &radius, value_type rotation=0.0)
 Constructor with specified center point, radius, and rotation.
 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.
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.
const Point2DgetRadius () const
 Returns the radius of this Ellipse.
value_type getRotation () const
Setter methods for changing this ellipse
void setCenter (const Point2D &p)
 Sets the center point of this Ellipse2D.
void setCenter (value_type x, value_type y)
 Sets the center point of this Ellipse2D.
void setRadius (const Point2D &p)
 Sets the radius of this Ellipse. Must be non-negative.
void setRadius (value_type x_length, value_type y_width)
 Sets the radius of this Ellipse2D. Must be non-negative.
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.

Protected Attributes

Point2D m_center
Point2D m_radius
value_type m_rotation

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

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.)

Reimplemented in datatypes::Circle2D.

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().

Reimplemented in datatypes::Circle2D.

Definition at line 97 of file Ellipse2D.hpp.

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 [inline, virtual]

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.

Sets the center point of this Ellipse2D.

Definition at line 116 of file Ellipse2D.hpp.

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.

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.

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

Definition at line 36 of file Ellipse2D.hpp.

Definition at line 37 of file Ellipse2D.hpp.

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 Wed Jun 14 2017 04:04:50