se_core::Vector2 Class Reference

A 2 element vector that is represented by x,y coordinates. More...

#include <Vector2.hpp>

Inheritance diagram for se_core::Vector2:

se_core::Tuple2 se_core::Point2 List of all members.

Public Types

enum  { DIMENSION = 2 }
 dimension More...

Public Member Functions

 Vector2 (coor_t x, coor_t y)
 Constructs and initializes a Vector2 from the specified xy coordinates.
 Vector2 (const coor_t v[])
 Constructs and initializes a Vector2 from the specified array.
 Vector2 (const Tuple2 &t1)
 Constructs and initializes a Vector2 from the specified Tuple2.
 Vector2 ()
 Constructs and initializes a Vector2 to (0,0).
coor_t dot (const Vector2 &v1) const
 Computes the dot product of the this vector and vector v1.
coor_double_t lengthSquared () const
 Returns the squared length of this vector.
coor_t length () const
 Returns the length of this vector.
void normalize ()
 Normalizes this vector in place.
void normalize (const Vector2 &v1)
 Sets the value of this vector to the normalization of vector v1.
bray_t angle (const Vector2 &v1) const
 Returns the angle in braybrookians between this vector and the vector parameter; the return value is constrained to the range [0,255].
Vector2operator= (const Tuple2 &t)
void set (coor_t xvalue, coor_t yvalue)
 Sets the value of this tuple to the specified xy coordinates.
void set (const coor_t t[])
 Sets the value of this tuple from the 2 values specified in the array.
void set (const Tuple2 &t1)
 Sets the value of this tuple to the value of the Tuple2 argument.
void get (coor_t t[]) const
 Copies the value of the elements of this tuple into the array t[].
void get (Tuple2 *t) const
 Gets the value of this tuple and copies the values into the Tuple2.
void add (const Tuple2 &t1, const Tuple2 &t2)
 Sets the value of this tuple to the vector sum of tuples t1 and t2.
void add (const Tuple2 &t1)
 Sets the value of this tuple to the vector sum of itself and tuple t1.
void sub (const Tuple2 &t1, const Tuple2 &t2)
 Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).
void sub (const Tuple2 &t1)
 Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).
void negate (const Tuple2 &t1)
 Sets the value of this tuple to the negation of tuple t1.
void negate ()
 Negates the value of this vector in place.
void scale (scale_t s, const Tuple2 &t1)
 Sets the value of this tuple to the scalar multiplication of tuple t1.
void scale (scale_t s)
 Sets the value of this tuple to the scalar multiplication of itself.
void scaleAdd (scale_t s, const Tuple2 &t1, const Tuple2 &t2)
 Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).
void scaleAdd (scale_t s, const Tuple2 &t1)
 Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1).
bool equals (const Tuple2 &t1) const
 Returns true if all of the data members of Tuple2 t1 are equal to the corresponding data members in this.
bool isNan () const
bool epsilonEquals (const Tuple2 &t1, coor_t epsilon) const
 Returns true if the L-infinite distance between this tuple and tuple t1 is less than or equal to the epsilon parameter, otherwise returns false.
void clamp (coor_t min, coor_t max, const Tuple2 &t)
 Clamps the tuple parameter to the range [low, high] and places the values into this tuple.
void clamp (coor_t min, coor_t max)
 Clamps this tuple to the range [low, high].
void clampMin (coor_t min, const Tuple2 &t)
 Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple.
void clampMin (coor_t min)
 Clamps the minimum value of this tuple to the min parameter.
void clampMax (coor_t max, const Tuple2 &t)
 Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple.
void clampMax (coor_t max)
 Clamps the maximum value of this tuple to the max parameter.
void absolute (const Tuple2 &t)
 Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.
void absolute ()
 Sets each component of this tuple to its absolute value.
void interpolate (const Tuple2 &t1, const Tuple2 &t2, scale_t alpha)
 Linearly interpolates between tuples t1 and t2 and places the result into this tuple: this = (1-alpha)*t1 + alpha*t2.
