Ceylan::Maths::Linear::Bipoint Class Reference

Two-dimensional point, whose coordinates are floating-point values (Real). More...

#include <CeylanBipoint.h>

Inheritance diagram for Ceylan::Maths::Linear::Bipoint:
Inheritance graph
[legend]
Collaboration diagram for Ceylan::Maths::Linear::Bipoint:
Collaboration graph
[legend]

List of all members.

Public Types

enum  TextOutputFormat { rawText, html }
 

Defines what text output formats for TextDisplayable instances are available.

More...

Public Member Functions

 Bipoint (Real x0=0, Real x1=0)
 Constructs a new vector with specified coordinates.
virtual ~Bipoint () throw ()
 Basic virtual destructor.
virtual void setTo (Real x0, Real x1)
 Reassigns this Bipoint's coordinates.
virtual void setAllElementsTo (Real commonValue)
 Sets this point so that all its elements equal commonValue.
virtual Real getX () const
 Returns the abscissa of this point.
virtual Real getY () const
 Returns the ordinate of this point.
virtual Real getElementAt (MatrixIndex index) const
 Returns indexed element.
virtual void setElementAt (MatrixIndex index, Real newValue)
 Sets indexed element to specified value.
virtual const std::string toString (VerbosityLevels level=high) const
 Returns a user-friendly description of the state of this object.
virtual void nullify ()
 Sets this Point to the null Point (all coordinates zeroed).

Static Public Member Functions

static Real Distance (const Bipoint &first, const Bipoint &second)
 Returns the distance between the two bipoints.
static Real DistancePow2 (const Bipoint &first, const Bipoint &second)
 Returns the square of the distance between the two bipoints.
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Static Public Attributes

static const MatrixIndex Dimensions = 2
 Tells what is the dimension for this point.

Protected Attributes

Real _coordinates [Dimensions]
 The three coordinates of this Bipoint.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Friends

class Vector2
 Must access to each other's coordinates.
class Matrix2
 Must access to each other's coordinates.
CEYLAN_DLL friend bool operator== (const Bipoint &t1, const Bipoint &t2)
 Tells whether the two Bipoints have the same elements.
CEYLAN_DLL friend bool operator!= (const Bipoint &t1, const Bipoint &t2)
 Tells whether the two Bipoints are different.
CEYLAN_DLL friend Bipoint operator+ (const Bipoint &t, const Vector2 &v)
 Translates a 2D point of specified 2D vector: result = t + v.
CEYLAN_DLL friend Bipoint operator- (const Bipoint &t, const Vector2 &v)
 Translates a 2D point of specified opposite 2D vector: result = t - v.
CEYLAN_DLL friend Vector2 vectorize (const Bipoint &t)
 Transforms a 2D point into a 2D vector, which will have the same coordinates.
CEYLAN_DLL friend Vector2 vectorize (const Bipoint &t1, const Bipoint &t2)
 Constructs a 2D vector from two 2D points: result = t2 - t1.

Detailed Description

Two-dimensional point, whose coordinates are floating-point values (Real).

Points and vectors are basically the same beasts, except they can mean different things to the developer. The Vector class is more versatile.

Note:
Beware of counter-intuitive operator priorities.

Definition at line 70 of file CeylanBipoint.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

Bipoint::Bipoint ( Real  x0 = 0,
Real  x1 = 0 
) [explicit]

Constructs a new vector with specified coordinates.

Note:
If no argument is specified, constructs the null vector.

Definition at line 62 of file CeylanBipoint.cc.

References _coordinates.

Bipoint::~Bipoint (  )  throw () [virtual]

Basic virtual destructor.

Definition at line 72 of file CeylanBipoint.cc.


Member Function Documentation

Real Bipoint::Distance ( const Bipoint first,
const Bipoint second 
) [static]

Returns the distance between the two bipoints.

Definition at line 231 of file CeylanBipoint.cc.

References getX(), getY(), Ceylan::Maths::Pow2(), and Ceylan::Maths::Sqrt().

Real Bipoint::DistancePow2 ( const Bipoint first,
const Bipoint second 
) [static]

Returns the square of the distance between the two bipoints.

Note:
Allows to avoid to compute a square root, which may be long.

Definition at line 241 of file CeylanBipoint.cc.

References getX(), getY(), and Ceylan::Maths::Pow2().

Real Bipoint::getElementAt ( MatrixIndex  index  )  const [virtual]

Returns indexed element.

Index ranges from 0 to Dimensions-1.

