#include <CeylanVector3.h>
Public Types | |
enum | TextOutputFormat { rawText, html } |
Defines what text output formats for TextDisplayable instances are available. More... | |
Public Member Functions | |
Vector3 (Real x0=0, Real x1=0, Real x2=0) | |
Constructs a new vector with specified coordinates. | |
virtual | ~Vector3 () throw () |
Basic virtual destructor. | |
virtual void | setTo (Real x0, Real x1, Real x2) |
Reassigns this vector's coordinates. | |
virtual void | nullify () |
Sets this vector to the null vector (all coordinates zeroed). | |
virtual void | setAllElementsTo (Real commonValue) |
Sets this vector so that all its elements equal commonValue. | |
virtual Real | getElementAt (MatrixIndex index) const |
Returns indexed element. | |
virtual void | setElementAt (MatrixIndex index, Real newValue) |
Sets indexed element to specified value. | |
virtual void | normalize () |
Normalizes this vector, so that its norm equals one. | |
virtual Real | magnitude () const |
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 = 3 |
Tells what is the dimension for this vector. | |
Protected Attributes | |
Real | _vec [Dimensions] |
The coordinates of this vector. | |
Static Protected Attributes | |
static TextOutputFormat | _OutputFormat = rawText |
The text format to be used currently by TextDisplayable instances. | |
Friends | |
class | Tripoint |
Must access to each other's coordinates. | |
class | Matrix3 |
Must access to each other's coordinates. | |
CEYLAN_DLL friend bool | operator== (const Vector3 &v1, const Vector3 &v2) |
Tells whether the two vectors have the same elements. | |
CEYLAN_DLL friend bool | operator!= (const Vector3 &v1, const Vector3 &v2) |
Tells whether the two vectors have the same elements. | |
CEYLAN_DLL friend Tripoint | operator+ (const Tripoint &t, const Vector3 &v) |
Translates a 3D point of specified 3D vector: result = t + v. | |
CEYLAN_DLL friend Tripoint | operator- (const Tripoint &t, const Vector3 &v) |
Translates a 3D point of specified opposite 3D vector: result = t - v. | |
CEYLAN_DLL friend Vector3 | vectorize (const Tripoint &t) |
Transforms a 3D point into a 3D vector, which will have the same coordinates. | |
CEYLAN_DLL friend Vector3 | vectorize (const Tripoint &t1, const Tripoint &t2) |
Constructs a 3D vector from two 3D points: result = t1 - t2. | |
CEYLAN_DLL friend Vector3 | operator+ (const Vector3 &v1, const Vector3 &v2) |
Adds two vectors: result = v1 + v2. | |
CEYLAN_DLL friend Vector3 | operator- (const Vector3 &v1, const Vector3 &v2) |
Substracts two vectors: result = v1 - v2. | |
CEYLAN_DLL friend Vector3 | operator* (Real lambda, const Vector3 &v) |
Multiplies v by coefficient lambda: result = lamba.v. | |
CEYLAN_DLL friend Vector3 | operator* (const Matrix3 &m, const Vector3 &v) |
Applies vector v to matrix m: result = m.v. | |
CEYLAN_DLL friend Real | operator| (const Vector3 &v1, const Vector3 &v2) |
Computes the dot product of v1 and v2: result = v1 (dotproduct) v2. | |
CEYLAN_DLL friend Vector3 | operator^ (const Vector3 &v1, const Vector3 &v2) |
Returns the cross product of v1 and v2: result = v1 (crossproduct) v2. | |
CEYLAN_DLL friend Real | operator~ (const Vector3 &v) |
Returns the magnitude of specified vector. |
Definition at line 66 of file CeylanVector3.h.
enum Ceylan::TextDisplayable::TextOutputFormat [inherited] |
Defines what text output formats for TextDisplayable instances are available.
Definition at line 124 of file CeylanTextDisplayable.h.
Constructs a new vector with specified coordinates.
Definition at line 62 of file CeylanVector3.cc.
References _vec.
Vector3::~Vector3 | ( | ) | throw () [virtual] |
Real Vector3::getElementAt | ( | MatrixIndex | index | ) | const [virtual] |
Returns indexed element.
Index ranges from 0 to Dimensions-1.
MathsException | if index is out of bounds and if in debug mode. |
Definition at line 114 of file CeylanVector3.cc.
References _vec, and Dimensions.
TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat | ( | ) | [static, inherited] |
Returns the current overall text format to be used by TextDisplayable instances.
Definition at line 63 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::formatStringList(), Ceylan::formatStringMap(), Ceylan::XML::XMLMarkup::toString(), toString(), Ceylan::Maths::Linear::Vector2::toString(), Ceylan::Maths::Linear::Tripoint::toString(), Ceylan::Module::toString(), Ceylan::Maths::Linear::Matrix3::toString(), Ceylan::Maths::Linear::Matrix2::toString(), Ceylan::Maths::Linear::HomogeneousMatrix3::toString(), and Ceylan::Maths::Linear::Bipoint::toString().
Real Vector3::magnitude | ( | ) | const [virtual] |
Returns this vector's magnitude.
Implements Ceylan::Maths::Linear::Vector.
Definition at line 168 of file CeylanVector3.cc.
References _vec, Dimensions, and Ceylan::Maths::Sqrt().
Referenced by normalize().
void Vector3::normalize | ( | ) | [virtual] |
Normalizes this vector, so that its norm equals one.
LinearException | if the null vector is passed, since it is the only one that cannot be normalized. |
Implements Ceylan::Maths::Linear::Vector.
Definition at line 148 of file CeylanVector3.cc.
References _vec, Dimensions, Ceylan::Maths::IsNull(), and magnitude().
Referenced by Ceylan::Maths::Linear::LineProjection3DFunctor::LineProjection3DFunctor(), and Ceylan::Maths::Linear::Rotation3DFunctor::Rotation3DFunctor().
void Vector3::nullify | ( | ) | [virtual] |
Sets this vector to the null vector (all coordinates zeroed).
Reimplemented from Ceylan::Maths::Linear::Vector.
Definition at line 91 of file CeylanVector3.cc.
References setAllElementsTo().
void Vector3::setAllElementsTo | ( | Real | commonValue | ) | [virtual] |
Sets this vector so that all its elements equal commonValue.
Implements Ceylan::Maths::Linear::Vector.
Definition at line 100 of file CeylanVector3.cc.
References _vec, and Dimensions.
Referenced by nullify().
void Vector3::setElementAt | ( | MatrixIndex | index, | |
Real | newValue | |||
) | [virtual] |
Sets indexed element to specified value.
Index ranges from 0 to Dimensions-1.
MathsException | if index is out of bounds and if in debug mode. |
Definition at line 131 of file CeylanVector3.cc.
References _vec, and Dimensions.
void TextDisplayable::SetOutputFormat | ( | TextOutputFormat | newOutputFormat | ) | [static, inherited] |
Sets the current overall text format to be used by TextDisplayable instances.
newOutputFormat | the new output format. |
Definition at line 72 of file CeylanTextDisplayable.cc.
References Ceylan::TextDisplayable::_OutputFormat.
Referenced by Ceylan::Log::LogHolder::LogHolder().
Reassigns this vector's coordinates.
Definition at line 80 of file CeylanVector3.cc.
References _vec.
Referenced by Ceylan::Maths::Linear::Matrix3::CreateFrom().
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.
displayables | a list of pointers to TextDisplayable instances/ | |
level | the requested verbosity level. |
Definition at line 45 of file CeylanTextDisplayable.cc.
References Ceylan::formatStringList().
const string Vector3::toString | ( | VerbosityLevels | level = high |
) | const [virtual] |
Returns a user-friendly description of the state of this object.
level | the requested verbosity level. |
Reimplemented from Ceylan::Maths::Linear::Vector.
Definition at line 186 of file CeylanVector3.cc.
References _vec, Ceylan::DigitOutputPrecision, Dimensions, Ceylan::Log::LogPlug::error(), Ceylan::TextDisplayable::GetOutputFormat(), Ceylan::high, and Ceylan::TextDisplayable::html.
Referenced by Ceylan::Maths::Linear::Rotation3DFunctor::toString(), and Ceylan::Maths::Linear::LineProjection3DFunctor::toString().
friend class Matrix3 [friend] |
Tells whether the two vectors have the same elements.
Applies vector v to matrix m: result = m.v.
Multiplies v by coefficient lambda: result = lamba.v.
Adds two vectors: result = v1 + v2.
Translates a 3D point of specified 3D vector: result = t + v.
Substracts two vectors: result = v1 - v2.
Translates a 3D point of specified opposite 3D vector: result = t - v.
Tells whether the two vectors have the same elements.
Returns the cross product of v1 and v2: result = v1 (crossproduct) v2.
Computes the dot product of v1 and v2: result = v1 (dotproduct) v2.
Returns the magnitude of specified vector.
friend class Tripoint [friend] |
Constructs a 3D vector from two 3D points: result = t1 - t2.
Transforms a 3D point into a 3D vector, which will have the same coordinates.
TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited] |
The text format to be used currently by TextDisplayable instances.
Definition at line 158 of file CeylanTextDisplayable.h.
Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().
Real Ceylan::Maths::Linear::Vector3::_vec[Dimensions] [protected] |
The coordinates of this vector.
Definition at line 321 of file CeylanVector3.h.
Referenced by getElementAt(), magnitude(), normalize(), Ceylan::Maths::Linear::operator^(), Ceylan::Maths::Linear::operator|(), setAllElementsTo(), Ceylan::Maths::Linear::Matrix3::setColumn(), setElementAt(), setTo(), toString(), and Vector3().
const MatrixIndex Ceylan::Maths::Linear::Vector3::Dimensions = 3 [static] |
Tells what is the dimension for this vector.
Reimplemented from Ceylan::Maths::Linear::Vector.
Definition at line 312 of file CeylanVector3.h.
Referenced by getElementAt(), magnitude(), normalize(), setAllElementsTo(), setElementAt(), and toString().