void interpolate (const Tuple2 &t1, scale_t alpha)
 Linearly interpolates between this tuple and tuple t1 and places the result into this tuple: this = (1-alpha)*this + alpha*t1.
char * toString (char *buffer) const
 Returns a string that contains the values of this Tuple2.
bool operator== (const Tuple2 &t1) const
coor_t operator[] (short index) const
coor_toperator[] (short index)
Tuple2operator+= (const Tuple2 &t1)
Tuple2operator-= (const Tuple2 &t1)
Tuple2operator *= (scale_t s)
Tuple2 operator+ (const Tuple2 &t1) const
Tuple2 operator- (const Tuple2 &t1) const
Tuple2 operator * (scale_t s) const

Public Attributes

coor_t x_
 The x coordinate.
coor_t y_
 The y coordinate.

Detailed Description

A 2 element vector that is represented by x,y coordinates.

Java3D specification 1.1, implementation

Revision
1.3
,
Date
1999/10/06 02:52:46
Author:
Kenji hiranabe SagaEngine adaption

Rune Myrland

Definition at line 36 of file Vector2.hpp.


Member Enumeration Documentation

anonymous enum [inherited]
 

dimension

Enumeration values:
DIMENSION 

Definition at line 43 of file Tuple2.hpp.


Constructor & Destructor Documentation

se_core::Vector2::Vector2 coor_t  x,
coor_t  y
[inline]
 

Constructs and initializes a Vector2 from the specified xy coordinates.

Parameters:
x the x coordinate
y the y coordinate

Definition at line 43 of file Vector2.hpp.

se_core::Vector2::Vector2 const coor_t  v[]  )  [inline]
 

Constructs and initializes a Vector2 from the specified array.

Parameters:
v the array of length 2 containing xy in order

Definition at line 49 of file Vector2.hpp.

se_core::Vector2::Vector2 const Tuple2 t1  )  [inline]
 

Constructs and initializes a Vector2 from the specified Tuple2.

Parameters:
t1 the Tuple2 containing the initialization x y data

Definition at line 55 of file Vector2.hpp.

se_core::Vector2::Vector2  )  [inline]
 

Constructs and initializes a Vector2 to (0,0).

Definition at line 60 of file Vector2.hpp.


Member Function Documentation

void se_core::Tuple2::absolute  )  [inline, inherited]
 

Sets each component of this tuple to its absolute value.

Definition at line 319 of file Tuple2.hpp.

void se_core::Tuple2::absolute const Tuple2 t  )  [inline, inherited]
 

Sets each component of the tuple parameter to its absolute value and places the modified values into this tuple.

Parameters:
t the source tuple, which will not be modified

Definition at line 279 of file Tuple2.hpp.

void se_core::Tuple2::add const Tuple2 t1  )  [inline, inherited]
 

Sets the value of this tuple to the vector sum of itself and tuple t1.

Parameters:
t1 the other tuple

Definition at line 136 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::add const Tuple2 t1,
const Tuple2 t2
[inline, inherited]
 

Sets the value of this tuple to the vector sum of tuples t1 and t2.

Parameters:
t1 the first tuple
t2 the second tuple

Definition at line 127 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

bray_t se_core::Vector2::angle const Vector2 v1  )  const
 

Returns the angle in braybrookians between this vector and the vector parameter; the return value is constrained to the range [0,255].

Parameters:
v1 the other vector
Returns:
the angle in braybrookians in the range [0,255]

Definition at line 16 of file Vector2.cpp.

References abs, se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::clamp coor_t  min,
coor_t  max
[inline, inherited]
 

Clamps this tuple to the range [low, high].

Parameters:
min the lowest value in this tuple after clamping
max the highest value in this tuple after clamping

Definition at line 289 of file Tuple2.hpp.

void se_core::Tuple2::clamp coor_t  min,
coor_t  max,
const Tuple2 t
[inline, inherited]
 

Clamps the tuple parameter to the range [low, high] and places the values into this tuple.

