From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03027.html | 993 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 993 insertions(+) create mode 100644 docs/doxygen/nel/a03027.html (limited to 'docs/doxygen/nel/a03027.html') diff --git a/docs/doxygen/nel/a03027.html b/docs/doxygen/nel/a03027.html new file mode 100644 index 00000000..6cfe928c --- /dev/null +++ b/docs/doxygen/nel/a03027.html @@ -0,0 +1,993 @@ + + +NeL: NLPACS::COrderedChain class Reference + + + +
+

NLPACS::COrderedChain Class Reference

#include <chain.h> +

+


Detailed Description

+A list of ordered vertices, partially delimiting 2 different surfaces. In the vertex list, we consider the following order v1 < v2 iff v1.x < v2.x || v1.x == v2.x && v1.y < v2.y The vertices composing the chain are only 2 coordinates (x, y) wide, packed on 16 bits each (which is 4 bytes per vertex.) This is the packed form of the COrderedChain3f. (4 bytes per vertex.)
Author:
Benjamin Legros

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 107 of file chain.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

void computeMinMax ()
float distance (const NLMISC::CVector &position) const
uint16 getIndexInParent () const
 Returns the index of the ochain within the parent chain.

float getLength () const
 Returns the length of the chain.

const CVector2sgetMax () const
 Returns the max vector of the chain.

const CVector2sgetMin () const
 Returns the min vector of the chain.

uint16 getParentId () const
 Returns the parent chain Id of this ordered chain.

const std::vector< CVector2s > & getVertices () const
 Returns the vertices of the chain.

bool isForward () const
 Returns true if the chain should be accessed forward within the parent CChain (see _Forward.).

const CVector2soperator[] (uint n) const
void pack (const COrderedChain3f &chain)
void serial (NLMISC::IStream &f)
void translate (const NLMISC::CVector &translation)
void traverse (sint from, sint to, bool forward, std::vector< CVector2s > &path) const

Protected Attributes

bool _Forward
 Set if the chain should be read forward within the parent CChain (for sequential access to vertices.).

uint16 _IndexInParent
 The index of the ochain within the parent chain.

float _Length
 The length of the chain.

CVector2s _Max
 The min and max vertices of the chain.

CVector2s _Min
 The min and max vertices of the chain.

uint16 _ParentId
 The parent chain Id.

std::vector< CVector2s_Vertices
 The vertices of the chain, ordered following x growth.


Friends

class CChain
class CRetrievableSurface
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + +
void NLPACS::COrderedChain::computeMinMax  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 178 of file chain.h. +

+References _Max, _Min, NLPACS::CVector2s::minof(), and uint. +

+Referenced by NLPACS::CChain::make(). +

+

00179         {
+00180                 _Min = _Max = CVector2s(0, 0);
+00181 
+00182                 if (_Vertices.empty())
+00183                         return;
+00184 
+00185                 _Min = _Max = _Vertices[0];
+00186                 uint    i;
+00187                 for (i=1; i<_Vertices.size(); ++i)
+00188                 {
+00189                         _Min.minof(_Min, _Vertices[i]);
+00190                         _Max.maxof(_Max, _Vertices[i]);
+00191                 }
+00192         }
+
+

+ + + + +
+ + + + + + + + + + +
float NLPACS::COrderedChain::distance const NLMISC::CVector position  )  const
+
+ + + + + +
+   + + +

+ +

+Definition at line 115 of file chain.cpp. +

+References len, NLMISC::CVector2f::norm(), uint, NLMISC::CVector2f::x, and NLMISC::CVector2f::y. +

+

00116 {
+00117         float           minDist = 1.0e10f;
+00118         uint            i;
+00119         CVector2f       pos = CVector2f(position);
+00120 
+00121         for (i=0; i+1<_Vertices.size(); ++i)
+00122         {
+00123                 CVector2f       a = _Vertices[i].unpack(),
+00124                                         b = _Vertices[i+1].unpack();
+00125 
+00126                 CVector2f       d = (b-a);
+00127                 float           len = d.norm();
+00128                 d /= len;
+00129                 CVector2f       n = CVector2f(d.y, -d.x);
+00130 
+00131                 float           l = (pos-a)*d;
+00132                 float           dist;
+00133 
+00134                 if (l < 0.0f)
+00135                 {
+00136                         dist = (pos-a).norm();
+00137                 }
+00138                 else if (l > len)
+00139                 {
+00140                         dist = (pos-b).norm();
+00141                 }
+00142                 else
+00143                 {
+00144                         dist = (float)fabs((pos-a)*n);
+00145                 }
+00146 
+00147                 if (dist < minDist)
+00148                 {
+00149                         minDist = dist;
+00150                 }
+00151         }
+00152 
+00153         return minDist;
+00154 }
+
+

+ + + + +
+ + + + + + + + + +
uint16 NLPACS::COrderedChain::getIndexInParent  )  const [inline]
+
+ + + + + +
+   + + +

+Returns the index of the ochain within the parent chain. +

+ +

+Definition at line 142 of file chain.h. +

