Ceylan::Maths::Linear::Vector Class Reference

Abstract class for vectors, whose coordinates are floating-point values (Real). More...

#include <CeylanVector.h>

Inheritance diagram for Ceylan::Maths::Linear::Vector:

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

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

 Vector ()
 Constructs a new vector.
virtual ~Vector () throw ()
 Basic virtual destructor.
virtual void nullify ()
 Sets this vector to the null vector (all coordinates zeroed).
virtual void setAllElementsTo (Real commonValue)=0
 Sets this vector so that all its elements equal commonValue.
virtual void normalize ()=0
 Normalizes this vector, so that its norm equals one.
virtual Real magnitude () const =0
 Returns this vector's magnitude.
virtual const std::string toString (VerbosityLevels level=high) const
 Returns a user-friendly description of the state of this object.

Static Public Member Functions

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 = 0
 Tells what is the dimension for this vector.

Static Protected Attributes

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


Detailed Description

Abstract class for vectors, whose coordinates are floating-point values (Real).

Indices ranges for 0 to Dimensions-1

Note:
Beware of counter-intuitive operator priorities.

Some methods could be gathered in this abstract class, instead of child classes (ex: setAllElementsTo could use the Dimensions attribute so that this method could be generically defined). The problem is however that Dimensions should be static, but it would not be overloaded by child classes. Even from a Vector3, lines such as 'for ( MatrixIndex i = 0 ; i < Dimensions ; i++ )' would use Vector::Dimensions, and not Vector3::Dimensions. A solution could be to define a getDimensions method. As it would have to be overloaded, inlining is not an option, a nd the overhead would remain significant. Better define these methods in each child class, even if their text is exactly duplicated.

Definition at line 76 of file CeylanVector.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

Vector::Vector (  ) 

Constructs a new vector.

Definition at line 39 of file CeylanVector.cc.

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

Basic virtual destructor.

Definition at line 46 of file CeylanVector.cc.


Member Function Documentation

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

virtual Real Ceylan::Maths::Linear::Vector::magnitude (  )  const [pure virtual]

Returns this vector's magnitude.

See also:
operator ~

Implemented in Ceylan::Maths::Linear::Vector2, and Ceylan::Maths::Linear::Vector3.

virtual void Ceylan::Maths::Linear::Vector::normalize (  )  [pure virtual]

Normalizes this vector, so that its norm equals one.

Exceptions:
LinearException if the null vector is passed, since it is the only one that cannot be normalized.

Implemented in Ceylan::Maths::Linear::Vector2, and Ceylan::Maths::Linear::Vector3.

void Vector::nullify (  )  [virtual]

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

Reimplemented in Ceylan::Maths::Linear::Vector2, and Ceylan::Maths::Linear::Vector3.

Definition at line 53 of file CeylanVector.cc.

References setAllElementsTo().

virtual void Ceylan::Maths::Linear::Vector::setAllElementsTo ( Real  commonValue  )  [pure virtual]

Sets this vector so that all its elements equal commonValue.

Implemented in Ceylan::Maths::Linear::Vector2, and Ceylan::Maths::Linear::Vector3.

Referenced by nullify().

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

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 Vector::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

Implements Ceylan::TextDisplayable.

Reimplemented in Ceylan::Maths::Linear::Vector2, and Ceylan::Maths::Linear::Vector3.

Definition at line 62 of file CeylanVector.cc.


Member Data Documentation

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

Reimplemented in Ceylan::Maths::Linear::Vector2, and Ceylan::Maths::Linear::Vector3.

Definition at line 156 of file CeylanVector.h.


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

Generated on Thu Jun 4 20:40:33 2009 for Ceylan by  doxygen 1.5.8