Parameters:
min the lowest value in the tuple after clamping
max the highest value in the tuple after clamping
t the source tuple, which will not be modified

Definition at line 246 of file Tuple2.hpp.

void se_core::Tuple2::clampMax coor_t  max  )  [inline, inherited]
 

Clamps the maximum value of this tuple to the max parameter.

Parameters:
max the highest value in the tuple after clamping

Definition at line 309 of file Tuple2.hpp.

void se_core::Tuple2::clampMax coor_t  max,
const Tuple2 t
[inline, inherited]
 

Clamps the maximum value of the tuple parameter to the max parameter and places the values into this tuple.

Parameters:
max the highest value in the tuple after clamping
t the source tuple, which will not be modified

Definition at line 268 of file Tuple2.hpp.

void se_core::Tuple2::clampMin coor_t  min  )  [inline, inherited]
 

Clamps the minimum value of this tuple to the min parameter.

Parameters:
min the lowest value in this tuple after clamping

Definition at line 298 of file Tuple2.hpp.

void se_core::Tuple2::clampMin coor_t  min,
const Tuple2 t
[inline, inherited]
 

Clamps the minimum value of the tuple parameter to the min parameter and places the values into this tuple.

Parameters:
min the lowest value in the tuple after clamping
t the source tuple, which will not be modified

Definition at line 257 of file Tuple2.hpp.

coor_t se_core::Vector2::dot const Vector2 v1  )  const [inline]
 

Computes the dot product of the this vector and vector v1.

Parameters:
v1 the other vector

Definition at line 66 of file Vector2.hpp.

References coor_t, se_core::Tuple2::x_, and se_core::Tuple2::y_.

Referenced by se_core::Point2::nearestPoint().

bool se_core::Tuple2::epsilonEquals const Tuple2 t1,
coor_t  epsilon
const [inherited]
 

Returns true if the L-infinite distance between this tuple and tuple t1 is less than or equal to the epsilon parameter, otherwise returns false.

The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].

Parameters:
t1 the tuple to be compared to this tuple
epsilon the threshold value

Definition at line 8 of file Tuple2.cpp.

References abs, se_core::Tuple2::x_, and se_core::Tuple2::y_.

bool se_core::Tuple2::equals const Tuple2 t1  )  const [inline, inherited]
 

Returns true if all of the data members of Tuple2 t1 are equal to the corresponding data members in this.

Parameters:
t1 the vector with which the comparison is made.

Definition at line 224 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::get Tuple2 t  )  const [inline, inherited]
 

Gets the value of this tuple and copies the values into the Tuple2.

Parameters:
t Tuple2 object into which that values of this object are copied

Definition at line 116 of file Tuple2.hpp.

References Assert, se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::get coor_t  t[]  )  const [inline, inherited]
 

Copies the value of the elements of this tuple into the array t[].

Parameters:
t the array that will contain the values of the vector asserting t has room for 2 values.

Definition at line 107 of file Tuple2.hpp.

void se_core::Tuple2::interpolate const Tuple2 t1,
scale_t  alpha
[inline, inherited]
 

Linearly interpolates between this tuple and tuple t1 and places the result into this tuple: this = (1-alpha)*this + alpha*t1.

Parameters:
t1 the first tuple
alpha the alpha interpolation parameter

Definition at line 346 of file Tuple2.hpp.

References scale_t, se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::interpolate const Tuple2 t1,
const Tuple2 t2,
scale_t  alpha
[inline, inherited]
 

Linearly interpolates between tuples t1 and t2 and places the result into this tuple: this = (1-alpha)*t1 + alpha*t2.

Parameters:
t1 the first tuple
t2 the second tuple
alpha the alpha interpolation parameter

Definition at line 333 of file Tuple2.hpp.

bool se_core::Tuple2::isNan  )  const [inherited]
 

Definition at line 21 of file Tuple2.cpp.

coor_t se_core::Vector2::length  )  const
 

