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/a03737.html | 853 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 853 insertions(+) create mode 100644 docs/doxygen/nel/a03737.html (limited to 'docs/doxygen/nel/a03737.html') diff --git a/docs/doxygen/nel/a03737.html b/docs/doxygen/nel/a03737.html new file mode 100644 index 00000000..aa7703bf --- /dev/null +++ b/docs/doxygen/nel/a03737.html @@ -0,0 +1,853 @@ + + +NeL: NLLIGO::CZoneEdge class Reference + + + +
+

NLLIGO::CZoneEdge Class Reference

#include <zone_edge.h> +

+


Detailed Description

+A ZoneEdge descriptor

+

Author:
Cyril 'Hulud' Corvazier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 55 of file zone_edge.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

bool build (const std::vector< NLMISC::CVector > &theEdge, const std::vector< uint32 > &theId, uint rotation, sint32 offsetX, sint32 offsetY, const CLigoConfig &config, CLigoError &errors)
 Build a edge zone.

void buildMatrix (NLMISC::CMatrix &mat, const CLigoConfig &config) const
 Return the matrix.

uint getNumVertex () const
 Return the vertex count.

sint32 getOffsetX () const
sint32 getOffsetY () const
uint32 getRotation () const
 Get values.

const NLMISC::CVectorgetVertex (uint id) const
 Return the vertex.

void invert (const CLigoConfig &config)
 Invert the edge.

bool isSymetrical (const CLigoConfig &config, CLigoError &errors) const
 Is symetrical ?

bool isTheSame (const CZoneEdge &other, const CLigoConfig &config, CLigoError &errors) const
 Is the same edge ?

void serial (NLMISC::IStream &s)
 Serial.


Private Attributes

std::vector< uint32_Id
 Id of the vertices.

sint32 _OffsetX
 X an Y offset of the edge. the position of the i-th vertex is rotate (_Rotation) * (theEdge[i], 0, 0) + (_OffsetX, _OffsetY, 0).

sint32 _OffsetY
uint32 _Rotation
 Rotation of the edge. Must be 0, 1, 2, 3. The rotation angle is Pi/2 * (double)_Rotation in CCW.

std::vector< NLMISC::CVector_TheEdge
 The vector of position for this edge.

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLLIGO::CZoneEdge::build const std::vector< NLMISC::CVector > &  theEdge,
const std::vector< uint32 > &  theId,
uint  rotation,
sint32  offsetX,
sint32  offsetY,
const CLigoConfig config,
CLigoError errors
+
+ + + + + +
+   + + +

+Build a edge zone. +

+ +

+Definition at line 41 of file zone_edge.cpp. +

+References _Id, _OffsetX, _OffsetY, _Rotation, _TheEdge, NLLIGO::CLigoConfig::CellSize, NLLIGO::CLigoError::clear(), nlassert, NLLIGO::CLigoError::pushVertexError(), sint32, NLLIGO::CLigoConfig::Snap, uint, x, and y. +

+

00043 {
+00044         // Some checks
+00045         nlassert (rotation>=0);
+00046         nlassert (rotation<=3);
+00047         nlassert (theEdge.size() == theId.size());
+00048 
+00049         // Cancels errors
+00050         errors.clear ();
+00051 
+00052         // Errors ?
+00053         bool ok = true;
+00054 
+00055         // Check first position
+00056         CVector toCheck (theEdge[0].x, theEdge[0].y, 0);
+00057         if ((float)fabs (toCheck.norm())>config.Snap)
+00058         {
+00059                 // Vertex error
+00060                 errors.pushVertexError (CLigoError::UnknownError, 0);
+00061                 ok = false;
+00062         }
+00063 
+00064         // Check last position
+00065         uint lastIndex = theEdge.size()-1;
+00066         toCheck  = CVector (theEdge[lastIndex].x, theEdge[lastIndex].y, 0);
+00067         if (((toCheck-CVector (config.CellSize, 0, 0)).norm())>config.Snap)
+00068         {
+00069                 // Vertex error
+00070                 errors.pushVertexError (CLigoError::UnknownError, 0);
+00071                 ok = false;
+00072         }
+00073 
+00074         // No error ? Build!
+00075         if (ok)
+00076         {
+00077                 _TheEdge = theEdge;
+00078                 _Rotation = rotation;
+00079                 _OffsetX = offsetX;
+00080                 _OffsetY = offsetY;
+00081                 _Id = theId;
+00082         }
+00083 
+00084         return ok;
+00085 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
void NLLIGO::CZoneEdge::buildMatrix NLMISC::CMatrix mat,
const CLigoConfig config
const
+
+ + + + + +
+   + + +

+Return the matrix. +

+ +

+Definition at line 212 of file zone_edge.cpp. +

+References _OffsetX, _OffsetY, _Rotation, NLLIGO::CLigoConfig::CellSize, NLMISC::CMatrix::identity(), NLMISC::Pi, NLMISC::CMatrix::rotateZ(), and NLMISC::CMatrix::setPos(). +

+

00213 {
+00214         // Build a transformation matrix
+00215         mat.identity();
+00216         mat.rotateZ ((float)Pi*(float)_Rotation/2.f);
+00217         mat.setPos (CVector (config.CellSize*(float)_OffsetX, config.CellSize*(float)_OffsetY, 0));
+00218 }
+
+

+ + + + +
+ + + + + + + + + +
uint NLLIGO::CZoneEdge::getNumVertex  )  const [inline]
+
+ + + + + +
+   + + +

