Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Re: .off To .stl coverter

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Re: .off To .stl coverter


Chronological Thread 
  • From: Richard Downe <>
  • To: <>
  • Subject: Re: [cgal-discuss] Re: .off To .stl coverter
  • Date: Fri, 29 Mar 2013 11:09:57 -0500

Mario--
My kernel definitions in my headers are:

typedef CGAL::Exact_predicates_exact_constructions_kernel EK;
typedef CGAL::Exact_predicates_inexact_constructions_kernel IK;

While I am not familiar with the details of your EK kernel
(typedef CGAL::Simple_cartesian<CGAL::Quotient&lt;CGAL::MP_Float> > EK;)
It appears from its definition that it represents a point with a std::pair.

Thus the cartesian converter does not know how to map between your two kernel specializations.
I don't know why you're using the exact kernel that you are using. If your code would work with the EPECK kernel that I use, I'd suggest that, and expect it will work quite well for you.

If not, you probably need to define your own version of the cartesian converter to handle the extra information in your kernel.
-rd



On 03/29/2013 06:11 AM, mario wrote:
Hi richard,

really thanks for your code but i've an error i do not know why.

i used your code in my function that is the same as in Surface
reconstruction points example
(http://doc.cgal.org/4.2/CGAL.CGAL.Surface-Reconstruction-from-Point-Sets/html/Surface_reconstruction_points_3_2poisson_reconstruction_example_8cpp-example.html):

:
:
:
CGAL::make_surface_mesh(c2t3, // reconstructed mesh
surface, // implicit surface
criteria, // meshing criteria
CGAL::Manifold_with_boundary_tag()); // require
manifold mesh

ExportLumenSTLSolid(c2t3,"prova.stl");
:
:
:
i commented what i don'need in ExportLumen in this way:

template<class T>
void ExportLumenSTLSolid(const T& surf, const std::string& filename/*,
std::vector< endCapStruct > *caps=NULL*/)
{
using namespace std;
typedef typename T::Facet_iterator Facet_iterator;
typedef typename T::Cell_handle Cell_handle;
typedef typename T::Vertex_handle Vertex_handle;
typedef EK::Point_3 EP;

/* vector<endCapStruct>::iterator cIter;*/

IK_to_EK to_exact;
EK_to_IK to_inexact;

ofstream stlFile(filename.c_str());
stlFile << "solid FUSSOLID stereolithography representation of
angio/ivus fusion results" << endl;

Facet_iterator f = surf.facets_begin();
for( ; f != surf.facets_end(); f++) {
Cell_handle cHnd = f->first;

Vertex_handle h[3];
h[0] = ( f->second==0 ? cHnd->vertex( 1 ) : cHnd->vertex( 0 ) );
h[1] = ( f->second < 2 ? cHnd->vertex( 2 ) : cHnd->vertex( 1 )
);
h[2] = ( f->second < 3 ? cHnd->vertex( 3 ) : cHnd->vertex( 2 )
);

bool render = true;
bool out_of_bounds[3];
EP eP[3];
for (int i=0; i<3; i++) {
eP[i] = to_exact(h[i]->point());
out_of_bounds[i] = false;
}

/* if (caps) {
for (cIter = caps->begin(); cIter != caps->end(); cIter++) {
for (int i=0; i<3; i++) {
CGAL::Vector_3<EK> tmpVec = eP[i] - CGAL::ORIGIN;
EP transposed = CGAL::ORIGIN +
tmpVec.transform(cIter->bbTransform);
if
((cIter->plane.oriented_side(eP[i])!=CGAL::ON_POSITIVE_SIDE) &&
(cIter->bb.bounded_side(transposed)==CGAL::ON_BOUNDED_SIDE)) {
EP tmp = cIter->plane.projection(eP[i]);
eP[i] = tmp;
out_of_bounds[i] = true;
}
}
}

render = (!(out_of_bounds[0] && out_of_bounds[1] &&
out_of_bounds[2]));
}*/

/* if (render) {*/
CGAL::Vector_3<IK> n = CGAL::normal( to_inexact(eP[0]),
to_inexact(eP[1]), to_inexact(eP[2]) );
stlFile << " facet normal " << n.x() << " " << n.y() << " "
<< n.z() << endl;
stlFile << " outer loop" << endl;
for (int i=0; i<3; i++)
stlFile << " vertex " << eP[i].x() << " " <<
eP[i].y() << " " << eP[i].z() << endl;
stlFile << " endloop" << endl;
stlFile << " endfacet" << endl;
/* }*/
}

stlFile << "endsolid FUSSOLID" << endl;
stlFile.close();
}



but i don't know why i ave a mismatch error:
error C2664: 'std::pair<_Ty1,_Ty2>
CGAL::Cartesian_converter<K1,K2>::operator ()(const
std::pair<CGAL::Point_2&lt;R_>,CGAL::Point_2<R_>> &) const' : cannot convert
parameter 1 from 'CGAL::Point_3<R_>' to 'const std::pair<_Ty1,_Ty2> &'

this happen in the line
" eP[i] = to_exact(h[i]->point());"



my include files are these:



#include <CGAL/Simple_cartesian.h>
#include <CGAL/Quotient.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Cartesian_converter.h>



typedef CGAL::Simple_cartesian<double> IK;
typedef CGAL::Simple_cartesian<CGAL::Quotient&lt;CGAL::MP_Float> > EK;
typedef CGAL::Cartesian_converter<IK,EK> IK_to_EK;
typedef CGAL::Cartesian_converter<EK,IK> EK_to_IK;

Do you have any suggestion??

Mario



--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/off-To-stl-coverter-tp4657020p4657075.html
Sent from the cgal-discuss mailing list archive at Nabble.com.





Archive powered by MHonArc 2.6.18.

Top of Page