# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CVector Class Reference

A 3D vector of float. More...

#include <vector.h>

Inheritance diagram for NLMISC::CVector:

NLLIGO::CPrimVector List of all members.

Public Methods

std::string asString () const
 Returns the contents as a printable string "x y z". More...

Object.
 CVector ()
 Constructor wich do nothing. More...

 CVector (float _x, float _y, float _z)
 Constructor . More...

 CVector (const CVector &v)
 Copy Constructor. More...

Base Maths.
CVector & operator+= (const CVector &v)
CVector & operator-= (const CVector &v)
CVector & operator *= (float f)
CVector & operator/= (float f)
CVector operator+ (const CVector &v) const
CVector operator- (const CVector &v) const
CVector operator * (float f) const
CVector operator/ (float f) const
CVector operator- () const
Advanced Maths.
float operator * (const CVector &v) const
 Dot product. More...

CVector operator^ (const CVector &v) const
 Cross product. More...

float norm () const
 Return the norm of the vector. More...

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

void normalize ()
 Normalize the vector. More...

CVector normed () const
 Return the vector normalized. More...

Misc.
void set (float _x, float _y, float _z)
bool operator== (const CVector &v) const
bool operator!= (const CVector &v) const
bool isNull () const
bool operator< (const CVector &v) const
 This operator is here just for map/set insertion(no meaning). comparison order is x,y,z. More...

void sphericToCartesian (float r, float theta, float phi)
 Setup the vector with spheric coordinates. More...

void cartesianToSpheric (float &r, float &theta, float &phi) const
 Get the sphreic coordinates of the vector. More...

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

void maxof (const CVector &a, const CVector &b)
 Set all vector x/y/z as maximum of a/b x/y/z (respectively). More...

void serial (IStream &f)
 serial. More...


Public Attributes

float x
float y
float z

Static Public Attributes

const CVector Null
 Null vector (0,0,0). More...

const CVector I
 I vector (1,0,0). More...

const CVector J
 J vector (0,1,0). More...

const CVector K
 K vector (0,0,1). More...


Friends

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

Detailed Description

A 3D vector of float.

Author:
Lionel Berenguier , Nevrax France
Date:
2000

Definition at line 48 of file vector.h.


Constructor & Destructor Documentation

NLMISC::CVector::CVector   [inline]
 

Constructor wich do nothing.

Definition at line 67 of file vector.h.

Referenced by cartesianToSpheric, CVector, normed, operator *, operator+, operator-, and operator^.

NLMISC::CVector::CVector float    _x,
float    _y,
float    _z
[inline]
 

Constructor .

Definition at line 69 of file vector.h.

NLMISC::CVector::CVector const CVector &    v [inline]
 

Copy Constructor.

Definition at line 71 of file vector.h.

References CVector, r, and v.


Member Function Documentation

string NLMISC::CVector::asString   const
 

Returns the contents as a printable string "x y z".

Definition at line 45 of file vector.cpp.

References x, y, and z.

void NLMISC::CVector::cartesianToSpheric float &    r,
float &    theta,
float &    phi
const [inline]
 

Get the sphreic coordinates of the vector.

See sphericToCartesian() to know coordinates conventions.

See also:
sphericToCartesian()

Definition at line 161 of file vector_inline.h.

References NLMISC::clamp, CVector, norm, normed, r, and v.

bool NLMISC::CVector::isNull   const [inline]
 

Definition at line 148 of file vector_inline.h.

Referenced by NLSOUND::CSimpleSource::setDirection, NLPACS::CGlobalRetriever::testBBoxMove, and NLPACS::CGlobalRetriever::testCylinderMove.

void NLMISC::CVector::maxof const CVector &    a,
const CVector &    b
[inline]
 

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

Definition at line 192 of file vector_inline.h.

References x, y, and z.

void NLMISC::CVector::minof const CVector &    a,
const CVector &    b
[inline]
 

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

Definition at line 186 of file vector_inline.h.

References min, x, y, and z.

float NLMISC::CVector::norm   const [inline]
 

Return the norm of the vector.

Definition at line 115 of file vector_inline.h.

References x, y, and z.

Referenced by cartesianToSpheric, NL3D::CMaterial::decompUserTexMat, NLLIGO::CPrimZone::getSegmentDist, and normalize.