Exceptions:
MathsException if index is out of bounds, and if in debug mode.

Implements Ceylan::Maths::Linear::Point.

Definition at line 117 of file CeylanBipoint.cc.

References _coordinates, and Dimensions.

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]
Real Bipoint::getX (  )  const [virtual]

Returns the abscissa of this point.

Definition at line 102 of file CeylanBipoint.cc.

References _coordinates.

Referenced by Distance(), DistancePow2(), and Ceylan::Locatable2D::setCenter().

Real Bipoint::getY (  )  const [virtual]

Returns the ordinate of this point.

Definition at line 109 of file CeylanBipoint.cc.

References _coordinates.

Referenced by Distance(), DistancePow2(), and Ceylan::Locatable2D::setCenter().

void Point::nullify (  )  [virtual, inherited]

Sets this Point to the null Point (all coordinates zeroed).

Definition at line 52 of file CeylanPoint.cc.

References Ceylan::Maths::Linear::Point::setAllElementsTo().

void Bipoint::setAllElementsTo ( Real  commonValue  )  [virtual]

Sets this point so that all its elements equal commonValue.

Implements Ceylan::Maths::Linear::Point.

Definition at line 89 of file CeylanBipoint.cc.

References _coordinates, and Dimensions.

void Bipoint::setElementAt ( MatrixIndex  index,
Real  newValue 
) [virtual]

Sets indexed element to specified value.

Index ranges from 0 to Dimensions-1.

Exceptions:
MathsException if index is out of bounds, and if in debug mode.

Implements Ceylan::Maths::Linear::Point.

Definition at line 133 of file CeylanBipoint.cc.

References _coordinates, and Dimensions.

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

void Bipoint::setTo ( Real  x0,
Real  x1 
) [virtual]

Reassigns this Bipoint's coordinates.

Definition at line 79 of file CeylanBipoint.cc.

References _coordinates.

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const string Bipoint::toString ( VerbosityLevels  level = high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Reimplemented from Ceylan::Maths::Linear::Point.

Definition at line 149 of file CeylanBipoint.cc.

References _coordinates, Ceylan::DigitOutputPrecision, Dimensions, Ceylan::Log::LogPlug::error(), Ceylan::TextDisplayable::GetOutputFormat(), Ceylan::high, and Ceylan::TextDisplayable::html.


Friends And Related Function Documentation

friend class Matrix2 [friend]

Must access to each other's coordinates.

Definition at line 82 of file CeylanBipoint.h.

CEYLAN_DLL friend bool operator!= ( const Bipoint t1,
const Bipoint t2 
) [friend]

Tells whether the two Bipoints are different.

Note:
Exact comparison of floating point values is meaningless on most cases, hence strict equality is replaced here by relative equality.
See also:
Maths::AreRelativelyEqual.
CEYLAN_DLL friend Bipoint operator+ ( const Bipoint t,
const Vector2 v 
) [friend]

Translates a 2D point of specified 2D vector: result = t + v.

CEYLAN_DLL friend Bipoint operator- ( const Bipoint t,
const Vector2 v 
) [friend]

Translates a 2D point of specified opposite 2D vector: result = t - v.

CEYLAN_DLL friend bool operator== ( const Bipoint t1,
const Bipoint t2 
) [friend]

Tells whether the two Bipoints have the same elements.

Note:
Exact comparison of floating point values is meaningless on most cases, hence strict equality is replaced here by relative equality.
See also:
Maths::AreRelativelyEqual.
friend class Vector2 [friend]

Must access to each other's coordinates.

Definition at line 78 of file CeylanBipoint.h.

CEYLAN_DLL friend Vector2 vectorize ( const Bipoint t1,
const Bipoint t2 
) [friend]

Constructs a 2D vector from two 2D points: result = t2 - t1.

CEYLAN_DLL friend Vector2 vectorize ( const Bipoint t  )  [friend]

Transforms a 2D point into a 2D vector, which will have the same coordinates.


Member Data Documentation

The three coordinates of this Bipoint.

Definition at line 276 of file CeylanBipoint.h.

Referenced by Bipoint(), getElementAt(), getX(), getY(), setAllElementsTo(), setElementAt(), setTo(), and toString().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

Tells what is the dimension for this point.

Reimplemented from Ceylan::Maths::Linear::Point.

Definition at line 268 of file CeylanBipoint.h.

Referenced by getElementAt(), setAllElementsTo(), setElementAt(), and toString().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 13:41:19 2010 for Ceylan by  doxygen 1.6.3