GbVec2< T > Class Template Reference

GbVec2 is a field class for holding 2-D vectors/points/distances. More...

#include <gfx/gbvec.h>

Inheritance diagram for GbVec2< T >:

Inheritance graph
[legend]
Collaboration diagram for GbVec2< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 GbVec2 (T x_=T(), T y_=T())
 Default constructor, or set initial 2-D coordinates.
 GbVec2 (const rutz::fstring &s)
 String conversion constructor.
virtual ~GbVec2 ()
 Virtual destructor.
geom::vec2< T > & vec ()
 Get the underlying geom::vec2 value.
const geom::vec2< T > & vec () const
 Get the underlying geom::vec2 value.
virtual rutz::fstring value_typename () const
 Get a string describing the underlying native type.
virtual const T * const_begin () const
 Returns a const pointer to the start of the underlying storage.
T & x ()
const T & x () const
T & y ()
const T & y () const
vec2 abs () const
void set (Tx, Ty)
bool operator== (const vec2< T > &b)
double length () const
void set_length (double len)
void set_polar_rad (double r, double theta)
double theta_deg () const
void set_theta_deg (double degrees)
void rotate_deg (double degrees)
double angle_to (const vec2< T > &b) const
 Result in radians.
double distance_to (const vec2< T > &b) const
void scale_by (const U &factor)
vec2 operator* (const T &factor) const
vec2 operator* (const vec2< U > &rhs) const
vec2 operator/ (const T &factor) const
vec2 operator/ (const vec2< U > &rhs) const
vec2 & operator*= (const U &factor)
vec2 & operator*= (const vec2< U > &factor)
vec2 & operator/= (const U &factor)
vec2 & operator/= (const vec2< U > &factor)
vec2 operator+ (const vec2< T > &rhs) const
vec2 operator- (const vec2< T > &rhs) const
vec2 & operator+= (const vec2< U > &rhs)
vec2 & operator-= (const vec2< U > &rhs)
void debug_dump () const throw ()
virtual void print_to (std::ostream &os) const
 Write the value to a std::ostream.
virtual void scan_from (std::istream &is)
 Read the value from a std::istream.
rutz::fstring get_string () const
 Get an rutz::fstring representation of the value.
void set_string (rutz::fstring val)
 Set the value from an rutz::fstring.

Static Public Member Functions

static vec2 zeros ()
static vec2 ones ()

Protected Member Functions

const T * const_end () const
 Returns a const pointer to one-past-the-end of the underlying storage.
T * mutable_begin ()
 Returns a non-const pointer to the start of the underlying storage.
T * mutable_end ()
 Returns a non-const pointer to one-past-the-end of the underlying storage.


Detailed Description

template<class T>
class GbVec2< T >

GbVec2 is a field class for holding 2-D vectors/points/distances.

Definition at line 44 of file gbvec.h.


Member Function Documentation

rutz::fstring rutz::value::get_string (  )  const [inherited]

Get an rutz::fstring representation of the value.

Builds a string stream, calls print_to(), and returns its value.

Definition at line 58 of file value.cc.

References rutz::value::print_to().

void rutz::value::set_string ( rutz::fstring  val  )  [inherited]

Set the value from an rutz::fstring.

Builds a string stream from val and calling scan_from() with it.

Definition at line 66 of file value.cc.

References rutz::fstring::c_str(), and rutz::value::scan_from().

Referenced by GbVec2< double >::GbVec2(), and GbVec3< double >::GbVec3().


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

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:54:29 2008 by Doxygen version 1.5.5.