void NLMISC::CVector::normalize   [inline]
 

Normalize the vector.

Definition at line 119 of file vector_inline.h.

References norm.

Referenced by NL3D::CZoneLighter::buildZoneInformation, NL3D::CPSRadialEmitter::emit, NL3D::CPSEmitterConic::emit, NL3D::CZoneLighter::light, and NL3D::CHeatHaze::performHeatHaze.

CVector NLMISC::CVector::normed   const [inline]
 

Return the vector normalized.

Definition at line 125 of file vector_inline.h.

References CVector.

Referenced by cartesianToSpheric, and NL3D::CSpecCubeMapFunctor::operator().

float NLMISC::CVector::operator * const CVector &    v const [inline]
 

Dot product.

Definition at line 97 of file vector_inline.h.

References v, x, y, and z.

CVector NLMISC::CVector::operator * float    f const [inline]
 

Definition at line 75 of file vector_inline.h.

References CVector, x, y, and z.

CVector & NLMISC::CVector::operator *= float    f [inline]
 

Definition at line 54 of file vector_inline.h.

References x, y, and z.

bool NLMISC::CVector::operator!= const CVector &    v const [inline]
 

Definition at line 144 of file vector_inline.h.

References v.

CVector NLMISC::CVector::operator+ const CVector &    v const [inline]
 

Definition at line 65 of file vector_inline.h.

References CVector, v, x, y, and z.

CVector & NLMISC::CVector::operator+= const CVector &    v [inline]
 

Definition at line 40 of file vector_inline.h.

References v, x, y, and z.

CVector NLMISC::CVector::operator-   const [inline]
 

Definition at line 84 of file vector_inline.h.

References CVector, x, y, and z.

CVector NLMISC::CVector::operator- const CVector &    v const [inline]
 

Definition at line 70 of file vector_inline.h.

References CVector, v, x, y, and z.

CVector & NLMISC::CVector::operator-= const CVector &    v [inline]
 

Definition at line 47 of file vector_inline.h.

References v, x, y, and z.

CVector NLMISC::CVector::operator/ float    f const [inline]
 

Definition at line 80 of file vector_inline.h.

CVector & NLMISC::CVector::operator/= float    f [inline]
 

Definition at line 61 of file vector_inline.h.

bool NLMISC::CVector::operator< const CVector &    v const [inline]
 

This operator is here just for map/set insertion(no meaning). comparison order is x,y,z.

Definition at line 152 of file vector_inline.h.

References v, x, y, and z.

bool NLMISC::CVector::operator== const CVector &    v const [inline]
 

Definition at line 140 of file vector_inline.h.

References v, x, y, and z.

CVector NLMISC::CVector::operator^ const CVector &    v const [inline]
 

Cross product.

compute the cross product *this ^ v.

Definition at line 101 of file vector_inline.h.

References CVector, v, x, y, and z.

void NLMISC::CVector::serial IStream   f [inline]
 

serial.

Definition at line 198 of file vector_inline.h.

References x, y, and z.

void NLMISC::CVector::set float    _x,
float    _y,
float    _z
[inline]
 

Definition at line 136 of file vector_inline.h.

References x, y, and z.

Referenced by NL3D::CZoneLighter::CLightDesc::CLightDesc, NL3D::CInstanceLighter::CLightDesc::CLightDesc, NL3D::CQuadTree::CQuadTree, NLSOUND::CSourceDSound::getDirection, NLSOUND::CSourceAL::getDirection, NLSOUND::CListenerDSound::getOrientation, NLSOUND::CListenerAL::getOrientation, NLSOUND::CSourceDSound::getVelocity, NLSOUND::CSourceAL::getVelocity, NLSOUND::CListenerDSound::getVelocity, NLSOUND::CListenerAL::getVelocity, NL3D::CZoneLighter::init, NL3D::CPSBrownianForce::initPrecalc, NL3D::CPSBrownianForce::integrate, NL3D::CHeatHaze::performHeatHaze, and NLPACS::ULocalPosition::setKeepZ.

void NLMISC::CVector::sphericToCartesian float    r,
float    theta,
float    phi
[inline]
 

Setup the vector with spheric coordinates.

