89 WOEdge *woedge = *_edge_it;
111 vector<WEdge *>::const_iterator it;
113 if ((*it)->GetNumberOfOEdges() == 1) {
119 if (!(*it)->GetaOEdge()->GetaFace()) {
159WOEdge **WVertex::incoming_edge_iterator::operator->()
161 WOEdge **ppaOEdge = (*_iter)->GetaOEdge();
162 if (aOEdge->GetbVertex() == _vertex) {
166 WOEdge *bOEdge = (*_iter)->GetbOEdge();
191 _vec = iBrother.
_vec;
203 return GetOwner()->GetOtherOEdge(
this);
208 return _pbFace->GetPrevOEdge(
this);
264 _Mark = iBrother.
_Mark;
278 return getShape()->frs_material(_FrsMaterialIndex);
284 vector<WEdge *> &v1Edges = v1->
GetEdges();
285 for (vector<WEdge *>::iterator it1 = v1Edges.begin(), end = v1Edges.end(); it1 != end; it1++) {
291 cerr <<
"Warning: edge " << v1->
GetId() <<
" - " <<
v2->GetId()
292 <<
" appears twice, correcting" << endl;
295 (*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1);
305 cerr <<
"Warning: edge " << v1->
GetId() <<
" - " <<
v2->GetId()
306 <<
" appears twice, correcting" << endl;
309 (*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1);
325 WOEdge *pInvertEdge =
nullptr;
326 vector<WEdge *> &v2Edges =
v2->GetEdges();
327 vector<WEdge *>::iterator it;
328 for (it = v2Edges.begin(); it != v2Edges.end(); it++) {
329 if ((*it)->GetbVertex() == v1) {
332 pInvertEdge = (*it)->GetaOEdge();
351 edge = instanciateEdge();
364 if (v1->
GetId() ==
v2->GetId()) {
365 cerr <<
"Warning: edge " <<
this <<
" null with vertex " << v1->
GetId() << endl;
368 edge->AddOEdge(pOEdge);
382 if (_OEdgeList.size() != 3) {
386 vector<WOEdge *>::iterator it;
388 for (it = _OEdgeList.begin(); it != _OEdgeList.end(); it++) {
389 if ((*it)->GetaVertex() ==
v) {
397 for (it = _OEdgeList.begin(); it != _OEdgeList.end(); it++) {
398 if (((*it)->GetaVertex() !=
v) && ((*it)->GetbVertex() !=
v)) {
411 vector<WOEdge *>::iterator it;
412 Vec3f origin = (*(_OEdgeList.begin()))->GetaVertex()->GetVertex();
413 it = _OEdgeList.begin();
415 for (it = it++; it != _OEdgeList.end(); it++) {
416 Vec3f v1 =
Vec3f((*it)->GetaVertex()->GetVertex() - origin);
417 Vec3f v2 =
Vec3f((*it)->GetbVertex()->GetVertex() - origin);
418 a += (v1 ^
v2).
norm() / 2.0f;
425 vector<WOEdge *>::iterator woe, woend, woefirst;
426 woefirst = _OEdgeList.begin();
427 woend = _OEdgeList.end();
431 for (; woe != woend; woe++) {
432 if ((*woe) == iOEdge) {
438 if ((*woefirst) == iOEdge) {
469 _Name = iBrother.
_Name;
473 _meanEdgeSize = iBrother._meanEdgeSize;
474 iBrother.bbox(_min, _max);
477 vector<WVertex *>::iterator
v = vertexList.begin(), vend = vertexList.end();
478 for (;
v != vend; ++
v) {
483 AddVertex(newVertex);
486 vector<WEdge *> &edgeList = iBrother.
getEdgeList();
487 vector<WEdge *>::iterator
e = edgeList.begin(), eend = edgeList.end();
488 for (;
e != eend; ++
e) {
494 vector<WFace *> &faceList = iBrother.
GetFaceList();
495 vector<WFace *>::iterator f = faceList.begin(), fend = faceList.end();
496 for (; f != fend; ++f) {
503 vend = _VertexList.end();
504 for (
v = _VertexList.begin();
v != vend; ++
v) {
505 const vector<WEdge *> &vedgeList = (*v)->GetEdges();
506 vector<WEdge *> newvedgelist;
508 for (i = 0; i < vedgeList.size(); i++) {
509 WEdge *current = vedgeList[i];
511 newvedgelist.push_back(currentvedata->
_copy);
513 (*v)->setEdges(newvedgelist);
519 WOEdge *aoEdge = (*e)->GetaOEdge();
529 WOEdge *boEdge = (*e)->GetbOEdge();
541 fend = _FaceList.end();
542 for (f = _FaceList.begin(); f != fend; ++f) {
544 const vector<WOEdge *> &oedgeList = (*f)->getEdgeList();
545 vector<WOEdge *> newoedgelist;
547 uint n = oedgeList.size();
548 for (i = 0; i < n; i++) {
549 WOEdge *current = oedgeList[i];
551 newoedgelist.push_back(currentoedata->
_copy);
555 (*f)->setEdgeList(newoedgelist);
563 (*v)->userdata =
nullptr;
569 delete (
edgedata *)((*e)->userdata);
570 (*e)->userdata =
nullptr;
572 delete (
oedgedata *)((*e)->GetaOEdge()->userdata);
573 (*e)->GetaOEdge()->userdata =
nullptr;
575 WOEdge *oedgeb = (*e)->GetbOEdge();
584 for (f = iBrother.
GetFaceList().begin(); f != fend; ++f) {
585 delete (
facedata *)((*f)->userdata);
586 (*f)->userdata =
nullptr;
591 vector<bool> &iFaceEdgeMarksList,
595 WFace *face = instanciateFace();
597 WFace *result = MakeFace(iVertexList, iFaceEdgeMarksList, iMaterial, face);
605 vector<Vec3f> &iNormalsList,
606 vector<Vec2f> &iTexCoordsList,
607 vector<bool> &iFaceEdgeMarksList,
611 WFace *face = MakeFace(iVertexList, iFaceEdgeMarksList, iMaterial);
618 face->setNormalList(iNormalsList);
620 face->setTexCoordsList(iTexCoordsList);
626 vector<bool> &iFaceEdgeMarksList,
630 int id = _FaceList.size();
638 if (3 == iVertexList.size()) {
639 if ((iVertexList[0] == iVertexList[1]) || (iVertexList[0] == iVertexList[2]) ||
640 (iVertexList[2] == iVertexList[1]))
642 cerr <<
"Warning: degenerated triangle detected, correcting" << endl;
647 vector<WVertex *>::iterator it;
652 it = iVertexList.begin();
653 v1 = (*it)->GetVertex();
655 v2 = (*it)->GetVertex();
657 v3 = (*it)->GetVertex();
660 Vec3r vector2(v3 - v1);
662 Vec3r normal(vector1 ^ vector2);
664 face->setNormal(normal);
666 vector<bool>::iterator mit = iFaceEdgeMarksList.begin();
671 vector<WVertex *>::iterator va, vb;
673 va = iVertexList.begin();
675 for (; va != iVertexList.end(); va = vb) {
681 if (*va == iVertexList.back()) {
682 oedge = face->MakeEdge(*va, iVertexList.front());
685 oedge = face->MakeEdge(*va, *vb);
693 if (1 == edge->GetNumberOfOEdges()) {
699 _meanEdgeSize += edge->GetaOEdge()->GetVec().norm();
716 real meanEdgeSize = 0.0;
721 meanEdgeSize += (*it)->GetaOEdge()->GetVec().norm();
Classes to define a Winged Edge data structure.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
short GetNumberOfOEdges()
virtual WEdge * duplicate()
const vector< WOEdge * > & getEdgeList()
vector< Vec2f > _VerticesTexCoords
const FrsMaterial & frs_material()
WOEdge * GetPrevOEdge(WOEdge *iOEdge)
virtual WOEdge * MakeEdge(WVertex *v1, WVertex *v2)
virtual WFace * duplicate()
bool getOppositeEdge(const WVertex *v, WOEdge *&e)
void setFrsMaterialIndex(uint iMaterialIndex)
vector< Vec3f > _VerticesNormals
void setbVertex(WVertex *pv)
virtual WOEdge * duplicate()
void setaVertex(WVertex *pv)
vector< WVertex * > & getVertexList()
real ComputeMeanEdgeSize() const
vector< FrsMaterial > _FrsMaterials
vector< WEdge * > & getEdgeList()
virtual WShape * duplicate()
virtual WFace * MakeFace(vector< WVertex * > &iVertexList, vector< bool > &iFaceEdgeMarksList, uint iMaterialIndex)
vector< WFace * > & GetFaceList()
static uint _SceneCurrentId
virtual WFace * operator*()
virtual WOEdge * operator*()
vector< WEdge * > & GetEdges()
virtual incoming_edge_iterator incoming_edges_begin()
vector< WEdge * > _EdgeList
virtual incoming_edge_iterator incoming_edges_end()
void setShape(WShape *iShape)
void AddEdge(WEdge *iEdge)
virtual WVertex * duplicate()
VecMat::Vec3< float > Vec3f