NLMISC::CVector2f Class Reference

#include <vector_2f.h>


Detailed Description

A 2D vector of float.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 47 of file vector_2f.h.

Public Member Functions

Object.
CVector asVector () const
 CVector2f (const CVector &v)
 Constructor that uses the (x,y) coordinates of a CVector.

 CVector2f (const CVector2f &v)
 Copy Constructor.

 CVector2f (float _x, float _y)
 Constructor.

 CVector2f ()
 Constructor wich do nothing.

 operator CVector () const
Misc.
bool isNull () const
void maxof (const CVector2f &a, const CVector2f &b)
 Set all vector x/y/z as maximum of a/b x/y/z (respectively).

void minof (const CVector2f &a, const CVector2f &b)
 Set all vector x/y/z as minimum of a/b x/y/z (respectively).

bool operator!= (const CVector2f &v) const
bool operator== (const CVector2f &v) const
void serial (NLMISC::IStream &f)
 serial.

void set (float _x, float _y)
Advanced Maths.
float norm () const
 Return the norm of the vector.

void normalize ()
 Normalize the vector.

CVector2f normed () const
 Return the vector normalized.

float operator * (const CVector2f &v) const
 Dot product.

float sqrnorm () const
 Return the square of the norm of the vector.

Base Maths.
CVector2f operator * (float f) const
CVector2foperator *= (float f)
CVector2f operator+ (const CVector2f &v) const
CVector2foperator+= (const CVector2f &v)
CVector2f operator- () const
CVector2f operator- (const CVector2f &v) const
CVector2foperator-= (const CVector2f &v)
CVector2f operator/ (float f) const
CVector2foperator/= (float f)

Data Fields

float x
float y

Static Public Attributes

Constants
const CVector2f Null

Friends

CVector2f operator * (float f, const CVector2f &v0)


Constructor & Destructor Documentation

NLMISC::CVector2f::CVector2f  )  [inline]
 

Constructor wich do nothing.

Definition at line 58 of file vector_2f.h.

Referenced by operator *(), operator+(), operator-(), and operator/().

00058 {}

NLMISC::CVector2f::CVector2f float  _x,
float  _y
[inline]
 

Constructor.

Definition at line 60 of file vector_2f.h.

References x, and y.

00060 : x(_x), y(_y) {}

NLMISC::CVector2f::CVector2f const CVector2f v  )  [inline]
 

Copy Constructor.

Definition at line 62 of file vector_2f.h.

References v, x, and y.

00062 : x(v.x), y(v.y) {}

NLMISC::CVector2f::CVector2f const CVector v  )  [inline]
 

Constructor that uses the (x,y) coordinates of a CVector.

Definition at line 64 of file vector_2f.h.

References v, x, and y.

00064 : x(v.x), y(v.y) {}


Member Function Documentation

CVector NLMISC::CVector2f::asVector  )  const [inline]
 

Definition at line 68 of file vector_2f.h.

References x, and y.

Referenced by operator CVector().

00068 { return CVector(x, y, 0); }

bool NLMISC::CVector2f::isNull  )  const [inline]
 

Definition at line 113 of file vector_2f.h.

References x, and y.

Referenced by NLPACS::CEdgeCollide::testCircleMove().

00113 {return x==0.0f && y==0.0f;}

void NLMISC::CVector2f::maxof const CVector2f a,
const CVector2f b
[inline]
 

Set all vector x/y/z as maximum of a/b x/y/z (respectively).

Definition at line 121 of file vector_2f.h.

References x, x, y, and y.

00122         {
00123                 x= std::max(a.x, b.x);
00124                 y= std::max(a.y, b.y);
00125         }

void NLMISC::CVector2f::minof const CVector2f a,
const CVector2f b
[inline]
 

Set all vector x/y/z as minimum of a/b x/y/z (respectively).

Definition at line 115 of file vector_2f.h.

References min, x, x, y, and y.

00116         {
00117                 x= std::min(a.x, b.x);
00118                 y= std::min(a.y, b.y);
00119         }