Returns the length of this vector.

Returns:
the length of this vector

Definition at line 10 of file Vector2.cpp.

Referenced by se_core::Point2::nearestPoint().

coor_double_t se_core::Vector2::lengthSquared  )  const [inline]
 

Returns the squared length of this vector.

Returns:
the squared length of this vector

Definition at line 74 of file Vector2.hpp.

References coor_double_t.

void se_core::Tuple2::negate  )  [inline, inherited]
 

Negates the value of this vector in place.

Definition at line 172 of file Tuple2.hpp.

void se_core::Tuple2::negate const Tuple2 t1  )  [inline, inherited]
 

Sets the value of this tuple to the negation of tuple t1.

Parameters:
t1 the source vector

Definition at line 164 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Vector2::normalize const Vector2 v1  )  [inline]
 

Sets the value of this vector to the normalization of vector v1.

Parameters:
v1 the un-normalized vector

Definition at line 100 of file Vector2.hpp.

References se_core::Tuple2::set().

void se_core::Vector2::normalize  )  [inline]
 

Normalizes this vector in place.

Definition at line 88 of file Vector2.hpp.

References coor_t.

Tuple2 se_core::Tuple2::operator * scale_t  s  )  const [inline, inherited]
 

Definition at line 413 of file Tuple2.hpp.

Tuple2& se_core::Tuple2::operator *= scale_t  s  )  [inline, inherited]
 

Definition at line 403 of file Tuple2.hpp.

Tuple2 se_core::Tuple2::operator+ const Tuple2 t1  )  const [inline, inherited]
 

Definition at line 407 of file Tuple2.hpp.

Tuple2& se_core::Tuple2::operator+= const Tuple2 t1  )  [inline, inherited]
 

Definition at line 395 of file Tuple2.hpp.

Tuple2 se_core::Tuple2::operator- const Tuple2 t1  )  const [inline, inherited]
 

Definition at line 410 of file Tuple2.hpp.

Tuple2& se_core::Tuple2::operator-= const Tuple2 t1  )  [inline, inherited]
 

Definition at line 399 of file Tuple2.hpp.

Vector2& se_core::Vector2::operator= const Tuple2 t  )  [inline]
 

Reimplemented from se_core::Tuple2.

Reimplemented in se_core::Point2.

Definition at line 116 of file Vector2.hpp.

bool se_core::Tuple2::operator== const Tuple2 t1  )  const [inline, inherited]
 

Definition at line 360 of file Tuple2.hpp.

coor_t& se_core::Tuple2::operator[] short  index  )  [inline, inherited]
 

Definition at line 376 of file Tuple2.hpp.

References Assert, and coor_t.

coor_t se_core::Tuple2::operator[] short  index  )  const [inline, inherited]
 

Definition at line 364 of file Tuple2.hpp.

References Assert, and coor_t.

void se_core::Tuple2::scale scale_t  s  )  [inline, inherited]
 

Sets the value of this tuple to the scalar multiplication of itself.

Parameters:
s the scalar value

Definition at line 191 of file Tuple2.hpp.

void se_core::Tuple2::scale scale_t  s,
const Tuple2 t1
[inline, inherited]
 

Sets the value of this tuple to the scalar multiplication of tuple t1.

Parameters:
s the scalar value
t1 the source tuple

Definition at line 182 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

Referenced by se_core::Point2::nearestPoint().

void se_core::Tuple2::scaleAdd scale_t  s,
const Tuple2 t1
[inline, inherited]
 

Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + t1).

Parameters:
s the scalar value
t1 the tuple to be added

Definition at line 214 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::scaleAdd scale_t  s,
const Tuple2 t1,
const Tuple2 t2
[inline, inherited]
 

Sets the value of this tuple to the scalar multiplication of tuple t1 and then adds tuple t2 (this = s*t1 + t2).

Parameters:
s the scalar value
t1 the tuple to be multipled
t2 the tuple to be added

Definition at line 203 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::set const Tuple2 t1  )  [inline, inherited]
 