sphericToCartesian(1,0,0) build the I vector ((1,0,0)). the formula is:
x= r*cos(theta)*cos(phi)
y= r*sin(theta)*cos(phi)
z= r*sin(phi)

See also:
cartesianToSpheric()

Definition at line 175 of file vector_inline.h.

References r, x, y, and z.

float NLMISC::CVector::sqrnorm   const [inline]
 

Return the square of the norm of the vector.

Definition at line 111 of file vector_inline.h.

References x, y, and z.

Referenced by NLSOUND::CSourceDSound::updateVolume.


Friends And Related Function Documentation

CVector operator * float    f,
const CVector &    v0
[friend]
 

Definition at line 88 of file vector_inline.h.


Member Data Documentation

const CVector NLMISC::CVector::I [static]
 

I vector (1,0,0).

Referenced by NL3D::CPSPlaneBasisBlender::CPSPlaneBasisBlender, NLPACS::UMoveContainer::getPACSCoordsFromMatrix, NL3D::CPSRibbon::setupTextureMatrix, and NL3D::CPSShockWave::setupUFactor.

const CVector NLMISC::CVector::J [static]
 

J vector (0,1,0).

Referenced by NL3D::CPSPlaneBasisBlender::CPSPlaneBasisBlender, NL3D::CPSRibbon::setupTextureMatrix, NL3D::CPSShockWave::setupUFactor, and NL3D::ITravCameraScene::update.

const CVector NLMISC::CVector::K [static]
 

K vector (0,0,1).

Referenced by NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater, NL3D::CPSPlaneBasisMemory::CPSPlaneBasisMemory, NL3D::CZoneLighter::lightWater, NL3D::CHeatHaze::performHeatHaze, NL3D::CPSRibbon::setupTextureMatrix, NL3D::CPSShockWave::setupUFactor, and NL3D::CAnimatedMaterial::update.

const CVector NLMISC::CVector::Null [static]
 

Null vector (0,0,0).

Referenced by NLPACS::CLocalRetriever::CLocalPosition::CLocalPosition, NL3D::CParticleSystem::computeBBox, NL3D::CPSLocated::CPostNewElementRequestInfo::CPostNewElementRequestInfo, NL3D::CSegRemanence::CSampledPos::CSampledPos, NL3D::CSegRemanenceShape::CSegRemanenceShape, NL3D::CWaterShape::CWaterShape, NL3D::CMRMMeshFinal::CWedge::CWedge, NL3D::CWaveMakerShape::getAABBox, NL3D::CParticleSystemShape::getAABBox, NL3D::UParticleSystemInstance::getGlobalVectorValue, NL3D::CParticleSystem::getGlobalVectorValue, NL3D::CParticleSystem::getGlobalVectorValueHandle, NL3D::IPSMover::getNormal, NL3D::CPSBrownianForce::initPrecalc, NL3D::ITravCameraScene::ITravCameraScene, NL3D::CHeatHaze::performHeatHaze, NL3D::CSegRemanenceShape::setNumCorners, and NL3D::CParticleSystem::setSysMat.

float NLMISC::CVector::x
 

Definition at line 51 of file vector.h.

Referenced by NLPACS::CMoveContainer::addCollisionnablePrimitiveBlock, asString, NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater, NLLIGO::CPrimZone::contains, NL3D::CMaterial::decompUserTexMat, NL3D::CCloud::dispBill, NL3D::CCloud::dispXYZ, NL3D::CPSEmitterRectangle::emit, NL3D::CCloud::genBill, NLPACS::CRetrieverInstance::getDoubleGlobalPosition, NLPACS::CRetrieverInstance::getGlobalPosition, NL3D::CPSUtil::getInterpolatedNoise, NLPACS::CRetrieverInstance::getLocalPosition, NL3D::CCloud::getSizeX, NL3D::CZoneLighter::getSkyContribution, NLSOUND::CListenerAL::getVelocity, NL3D::CCloud::getX, NL3D::CQuadTree::CQuadNode::includeBoxQuad, NL3D::CCloud::init, NL3D::CQuadTree::insert, NLPACS::CFaceGrid::CFaceGridBuild::insert, NLPACS::CLocalRetriever::insurePosition, NL3D::CPSBrownianForce::integrate, NL3D::CPSGravity::integrate, NL3D::CPSLocated::integrateSingle, NL3D::CPSBrownianForce::integrateSingle, NL3D::CPSGravity::integrateSingle, NL3D::CQuadTree::CQuadNode::intersectBox, NL3D::CQuadTree::CQuadNode::intersectBoxQuad, NL3D::CZoneLighter::light, NL3D::CZoneLighter::lightWater, NLPACS::CCollisionMeshBuild::link, maxof, minof, norm, operator *, operator *=, operator+, operator+=, operator-, operator-=, operator<, operator==, operator^, NLPACS::CVector2s::pack, NL3D::CPSBrownianForce::performDynamic, NL3D::CHeatHaze::performHeatHaze, NL3D::CCubeGrid::project, NL3D::CCloud::reset, NL3D::CQuadTree::select, NLPACS::CFaceGrid::select, NL3D::CCubeGrid::select, NL3D::CStaticQuadGrid< const CTriangle * >::selectPoint, serial, set, NL3D::CDriverGL::setConstant, NLSOUND::CSourceDSound::setDirection, NLSOUND::CSourceAL::setDirection, NLSOUND::CListenerDSound::setOrientation, NLSOUND::CListenerAL::setOrientation, NLSOUND::CSourceDSound::setPos, NLSOUND::CSourceAL::setPos, NLSOUND::CListenerDSound::setPos, NLSOUND::CListenerAL::setPos, NL3D::CCloud::setSizeX, NL3D::CWaterRenderObs::setupMaterialNVertexShader, NLSOUND::CSourceDSound::setVelocity, NLSOUND::CSourceAL::setVelocity, NLSOUND::CListenerDSound::setVelocity, NLSOUND::CListenerAL::setVelocity, NL3D::CCloud::setX, NLPACS::CRetrieverInstance::snap, sphericToCartesian, NL3D::CQuadTree::CQuadNode::split, sqrnorm, NLPACS::CGlobalRetriever::testBBoxMove, NLPACS::CGlobalRetriever::testBBoxRot, NLPACS::CGlobalRetriever::testCylinderMove, NLPACS::IQuadNode::translate, NL3D::CWaveMakerDetailObs::traverse, and NL3D::CWaterRenderObs::traverse.

float NLMISC::CVector::y
 

Definition at line 51 of file vector.h.

Referenced by NLPACS::CMoveContainer::addCollisionnablePrimitiveBlock, asString, NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater, NLLIGO::CPrimZone::contains, NL3D::CMaterial::decompUserTexMat, NL3D::CCloud::dispBill, NL3D::CCloud::dispXYZ, NL3D::CDeform2d::doDeform, NL3D::CPSEmitterRectangle::emit, NL3D::CCloud::genBill, NLPACS::CRetrieverInstance::getDoubleGlobalPosition, NLPACS::CRetrieverInstance::getGlobalPosition, NL3D::CPSUtil::getInterpolatedNoise, NLPACS::CRetrieverInstance::getLocalPosition, NL3D::CCloud::getSizeY, NL3D::CZoneLighter::getSkyContribution, NLSOUND::CListenerAL::getVelocity, NL3D::CCloud::getY, NL3D::CCloud::init, NL3D::CQuadTree::insert, NL3D::CQuadTree::CQuadNode::insert, NLPACS::CFaceGrid::CFaceGridBuild::insert, NLPACS::CLocalRetriever::insurePosition, NL3D::CPSBrownianForce::integrate, NL3D::CPSGravity::integrate, NL3D::CPSLocated::integrateSingle, NL3D::CPSBrownianForce::integrateSingle, NL3D::CPSGravity::integrateSingle, NL3D::CQuadTree::CQuadNode::intersectBox, NL3D::CZoneLighter::light, NL3D::CZoneLighter::lightWater, NLPACS::CCollisionMeshBuild::link, maxof, minof, norm, operator *, operator *=, operator+, operator+=, operator-, operator-=, operator<, operator==, operator^, NLPACS::CVector2s::pack, NL3D::CPSBrownianForce::performDynamic, NL3D::CCubeGrid::project, NL3D::CCloud::reset, NL3D::CQuadTree::select, NLPACS::CFaceGrid::select, NL3D::CCubeGrid::select, NL3D::CStaticQuadGrid< const CTriangle * >::selectPoint, serial, set, NL3D::CDriverGL::setConstant, NLSOUND::CSourceDSound::setDirection, NLSOUND::CSourceAL::setDirection, NLSOUND::CListenerDSound::setOrientation, NLSOUND::CListenerAL::setOrientation, NLSOUND::CSourceDSound::setPos, NLSOUND::CSourceAL::setPos, NLSOUND::CListenerDSound::setPos, NLSOUND::CListenerAL::setPos, NL3D::CCloud::setSizeY, NL3D::CWaterRenderObs::setupMaterialNVertexShader, NLSOUND::CSourceDSound::setVelocity, NLSOUND::CSourceAL::setVelocity, NLSOUND::CListenerDSound::setVelocity, NLSOUND::CListenerAL::setVelocity, NL3D::CCloud::setY, NLPACS::CRetrieverInstance::snap, sphericToCartesian, sqrnorm, NLPACS::CGlobalRetriever::testBBoxMove, NLPACS::CGlobalRetriever::testBBoxRot, NLPACS::CGlobalRetriever::testCylinderMove, NLPACS::IQuadNode::translate, NL3D::CWaveMakerDetailObs::traverse, and NL3D::CWaterRenderObs::traverse.

float NLMISC::CVector::z
 

Definition at line 51 of file vector.h.

Referenced by NLPACS::CMoveContainer::addCollisionnablePrimitiveBlock, NLPACS::IQuadNode::addVertex, asString, NL3D::CZoneLighter::computeTileFlagsForPositionTowardWater, NL3D::CCloud::dispBill, NL3D::CCloud::dispXYZ, NL3D::CPSEmitterRectangle::emit, NL3D::CCloud::genBill, NLPACS::CRetrieverInstance::getDoubleGlobalPosition, NLPACS::CRetrieverInstance::getGlobalPosition, NLPACS::CLocalRetriever::getHeight, NL3D::CPSUtil::getInterpolatedNoise, NLPACS::CRetrieverInstance::getLocalPosition, NL3D::CCloud::getSizeZ, NLSOUND::CListenerAL::getVelocity, NL3D::CCloud::getZ, NL3D::CQuadTree::CQuadNode::includeBoxQuad, NL3D::CCloud::init, NL3D::CQuadTree::insert, NL3D::CPSBrownianForce::integrate, NL3D::CPSGravity::integrate, NL3D::CPSLocated::integrateSingle, NL3D::CPSBrownianForce::integrateSingle, NL3D::CPSGravity::integrateSingle, NL3D::CQuadTree::CQuadNode::intersectBox, NL3D::CQuadTree::CQuadNode::intersectBoxQuad, NLPACS::CCollisionMeshBuild::link, maxof, minof, norm, operator *, operator *=, operator+, operator+=, operator-, operator-=, operator<, operator==, operator^, NL3D::CHeatHaze::performHeatHaze, NL3D::CCubeGrid::project, NL3D::CCloud::reset, NL3D::CQuadTree::select, NL3D::CCubeGrid::select, serial, set, NL3D::CDriverGL::setConstant, NLSOUND::CSourceDSound::setDirection, NLSOUND::CSourceAL::setDirection, NLPACS::ULocalPosition::setKeepZ, NLSOUND::CListenerDSound::setOrientation, NLSOUND::CListenerAL::setOrientation, NLSOUND::CSourceDSound::setPos, NLSOUND::CSourceAL::setPos, NLSOUND::CListenerDSound::setPos, NLSOUND::CListenerAL::setPos, NL3D::CCloud::setSizeZ, NL3D::CWaterRenderObs::setupMaterialNVertexShader, NLSOUND::CSourceDSound::setVelocity, NLSOUND::CSourceAL::setVelocity, NLSOUND::CListenerDSound::setVelocity, NLSOUND::CListenerAL::setVelocity, NL3D::CCloud::setZ, NLPACS::CRetrieverInstance::snap, sphericToCartesian, NL3D::CQuadTree::CQuadNode::split, sqrnorm, NLPACS::IQuadNode::translate, NL3D::CWaterRenderObs::traverse, and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus.


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