+References uint16. +

+Referenced by NLPACS::CGlobalRetriever::check(), and NLPACS::COrderedChain3f::unpack(). +

+

00142 { return _IndexInParent; }
+
+

+ + + + +
+ + + + + + + + + +
float NLPACS::COrderedChain::getLength  )  const [inline]
+
+ + + + + +
+   + + +

+Returns the length of the chain. +

+ +

+Definition at line 145 of file chain.h. +

+Referenced by NLPACS::CGlobalRetriever::findPath(). +

+

00145 { return _Length; }
+
+

+ + + + +
+ + + + + + + + + +
const CVector2s& NLPACS::COrderedChain::getMax  )  const [inline]
+
+ + + + + +
+   + + +

+Returns the max vector of the chain. +

+ +

+Definition at line 154 of file chain.h. +

+References _Max. +

+Referenced by NLPACS::CLocalRetriever::retrieveAccuratePosition(), and NLPACS::CLocalRetriever::retrievePosition(). +

+

00154 { return _Max; };
+
+

+ + + + +
+ + + + + + + + + +
const CVector2s& NLPACS::COrderedChain::getMin  )  const [inline]
+
+ + + + + +
+   + + +

+Returns the min vector of the chain. +

+ +

+Definition at line 151 of file chain.h. +

+References _Min. +

+Referenced by NLPACS::CLocalRetriever::retrieveAccuratePosition(), and NLPACS::CLocalRetriever::retrievePosition(). +

+

00151 { return _Min; };
+
+

+ + + + +
+ + + + + + + + + +
uint16 NLPACS::COrderedChain::getParentId  )  const [inline]
+
+ + + + + +
+   + + +

+Returns the parent chain Id of this ordered chain. +

+ +

+Definition at line 139 of file chain.h. +

+References uint16. +

+Referenced by NLPACS::CGlobalRetriever::check(), NLPACS::CLocalRetriever::findPath(), NLPACS::CGlobalRetriever::getBorders(), NLPACS::CLocalRetriever::retrieveAccuratePosition(), NLPACS::CLocalRetriever::retrievePosition(), NLPACS::CLocalRetriever::testCollision(), and NLPACS::COrderedChain3f::unpack(). +

+

00139 { return _ParentId; }
+
+

+ + + + +
+ + + + + + + + + +
const std::vector<CVector2s>& NLPACS::COrderedChain::getVertices  )  const [inline]
+
+ + + + + +
+   + + +

+Returns the vertices of the chain. +

+ +

+Definition at line 133 of file chain.h. +

+Referenced by NLPACS::CLocalRetriever::buildSurfacePolygons(), NLPACS::computeRetriever(), NLPACS::CLocalRetriever::dumpSurface(), NLPACS::CGlobalRetriever::findPath(), NLPACS::CLocalRetriever::insurePosition(), NLPACS::CLocalRetriever::retrieveAccuratePosition(), NLPACS::CLocalRetriever::retrievePosition(), NLPACS::CLocalRetriever::CIterator::setupIndex(), NLPACS::CLocalRetriever::testCollision(), and NLPACS::COrderedChain3f::unpack(). +

+

00133 { return _Vertices; }
+
+

+ + + + +
+ + + + + + + + + +
bool NLPACS::COrderedChain::isForward  )  const [inline]
+
+ + + + + +
+   + + +

+Returns true if the chain should be accessed forward within the parent CChain (see _Forward.). +

+ +

+Definition at line 136 of file chain.h. +

+Referenced by NLPACS::CLocalRetriever::buildSurfacePolygons(), NLPACS::CLocalRetriever::insurePosition(), NLPACS::CLocalRetriever::retrieveAccuratePosition(), NLPACS::CLocalRetriever::retrievePosition(), NLPACS::CLocalRetriever::CIterator::setupIndex(), and NLPACS::COrderedChain3f::unpack(). +

+

00136 { return _Forward; }
+
+

+ + + + +
+ + + + + + + + + + +
const CVector2s& NLPACS::COrderedChain::operator[] uint  n  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 148 of file chain.h. +

+References uint. +

+

00148 { return _Vertices[n]; }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::COrderedChain::pack const COrderedChain3f chain  )  [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 161 of file chain.h. +

+References _Max, _Min, NLPACS::COrderedChain3f::getIndexInParent(), NLPACS::COrderedChain3f::getParentId(), NLPACS::COrderedChain3f::getVertices(), NLPACS::COrderedChain3f::isForward(), NLPACS::CVector2s::maxof(), NLPACS::CVector2s::minof(), and uint. +

+Referenced by NLPACS::CChain::make(). +

+

00162         {
+00163                 uint    i;
+00164                 const std::vector<NLMISC::CVector>      &vertices = chain.getVertices();
+00165                 _Vertices.resize(vertices.size());
+00166                 _Forward = chain.isForward();
+00167                 _ParentId = chain.getParentId();
+00168                 _IndexInParent = chain.getIndexInParent();
+00169                 for (i=0; i<vertices.size(); ++i)
+00170                 {
+00171                         _Vertices[i] = CVector2s(vertices[i]);
+00172                         _Min.minof(_Min, _Vertices[i]);
+00173                         _Max.maxof(_Max, _Vertices[i]);
+00174                 }
+00175         }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::COrderedChain::serial NLMISC::IStream f  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 158 of file chain.cpp. +

+References _Max, _Min, NLMISC::IStream::isReading(), NLPACS::CVector2s::maxof(), NLMISC::IStream::serial(), NLMISC::IStream::serialCont(), NLMISC::IStream::serialVersion(), sint, and uint. +

+

00159 {
+00160         /*
+00161         Version 0:
+00162                 - base version.
+00163         Version 1:
+00164                 - added _Min and _Max vectors
+00165         */
+00166         sint    ver= f.serialVersion(1);
+00167 
+00168         f.serialCont(_Vertices);
+00169         f.serial(_Forward);
+00170         f.serial(_ParentId);
+00171         f.serial(_IndexInParent);
+00172         f.serial(_Length);
+00173 
+00174         if (ver >= 1)
+00175         {
+00176                 f.serial(_Min, _Max);
+00177         }
+00178         else if (f.isReading() && !_Vertices.empty())
+00179         {
+00180                 uint    i;
+00181                 _Max = _Min = _Vertices[0];
+00182                 for (i=1; i<_Vertices.size(); ++i)
+00183                 {
+00184                         _Min.minof(_Min, _Vertices[i]);
+00185                         _Max.maxof(_Max, _Vertices[i]);
+00186                 }
+00187         }
+00188 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLPACS::COrderedChain::translate const NLMISC::CVector translation  ) 
+
+ + + + + +
+   + + +

+ +

+Definition at line 83 of file chain.cpp. +

+References NLPACS::CVector2s::pack(), and uint. +

+

00084 {
+00085         uint    i;
+00086         CVector2s       translat;
+00087         translat.pack(translation);
+00088         for (i=0; i<_Vertices.size(); ++i)
+00089                 _Vertices[i] += translat;
+00090 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLPACS::COrderedChain::traverse sint  from,
sint  to,
bool  forward,
std::vector< CVector2s > &  path
const
+
+ + + + + +
+   + + +

+ +

+Definition at line 93 of file chain.cpp. +

+References from, and sint. +

+

00094 {
+00095         sint    i;
+00096         if (forward)
+00097         {
+00098                 if (from < 0)   from = 0;
+00099                 if (to < 0)             to = _Vertices.size()-1;
+00100 
+00101                 for (i=from+1; i<=to; ++i)
+00102                         path.push_back(_Vertices[i]);
+00103         }
+00104         else
+00105         {
+00106                 if (from < 0)   from = _Vertices.size()-2;
+00107                 if (to < 0)             to = -1;
+00108 
+00109                 for (i=from; i>to; --i)
+00110                         path.push_back(_Vertices[i]);
+00111         }
+00112 }
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend class CChain [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 110 of file chain.h.

+

+ + + + +
+ + +
friend class CRetrievableSurface [friend] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 111 of file chain.h.

+


Field Documentation

+

+ + + + +
+ + +
bool NLPACS::COrderedChain::_Forward [protected] +
+
+ + + + + +
+   + + +

+Set if the chain should be read forward within the parent CChain (for sequential access to vertices.). +

+ +

+Definition at line 117 of file chain.h.

+

+ + + + +
+ + +
uint16 NLPACS::COrderedChain::_IndexInParent [protected] +
+
+ + + + + +
+   + + +

+The index of the ochain within the parent chain. +

+ +

+Definition at line 123 of file chain.h.

+

+ + + + +
+ + +
float NLPACS::COrderedChain::_Length [protected] +
+
+ + + + + +
+   + + +

+The length of the chain. +

+ +

+Definition at line 126 of file chain.h. +

+Referenced by NLPACS::CChain::make().

+

+ + + + +
+ + +
CVector2s NLPACS::COrderedChain::_Max [protected] +
+
+ + + + + +
+   + + +

+The min and max vertices of the chain. +

+ +

+Definition at line 129 of file chain.h. +

+Referenced by computeMinMax(), getMax(), pack(), and serial().

+

+ + + + +
+ + +
CVector2s NLPACS::COrderedChain::_Min [protected] +
+
+ + + + + +
+   + + +

+The min and max vertices of the chain. +

+ +

+Definition at line 129 of file chain.h. +

+Referenced by computeMinMax(), getMin(), pack(), and serial().

+

+ + + + +
+ + +
uint16 NLPACS::COrderedChain::_ParentId [protected] +
+
+ + + + + +
+   + + +

+The parent chain Id. +

+ +

+Definition at line 120 of file chain.h.

+

+ + + + +
+ + +
std::vector<CVector2s> NLPACS::COrderedChain::_Vertices [protected] +
+
+ + + + + +
+   + + +

+The vertices of the chain, ordered following x growth. +

+ +

+Definition at line 114 of file chain.h. +

+Referenced by NLPACS::CChain::make().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 14:19:35 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1