Commit edc040c7 authored by untereiner's avatar untereiner

Merge cgogn.u-strasbg.fr:~jund/CGoGN

parents cd6c1705 e8dbdda7
...@@ -48,7 +48,7 @@ template <typename PFP> ...@@ -48,7 +48,7 @@ template <typename PFP>
void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position, SubdivideType sType = S_QUAD); void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position, SubdivideType sType = S_QUAD);
template <typename PFP> template <typename PFP>
void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position); Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
template <typename PFP> template <typename PFP>
void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position); void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
......
...@@ -168,11 +168,13 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position ...@@ -168,11 +168,13 @@ void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
} }
template <typename PFP> template <typename PFP>
void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position) Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position)
{ {
assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ; assert(map.getDartLevel(d) <= map.getCurrentLevel() || !"Access to a dart introduced after current level") ;
assert(!map.volumeIsSubdivided(d) || !"Trying to subdivide an already subdivided volume") ; assert(!map.volumeIsSubdivided(d) || !"Trying to subdivide an already subdivided volume") ;
std::cout << "SUUUUUUB marine" << std::endl;
unsigned int vLevel = map.volumeLevel(d) ; unsigned int vLevel = map.volumeLevel(d) ;
Dart old = map.volumeOldestDart(d) ; Dart old = map.volumeOldestDart(d) ;
...@@ -362,6 +364,8 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -362,6 +364,8 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
} }
map.setCurrentLevel(cur) ; map.setCurrentLevel(cur) ;
return subdividedfaces.begin()->first;
} }
......
#ifndef PARTCELL_H
#define PARTCELL_H
#include "particle_base.h"
#include "Algo/Geometry/inclusion.h"
#include "Geometry/intersection.h"
#include "Geometry/orientation.h"
#include "Geometry/plane_3d.h"
#include <iostream>
/* A particle cell is a particle base within a map, within a precise cell, the displacement function should indicate
after each displacement wherein lies the new position of the particle */
namespace CGoGN
{
namespace Algo
{
namespace MovingObjects
{
template <typename PFP>
class ParticleCell3D : public ParticleBase
{
public :
typedef typename PFP::MAP Map;
typedef typename PFP::VEC3 VEC3;
typedef typename PFP::TVEC3 TAB_POS;
Map& m;
const TAB_POS& position;
Dart d;
Dart lastCrossed;
VEC3 m_positionFace;
unsigned int state;
unsigned int crossCell ;
ParticleCell3D(Map& map) : m(map)
{}
ParticleCell3D(Map& map, Dart belonging_cell, VEC3 pos, const TAB_POS& tabPos) :
ParticleBase(pos), m(map), position(tabPos), d(belonging_cell), state(3)
{
m_positionFace = pointInFace(d);
}
void display();
Dart getCell() { return d; }
VEC3 pointInFace(Dart d);
Geom::Orientation3D isLeftENextVertex(VEC3 c, Dart d, VEC3 base);
bool isRightVertex(VEC3 c, Dart d, VEC3 base);
Geom::Orientation3D whichSideOfFace(VEC3 c, Dart d);
Geom::Orientation3D isLeftL1DVol(VEC3 c, Dart d, VEC3 base, VEC3 top);
Geom::Orientation3D isRightDVol(VEC3 c, Dart d, VEC3 base, VEC3 top);
Geom::Orientation3D isAbove(VEC3 c, Dart d, VEC3 top);
int isLeftL1DFace(VEC3 c, Dart d, VEC3 base, VEC3 normal);
bool isRightDFace(VEC3 c, Dart d, VEC3 base, VEC3 normal);
Dart nextDartOfVertexNotMarked(Dart d, CellMarker& mark);
Dart nextNonPlanar(Dart d);
Dart nextFaceNotMarked(Dart d,CellMarker& mark);
Geom::Orientation3D whichSideOfEdge(VEC3 c, Dart d);
bool isOnHalfEdge(VEC3 c, Dart d);
void vertexState(const VEC3& current);
void edgeState(const VEC3& current);
void faceState(const VEC3& current, Geom::Orientation3D sideOfFace=Geom::ON);
void volumeState(const VEC3& current);
void volumeSpecialCase(const VEC3& current);
void move(const VEC3& newCurrent)
{
if(!Geom::arePointsEquals(newCurrent, m_position))
{
switch(state) {
case VERTEX_ORBIT : vertexState(newCurrent); break;
case EDGE_ORBIT : edgeState(newCurrent); break;
case FACE_ORBIT : faceState(newCurrent); break;
case VOLUME_ORBIT : volumeState(newCurrent); break;
}
display();
}
}
};
#include "particle_cell_3D.hpp"
}
}
}
#endif
This diff is collapsed.
...@@ -84,7 +84,7 @@ class Plane3D ...@@ -84,7 +84,7 @@ class Plane3D
// project the point p onto the plane // project the point p onto the plane
void project(Vector<3,T>& p) const; void project(Vector<3,T>& p) const;
// return true or false according to the side of the plane where point p is // return on/over/under according to the side of the plane where point p is
Orientation3D orient(const Vector<3,T>& p) const; Orientation3D orient(const Vector<3,T>& p) const;
/**********************************************/ /**********************************************/
......
...@@ -106,7 +106,7 @@ T Plane3D<T>::distance(const Vector<3,T>& p) const ...@@ -106,7 +106,7 @@ T Plane3D<T>::distance(const Vector<3,T>& p) const
template <typename T> template <typename T>
void Plane3D<T>::project(Vector<3,T>& p) const void Plane3D<T>::project(Vector<3,T>& p) const
{ {
#define PRECISION 1e-20 #define PRECISION 1e-5
T d = -distance(p) ; T d = -distance(p) ;
if(abs(d) > PRECISION) if(abs(d) > PRECISION)
{ {
...@@ -119,7 +119,7 @@ void Plane3D<T>::project(Vector<3,T>& p) const ...@@ -119,7 +119,7 @@ void Plane3D<T>::project(Vector<3,T>& p) const
template <typename T> template <typename T>
Orientation3D Plane3D<T>::orient(const Vector<3,T>& p) const Orientation3D Plane3D<T>::orient(const Vector<3,T>& p) const
{ {
#define PRECISION 1e-20 #define PRECISION 1e-5
T dist = distance(p) ; T dist = distance(p) ;
if(dist < -PRECISION) if(dist < -PRECISION)
return UNDER ; return UNDER ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment