00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "geometry.hh"
00026
00027 namespace GMap3d
00028 {
00029
00030 INLINE
00031 void CGMapVertex::empty()
00032 {
00033 CGMap::empty();
00034
00035 setOrbitUsed(ORBIT_VERTEX);
00036 }
00037
00038 INLINE
00039 CDart* CGMapVertex::newDart()
00040 {
00041 return new CDartVertex(FMaskMarks);
00042 }
00043
00044 INLINE
00045 void CGMapVertex::delDart(CDart * ADart)
00046 {
00047 assert(ADart != NULL);
00048
00049 delete static_cast<CDartVertex *>(ADart);
00050 }
00051
00052 INLINE
00053 CDart* CGMapVertex::addMapDart()
00054 {
00055 return CGMapGeneric::addMapDart();
00056 }
00057
00058 INLINE
00059 CDartVertex* CGMapVertex::addMapDart(const CVertex & AVertex)
00060 {
00061 CDartVertex * dart = static_cast<CDartVertex *>(CGMapGeneric::addMapDart());
00062 setVertex(dart, AVertex);
00063 return dart;
00064 }
00065
00066 INLINE
00067 TCoordinate CGMapVertex::getBurstCoef(int ADim) const
00068 {
00069 assert(ADim>=0 && ADim<=3);
00070
00071 return FBurstCoef[ADim];
00072 }
00073
00074 INLINE
00075 void CGMapVertex::setBurstCoef(int ADim, TCoordinate ACoef)
00076 {
00077 assert(ADim >=0 && ADim <=3);
00078 assert(ACoef>=0 && ACoef<=1);
00079
00080 FBurstCoef[ADim]= ACoef;
00081 }
00082
00083 INLINE
00084 CAttributeVertex * CGMapVertex::findVertex(CDart* ADart)
00085 {
00086 assert(ADart!=NULL);
00087
00088 return static_cast<CAttributeVertex *>
00089 (getAttribute(ADart, ORBIT_VERTEX, ATTRIBUTE_VERTEX));
00090 }
00091
00092 INLINE
00093 CAttributeVertex * CGMapVertex::getVertex(CDart* ADart) const
00094 {
00095 assert(ADart!=NULL);
00096
00097 return static_cast<CAttributeVertex *>
00098 (ADart->getAttribute(ORBIT_VERTEX, ATTRIBUTE_VERTEX));
00099 }
00100
00101 INLINE
00102 void CGMapVertex::setVertex(CDart* ADart, const CVertex & AVertex)
00103 {
00104 assert(ADart!=NULL);
00105 assert(findVertex(ADart)==NULL);
00106
00107 addAttribute(ADart, ORBIT_VERTEX, new CAttributeVertex(AVertex));
00108 }
00109
00110 INLINE
00111 void CGMapVertex::setVertex(CDart* ADart, CAttributeVertex * AVertex)
00112 {
00113 assert(ADart!=NULL);
00114 assert(AVertex!=NULL);
00115 assert(findVertex(ADart)==NULL);
00116
00117 addAttribute(ADart, ORBIT_VERTEX, AVertex);
00118 }
00119
00120 INLINE
00121 void CGMapVertex::updateVertex(CDart* ADart, const CVertex & AVertex)
00122 {
00123 assert(ADart!=NULL);
00124
00125 CAttributeVertex * vertex = findVertex(ADart);
00126
00127 if (vertex==NULL)
00128 addAttribute(ADart, ORBIT_VERTEX, new CAttributeVertex(AVertex));
00129 else
00130 *vertex = AVertex;
00131 }
00132
00133 INLINE
00134 void CGMapVertex::delVertex(CDart* ADart)
00135 {
00136 assert(ADart!=NULL);
00137
00138 deleteAttribute(ADart, ORBIT_VERTEX, ATTRIBUTE_VERTEX);
00139 }
00140
00141 INLINE
00142 CAttributeVertex * CGMapVertex::removeVertex(CDart* ADart)
00143 {
00144 assert(ADart!=NULL);
00145
00146 return
00147 static_cast<CAttributeVertex *>(removeAttribute(ADart, ORBIT_VERTEX,
00148 ATTRIBUTE_VERTEX));
00149 }
00150
00151 INLINE
00152 CVertex & CGMapVertex::getBurstVertex(CDart* ADart) const
00153 {
00154 assert(ADart!=NULL);
00155 return (static_cast<CDartVertex *>(ADart))->getBurstVertex();
00156 }
00157
00158 INLINE
00159 void CGMapVertex::setBurstVertex(CDart* ADart, const CVertex & AVertex)
00160 {
00161 assert(ADart!=NULL);
00162 static_cast<CDartVertex *>(ADart)->setBurstVertex(AVertex);
00163 }
00164
00165 INLINE
00166 CVertex CGMapVertex::computeBurstExtremity(CDart* ADart) const
00167 {
00168 if (isFree0(ADart))
00169 return getBurstVertex(ADart);
00170
00171 TCoordinate k0 = FBurstCoef[0];
00172
00173 CVertex& v1 = getBurstVertex( ADart );
00174 CVertex& v2 = getBurstVertex(alpha0(ADart));
00175
00176
00177
00178 k0 /= 2;
00179
00180 return k0*v2 + (1-k0)*v1;
00181 }
00182
00183 INLINE
00184 CAttributeVertex*
00185 CGMapVertex::getDirectInfoAsAttributeVertex(CDart* ADart,
00186 int ADirectInfoIndex) const
00187 {
00188 assert(ADart!=NULL);
00189 return static_cast<CAttributeVertex*>(ADart->getDirectInfo(ADirectInfoIndex));
00190 }
00191
00192 INLINE
00193 CVertex*
00194 CGMapVertex::getDirectInfoAsVertex(CDart* ADart, int ADirectInfoIndex) const
00195 {
00196 assert(ADart!=NULL);
00197 return static_cast<CVertex*>(ADart->getDirectInfo(ADirectInfoIndex));
00198 }
00199
00200 INLINE
00201 TCoordinate*
00202 CGMapVertex::getDirectInfoAsCoord(CDart* ADart, int ADirectInfoIndex) const
00203 {
00204 assert(ADart!=NULL);
00205 return static_cast<TCoordinate*>(ADart->getDirectInfo(ADirectInfoIndex));
00206 }
00207
00208 }
00209