mirror of https://github.com/CGAL/cgal
- demo now output an off file, probably non oriented.
- Mesh_3/application/off_to_medit.C helps to convert it to a medit file.
This commit is contained in:
parent
e5d4a9f32a
commit
ba53fc3365
|
|
@ -62,8 +62,8 @@ int main(int argc, char** argv)
|
|||
if(off)
|
||||
{
|
||||
mesh << (i1 + 1) << " "
|
||||
<< (i2 + 1) << " "
|
||||
<< (i3 + 1) << " 0\n";
|
||||
<< (i2 + 1) << " "
|
||||
<< (i3 + 1) << " 0\n";
|
||||
--number_of_faces;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
5 April 2006 Laurent Rineau
|
||||
- demo now output an off file, probably non oriented.
|
||||
- Mesh_3/application/off_to_medit.C helps to convert it to a medit file.
|
||||
|
||||
29 March 2006 Laurent Rineau
|
||||
- New "#ifdef CGAL_USE_CORE/#endif" around the use of CORE, in
|
||||
test/Surface_mesher/implicit_surface_mesher_test.C
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#include <CGAL/make_surface_mesh.h>
|
||||
#include <CGAL/Implicit_surface_3.h>
|
||||
|
||||
#include <CGAL/IO/Complex_2_in_triangulation_3_file_writer.h>
|
||||
|
||||
#include "implicit_functions.h"
|
||||
#include "parameters.h"
|
||||
|
||||
|
|
@ -199,5 +201,14 @@ int main(int argc, char **argv) {
|
|||
|
||||
std::cerr << "\nNumber of points after refine_surface(): "
|
||||
<< tr.number_of_vertices() << std::endl;
|
||||
|
||||
|
||||
std::cerr << "\nWriting " << filename.c_str() << "...\n";
|
||||
std::ofstream out(filename.c_str());
|
||||
if( !out )
|
||||
std::cerr << "Cannot open " << filename.c_str() << "!\n";
|
||||
else
|
||||
{
|
||||
CGAL::output_surface_facets_to_off(out, c2t3);
|
||||
std::cerr << "done.\n";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -394,7 +394,6 @@ protected:
|
|||
}
|
||||
|
||||
void set_in_complex (const Cell_handle c, const int i) {
|
||||
++m_number_of_facets;
|
||||
Cell_handle c2 = c->neighbor(i);
|
||||
int i2 = c2->index(c);
|
||||
Facet f = canonical_facet(c, i);
|
||||
|
|
@ -403,7 +402,9 @@ protected:
|
|||
// unifying cases dim == 2 ou 3
|
||||
if (tr.dimension() == 3) {
|
||||
// if not already in the complex
|
||||
if ( face_status (c, i) == NOT_IN_COMPLEX ) {
|
||||
if ( face_status (c, i) == NOT_IN_COMPLEX )
|
||||
{
|
||||
++m_number_of_facets;
|
||||
|
||||
c->set_facet_on_surface(i,true);
|
||||
c2->set_facet_on_surface(i2,true);
|
||||
|
|
@ -434,7 +435,9 @@ protected:
|
|||
}
|
||||
else if (tr.dimension() == 2) {
|
||||
// if not already in the complex
|
||||
if ( face_status (c, i) == NOT_IN_COMPLEX ) {
|
||||
if ( face_status (c, i) == NOT_IN_COMPLEX )
|
||||
{
|
||||
++m_number_of_facets;
|
||||
|
||||
c->set_facet_on_surface(i,true);
|
||||
|
||||
|
|
@ -466,7 +469,6 @@ protected:
|
|||
}
|
||||
|
||||
void remove_from_complex (const Cell_handle c, const int i) {
|
||||
--m_number_of_facets;
|
||||
Cell_handle c2 = c->neighbor(i);
|
||||
int i2 = c2->index(c);
|
||||
Facet f = canonical_facet(c, i);
|
||||
|
|
@ -475,7 +477,9 @@ protected:
|
|||
// unifying cases dim == 2 ou 3
|
||||
if (tr.dimension() == 3) {
|
||||
// if in the complex
|
||||
if ( face_status (c, i) != NOT_IN_COMPLEX ) {
|
||||
if ( face_status (c, i) != NOT_IN_COMPLEX )
|
||||
{
|
||||
--m_number_of_facets;
|
||||
|
||||
c->set_facet_on_surface(i,false);
|
||||
c2->set_facet_on_surface(i2,false);
|
||||
|
|
@ -512,7 +516,9 @@ protected:
|
|||
|
||||
else if (tr.dimension() == 2){
|
||||
// if in the complex
|
||||
if ( face_status (c, i) != NOT_IN_COMPLEX ) {
|
||||
if ( face_status (c, i) != NOT_IN_COMPLEX )
|
||||
{
|
||||
--m_number_of_facets;
|
||||
|
||||
c->set_facet_on_surface(i,false);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,168 +0,0 @@
|
|||
// Copyright (c) 2003-2005 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
// the terms of the Q Public License version 1.0.
|
||||
// See the file LICENSE.QPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Steve Oudot, David Rey, Mariette Yvinec, Laurent Rineau, Andreas Fabri
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef CGAL_COMPLEX_2_IN_TRIANGULATION_SURFACE_MESH_CELL_BASE_3_H
|
||||
#define CGAL_COMPLEX_2_IN_TRIANGULATION_SURFACE_MESH_CELL_BASE_3_H
|
||||
|
||||
#include <CGAL/Complex_2_in_triangulation_cell_base_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class GT, class Cb=Complex_2_in_triangulation_cell_base_3<GT> >
|
||||
class Complex_2_in_triangulation_surface_mesh_cell_base_3 :
|
||||
public Cb {
|
||||
|
||||
public:
|
||||
typedef Complex_2_in_triangulation_surface_mesh_cell_base_3 <GT, Cb> Self;
|
||||
|
||||
template < class TDS3 >
|
||||
struct Rebind_TDS {
|
||||
typedef typename Cb::template Rebind_TDS<TDS3>::Other Cb3;
|
||||
typedef Complex_2_in_triangulation_surface_mesh_cell_base_3 <GT, Cb3> Other;
|
||||
};
|
||||
|
||||
|
||||
typedef typename GT::Point_3 Point;
|
||||
|
||||
typedef typename Cb::Triangulation_data_structure Tds;
|
||||
typedef typename Tds::Vertex_handle Vertex_handle;
|
||||
typedef typename Tds::Cell_handle Cell_handle;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Champs ajoutes a la classe
|
||||
|
||||
// Facets
|
||||
Point tab_surface_center_facets [4];
|
||||
bool facet_visited [4];
|
||||
bool visits [4];
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
Complex_2_in_triangulation_surface_mesh_cell_base_3() : Cb() {
|
||||
|
||||
facet_visited[0] = facet_visited[1] = facet_visited[2] =
|
||||
facet_visited[3] = false;
|
||||
visits[0] = visits[1] = visits[2] = visits[3] = false;
|
||||
}
|
||||
|
||||
Complex_2_in_triangulation_surface_mesh_cell_base_3 (Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Vertex_handle v3) :
|
||||
Cb (v0, v1, v2, v3) {
|
||||
|
||||
facet_visited[0] = facet_visited[1] = facet_visited[2] =
|
||||
facet_visited[3] = false;
|
||||
visits[0] = visits[1] = visits[2] = visits[3] = false;
|
||||
}
|
||||
|
||||
Complex_2_in_triangulation_surface_mesh_cell_base_3 (Vertex_handle v0,
|
||||
Vertex_handle v1,
|
||||
Vertex_handle v2,
|
||||
Vertex_handle v3,
|
||||
Cell_handle n0,
|
||||
Cell_handle n1,
|
||||
Cell_handle n2,
|
||||
Cell_handle n3) :
|
||||
Cb (v0, v1, v2, v3, n0, n1, n2, n3) {
|
||||
|
||||
facet_visited[0] = facet_visited[1] = facet_visited[2] =
|
||||
facet_visited[3] = false;
|
||||
visits[0] = visits[1] = visits[2] = visits[3] = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Access functions
|
||||
|
||||
// Facets
|
||||
|
||||
bool is_facet_visited (const int facet) const {
|
||||
CGAL_assertion (facet>=0 && facet <4);
|
||||
return facet_visited[facet];
|
||||
}
|
||||
|
||||
bool visited (const int facet) const {
|
||||
CGAL_assertion (facet>=0 && facet <4);
|
||||
return visits[facet];
|
||||
}
|
||||
|
||||
const Point& get_facet_surface_center(const int facet) const {
|
||||
CGAL_assertion (facet>=0 && facet <4);
|
||||
return(tab_surface_center_facets[facet]);
|
||||
}
|
||||
|
||||
// Setting functions
|
||||
|
||||
// Facets
|
||||
|
||||
void set_facet_visited (const int facet) {
|
||||
CGAL_assertion (facet>=0 && facet <4);
|
||||
facet_visited[facet] = true;
|
||||
}
|
||||
|
||||
void set_visited (const int facet) {
|
||||
CGAL_assertion (facet>=0 && facet <4);
|
||||
visits[facet] = true;
|
||||
}
|
||||
|
||||
void reset_visited (const int facet) {
|
||||
CGAL_assertion (facet>=0 && facet <4);
|
||||
visits[facet] = false;
|
||||
facet_visited [facet] = false;
|
||||
}
|
||||
|
||||
void set_facet_surface_center(const int facet,
|
||||
const Point& p) {
|
||||
CGAL_assertion (facet>=0 && facet <4);
|
||||
tab_surface_center_facets[facet]=p;
|
||||
}
|
||||
|
||||
}; // end Complex_2_in_triangulation_surface_mesh_cell_base_3
|
||||
|
||||
template < class GT, class Cb >
|
||||
std::istream&
|
||||
operator>>(std::istream &is,
|
||||
Complex_2_in_triangulation_surface_mesh_cell_base_3<GT, Cb> &v)
|
||||
{
|
||||
return is >> static_cast<Cb&>(v);
|
||||
}
|
||||
|
||||
template < class GT, class Cb >
|
||||
std::ostream&
|
||||
operator<<(std::ostream &os,
|
||||
const Complex_2_in_triangulation_surface_mesh_cell_base_3<GT, Cb> &v)
|
||||
{
|
||||
return os << static_cast<const Cb&>(v);
|
||||
}
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
|
||||
#endif // CGAL_COMPLEX_2_IN_TRIANGULATION_SURFACE_MESH_CELL_BASE_3_H
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2003-2005 INRIA Sophia-Antipolis (France).
|
||||
// Copyright (c) 2003-2006 INRIA Sophia-Antipolis (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you may redistribute it under
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
// $Id$
|
||||
//
|
||||
//
|
||||
// Author(s) : Steve OUDOT
|
||||
// Author(s) : Steve Oudot, Laurent Rineau
|
||||
|
||||
|
||||
#ifndef CGAL_IO_COMPLEX_2_IN_TRIANGULATION_3_FILE_WRITER_H
|
||||
|
|
@ -37,9 +37,11 @@ int number_of_facets_on_surface(const Tr& T) {
|
|||
}
|
||||
|
||||
|
||||
template < class Tr>
|
||||
template <class C2t3>
|
||||
void
|
||||
output_surface_facets_to_off (std::ostream& os, const Tr & T) {
|
||||
output_surface_facets_to_off (std::ostream& os, const C2t3& c2t3)
|
||||
{
|
||||
typedef typename C2t3::Triangulation Tr;
|
||||
typedef typename Tr::Finite_facets_iterator Finite_facets_iterator;
|
||||
typedef typename Tr::Finite_vertices_iterator Finite_vertices_iterator;
|
||||
typedef typename Tr::Vertex_handle Vertex_handle;
|
||||
|
|
@ -47,36 +49,41 @@ output_surface_facets_to_off (std::ostream& os, const Tr & T) {
|
|||
|
||||
// Header.
|
||||
|
||||
const Tr& tr = c2t3.triangulation();
|
||||
|
||||
os << "OFF \n"
|
||||
<< T.number_of_vertices() << " " <<
|
||||
number_of_facets_on_surface (T) <<
|
||||
" " << 0 << "\n";
|
||||
<< tr.number_of_vertices() << " "
|
||||
<< c2t3.number_of_facets()
|
||||
<< " " << 0 << "\n";
|
||||
|
||||
CGAL_assertion(c2t3.number_of_facets() == number_of_facets_on_surface(tr));
|
||||
|
||||
os << std::setprecision(20);
|
||||
|
||||
// Finite vertices coordinates.
|
||||
std::map<Vertex_handle, int> V;
|
||||
int inum = 0;
|
||||
for( Finite_vertices_iterator
|
||||
vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit) {
|
||||
for(Finite_vertices_iterator vit = tr.finite_vertices_begin();
|
||||
vit != tr.finite_vertices_end();
|
||||
++vit)
|
||||
{
|
||||
V[vit] = inum++;
|
||||
Point p = static_cast<Point>(vit->point());
|
||||
os << p.x() << " " << p.y() << " " << p.z() << "\n";
|
||||
}
|
||||
|
||||
// Finite facets indices.
|
||||
for( Finite_facets_iterator fit = T.finite_facets_begin();
|
||||
fit != T.finite_facets_end(); ++fit)
|
||||
for( Finite_facets_iterator fit = tr.finite_facets_begin();
|
||||
fit != tr.finite_facets_end(); ++fit)
|
||||
if ((*fit).first->is_facet_on_surface((*fit).second)==true)
|
||||
{
|
||||
os << "3 ";
|
||||
for (int i=0; i<4; i++)
|
||||
if (i != (*fit).second)
|
||||
os << V[(*fit).first->vertex(i)] << " ";
|
||||
|
||||
os << "\n"; // without color.
|
||||
}
|
||||
{
|
||||
os << "3 ";
|
||||
for (int i=0; i<4; i++)
|
||||
if (i != (*fit).second)
|
||||
os << V[(*fit).first->vertex(i)] << " ";
|
||||
|
||||
os << "\n"; // without color.
|
||||
}
|
||||
}
|
||||
|
||||
// only if cells have is_in_domain() method.
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ namespace CGAL {
|
|||
|
||||
// Tests whether a given facet is restricted or not
|
||||
bool is_facet_on_surface(const Facet& f, Point& center,
|
||||
const bool check_visits = false) {
|
||||
const bool check_visits = true) {
|
||||
typedef typename Surface_mesh_traits::Intersect_3 Intersect_3;
|
||||
Intersect_3 intersect = meshtraits.intersect_3_object();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue