Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 8259ea87 by Pierre Kraemer

### update several Algo/Geometry functions

parent f0e1b718
 ... ... @@ -25,7 +25,6 @@ #ifndef __ALGO_GEOMETRY_BOUNDINGBOX_H__ #define __ALGO_GEOMETRY_BOUNDINGBOX_H__ #include "Geometry/basic.h" #include "Geometry/bounding_box.h" #include "Topology/generic/attributeHandler.h" #include "Topology/generic/traversor/traversorCell.h" ... ... @@ -43,9 +42,7 @@ template Geom::BoundingBox computeBoundingBox(typename PFP::MAP& map, const VertexAttribute& position) { Geom::BoundingBox bb ; TraversorV t(map) ; for(Dart d = t.begin(); d != t.end(); d = t.next()) bb.addPoint(position[d]) ; foreach_cell(map, [&] (Vertex v) { bb.addPoint(position[v]) ; }); return bb ; } ... ...
 ... ... @@ -41,7 +41,7 @@ namespace Geometry * Test if an edge bounded by 2 faces is convex or concave */ template bool isEdgeConvexe(typename PFP::MAP& map, Dart d, const VertexAttribute& position) ; bool isEdgeConvex(typename PFP::MAP& map, Edge e, const VertexAttribute& position) ; } // namespace Geometry ... ...
 ... ... @@ -40,14 +40,14 @@ namespace Geometry { template bool isEdgeConvexe(typename PFP::MAP& map, Dart d, const VertexAttribute& position) bool isEdgeConvex(typename PFP::MAP& map, Edge e, const VertexAttribute& position) { typedef typename PFP::VEC3 VEC3 ; const VEC3 n = faceNormal(map, d, position); const VEC3 e = vectorOutOfDart(map, map.phi1(map.phi2(d)), position) ; const VEC3 n = faceNormal(map, e.dart, position); const VEC3 ee = vectorOutOfDart(map, map.phi1(map.phi2(e.dart)), position) ; if((e * n) > 0) if((ee * n) < 0) return true; else return false; ... ...
 ... ... @@ -37,38 +37,36 @@ namespace Geometry /** * compute squared distance from point to the plane of a planar face * @param map the map * @param d a dart of the face * @param f a face * @param position the vertex attribute storing positions * @param P the point * @return the squared distance to tha plane * @return the squared distance to the plane */ template typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d, const VertexAttribute& position, const VEC3& P) ; typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Face f, const VertexAttribute& position, const VEC3& P) ; /** * compute squared distance from point to face (assuming face is convex) * Algo: min distance of each subtriangle of face (not optimum ?) * @param map the map * @param d a dart of the face * @param f a face * @param position the vertex attribute storing positions * @param P the point * @return the squared distance */ template typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, const VertexAttribute& position, const VEC3& P) ; typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Face f, const VertexAttribute& position, const VEC3& P) ; /** * compute squared distance from point to an edge * @param map the map * @param d a dart of the edge * @param e an edge * @param position the vertex attribute storing positions * @param P the point * @return the squared distance */ template typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, const VertexAttribute& position, const VEC3& P) ; template bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute& position); typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Edge e, const VertexAttribute& position, const VEC3& P) ; } // namespace Geometry ... ...
 ... ... @@ -23,8 +23,6 @@ *******************************************************************************/ #include "Geometry/distances.h" #include "Algo/Geometry/normal.h" #include namespace CGoGN { ... ... @@ -36,64 +34,50 @@ namespace Geometry { template bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute& position) typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Face f, const VertexAttribute& position, const VEC3& P) { if (map.phi<111>(d)==d) return true; Vertex v(f.dart); const typename PFP::VEC3& A = position[v]; v.dart = map.phi1(v.dart); const typename PFP::VEC3& B = position[v]; v.dart = map.phi1(v.dart); const typename PFP::VEC3& C = position[v]; typename PFP::VEC3 No = Algo::Surface::Geometry::triangleNormal(map, d, position) ; Dart e = map.phi<11>(d); while (e != d) { typename PFP::VEC3 n = Algo::Surface::Geometry::triangleNormal(map, e, position) ; e = map.phi1(e); if (e!=d) e = map.phi1(e); } return Geom::squaredDistancePoint2TrianglePlane(P, A, B, C); } template typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d, const VertexAttribute& position, const VEC3& P) { const typename PFP::VEC3& A = position[d]; d = map.phi1(d); const typename PFP::VEC3& B = position[d]; d = map.phi1(d); const typename PFP::VEC3& C = position[d]; return Geom::squaredDistancePoint2TrianglePlane(P,A,B,C); } template typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, const VertexAttribute& position, const VEC3& P) typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Face f, const VertexAttribute& position, const VEC3& P) { typedef typename PFP::REAL REAL; const typename PFP::VEC3& A = position[d]; const typename PFP::VEC3& A = position[f.dart]; Dart d = map.phi1(f.dart); Dart e = map.phi1(d); Dart f = map.phi1(e); REAL dist2 = Geom::squaredDistancePoint2Triangle(P,A,position[e],position[f]); e = f; f = map.phi1(e); REAL dist2 = Geom::squaredDistancePoint2Triangle(P, A, position[d], position[e]); d = e; e = map.phi1(d); while (f != d) while (e != f.dart) { REAL d2 = Geom::squaredDistancePoint2Triangle(P,A,position[e],position[f]); REAL d2 = Geom::squaredDistancePoint2Triangle(P, A, position[d], position[e]); if (d2 < dist2) dist2 = d2; e = f; f = map.phi1(e); d = e; e = map.phi1(d); } return dist2; } template typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, const VertexAttribute& position, const VEC3& P) typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Edge e, const VertexAttribute& position, const VEC3& P) { const typename PFP::VEC3& A = position[d]; typename PFP::VEC3& AB = position[map.phi1(d)]-A; typename PFP::REAL AB2 = AB*AB; return Geom::squaredDistanceSeg2Point(A,AB,AB2,P) ; const typename PFP::VEC3& A = position[e.dart]; typename PFP::VEC3 AB = position[map.phi1(e.dart)] - A; typename PFP::REAL AB2 = AB * AB; return Geom::squaredDistanceSeg2Point(A, AB, AB2, P) ; } } // namespace Geometry ... ...
 ... ... @@ -24,7 +24,7 @@ #include "Geometry/basic.h" #include "Algo/Geometry/normal.h" #include "Topology/generic/traversorCell.h" #include "Topology/generic/traversor/traversorCell.h" namespace CGoGN { ... ...
 ... ... @@ -45,61 +45,61 @@ namespace Geometry /** * test if the volume is convex * @param the map * @param a dart of the volume * @param a volume * @param true if the faces of the volume must be in CCW order (default=true) */ template bool isConvex(typename PFP::MAP& map, Dart d, const VertexAttribute& positions, bool CCW, unsigned int thread = 0); bool isConvex(typename PFP::MAP& map, Vol v, const VertexAttribute& positions, bool CCW, unsigned int thread = 0); /** * test if a point is inside a volume * @param map the map * @param d a dart defining the volume * @param a volume * @param the point */ template bool isPointInVolume(typename PFP::MAP& map, Dart d, const VertexAttribute& positions, const typename PFP::VEC3& point); bool isPointInVolume(typename PFP::MAP& map, Vol v, const VertexAttribute& positions, const typename PFP::VEC3& point); /** * test if a point is inside a volume * @param map the map * @param d a dart defining a convex volume * @param a convex volume * @param the point */ template bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute& positions, const typename PFP::VEC3& point, bool CCW = true); bool isPointInConvexVolume(typename PFP::MAP& map, Vol v, const VertexAttribute& positions, const typename PFP::VEC3& point, bool CCW = true); /** * test if a point is inside a face in a plane * test if a point is inside a face * @param map the map * @param d a dart defining the face * @param a face * @param the point */ template bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const VertexAttribute& positions, const typename PFP::VEC3& point, bool CCW = true); bool isPointInConvexFace(typename PFP::MAP& map, Face f, const VertexAttribute& positions, const typename PFP::VEC3& point, bool CCW); /** * test if a point is inside a face * test if a point is inside a face in a plane * @param map the map * @param d a dart defining the face * @param a face * @param the point */ template bool isPointInConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute& positions, const typename PFP::VEC3& point, bool CCW); bool isPointInConvexFace2D(typename PFP::MAP& map, Face f, const VertexAttribute& positions, const typename PFP::VEC3& point, bool CCW = true); /** * test if a point is on an edge * @param map the map * @param d a dart defining the edge * @param an edge * @param the point */ template bool isPointOnEdge(typename PFP::MAP& map, Dart d, const VertexAttribute& positions, const typename PFP::VEC3& point); bool isPointOnEdge(typename PFP::MAP& map, Edge e, const VertexAttribute& positions, const typename PFP::VEC3& point); /** * test if a point is on an half-edge defined by a dart * @param map the map * @param d a dart defining the edge * @param a Dart * @param the point */ template ... ... @@ -108,23 +108,22 @@ bool isPointOnHalfEdge(typename PFP::MAP& map, Dart d, const VertexAttribute bool isPointOnVertex(typename PFP::MAP& map, Dart d, const VertexAttribute& positions, const typename PFP::VEC3& point); bool isPointOnVertex(typename PFP::MAP& map, Vertex v, const VertexAttribute& positions, const typename PFP::VEC3& point); /** * test if a face is intersecting or totally included in a tetrahedron * TODO to test * @param map the map * @param d a dart defining the face * @param f a face * @param the points of the tetra (0,1,2) the first face and (3) the last point of the tetra, in well oriented order * @param true if the faces of the tetra are in CCW order (default=true) */ template bool isConvexFaceInOrIntersectingTetrahedron(typename PFP::MAP& map, Dart d, const VertexAttribute& positions, const typename PFP::VEC3 points[4], bool CCW); bool isConvexFaceInOrIntersectingTetrahedron(typename PFP::MAP& map, Face f, const VertexAttribute& positions, const typename PFP::VEC3 points[4], bool CCW); } // namespace Geometry ... ...