float NLMISC::CVector2f::norm  )  const [inline]
 

Return the norm of the vector.

Definition at line 89 of file vector_2f.h.

References sqrnorm().

Referenced by NLPACS::COrderedChain::distance(), normalize(), NLPACS::testCirclePoint(), and NLPACS::CEdgeCollide::testEdgeMove().

00089 {return (float)sqrt(sqrnorm());}

void NLMISC::CVector2f::normalize  )  [inline]
 

Normalize the vector.

Definition at line 93 of file vector_2f.h.

References norm().

Referenced by NLPACS::CEdgeCollide::make(), and NLPACS::CEdgeCollide::testCircleMove().

00094         {
00095                 float   f= norm();
00096                 if(f>0)
00097                         *this/=f;
00098         }

CVector2f NLMISC::CVector2f::normed  )  const [inline]
 

Return the vector normalized.

Definition at line 100 of file vector_2f.h.

References v.

Referenced by NLPACS::CLocalRetriever::snapToInteriorGround().

00101         {
00102                 CVector2f       v= *this;
00103                 v.normalize();
00104                 return v;
00105         }

float NLMISC::CVector2f::operator * const CVector2f v  )  const [inline]
 

Dot product.

Definition at line 87 of file vector_2f.h.

References v, x, and y.

00087 {return x*v.x + y*v.y;}

CVector2f NLMISC::CVector2f::operator * float  f  )  const [inline]
 

Definition at line 79 of file vector_2f.h.

References CVector2f(), x, and y.

00079 {return CVector2f(x*f, y*f);}

CVector2f& NLMISC::CVector2f::operator *= float  f  )  [inline]
 

Definition at line 75 of file vector_2f.h.

References x, and y.

00075 {x*=f; y*=f; return *this;}

NLMISC::CVector2f::operator CVector  )  const [inline]
 

Definition at line 66 of file vector_2f.h.

References asVector().

00066 { return this->asVector(); }

bool NLMISC::CVector2f::operator!= const CVector2f v  )  const [inline]
 

Definition at line 112 of file vector_2f.h.

References v.

00112 {return !(*this==v);}

CVector2f NLMISC::CVector2f::operator+ const CVector2f v  )  const [inline]
 

Definition at line 77 of file vector_2f.h.

References CVector2f(), v, x, and y.

00077 {return CVector2f(x+v.x, y+v.y);}

CVector2f& NLMISC::CVector2f::operator+= const CVector2f v  )  [inline]
 

Definition at line 73 of file vector_2f.h.

References v, x, and y.

00073 {x+=v.x; y+=v.y; return *this;}

CVector2f NLMISC::CVector2f::operator-  )  const [inline]
 

Definition at line 81 of file vector_2f.h.

References CVector2f(), x, and y.

00081 {return CVector2f(-x, -y);}

CVector2f NLMISC::CVector2f::operator- const CVector2f v  )  const [inline]
 

Definition at line 78 of file vector_2f.h.

References CVector2f(), v, x, and y.

00078 {return CVector2f(x-v.x, y-v.y);}

CVector2f& NLMISC::CVector2f::operator-= const CVector2f v  )  [inline]
 

Definition at line 74 of file vector_2f.h.

References v, x, and y.

00074 {x-=v.x; y-=v.y; return *this;}

CVector2f NLMISC::CVector2f::operator/ float  f  )  const [inline]
 

Definition at line 80 of file vector_2f.h.

References CVector2f(), x, and y.

00080 {return CVector2f(x/f, y/f);}

CVector2f& NLMISC::CVector2f::operator/= float  f  )  [inline]
 

Definition at line 76 of file vector_2f.h.

References x, and y.

00076 {x/=f; y/=f; return *this;}

bool NLMISC::CVector2f::operator== const CVector2f v  )  const [inline]
 

Definition at line 111 of file vector_2f.h.

References v, x, and y.

00111 {return x==v.x && y==v.y;}

void NLMISC::CVector2f::serial NLMISC::IStream f  )  [inline]
 

serial.

Definition at line 127 of file vector_2f.h.

References NLMISC::IStream::serial(), x, and y.

00127 {f.serial(x,y);}

void NLMISC::CVector2f::set float  _x,
float  _y
[inline]
 

Definition at line 110 of file vector_2f.h.

References x, and y.

Referenced by NL3D::CPatch::bind(), NL3D::CPatchUVLocator::build(), NLMISC::BuildHermiteVector(), NL3D::CPatch::computeDisplaceCornerSmooth(), NL3D::CPatch::computeDisplaceEdgeSmooth(), NL3D::CPatch::computeDisplaceRawOnNeighbor(), NL3D::CPatch::computeNearBlockLightmap(), NL3D::CPatch::computeNormalCornerSmooth(), NL3D::CPatch::computeNormalEdgeSmooth(), NL3D::CPatch::computeNormalOnNeighbor(), NL3D::CWaterShape::CWaterShape(), NL3D::CPSMultiTexturedParticle::enableAlternateTex(), NL3D::CPSMultiTexturedParticle::enableMultiTexture(), and NL3D::CWaterModel::updateDiffuseMapMatrix().

00110 {x= _x; y=_y;}

float NLMISC::CVector2f::sqrnorm  )  const [inline]
 

Return the square of the norm of the vector.

Definition at line 91 of file vector_2f.h.

References x, and y.

Referenced by NLPACS::CLocalRetriever::insurePosition(), and norm().

00091 {return x*x + y*y;}


Friends And Related Function Documentation

CVector2f operator * float  f,
const CVector2f v0
[friend]
 

Definition at line 140 of file vector_2f.h.

00141 {
00142         return v*f;
00143 }


Field Documentation

const CVector2f NLMISC::CVector2f::Null [static]
 

float NLMISC::CVector2f::x
 

Definition at line 52 of file vector_2f.h.

Referenced by NL3D::CPatch::bind(), NL3D::CPatchUVLocator::build(), NLMISC::BuildHermiteVector(), NL3D::CPatch::computeContinousVertex(), NL3D::CPatch::computeDisplaceCornerSmooth(), NL3D::CPatch::computeDisplaceEdgeSmooth(), NL3D::CPatch::computeDisplaceRawOnNeighbor(), NLMISC::CPolygon2D::computeInnerBorders(), NL3D::CPatch::computeNearBlockLightmap(), NL3D::CPatch::computeNormalCornerSmooth(), NL3D::CPatch::computeNormalEdgeSmooth(), NL3D::CPatch::computeNormalOnNeighbor(), NLMISC::CPolygon2D::computeOuterBorders(), NL3D::CPatch::computeTileLightmapPixelAroundCorner(), NLMISC::CPolygon2D::contains(), NLPACS::COrderedChain::distance(), NL3D::CWaterModel::doSimpleRender(), NL3D::FillQuadCoords(), NL3D::FillQuadCoordsLocalTime(), NL3D::CVegetable::generateGroupEx(), NL3D::CWaterModel::getAttenuatedHeight(), NLMISC::CPolygon2D::getBestTriplet(), NL3D::CWaterHeightMap::getHeight(), NLMISC::CPolygon2D::getLineEquation(), NL3D::CPSQuad::getNeededVB(), NL3D::CZoneLighter::getNormal(), NL3D::CSurfaceLightGrid::getStaticLightSetup(), NLPACS::CLocalRetriever::insurePosition(), NLMISC::CPolygon2D::intersect(), NL3D::CZoneLighter::isLumelOnEdgeMustBeOversample(), NL3D::CZoneLighter::lightWater(), NLPACS::CEdgeCollide::make(), maxof(), minof(), NL3D::CPatchUVLocator::CUVBasis::mulPoint(), NLMISC::operator<(), NL3D::CWaterHeightMap::perturbate(), NL3D::CWaterHeightMap::perturbatePoint(), NLMISC::CMouseSmoother::samplePos(), NLMISC::ScanEdge(), NL3D::CPatchUVLocator::selectPatch(), NL3D::CWaterModel::setupMaterialNVertexShader(), NL3D::CVegetableManager::setupVertexProgramConstants(), NLPACS::CLocalRetriever::snapToInteriorGround(), NLMISC::CPolygon2D::sumDPAgainstLine(), NLPACS::CEdgeCollide::testBBoxCollide(), NLPACS::CEdgeCollide::testBBoxMove(), NLPACS::testCirclePoint(), NLPACS::CGlobalRetriever::testCollisionWithCollisionChains(), NLPACS::CGlobalRetriever::testMovementWithCollisionChains(), NLPACS::CEdgeCollide::testPointMove(), NLMISC::CPolygon::toConvexPolygonsEdgeIntersect(), NL3D::CWaterModel::updateDiffuseMapMatrix(), and NL3D::CPSQuad::updateVbColNUVForRender().

float NLMISC::CVector2f::y
 

Definition at line 52 of file vector_2f.h.

Referenced by NL3D::CPatch::bind(), NL3D::CPatchUVLocator::build(), NLMISC::CPolygon2D::buildConvexHull(), NLMISC::BuildHermiteVector(), NL3D::CEdge::CEdge(), NL3D::CPatch::computeContinousVertex(), NL3D::CPatch::computeDisplaceCornerSmooth(), NL3D::CPatch::computeDisplaceEdgeSmooth(), NL3D::CPatch::computeDisplaceRawOnNeighbor(), NLMISC::CPolygon2D::computeInnerBorders(), NL3D::CPatch::computeNearBlockLightmap(), NL3D::CPatch::computeNormalCornerSmooth(), NL3D::CPatch::computeNormalEdgeSmooth(), NL3D::CPatch::computeNormalOnNeighbor(), NLMISC::CPolygon2D::computeOuterBorders(), NL3D::CPatch::computeTileLightmapPixelAroundCorner(), NLMISC::CPolygon2D::contains(), NLPACS::COrderedChain::distance(), NL3D::CWaterModel::doSimpleRender(), NL3D::FillQuadCoords(), NL3D::FillQuadCoordsLocalTime(), NL3D::CVegetable::generateGroupEx(), NL3D::CWaterModel::getAttenuatedHeight(), NLMISC::CPolygon2D::getBestTriplet(), NL3D::CWaterHeightMap::getHeight(), NLMISC::CPolygon2D::getLineEquation(), NL3D::CPSQuad::getNeededVB(), NL3D::CZoneLighter::getNormal(), NL3D::CSurfaceLightGrid::getStaticLightSetup(), NLPACS::CLocalRetriever::insurePosition(), NLMISC::CPolygon2D::intersect(), NL3D::CZoneLighter::isLumelOnEdgeMustBeOversample(), NL3D::CZoneLighter::lightWater(), NLPACS::CEdgeCollide::make(), maxof(), minof(), NL3D::CPatchUVLocator::CUVBasis::mulPoint(), NLMISC::operator<(), NL3D::operator<(), NL3D::CWaterHeightMap::perturbate(), NL3D::CWaterHeightMap::perturbatePoint(), NLMISC::CMouseSmoother::samplePos(), NLMISC::ScanEdge(), NL3D::CPatchUVLocator::selectPatch(), NL3D::CWaterModel::setupMaterialNVertexShader(), NL3D::CVegetableManager::setupVertexProgramConstants(), NLPACS::CLocalRetriever::snapToInteriorGround(), NLMISC::CPolygon2D::sumDPAgainstLine(), NLPACS::CEdgeCollide::testBBoxCollide(), NLPACS::CEdgeCollide::testBBoxMove(), NLPACS::testCirclePoint(), NLPACS::CGlobalRetriever::testCollisionWithCollisionChains(), NLPACS::CGlobalRetriever::testMovementWithCollisionChains(), NLPACS::CEdgeCollide::testPointMove(), NLMISC::CPolygon::toConvexPolygonsEdgeIntersect(), and NL3D::CWaterModel::updateDiffuseMapMatrix().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:42:24 2004 for NeL by doxygen 1.3.6