Sets the value of this tuple to the value of the Tuple2 argument.

Parameters:
t1 the tuple to be copied

Definition at line 97 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::set const coor_t  t[]  )  [inline, inherited]
 

Sets the value of this tuple from the 2 values specified in the array.

Parameters:
t the array of length 2 containing xy in order

Definition at line 88 of file Tuple2.hpp.

void se_core::Tuple2::set coor_t  xvalue,
coor_t  yvalue
[inline, inherited]
 

Sets the value of this tuple to the specified xy coordinates.

Parameters:
xvalue the x coordinate
yvalue the y coordinate

Definition at line 79 of file Tuple2.hpp.

Referenced by se_core::AreaEdge::distance(), se_basic::NavMesh::farthestLineOfSightXZ(), and normalize().

void se_core::Tuple2::sub const Tuple2 t1  )  [inline, inherited]
 

Sets the value of this tuple to the vector difference of itself and tuple t1 (this = this - t1).

Parameters:
t1 the other tuple

Definition at line 155 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

void se_core::Tuple2::sub const Tuple2 t1,
const Tuple2 t2
[inline, inherited]
 

Sets the value of this tuple to the vector difference of tuple t1 and t2 (this = t1 - t2).

Parameters:
t1 the first tuple
t2 the second tuple

Definition at line 146 of file Tuple2.hpp.

References se_core::Tuple2::x_, and se_core::Tuple2::y_.

Referenced by se_core::Point2::nearestPoint().

char * se_core::Tuple2::toString char *  buffer  )  const [inherited]
 

Returns a string that contains the values of this Tuple2.

The form is (x,y).

Returns:
the String representation

Definition at line 15 of file Tuple2.cpp.


Member Data Documentation

coor_t se_core::Tuple2::x_ [inherited]
 

The x coordinate.

Definition at line 48 of file Tuple2.hpp.

Referenced by se_core::Tuple2::add(), angle(), se_basic::NavMesh::barycentric(), se_core::Point2::distanceL1(), se_core::Point2::distanceLinf(), se_core::Point2::distanceSquared(), dot(), se_core::Tuple2::epsilonEquals(), se_core::Tuple2::equals(), se_basic::NavMeshArea::farthestLineOfSight(), se_basic::NavMesh::farthestLineOfSightXZ(), se_core::Tuple2::get(), se_core::Tuple2::interpolate(), se_basic::NavMesh::isInsideTriangle(), se_core::Point2::left(), se_core::Point2::lineIntersect(), se_basic::Path::lineIntersect(), se_core::Tuple2::negate(), se_core::operator<<(), se_core::Tuple2::scale(), se_core::Tuple2::scaleAdd(), se_core::Tuple2::set(), se_core::Tuple2::sub(), and se_core::Point2::willAIntersectB().

coor_t se_core::Tuple2::y_ [inherited]
 

The y coordinate.

Definition at line 53 of file Tuple2.hpp.

Referenced by se_core::Tuple2::add(), angle(), se_basic::NavMesh::barycentric(), se_core::Point2::distanceL1(), se_core::Point2::distanceLinf(), se_core::Point2::distanceSquared(), dot(), se_core::Tuple2::epsilonEquals(), se_core::Tuple2::equals(), se_basic::NavMeshArea::farthestLineOfSight(), se_basic::NavMesh::farthestLineOfSightXZ(), se_core::Tuple2::get(), se_core::Tuple2::interpolate(), se_basic::NavMesh::isInsideTriangle(), se_core::Point2::left(), se_core::Point2::lineIntersect(), se_basic::Path::lineIntersect(), se_core::Tuple2::negate(), se_core::operator<<(), se_core::Tuple2::scale(), se_core::Tuple2::scaleAdd(), se_core::Tuple2::set(), se_core::Tuple2::sub(), and se_core::Point2::willAIntersectB().


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

Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:32 2007 by Doxygen version 1.3.9.1.

SourceForge.net Logo