Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Compilation errors while extending Polyhedron_3

Subject: CGAL users discussion list

List archive

[cgal-discuss] Compilation errors while extending Polyhedron_3


Chronological Thread 
  • From: NMoreau <>
  • To:
  • Subject: [cgal-discuss] Compilation errors while extending Polyhedron_3
  • Date: Sun, 17 Feb 2013 07:22:34 -0800 (PST)

Hello!

First, I would like to apologize for the length of this message but I didn't
know how to explain my problem without going into details.

I'm (still) new to CGAL, and have to use some bits of code that were made by
someone else and use a specific polyhedron structure, derived from
Polyhedron_3. This structure defines some new attributes for the vertices
(like values and directions of curvature) and a member function which
computes the normal of a facet.

Starting from the big file made by this person, I had to take only the bits
of code I needed for my own use. Basically I had to make some
ExtendedPolyhedron.h file to define the structure used in another .h.
Unfortunately even if I did the same as in the exemple code I was given, I
have a bunch of errors when I try to compile the code.

Here is what I have:
*In my ExtendedPolyhedron.h file:*

/typedef float number_type;
typedef CGAL::Simple_cartesian<number_type> ExtendedKernel;

template <class Refs, class T, class P, class Norm>
class ExtendedFacet : public CGAL::HalfedgeDS_face_base<Refs,T> {
...
};
template <class Refs, class T, class Tv, class Tf>
class ExtendedHalfedge : public CGAL::HalfedgeDS_halfedge_base<Refs,T,Tv,Tf>
{
;..
};
template <class Refs, class T, class P, class V, class F>
class ExtendedVertex : public CGAL::HalfedgeDS_vertex_base<Refs, T, P> {
...
};

struct ExtendedItems : public CGAL::Polyhedron_items_3{
template <class Refs, class Traits>
struct Face_wrapper{
typedef typename Traits::Point_3 Point;
typedef typename Traits::Vector_3 Normal;
typedef ExtendedFacet<Refs, CGAL::Tag_true, Point, Normal>
Face;
};

template <class Refs, class Traits>
struct Vertex_wrapper{
typedef typename Traits::Point_3 Point;
typedef typename Traits::Vector_3 Vector;
typedef typename Traits::FT F;
typedef ExtendedVertex<Refs, CGAL::Tag_true, Point, Vector,
F> Vertex;
};

template<class Refs, class Traits>
struct Halfedge_wrapper
{
typedef ExtendedHalfedge<Refs, CGAL::Tag_true, CGAL::Tag_true,
CGAL::Tag_true> Halfedge;
};
};

template <class kernel, class items>
class ExtendedPolyhedron : public CGAL::Polyhedron_3<kernel,items>{
public:
typedef typename kernel::FT FT;
typedef typename kernel::Vector_3 Vector;
typedef typename kernel::Point_3 Point;
typedef typename
CGAL::Polyhedron_3<kernel,items>::Halfedge_data_structure
HDS;

void compute_normals()
{
std::for_each(facets_begin(),facets_end(),Facet_normal());
}

void computeNormalCycle(bool IsGeod = false, FT radius = 0)
{
Normal_cycle<ExtendedPolyhedron&lt;ExtendedKernel, ExtendedItems> >
estimator;
estimator.principal_curvature(*this, IsGeod, radius);
}

};/

*The Facet_normal is computed in a functor:*

/struct Facet_normal // (functor)
{
template <class Facet>
void operator()(Facet& f)
{
...
}
};/

*The Normal_cycle class is defined in the file that I have to use without
modifying it. The ExtendedPolyhedron.h file is included in my Mesh.h file,
in which I have I have a Mesh class with this attribute:*
/ExtendedPolyhedron<ExtendedKernel,ExtendedItems> halfedgeMesh;/

---------------------------------

So this is the structure of the code... Now here are the errors I get. I
don't understand what is happening:

---------------------------------
*In the normal_cycle.h file that I don't have to modify, I have:*
/template <class _Poly>
class Normal_cycle
{
typedef _Poly Polyhedron;

typedef typename Polyhedron::Halfedge_data_structure HDS;
typedef typename Polyhedron::Vertex Vertex;
...
Vertex::Vector VKmax(VectPro[1][2],VectPro[2][2],VectPro[3][2]);
Vertex::Vector VKmin(VectPro[1][1],VectPro[2][1],VectPro[3][1]);/

*What make the following error:*
/normal_cycle.h: In member function ‘void
Normal_cycle<_Poly>::principal_curvature(Normal_cycle<_Poly>::Polyhedron&,
bool, double)’:
normal_cycle.h:130:4: erreur: need ‘typename’ before
‘Normal_cycle<_Poly>::Vertex:: Vector’ because ‘Normal_cycle<_Poly>::Vertex’
is a dependent scope
normal_cycle.h:130:19: erreur: expected ‘;’ before ‘VKmax’
normal_cycle.h:131:4: erreur: need ‘typename’ before
‘Normal_cycle<_Poly>::Vertex:: Vector’ because ‘Normal_cycle<_Poly>::Vertex’
is a dependent scope
normal_cycle.h:131:19: erreur: expected ‘;’ before ‘VKmin’
normal_cycle.h:157:19: erreur: ‘VKmax’ was not declared in this scope
normal_cycle.h:158:19: erreur: ‘VKmin’ was not declared in this scope/

*and this one, which is related to the previous one:*
/normal_cycle.h:130:4: erreur: dependent-name ‘Normal_cycle<_Poly>::Vertex::
Vector’ is parsed as a non-type, but instantiation yields a type
normal_cycle.h:130:4: note: say ‘typename Normal_cycle<_Poly>::Vertex::
Vector’ if a type is meant
normal_cycle.h:131:4: erreur: dependent-name ‘Normal_cycle<_Poly>::Vertex::
Vector’ is parsed as a non-type, but instantiation yields a type
normal_cycle.h:131:4: note: say ‘typename Normal_cycle<_Poly>::Vertex::
Vector’ if a type is meant/

*Moreover it seems that I have a problem with the *
/void compute_normals()
{
std::for_each(facets_begin(),facets_end(),Facet_normal());
}/
*part as I get:*
/ExtendedPolyhedron.h: In member function ‘void ExtendedPolyhedron<kernel,
items>::compute_normals()’:
ExtendedPolyhedron.h:117:30: attention : there are no arguments to
‘facets_begin’ that depend on a template parameter, so a declaration of
‘facets_begin’ must be available [-fpermissive]
ExtendedPolyhedron.h:117:43: attention : there are no arguments to
‘facets_end’ that depend on a template parameter, so a declaration of
‘facets_end’ must be available [-fpermissive]
ExtendedPolyhedron.h:117:58: attention : there are no arguments to
‘Facet_normal’ that depend on a template parameter, so a declaration of
‘Facet_normal’ must be available [-fpermissive]/

*Finally, here is the last issue that I have:*
/normal_cycle.h:211:2: erreur: no matching function for call to
‘Normal_cycle<ExtendedPolyhedron&lt;CGAL::Simple_cartesian&lt;float>,
ExtendedItems> >::AreaFacetTriangle(
HalfedgeDS_in_place_list_face<...>::Face_handle )
normal_cycle.h:211:2: note: candidate is:
normal_cycle.h:343:9: note: double
Normal_cycle<_Poly>::AreaFacetTriangle(Normal_cycle<_Poly>::Facet_handle&)
normal_cycle.h:343:9: note: no known conversion for argument 1 from
‘CGAL::I_Polyhedron_halfedge<ExtendedHalfedge&lt;CGAL::HalfedgeDS_list_types&lt;...
> >::Face_handle (aka something)
to ‘Normal_cycle<ExtendedPolyhedron&lt;CGAL::Simple_cartesian&lt;float>,
ExtendedItems> >::Facet_handle& (aka the same thing&)
/

*If you want to see the complete message for this last error you can have it
here: * log.txt
<http://cgal-discuss.949826.n4.nabble.com/file/n4656746/log.txt>

---------------------------------------

I tryied everything that I could have in mind to fix this but it seems that
I can't see from where the problem comes from exactly...
Does anyone have an idea, or even some clue..? I'm stuck on this for days
now, so I would be grateful of any idea!

Thank you very much



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Compilation-errors-while-extending-Polyhedron-3-tp4656746.html
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.18.

Top of Page