Commit 8259ea87 authored by Pierre Kraemer's avatar 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 <typename PFP>
Geom::BoundingBox<typename PFP::VEC3> computeBoundingBox(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{
Geom::BoundingBox<typename PFP::VEC3> bb ;
TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
bb.addPoint(position[d]) ;
foreach_cell<VERTEX>(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 <typename PFP>
bool isEdgeConvexe(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position) ;
bool isEdgeConvex(typename PFP::MAP& map, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position) ;
} // namespace Geometry
......
......@@ -40,14 +40,14 @@ namespace Geometry
{
template <typename PFP>
bool isEdgeConvexe(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
bool isEdgeConvex(typename PFP::MAP& map, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{
typedef typename PFP::VEC3 VEC3 ;
const VEC3 n = faceNormal<PFP>(map, d, position);
const VEC3 e = vectorOutOfDart<PFP>(map, map.phi1(map.phi2(d)), position) ;
const VEC3 n = faceNormal<PFP>(map, e.dart, position);
const VEC3 ee = vectorOutOfDart<PFP>(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>
typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P) ;
typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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>
typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P) ;
typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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>
typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P) ;
template <typename PFP>
bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position);
typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P) ;
} // namespace Geometry
......
......@@ -23,8 +23,6 @@
*******************************************************************************/
#include "Geometry/distances.h"
#include "Algo/Geometry/normal.h"
#include <limits>
namespace CGoGN
{
......@@ -36,64 +34,50 @@ namespace Geometry
{
template <typename PFP>
bool isPlanar(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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>
typename PFP::REAL squaredDistancePoint2FacePlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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>
typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P)
typename PFP::REAL squaredDistancePoint2Face(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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>
typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VEC3& P)
typename PFP::REAL squaredDistancePoint2Edge(typename PFP::MAP& map, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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 <typename PFP>
bool isConvex(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, bool CCW, unsigned int thread = 0);
bool isConvex(typename PFP::MAP& map, Vol v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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 <typename PFP>
bool isPointInVolume(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, const typename PFP::VEC3& point);
bool isPointInVolume(typename PFP::MAP& map, Vol v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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 <typename PFP>
bool isPointInConvexVolume(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, const typename PFP::VEC3& point, bool CCW = true);
bool isPointInConvexVolume(typename PFP::MAP& map, Vol v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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 <typename PFP>
bool isPointInConvexFace2D(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, const typename PFP::VEC3& point, bool CCW = true);
bool isPointInConvexFace(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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 <typename PFP>
bool isPointInConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, const typename PFP::VEC3& point, bool CCW);
bool isPointInConvexFace2D(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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 <typename PFP>
bool isPointOnEdge(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, const typename PFP::VEC3& point);
bool isPointOnEdge(typename PFP::MAP& map, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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 <typename PFP>
......@@ -108,23 +108,22 @@ bool isPointOnHalfEdge(typename PFP::MAP& map, Dart d, const VertexAttribute<typ
/**
* test if a point is on a vertex
* @param map the map
* @param d a dart defining the vertex
* @param a vertex
* @param the point
*/
template <typename PFP>
bool isPointOnVertex(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, const typename PFP::VEC3& point);
bool isPointOnVertex(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& 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 <typename PFP>
bool isConvexFaceInOrIntersectingTetrahedron(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, const typename PFP::VEC3 points[4], bool CCW);
bool isConvexFaceInOrIntersectingTetrahedron(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& positions, const typename PFP::VEC3 points[4], bool CCW);
} // namespace Geometry
......
This diff is collapsed.
......@@ -42,47 +42,48 @@ namespace Geometry
* (works with triangular faces but not optimized)
* TODO to test
* @param map the map
* @param d a dart defining the n-sided face
* @param f a n-sided face
* @param PA segment point 1
* @param Dir a direction for the line
* @param Inter store the intersection point
* @return true if segment intersects the face
*/
template <typename PFP>
bool intersectionLineConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const typename PFP::VEC3& P, const typename PFP::VEC3& Dir, typename PFP::VEC3& Inter) ;
bool intersectionLineConvexFace(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const typename PFP::VEC3& P, const typename PFP::VEC3& Dir, typename PFP::VEC3& Inter) ;
/**
* test the intersection between a segment and a n-sided face (n>=3)
* (works with triangular faces but not optimized)
* TODO optimize - based on intersectionLineConvexFace - check whether the points are on both sides of the face before computing intersection
* @param map the map
* @param d a dart defining the n-sided face
* @param f a n-sided face
* @param PA segment point 1
* @param PB segment point 2
* @param Inter store the intersection point
* @return true if segment intersects the face
*/
template <typename PFP>
bool intersectionSegmentConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const typename PFP::VEC3& PA, const typename PFP::VEC3& PB, typename PFP::VEC3& Inter) ;
bool intersectionSegmentConvexFace(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const typename PFP::VEC3& PA, const typename PFP::VEC3& PB, typename PFP::VEC3& Inter) ;
/**
* test if two triangles intersect
* (based on the "Faster Triangle-Triangle intersection Tests" by Oliver Deviller and Philippe Guigue)
* @param the map
* @param a dart of the first triangle
* @param a dart of the second triangle
* @param the first triangle
* @param the second triangle
*/
template <typename PFP>
bool areTrianglesInIntersection(typename PFP::MAP& map, Dart tri1, Dart tri2, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position) ;
bool areTrianglesInIntersection(typename PFP::MAP& map, Face t1, Face t2, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position) ;
/**
* alpha = coef d'interpolation dans [0 ,1] tel que v = (1-alpha)*pin + alpha*pout
* alpha = coef d'interpolation dans [0,1] tel que v = (1-alpha)*pin + alpha*pout
* est le point d'intersection entre la sphère et le segment [pin, pout]
* avec pin = position[d] à l'intérieur de la sphère
* avec pout = position[phi1(d)] à l'extérieur de la sphère
* avec pin = position[v1] à l'intérieur de la sphère
* avec pout = position[v2] à l'extérieur de la sphère
* et v1 et v2 les deux sommets de l'arête
*/
template <typename PFP>
bool intersectionSphereEdge(typename PFP::MAP& map, typename PFP::VEC3& center, typename PFP::REAL radius, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, typename PFP::REAL& alpha) ;
bool intersectionSphereEdge(typename PFP::MAP& map, typename PFP::VEC3& center, typename PFP::REAL radius, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, typename PFP::REAL& alpha) ;
} // namespace Geometry
......
......@@ -44,12 +44,14 @@ namespace Geometry
{
template <typename PFP>
bool intersectionLineConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const typename PFP::VEC3& P, const typename PFP::VEC3& Dir, typename PFP::VEC3& Inter)
bool intersectionLineConvexFace(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const typename PFP::VEC3& P, const typename PFP::VEC3& Dir, typename PFP::VEC3& Inter)
{
typedef typename PFP::VEC3 VEC3 ;
const float SMALL_NUM = std::numeric_limits<typename PFP::REAL>::min() * 5.0f;
Dart d = f.dart;
VEC3 p1 = position[d];
VEC3 n = faceNormal<PFP>(map, d, position);
VEC3 w0 = P - p1;
......@@ -90,12 +92,12 @@ bool intersectionLineConvexFace(typename PFP::MAP& map, Dart d, const VertexAttr
}
template <typename PFP>
bool intersectionSegmentConvexFace(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const typename PFP::VEC3& PA, const typename PFP::VEC3& PB, typename PFP::VEC3& Inter)
bool intersectionSegmentConvexFace(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const typename PFP::VEC3& PA, const typename PFP::VEC3& PB, typename PFP::VEC3& Inter)
{
typedef typename PFP::VEC3 VEC3 ;
VEC3 dir = PB - PA;
if (intersectionLineConvexFace(map, d, position, PA, dir, Inter))
if (intersectionLineConvexFace(map, f, position, PA, dir, Inter))
{
VEC3 dirA = PA - Inter;
VEC3 dirB = PB - Inter;
......@@ -107,10 +109,13 @@ bool intersectionSegmentConvexFace(typename PFP::MAP& map, Dart d, const VertexA
}
template <typename PFP>
bool areTrianglesInIntersection(typename PFP::MAP& map, Dart tri1, Dart tri2, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
bool areTrianglesInIntersection(typename PFP::MAP& map, Face t1, Face t2, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{
typedef typename PFP::VEC3 VEC3 ;
Dart tri1 = t1.dart;
Dart tri2 = t2.dart;
//get vertices position
VEC3 tris1[3];
VEC3 tris2[3];
......@@ -174,8 +179,8 @@ bool areTrianglesInIntersection(typename PFP::MAP& map, Dart tri1, Dart tri2, co
// return isSegmentInTriangle2D(inter1,inter2,tris2[0],tris2[1],triS2[2],nTri2);
//compute face normal
VEC3 normale1 = faceNormal<PFP>(map, tri1, position);
VEC3 bary1 = faceCentroid<PFP>(map, tri1, position);
VEC3 normale1 = faceNormal<PFP>(map, t1, position);
VEC3 bary1 = faceCentroid<PFP>(map, t1, position);
int pos = 0;
int neg = 0;
......@@ -184,9 +189,9 @@ bool areTrianglesInIntersection(typename PFP::MAP& map, Dart tri1, Dart tri2, co
{
VEC3 nTest = bary1 - tris2[i];
float scal = nTest * normale1;
if (scal<0)
if (scal < 0)
++neg;
if (scal>0)
if (scal > 0)
++pos;
}
......@@ -195,8 +200,8 @@ bool areTrianglesInIntersection(typename PFP::MAP& map, Dart tri1, Dart tri2, co
return false;
//same for the second triangle
VEC3 normale2 = faceNormal<PFP>(map, tri2, position);
VEC3 bary2 = faceCentroid<PFP>(map, tri2, position);
VEC3 normale2 = faceNormal<PFP>(map, t2, position);
VEC3 bary2 = faceCentroid<PFP>(map, t2, position);
pos = 0;
neg = 0;
for (unsigned int i = 0; i < 3 ; ++i)
......@@ -233,13 +238,13 @@ bool areTrianglesInIntersection(typename PFP::MAP& map, Dart tri1, Dart tri2, co
}
template <typename PFP>
bool intersectionSphereEdge(typename PFP::MAP& map, typename PFP::VEC3& center, typename PFP::REAL radius, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, typename PFP::REAL& alpha)
bool intersectionSphereEdge(typename PFP::MAP& map, typename PFP::VEC3& center, typename PFP::REAL radius, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, typename PFP::REAL& alpha)
{
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ;
const VEC3& p1 = position[d];
const VEC3& p2 = position[map.phi1(d)];
const VEC3& p1 = position[e.dart];
const VEC3& p2 = position[map.phi1(e.dart)];
if(Geom::isPointInSphere(p1, center, radius) && !Geom::isPointInSphere(p2, center, radius))
{
VEC3 p = p1 - center;
......
......@@ -42,24 +42,24 @@ namespace Geometry
{
template <typename PFP>
Geom::Plane3D<typename PFP::REAL> trianglePlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
Geom::Plane3D<typename PFP::REAL> trianglePlane(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{
typename PFP::VEC3 n = triangleNormal<PFP>(map, d, position) ;
return Geom::Plane3D<typename PFP::REAL>(n, position[d]) ;
typename PFP::VEC3 n = triangleNormal<PFP>(map, f, position) ;
return Geom::Plane3D<typename PFP::REAL>(n, position[f.dart]) ;
}
template <typename PFP>
Geom::Plane3D<typename PFP::REAL> facePlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
Geom::Plane3D<typename PFP::REAL> facePlane(typename PFP::MAP& map, Face f, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{
typename PFP::VEC3 n = faceNormal<PFP>(map, d, position) ;
return Geom::Plane3D<typename PFP::REAL>(n, position[d]) ;
typename PFP::VEC3 n = faceNormal<PFP>(map, f, position) ;
return Geom::Plane3D<typename PFP::REAL>(n, position[f.dart]) ;
}
template <typename PFP>
Geom::Plane3D<typename PFP::REAL> vertexTangentPlane(typename PFP::MAP& map, Dart d, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
Geom::Plane3D<typename PFP::REAL> vertexTangentPlane(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position)
{
typename PFP::VEC3 n = vertexNormal<PFP>(map, d, position) ;
return Geom::Plane3D<typename PFP::REAL>(n, position[d]) ;
typename PFP::VEC3 n = vertexNormal<PFP>(map, v, position) ;
return Geom::Plane3D<typename PFP::REAL>(n, position[v]) ;
}
} // namespace Geometry
......
......@@ -127,6 +127,7 @@ inline void foreach_cell_until(const MAP& map, FUNC f, TraversalOptim opt = AUTO
namespace Parallel
{
/**
* @brief foreach_cell
* @param map
......@@ -136,9 +137,12 @@ namespace Parallel
* @param nbth number of used thread (0:for traversal, [1,nbth-1] for func computing
*/
template <unsigned int ORBIT, typename MAP, typename FUNC>
void foreach_cell(MAP& map, FUNC func, bool needMarkers=true, TraversalOptim opt=AUTO, unsigned int nbth=NumberOfThreads);
void foreach_cell(MAP& map, FUNC func, bool needMarkers = true, TraversalOptim opt = AUTO, unsigned int nbth = NumberOfThreads);
} // namespace Parallel
}
template <typename MAP, TraversalOptim OPT=AUTO>
......
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