Commit bfd7705b authored by Thomas Jund's avatar Thomas Jund

modifying antialiasing parameter (too high), and optimizing some geometry-inclusion function

parent a92c7c23
...@@ -133,14 +133,13 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute ...@@ -133,14 +133,13 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
bool inside = true;
std::list<Dart> visitedFaces; // Faces that are traversed std::list<Dart> visitedFaces; // Faces that are traversed
visitedFaces.push_back(d); // Start with the face of d visitedFaces.push_back(d); // Start with the face of d
std::list<Dart>::iterator face; std::list<Dart>::iterator face;
VEC3 N; VEC3 N;
DartMarkerStore mark(map); // Lock a marker DartMarkerStore mark(map); // Lock a marker
for (face = visitedFaces.begin(); inside && face != visitedFaces.end(); ++face) for (face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
{ {
if (!mark.isMarked(*face)) if (!mark.isMarked(*face))
{ {
...@@ -149,10 +148,10 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute ...@@ -149,10 +148,10 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute
if(CCW) if(CCW)
{ {
if(o3d == Geom::OVER) if(o3d == Geom::OVER)
inside = false; return false;
} }
else if(o3d == Geom::UNDER) else if(o3d == Geom::UNDER)
inside = false; return false;
Dart dNext = *face ; Dart dNext = *face ;
do do
...@@ -166,8 +165,7 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute ...@@ -166,8 +165,7 @@ bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute
} }
} }
//if the point is in the volume there is an odd number of intersection with all faces with any direction return true;
return inside;
} }
template <typename PFP> template <typename PFP>
...@@ -176,8 +174,6 @@ bool isPointInConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<t ...@@ -176,8 +174,6 @@ bool isPointInConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<t
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
bool inside = true;
Geom::Plane3D<REAL> pl = Geometry::facePlane<PFP>(map, d, position); Geom::Plane3D<REAL> pl = Geometry::facePlane<PFP>(map, d, position);
Geom::Orientation3D o3d = pl.orient(point); Geom::Orientation3D o3d = pl.orient(point);
if(o3d == Geom::ON) if(o3d == Geom::ON)
...@@ -193,12 +189,12 @@ bool isPointInConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<t ...@@ -193,12 +189,12 @@ bool isPointInConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<t
if(CCW) if(CCW)
{ {
if(o3d == Geom::UNDER) if(o3d == Geom::UNDER)
inside = false; return false;
} }
else if(o3d == Geom::OVER) else if(o3d == Geom::OVER)
inside = false; return false;
} }
return inside; return true;
} }
return false; return false;
...@@ -212,7 +208,6 @@ bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const VertexAttribute ...@@ -212,7 +208,6 @@ bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const VertexAttribute
// CGoGNout << "point " << point << "d " << d << "faceDeg " << map.faceDegree(d) << CGoGNendl; // CGoGNout << "point " << point << "d " << d << "faceDeg " << map.faceDegree(d) << CGoGNendl;
bool convex=true;
Geom::Orientation2D o2d; Geom::Orientation2D o2d;
Traversor2FV<typename PFP::MAP> tfv(map, d) ; Traversor2FV<typename PFP::MAP> tfv(map, d) ;
...@@ -222,13 +217,13 @@ bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const VertexAttribute ...@@ -222,13 +217,13 @@ bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const VertexAttribute
if(CCW) if(CCW)
{ {
if(o2d == Geom::RIGHT) if(o2d == Geom::RIGHT)
convex= false; return false;
} }
else if(o2d == Geom::LEFT) else if(o2d == Geom::LEFT)
return false; return false;
} }
return convex; return true;
} }
template <typename PFP> template <typename PFP>
......
...@@ -259,7 +259,6 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 goal) ...@@ -259,7 +259,6 @@ void ParticleCell2DAndHalf<PFP>::faceState(VEC3 goal)
assert(goal.isFinite()) ; assert(goal.isFinite()) ;
assert(this->getPosition().isFinite()) ; assert(this->getPosition().isFinite()) ;
// assert(Geometry::isPointInConvexFace2D<PFP>(m,d,m_positions,m_position,true));
//project goal within face plane //project goal within face plane
VEC3 n1 = Geometry::faceNormal<PFP>(m,d,m_positions); VEC3 n1 = Geometry::faceNormal<PFP>(m,d,m_positions);
......
...@@ -128,8 +128,9 @@ void Plane3D<T>::project(Vector<3,T>& p) const ...@@ -128,8 +128,9 @@ 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-10 #define PRECISION 1e-6
T dist = distance(p) ; T dist = distance(p) ;
if(dist < -PRECISION) if(dist < -PRECISION)
return UNDER ; return UNDER ;
if(dist > PRECISION) if(dist > PRECISION)
......
...@@ -112,7 +112,7 @@ SimpleQGLV::SimpleQGLV() : ...@@ -112,7 +112,7 @@ SimpleQGLV::SimpleQGLV() :
m_qglWidget->setFocus(Qt::MouseFocusReason); m_qglWidget->setFocus(Qt::MouseFocusReason);
QGLFormat format(/*QGL::SampleBuffers |*/ QGL::DoubleBuffer | QGL::AlphaChannel); QGLFormat format(/*QGL::SampleBuffers |*/ QGL::DoubleBuffer | QGL::AlphaChannel);
format.setSamples(16); format.setSamples(2);
m_qglWidget->setFormat(format); m_qglWidget->setFormat(format);
m_qglWidget->makeCurrent(); m_qglWidget->makeCurrent();
} }
......
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