+Return the vertex count. +

+ +

+Definition at line 76 of file zone_edge.h. +

+References _TheEdge, and uint. +

+

00076 { return _TheEdge.size(); }
+
+

+ + + + +
+ + + + + + + + + +
sint32 NLLIGO::CZoneEdge::getOffsetX  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 86 of file zone_edge.h. +

+References _OffsetX, and sint32. +

+

00086 { return _OffsetX; }
+
+

+ + + + +
+ + + + + + + + + +
sint32 NLLIGO::CZoneEdge::getOffsetY  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 87 of file zone_edge.h. +

+References _OffsetY, and sint32. +

+

00087 { return _OffsetY; }
+
+

+ + + + +
+ + + + + + + + + +
uint32 NLLIGO::CZoneEdge::getRotation  )  const [inline]
+
+ + + + + +
+   + + +

+Get values. +

+ +

+Definition at line 85 of file zone_edge.h. +

+References _Rotation, and uint32. +

+

00085 { return _Rotation; }
+
+

+ + + + +
+ + + + + + + + + + +
const NLMISC::CVector& NLLIGO::CZoneEdge::getVertex uint  id  )  const [inline]
+
+ + + + + +
+   + + +

+Return the vertex. +

+ +

+Definition at line 79 of file zone_edge.h. +

+References _TheEdge, and uint. +

+

00079 { return _TheEdge[id]; }
+
+

+ + + + +
+ + + + + + + + + + +
void NLLIGO::CZoneEdge::invert const CLigoConfig config  ) 
+
+ + + + + +
+   + + +

+Invert the edge. +

+ +

+Definition at line 195 of file zone_edge.cpp. +

+References _TheEdge, NLLIGO::CLigoConfig::CellSize, and uint. +

+Referenced by NLLIGO::CTransition::build(), and NLLIGO::CTransition::check(). +

+

00196 {
+00197         // Copy the array
+00198         const std::vector<NLMISC::CVector>      copy = _TheEdge;
+00199 
+00200         // For each internal vertices
+00201         uint vert;
+00202         for (vert=0; vert<_TheEdge.size(); vert++)
+00203         {
+00204                 // Invert
+00205                 const CVector &pos = copy[_TheEdge.size()-vert-1];
+00206                 _TheEdge[vert] = CVector (config.CellSize - pos.x, pos.y, pos.z);
+00207         }
+00208 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLLIGO::CZoneEdge::isSymetrical const CLigoConfig config,
CLigoError errors
const
+
+ + + + + +
+   + + +

+Is symetrical ? +

+ +

+Definition at line 89 of file zone_edge.cpp. +

+References _Id, _TheEdge, NLLIGO::CLigoConfig::CellSize, NLLIGO::CLigoError::clear(), NLLIGO::CLigoError::MainError, NLLIGO::CLigoError::pushVertexError(), NLLIGO::CLigoConfig::Snap, and uint. +

+

00090 {
+00091         // Cancels errors
+00092         errors.clear ();
+00093 
+00094         // Errors ?
+00095         bool ok = true;
+00096 
+00097         // For each internal vertices
+00098         uint vert;
+00099         for (vert=0; vert<_TheEdge.size(); vert++)
+00100         {
+00101                 // Symmetrical value
+00102                 CVector sym = CVector (config.CellSize-_TheEdge[vert].x, _TheEdge[vert].y, _TheEdge[vert].z);
+00103 
+00104                 // Others vertices
+00105                 uint vert2;
+00106                 for (vert2=0; vert2<_TheEdge.size(); vert2++)
+00107                 {
+00108                         // Not the same ?
+00109                         if (vert != vert2)
+00110                         {
+00111                                 // Snapped ?
+00112                                 if ((_TheEdge[vert2]-sym).norm() <= config.Snap)
+00113                                 {
+00114                                         // Good, next one
+00115                                         break;
+00116                                 }
+00117                         }
+00118                 }
+00119 
+00120                 // Not found ?
+00121                 if (vert2>=_TheEdge.size())
+00122                 {
+00123                         // Error
+00124                         ok = false;
+00125 
+00126                         // Push error message
+00127                         errors.pushVertexError (CLigoError::NotSymetrical, _Id[vert]);
+00128                         errors.MainError = CLigoError::NotSymetrical;
+00129                 }
+00130         }
+00131 
+00132         // Return error code
+00133         return ok;
+00134 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLLIGO::CZoneEdge::isTheSame const CZoneEdge other,
const CLigoConfig config,
CLigoError errors
const
+
+ + + + + +
+   + + +

+Is the same edge ? +

+ +

+Definition at line 138 of file zone_edge.cpp. +

+References _Id, _TheEdge, NLLIGO::CLigoError::MainError, NLLIGO::CLigoError::pushVertexError(), NLLIGO::CLigoConfig::Snap, and uint. +

+Referenced by NLLIGO::CTransition::build(), and NLLIGO::CTransition::check(). +

+

00139 {
+00140         // Same vertex count ?
+00141         if (_TheEdge.size() != other._TheEdge.size())
+00142         {
+00143                 // Error
+00144                 errors.MainError = CLigoError::NotSameVerticesNumber;
+00145                 return false;
+00146         }
+00147 
+00148         // Errors ?
+00149         bool ok = true;
+00150 
+00151         // For each internal vertices
+00152         uint vert;
+00153         for (vert=0; vert<_TheEdge.size(); vert++)
+00154         {
+00155                 // The same ?
+00156                 const CVector &pos0 = _TheEdge[vert];
+00157                 const CVector &pos1 = other._TheEdge[vert];
+00158                 if ((pos0-pos1).norm() > config.Snap)
+00159                 {
+00160                         // Error
+00161                         ok = false;
+00162 
+00163                         // Push error message
+00164                         errors.pushVertexError (CLigoError::NotSameVertex, other._Id[vert]);
+00165                         errors.MainError = CLigoError::NotSameVertex;
+00166                 }
+00167         }
+00168 
+00169         // Return error code
+00170         return ok;
+00171 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLLIGO::CZoneEdge::serial NLMISC::IStream s  ) 
+
+ + + + + +
+   + + +

+Serial. +

+ +

+Definition at line 175 of file zone_edge.cpp. +

+References _Id, _OffsetX, _OffsetY, _Rotation, _TheEdge, and s. +

+

00176 {
+00177         // Serial the version
+00178         /*sint ver =*/ s.serialVersion (0);
+00179 
+00180         s.xmlPush ("VERTICES");
+00181                 s.serialCont (_TheEdge);
+00182         s.xmlPop ();
+00183 
+00184         s.xmlPush ("VERTICES_ID");
+00185                 s.serialCont (_Id);
+00186         s.xmlPop ();
+00187 
+00188         s.xmlSerial (_Rotation, "ROTATION");
+00189 
+00190         s.xmlSerial (_OffsetX, _OffsetY, "OFFSET");
+00191 }
+
+


Field Documentation

+

+ + + + +
+ + +
std::vector<uint32> NLLIGO::CZoneEdge::_Id [private] +
+
+ + + + + +
+   + + +

+Id of the vertices. +

+ +

+Definition at line 95 of file zone_edge.h. +

+Referenced by build(), isSymetrical(), isTheSame(), and serial().

+

+ + + + +
+ + +
sint32 NLLIGO::CZoneEdge::_OffsetX [private] +
+
+ + + + + +
+   + + +

+X an Y offset of the edge. the position of the i-th vertex is rotate (_Rotation) * (theEdge[i], 0, 0) + (_OffsetX, _OffsetY, 0). +

+ +

+Definition at line 101 of file zone_edge.h. +

+Referenced by build(), buildMatrix(), getOffsetX(), and serial().

+

+ + + + +
+ + +
sint32 NLLIGO::CZoneEdge::_OffsetY [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 102 of file zone_edge.h. +

+Referenced by build(), buildMatrix(), getOffsetY(), and serial().

+

+ + + + +
+ + +
uint32 NLLIGO::CZoneEdge::_Rotation [private] +
+
+ + + + + +
+   + + +

+Rotation of the edge. Must be 0, 1, 2, 3. The rotation angle is Pi/2 * (double)_Rotation in CCW. +

+ +

+Definition at line 98 of file zone_edge.h. +

+Referenced by build(), buildMatrix(), getRotation(), and serial().

+

+ + + + +
+ + +
std::vector<NLMISC::CVector> NLLIGO::CZoneEdge::_TheEdge [private] +
+
+ + + + + +
+   + + +

+The vector of position for this edge. +

+ +

+Definition at line 92 of file zone_edge.h. +

+Referenced by build(), getNumVertex(), getVertex(), invert(), isSymetrical(), isTheSame(), and serial().

+


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