Surface_mesh  1.0
A simple and efficient halfedge-based mesh data structure
surface_mesh::Vector< Scalar, N > Class Template Reference

#include <Vector.h>

Public Types

typedef Scalar value_type
 the scalar type of the vector
 

Public Member Functions

 Vector ()
 default constructor, creates uninitialized values.
 
 Vector (const Scalar s)
 construct from scalar s (fills all components with s)
 
 Vector (const Scalar x, const Scalar y)
 construct from 2 scalars. only valid for 2D vectors.
 
 Vector (const Scalar x, const Scalar y, const Scalar z)
 construct from 3 scalars. only valid for 2D vectors.
 
 Vector (const Scalar x, const Scalar y, const Scalar z, const Scalar w)
 construct from 4 scalars. only valid for 2D vectors.
 
 Vector (Vector< Scalar, 3 > v, const Scalar w)
 construct from 3D Vector and 1 scalar. only valid for 4D vectors.
 
template<typename OtherScalarType >
 Vector (const Vector< OtherScalarType, N > &o)
 construct from vector of other scalar type
 
template<typename OtherScalarType >
 operator Vector< OtherScalarType, N > ()
 cast to vector of other scalar type
 
Scalar * data ()
 access to Scalar array
 
const Scalar * data () const
 access to const Scalar array
 
Scalar & operator[] (unsigned int i)
 get i'th element read-write
 
const Scalar operator[] (unsigned int i) const
 get i'th element read-only
 
Vector< Scalar, N > & operator= (const Scalar s)
 assign a scalar to all componenets
 
template<typename otherScalarType >
Vector< Scalar, N > & operator= (const Vector< otherScalarType, N > &o)
 assignment from a vector of different scalar type
 
bool operator== (const Vector< Scalar, N > &other) const
 component-wise comparison
 
bool operator!= (const Vector< Scalar, N > &other) const
 component-wise comparison
 
Vector< Scalar, N > & operator*= (const Scalar s)
 multiply vector by scalar s
 
Vector< Scalar, N > & operator/= (const Scalar s)
 divide vector by scalar s
 
Vector< Scalar, N > & operator*= (const Vector< Scalar, N > &v)
 component-wise multiplication by vector
 
Vector< Scalar, N > & operator/= (const Vector< Scalar, N > &v)
 component-wise division by vector
 
Vector< Scalar, N > & operator-= (const Vector< Scalar, N > &v)
 subtract vector v
 
Vector< Scalar, N > & operator+= (const Vector< Scalar, N > &v)
 add vector v
 
Vector< Scalar, N > & normalize ()
 normalize vector, return normalized vector
 
Vector< Scalar, N > minimize (const Vector< Scalar, N > &other)
 return vector with minimum of this and other in each component
 
Vector< Scalar, N > maximize (const Vector< Scalar, N > &other)
 return vector with maximum of this and other in each component
 

Static Public Member Functions

static int size ()
 returns the dimension of the vector
 

Public Attributes

Scalar data_ [N]
 

Detailed Description

template<typename Scalar, int N>
class surface_mesh::Vector< Scalar, N >

A vector class for an N-dimensional vector of scalar type T. Elements of a vector v can be accessed by v[0], v[1], ... For 3D vectors one can also use v.x, v.y and v.z.

Member Data Documentation

template<typename Scalar, int N>
Scalar surface_mesh::Vector< Scalar, N >::data_[N]

The N values of type Scalar are the only data members of this class. This guarantees 100% compatibility with arrays of type Scalar and size N, allowing us to define the cast operators to and from arrays and array pointers


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