Mesh_object Class Reference

The mesh object class. More...

#include <Mesh_object.h>

Collaboration diagram for Mesh_object:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Mesh_object ()
 Classical constructor.
 Mesh_object (const Mesh_object &)
 Copy Constructor.
 ~Mesh_object ()
 Classical destroy.
int destroy ()
 set all vector to 0
int get_vertex_number () const
 Number of vertices.
double & get_vertex (int k_vertex, int k_dim)
 Get vertex value.
double & get_vertex (int k_polygon, int k_vertex, int k_dim)
 Get vertex value.
double get_vertex (int k_vertex, int k_dim) const
 Get vertex value.
double get_vertex (int k_polygon, int k_vertex, int k_dim) const
 Get vertex value.
const double * get_vertex_p (int k_vertex)
 Get vertex pointer in double*.
const double * get_vertex_p (int k_polygon, int k_vertex)
 Get vertex pointer in double*.
V_3D get_vertex_v3d (int k_vertex) const
 Get vertex and return V_3D class.
V_3D get_vertex_v3d (int k_polygon, int k_vertex) const
 Get vertex and return V_3D class.
int set_vertex (int k_vertex, double x, double y, double z)
 Set vertex from the 3 coordinates.
int set_vertex (int k_vertex, int k_dim, double value)
 Set vertex from pointing a coordinate.
int set_vertex (int k_vertex, V_3D v)
 Set vertex form V_3D class.
int set_vertex (int k_vertex, double *v)
 Set vertex from pointer (only one point)=> assume size(v)=3.
int set_vertex (int k_vertex, int dim, double *v)
 Set vertex from a set of point in a pointer mode size(v)=3*dim.
int set_vertex (const Point_set &p)
 Set vertex from Point_Set.
int add_vertex (double x, double y, double z)
 Add a given vertex.
int add_vertex (const V_3D &v)
 Add a given vertex.
int add_vertex (const std::vector< double > &to_add)
 Add a vector of vertex.
int add_vertex (const std::vector< V_3D > &to_add)
 Add a vector of vertex in a V_3D vector.
int add_vertex (const double *v)
 Add a vertex via pointer (size should be 3).
int add_vertex (int dim, double *v)
 Add multiple vertices (size(v) should be 3*dim).
int add_vertex (const Point_set &p)
 Add from a Point_set class.
int add_unique (double x, double y, double z, double epsilon)
 Add unique vertex with an error epsilon (return -1 if not found).
int add_unique (const V_3D &v, double epsilon)
 Add unique vertex with an error epsilon (return -1 if not found).
int add_unique (const double *v, double epsilon)
 Add unique vertex with an error epsilon (return -1 if not found).
int exist (const V_3D &v) const
 look if a given vertex exists (return -1 if not)
int exist (const V_3D &v, double epsilon) const
 look if a given vertex exists (return -1 if not)
int exist (double x, double y, double z) const
 look if a given vertex exists (return -1 if not)
int exist (double x, double y, double z, double epsilon) const
 look if a given vertex exists (return -1 if not)
int eliminate (int k_index)
 Eliminate a given vertex.
int eliminate (const std::vector< int > &k_index)
 Eliminate a set of vertices.
int eliminate (const std::vector< double > &k_index)
 Eliminate a set of vertices.
int eliminate (double x, double y, double z)
 Eliminate a vertex equal at (x,y,z).
int eliminate (double x, double y, double z, double epsilon)
 Eliminate a vertex equal at (x,y,z) with the given error=epsilon.
int eliminate (const V_3D &x, double epsilon)
 Eliminate a vertex such that ||vertex-x||<=epsilon.
int eliminate (const V_3D &x)
 Eliminate a vertex such that ||vertex-x|| is small enough.
int eliminate (const double *x, double epsilon)
 Eliminate a vertex such that ||vertex-x||<=epsilon.
int eliminate (const double *x)
 Eliminate a vertex such that ||vertex-x|| is small enough.
int matrix_transform (const Matrix &M)
 Apply a general 4x4 matrix of transformation to every vertex.
int rotate (const V_3D &n, double angle)
 Rotate every vertex by a rotation of angle around the vector n.
int rotate (double n_x, double n_y, double n_z, double angle)
 Rotate every vertex by a rotation of angle around the vector (nx,ny,nz).
int rotate (const double *n, double angle)
 Rotate every vertex by a rotation of angle around the vector n.
int rotate_centered (const V_3D &n, double angle)
 Rotate every vertex by a rotation of angle around the vector n centered to the barycenter of the points set.
int rotate_centered (double n_x, double n_y, double n_z, double angle)
 Rotate every vertex by a rotation of angle around the vector (nx,ny,nz) centered to the barycenter of the points set.
int rotate_centered (const double *n, double angle)
 Rotate every vertex by a rotation of angle around the vector n centered to the barycenter of the points set.
int rotate (const V_3D &n, double angle, const V_3D &center)
 Rotate every vertex by a rotation of angle around the vector n centered on the point: center.
int rotate (double n_x, double n_y, double n_z, double angle, const V_3D &center)
 Rotate every vertex by a rotation of angle around the vector (nx,ny,nz) centered on the point: center.
int rotate (const double *n, double angle, const V_3D &center)
 Rotate every vertex by a rotation of angle around the vector n centered on the point: center.
int translate (double t_x, double t_y, double t_z)
 Translate every vertex by the vector (tx,ty,tz).
int translate (const double *t)
 Translate every vertex by the vector t.
int translate (const V_3D &t)
 Translate every vertex by the vector t.
int scale (double s_x, double s_y, double s_z)
 Scale every vertex by the factor (sx,sy,sz).
int scale (const double *s)
 Scale every vertex by the factor (s[0],s[1],s[2]).
int scale (const V_3D &s)
 Scale every vertex by the factor (s[0],s[1],s[2]).
int scale (double s)
 Scale every vertex by the factor s (the same in every direction).
int scale_centered (double s_x, double s_y, double s_z)
 Scale every vertex by the factor (sx,sy,sz) centered on the barycenter of the mesh.
int scale_centered (const double *s)
 Scale every vertex by the factor (s[0],s[1],s[2]) centered on the barycenter of the mesh.
int scale_centered (const V_3D &s)
 Scale every vertex by the factor (s[0],s[1],s[2]) centered on the barycenter of the mesh.
int scale_centered (double s)
 Scale every vertex by the factor s (the same in every direction) centered on the barycenter of the mesh.
V_3D get_middle_point () const
 Return the middle of the Points Set.
V_3D get_min_point () const
 Return the min of the Points Set.
V_3D get_max_point () const
 Return the max of the Points Set.
V_3D get_size_mesh () const
 Return the size of the mesh.
int center_mesh ()
int unitize_size ()
double get_closest_distance (double x, double y, double z, int *index) const
 get the index which is the closest of (x,y,z)
double get_closest_distance (const double *x, int *index) const
 get the index which is the closest of x
double get_closest_distance (const V_3D &x, int *index) const
 get the index which is the closest of x
double get_further_distance (double x, double y, double z, int *index) const
 get the index which is the further of (x,y,z)
double get_further_distance (const double *x, int *index) const
 get the index which is the further of x
double get_further_distance (const V_3D &x, int *index) const
 get the index which is the further of x
double distance_to_index (double x, double y, double z, int index) const
 get the distance of the point (x,y,z) to the vertex at position=index
double distance_to_index (const double *x, int index) const
 get the distance of the point x to the vertex at position=index
double distance_to_index (const V_3D &x, int index) const
 get the distance of the point x to the vertex at position=index
std::vector< int > N_closest (const V_3D &center, int N_closest) const
 get the N-closest vertices of the point center
std::vector< int > N_closest (double x, double y, double z, int N_closest) const
 get the N-closest vertices of the point (x,y,z)
std::vector< int > N_closest (double *x, int N_closest) const
 get the N-closest vertices of the point x
V_3D get_closest_vertex (const V_3D &center) const
 get the closest vertex
V_3D get_closest_vertex (double x, double y, double z) const
 get the closest vertex
V_3D get_closest_vertex (const double *x) const
 get the closest vertex
int get_index (int k_index) const
 get index from k_index
int & get_index (int k_index)
 get index from k_index
int get_index (int k_polygon, int k_index) const
 get index from k_index of k_polygon
int & get_index (int k_polygon, int k_index)
 get index from k_index of k_polygon
std::vector< int > get_index_of_polygon (int k_polygon) const
 get full_index of the given polygon
const int * get_index () const
 get_pointer
Connectivityget_connectivity ()
 get the Connectivity class
const Connectivityget_connectivity () const
 get the Connectivity class
int size_index () const
 size of the vector
int polygon_number () const
 number of polygons
int polygon_size (int k_polygon) const
 get size of the given polygon
int vertex_number () const
 get number of vertex by taking the max of every vertex index
int get_index_triangulated (int k_index) const
 get index of the triangulated version
int & get_index_triangulated (int k_index)
 get index of the triangulated version
int get_index_triangulated (int k_triangle, int k_index) const
 get index of this triangle in the triangulated version
int & get_index_triangulated (int k_triangle, int k_index)
 get index of this triangle in the triangulated version
const int * get_index_triangulated () const
 get pointer of the triangulation
int get_triangle_number () const
 get number of triangules in the triangulated version
int find_polygon (const std::vector< int > &polygon) const
 try to find a given polygon return polygon number or -1 if not found
int build_connectivity_index ()
 rebuild the index
int triangulate ()
 Triangulate the mesh.
int get_polygon_access (int k_polygon) const
 Get the polygon access from the connectivity.
int add_polygon (const std::vector< int > &polygon)
 add a full polygon
int add_polygon (int index_0, int index_1, int index_2, int index_3)
 add a full quad
int add_polygon (int index_0, int index_1, int index_2)
 add a full triangle
int add_index (int index)
 add index of polygon
int set_polygon (int k_polygon, const std::vector< int > &polygon)
 set polygon number k
int set_index (int k_polygon, int k_index, int index)
 set index
int delete_polygon (int k_polygon)
 delete polygon
int delete_given_polygon (const std::vector< int > polygon)
 delete polygon from a given polygon
int flip_polygon (int k_polygon)
 Flip a given polygon.
int flip_polygon ()
 Flip every polygon.
int_vector get_one_ring (int k_polygon, int k_vertex) const
 get one ring
int_vector get_one_ring (int k_vertex) const
 get one ring
int_vector get_polygon_ring (int k_polygon, int k_vertex) const
 get Polygon ring
int_vector get_polygon_ring (int k_vertex) const
 get Polygon ring
int build_manifold ()
 build manifold if there is triangle inversion
int build_edges ()
 build entire edges from polygons
int build_normal_per_polygon ()
 build a normal for each polygon
int build_normal_intermediate (double angle_threshold)
 build a different normal for every vertex of every polygon
int build_normal_per_vertex ()
 build a smooth normal for every vertex
int normal_type () const
 return the type of calculated normal (-1 if not)
V_3D get_polygon_normal (int k_polygon) const
 return the normal if they is one normal per polygon (type=1)
V_3D get_polygon_and_vertex_normal (int k_polygon, int k_vertex) const
 return the normal if they is one normal per polygon per vertex (type=3)
V_3D get_vertex_normal (int k_vertex) const
 return the normal if they is one normal per vertex (type=1)
int set_vertex_normal (int k_vertex, const V_3D &n)
 set the normal per vertex (if they is one normal per vertex: type=1)
V_3D get_vertex_normal (int k_polygon, int k_vertex) const
 return the normal if they is one normal per vertex (type=1)
int set_vertex_normal (int k_polygon, int k_vertex, const V_3D &n)
 set the normal per vertex (if they is one normal per vertex: type=1)
int set_per_vertex_color ()
 Set up the vector parameter of color for a per vertex color.
int set_per_polygon_color ()
 Set up the vector parameter of color for a per polygon color.
int set_per_polygon_and_vertex_color ()
 Set up the vector parameter of color for a per polygon_and_vertex color.
int color_type () const
 Get the type of color.
int fill_color (double r, double g, double b, double t)
 Fill the whole object with a given color.
int set_per_polygon_color (int k_polygon, double r, double g, double b, double t)
 Set per polygon color.
int get_per_polygon_color (int k_polygon, double *r, double *g, double *b, double *t) const
 Get per polygon color.
int set_per_vertex_color (int k_vertex, double r, double g, double b, double t)
 Set per vertex color (direct access).
int get_per_vertex_color (int k_vertex, double *r, double *g, double *b, double *t) const
 Get per vertex color (direct access).
int set_per_vertex_color (int k_polygon, int k_vertex, double r, double g, double b, double t)
 Set per vertex color.
int get_per_vertex_color (int k_polygon, int k_vertex, double *r, double *g, double *b, double *t) const
 Get per vertex color.
int set_per_polygon_and_vertex_color (int k_polygon, int k_vertex, double r, double g, double b, double t)
 Set per polygon_and_vertex color.
int get_per_polygon_and_vertex_color (int k_polygon, int k_vertex, double *r, double *g, double *b, double *t) const
 Get per polygon_and_vertex color.
int increase_alpha (double d_alpha)
 increase the transparency
int decrease_alpha (double d_alpha)
 decrease the transparency
int set_intermediate_texture ()
 enable the intermediate texture (vector of texture and index)
int texture_type () const
 return if texture is enabled or not
int get_intermediate_texture (int k_polygon, int k_vertex, double *t0, double *t1) const
 get texture coords
int set_intermediate_texture (int k_polygon, int k_vertex, double t0, double t1)
 set texture coords
int add_intermediate_texture (double t0, double t1)
 Add 2-coords texture in the vector.
int add_polygon_texture (const std::vector< int > &index)
 Add polygon index in the texture vector.
int set_texture_number (int k_texture)
 set the texture number
int get_texture_number () const
 get the texture number
int get_texture_polygon_number () const
 get the number of polygon of texture loaded (should be equal to the polygon of the mesh)
int check_texture () const
 check if texture are [ok] to be displayed
std::vector< int > add_unique_polygon (const Polygon &polygon)
 Add the polygon in a unique sens.
Polygon get_polygon (int k_polygon) const
 return the designated polygon
V_3D closest_mesh_point (const V_3D &x) const
 find the closest point on the mesh surface
std::vector< Curve_3Dplane_intersection (const V_3D &n, const V_3D &x0) const
 Get the intersection between the mesh and a plane.
Mesh_object half_space_intersection (const V_3D &n, const V_3D &x0, int *type)
 Return the intersection of the Mesh and the half space defined by the oriented plane <n,x-x0>=0.
Mesh_object half_space_intersection (const V_3D &n, const V_3D &x0)
 Return the intersection of the Mesh and the half space defined by the oriented plane <n,x-x0>=0.
int Laplacien_smooth (double lambda)
 Smooth a mesh using a Laplacien operator on the one ring.
int build_cube ()
 build a unit cube from [0,1]x[0,1]x[0,1]
int subdivide_mid_edge ()
 subdivide the mesh by linking consecutives middle points of the edges
int subdivide_barycenter_mid_edge ()
 subdivide the mesh by linking consecutives middle points of the edges to the barycenter
int subdivide_mixed_mid_edge ()
 subdivide the mesh with the middle edge. If it is a triangle, then
int fast_subdivide_mid_edge ()
 subdivide the mesh by linking consecutives middle points of the edges
int fast_subdivide_barycenter_mid_edge ()
 subdivide the mesh by linking consecutives middle points of the edges to the barycenter
int fast_subdivide_mixed_mid_edge ()
 subdivide the mesh by mixing the mid edge and the barycenter method for quads and triangles.
int load_off_file (const char *filename)
 Load a OFF file.
int load_off_file (const std::string &filename)
 Load a OFF file.
int save_off_file (const char *filename) const
 Save Mesh as a OFF file.
int save_off_file (const std::string &filename) const
 Save Mesh as a OFF file.
int load_obj_file (const char *filename)
 Load a OBJ file.
int load_obj_file (const std::string &filename)
 Load a OBJ file.
int save_obj_file (const char *filename)
 Save Mesh as a OBJ file.
int save_obj_file (const std::string &filename)
 Save Mesh as a OBJ file.
int load_collada_file (const char *filename)
 Load a COLLADA file.
int load_collada_file (const std::string &filename)
 Load a COLLADA file.
int load_collada_file (const char *filename, const char *geometry_name)
 Load a COLLADA file.
int load_collada_file (const std::string &filename, const std::string &geometry_name)
 Load a COLLADA file.
int load_g_file (const char *filename)
 Load a g file.
int load_g_file (const std::string &filename)
 Load a g file.
int save_g_file (const char *filename) const
 save a g file
int save_g_file (const std::string &filename) const
 save a g file
int set_name (const char *name)
 set the mesh name
int set_name (const std::string &name)
 set the mesh name
std::string get_name () const
 get the mesh name
std::string & get_name ()
 get the mesh name

Private Attributes

Connectivity connectivity
 The connectivity of the mesh.
Point_set point_set
 The geometry of the mesh.
std::vector< Vector_parameterparameters
 Vector of parameters.
std::string name
 name of the mesh


Detailed Description

The mesh object class.

The C0 mesh associating geometry as a point set and a connectivity

Definition at line 58 of file Mesh_object.h.


Constructor & Destructor Documentation

Mesh_object::Mesh_object (  ) 

Classical constructor.

Definition at line 5 of file Mesh_object.cpp.

References name.

00006 {name="NO_NAME";}

Mesh_object::Mesh_object ( const Mesh_object m  ) 

Copy Constructor.

Definition at line 11 of file Mesh_object.cpp.

References connectivity, name, parameters, and point_set.

00012 {
00013   connectivity = m.connectivity;
00014   point_set = m.point_set;
00015   parameters = m.parameters;
00016   name = m.name;
00017 }

Mesh_object::~Mesh_object (  ) 

Classical destroy.

Definition at line 8 of file Mesh_object.cpp.

References destroy().

00009 {destroy();}

Here is the call graph for this function:


Member Function Documentation

int Mesh_object::destroy (  ) 

set all vector to 0

Definition at line 19 of file Mesh_object.cpp.

References connectivity, Point_set::destroy(), Connectivity::destroy(), name, parameters, and point_set.

Referenced by build_cube(), load_collada_file(), load_g_file(), load_obj_file(), load_off_file(), and ~Mesh_object().

00020 {
00021   connectivity.destroy();
00022   point_set.destroy();
00023   parameters.resize(0);
00024   name="NO_NAME";
00025   return 0;
00026 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::get_vertex_number (  )  const

Number of vertices.

Number of stored vertex ((x0,y0,z0),...,(xN,yN,zN))

Definition at line 29 of file Mesh_object.cpp.

References point_set, and Point_set::size().

Referenced by add_unique_polygon(), Skinned::automatic_weight_calculation(), Skinned::check_integrity_skinning(), Skinned::fill_vertex_depending_on_bone(), File_parser::load_collada_skining_attribute(), Skinned::normalize_weight(), Skinned::skinning(), and vertex_number().

00030 {return point_set.size();}

Here is the call graph for this function:

Here is the caller graph for this function:

double & Mesh_object::get_vertex ( int  k_vertex,
int  k_dim 
)

Get vertex value.

Definition at line 31 of file Mesh_object.cpp.

References point_set.

00032 {return point_set(k_vertex,k_dim);}

double & Mesh_object::get_vertex ( int  k_polygon,
int  k_vertex,
int  k_dim 
)

Get vertex value.

Definition at line 33 of file Mesh_object.cpp.

References connectivity, and point_set.

00034 {return point_set(connectivity(k_polygon,k_vertex),k_dim);}

double Mesh_object::get_vertex ( int  k_vertex,
int  k_dim 
) const

Get vertex value.

Definition at line 35 of file Mesh_object.cpp.

References point_set.

00036 {return point_set(k_vertex,k_dim);}

double Mesh_object::get_vertex ( int  k_polygon,
int  k_vertex,
int  k_dim 
) const

Get vertex value.

Definition at line 37 of file Mesh_object.cpp.

References connectivity, and point_set.

00038 {return point_set(connectivity(k_polygon,k_vertex),k_dim);}

const double * Mesh_object::get_vertex_p ( int  k_vertex  ) 

Get vertex pointer in double*.

Definition at line 39 of file Mesh_object.cpp.

References Point_set::get_vertex_p(), and point_set.

00040 {return point_set.get_vertex_p(k_vertex);}

Here is the call graph for this function:

const double * Mesh_object::get_vertex_p ( int  k_polygon,
int  k_vertex 
)

Get vertex pointer in double*.

Definition at line 41 of file Mesh_object.cpp.

References connectivity, Point_set::get_vertex_p(), and point_set.

00042 {return point_set.get_vertex_p(connectivity(k_polygon,k_vertex));}

Here is the call graph for this function:

V_3D Mesh_object::get_vertex_v3d ( int  k_vertex  )  const

V_3D Mesh_object::get_vertex_v3d ( int  k_polygon,
int  k_vertex 
) const

Get vertex and return V_3D class.

Definition at line 45 of file Mesh_object.cpp.

References connectivity, and point_set.

00046 {return point_set(connectivity(k_polygon,k_vertex));}

int Mesh_object::set_vertex ( int  k_vertex,
double  x,
double  y,
double  z 
)

Set vertex from the 3 coordinates.

Definition at line 49 of file Mesh_object.cpp.

References point_set, and Point_set::set_vertex().

Referenced by Laplacien_smooth(), and Skinned::skinning().

00050 {return point_set.set_vertex(k_vertex,x,y,z);}

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_vertex ( int  k_vertex,
int  k_dim,
double  value 
)

Set vertex from pointing a coordinate.

Definition at line 51 of file Mesh_object.cpp.

References point_set, and Point_set::set_vertex().

00052 {return point_set.set_vertex(k_vertex,k_dim,value);}

Here is the call graph for this function:

int Mesh_object::set_vertex ( int  k_vertex,
V_3D  v 
)

Set vertex form V_3D class.

Definition at line 53 of file Mesh_object.cpp.

References point_set, and Point_set::set_vertex().

00054 {return point_set.set_vertex(k_vertex,v);}

Here is the call graph for this function:

int Mesh_object::set_vertex ( int  k_vertex,
double *  v 
)

Set vertex from pointer (only one point)=> assume size(v)=3.

Definition at line 55 of file Mesh_object.cpp.

References point_set, and Point_set::set_vertex().

00056 {return point_set.set_vertex(k_vertex,v);}

Here is the call graph for this function:

int Mesh_object::set_vertex ( int  k_vertex,
int  dim,
double *  v 
)

Set vertex from a set of point in a pointer mode size(v)=3*dim.

Definition at line 57 of file Mesh_object.cpp.

References point_set, and Point_set::set_vertex().

00058 {return point_set.set_vertex(k_vertex,dim,v);}

Here is the call graph for this function:

int Mesh_object::set_vertex ( const Point_set p  ) 

Set vertex from Point_Set.

Definition at line 59 of file Mesh_object.cpp.

References point_set, and Point_set::set_vertex().

00060 {return point_set.set_vertex(p);}

Here is the call graph for this function:

int Mesh_object::add_vertex ( double  x,
double  y,
double  z 
)

Add a given vertex.

Definition at line 64 of file Mesh_object.cpp.

References Point_set::add_vertex(), and point_set.

Referenced by add_unique_polygon(), build_cube(), fast_subdivide_barycenter_mid_edge(), fast_subdivide_mid_edge(), fast_subdivide_mixed_mid_edge(), subdivide_barycenter_mid_edge(), subdivide_mid_edge(), and subdivide_mixed_mid_edge().

00065 {return point_set.add_vertex(x,y,z);}

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::add_vertex ( const V_3D v  ) 

Add a given vertex.

Definition at line 66 of file Mesh_object.cpp.

References Point_set::add_vertex(), and point_set.

00067 {return point_set.add_vertex(v);}

Here is the call graph for this function:

int Mesh_object::add_vertex ( const std::vector< double > &  to_add  ) 

Add a vector of vertex.

Definition at line 68 of file Mesh_object.cpp.

References Point_set::add_vertex(), and point_set.

00069 {return point_set.add_vertex(to_add);}

Here is the call graph for this function:

int Mesh_object::add_vertex ( const std::vector< V_3D > &  to_add  ) 

Add a vector of vertex in a V_3D vector.

Definition at line 70 of file Mesh_object.cpp.

References Point_set::add_vertex(), and point_set.

00071 {return point_set.add_vertex(to_add);}

Here is the call graph for this function:

int Mesh_object::add_vertex ( const double *  v  ) 

Add a vertex via pointer (size should be 3).

Definition at line 72 of file Mesh_object.cpp.

References Point_set::add_vertex(), and point_set.

00073 {return point_set.add_vertex(v);}

Here is the call graph for this function:

int Mesh_object::add_vertex ( int  dim,
double *  v 
)

Add multiple vertices (size(v) should be 3*dim).

Definition at line 74 of file Mesh_object.cpp.

References Point_set::add_vertex(), and point_set.

00075 {return point_set.add_vertex(dim,v);}

Here is the call graph for this function:

int Mesh_object::add_vertex ( const Point_set p  ) 

Add from a Point_set class.

Definition at line 76 of file Mesh_object.cpp.

References Point_set::add_vertex(), and point_set.

00077 {return point_set.add_vertex(p);}

Here is the call graph for this function:

int Mesh_object::add_unique ( double  x,
double  y,
double  z,
double  epsilon 
)

Add unique vertex with an error epsilon (return -1 if not found).

Definition at line 82 of file Mesh_object.cpp.

References Point_set::add_unique(), and point_set.

00083 {return point_set.add_unique(x,y,z,epsilon);}

Here is the call graph for this function:

int Mesh_object::add_unique ( const V_3D v,
double  epsilon 
)

Add unique vertex with an error epsilon (return -1 if not found).

Definition at line 84 of file Mesh_object.cpp.

References Point_set::add_unique(), and point_set.

00085 {return point_set.add_unique(v,epsilon);}

Here is the call graph for this function:

int Mesh_object::add_unique ( const double *  v,
double  epsilon 
)

Add unique vertex with an error epsilon (return -1 if not found).

Definition at line 86 of file Mesh_object.cpp.

References Point_set::add_unique(), and point_set.

00087 {return point_set.add_unique(v,epsilon);}  

Here is the call graph for this function:

int Mesh_object::exist ( const V_3D v  )  const

look if a given vertex exists (return -1 if not)

Definition at line 89 of file Mesh_object.cpp.

References Point_set::exist(), and point_set.

Referenced by add_unique_polygon().

00090 {return point_set.exist(v);}

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::exist ( const V_3D v,
double  epsilon 
) const

look if a given vertex exists (return -1 if not)

Definition at line 91 of file Mesh_object.cpp.

References Point_set::exist(), and point_set.

00092 {return point_set.exist(v,epsilon);}

Here is the call graph for this function:

int Mesh_object::exist ( double  x,
double  y,
double  z 
) const

look if a given vertex exists (return -1 if not)

Definition at line 93 of file Mesh_object.cpp.

References Point_set::exist(), and point_set.

00094 {return point_set.exist(x,y,z);}

Here is the call graph for this function:

int Mesh_object::exist ( double  x,
double  y,
double  z,
double  epsilon 
) const

look if a given vertex exists (return -1 if not)

Definition at line 95 of file Mesh_object.cpp.

References Point_set::exist(), and point_set.

00096 {return point_set.exist(x,y,z,epsilon);}

Here is the call graph for this function:

int Mesh_object::eliminate ( int  k_index  ) 

Eliminate a given vertex.

Definition at line 99 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00100 {return point_set.eliminate(k_index);}

Here is the call graph for this function:

int Mesh_object::eliminate ( const std::vector< int > &  k_index  ) 

Eliminate a set of vertices.

Definition at line 101 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00102 {return point_set.eliminate(k_index);}

Here is the call graph for this function:

int Mesh_object::eliminate ( const std::vector< double > &  k_index  ) 

Eliminate a set of vertices.

Definition at line 103 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00104 {return point_set.eliminate(k_index);}

Here is the call graph for this function:

int Mesh_object::eliminate ( double  x,
double  y,
double  z 
)

Eliminate a vertex equal at (x,y,z).

Definition at line 105 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00106 {return point_set.eliminate(x,y,z);}

Here is the call graph for this function:

int Mesh_object::eliminate ( double  x,
double  y,
double  z,
double  epsilon 
)

Eliminate a vertex equal at (x,y,z) with the given error=epsilon.

Definition at line 107 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00108 {return point_set.eliminate(x,y,z,epsilon);}

Here is the call graph for this function:

int Mesh_object::eliminate ( const V_3D x,
double  epsilon 
)

Eliminate a vertex such that ||vertex-x||<=epsilon.

Definition at line 109 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00110 {return point_set.eliminate(x,epsilon);}

Here is the call graph for this function:

int Mesh_object::eliminate ( const V_3D x  ) 

Eliminate a vertex such that ||vertex-x|| is small enough.

Definition at line 111 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00112 {return point_set.eliminate(x);}

Here is the call graph for this function:

int Mesh_object::eliminate ( const double *  x,
double  epsilon 
)

Eliminate a vertex such that ||vertex-x||<=epsilon.

Definition at line 113 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00114 {return point_set.eliminate(x,epsilon);}

Here is the call graph for this function:

int Mesh_object::eliminate ( const double *  x  ) 

Eliminate a vertex such that ||vertex-x|| is small enough.

Definition at line 115 of file Mesh_object.cpp.

References Point_set::eliminate(), and point_set.

00116 {return point_set.eliminate(x);}

Here is the call graph for this function:

int Mesh_object::matrix_transform ( const Matrix M  ) 

Apply a general 4x4 matrix of transformation to every vertex.

Definition at line 644 of file Mesh_object.cpp.

References Point_set::matrix_transform(), and point_set.

00645 {return point_set.matrix_transform(M);}

Here is the call graph for this function:

int Mesh_object::rotate ( const V_3D n,
double  angle 
)

Rotate every vertex by a rotation of angle around the vector n.

Definition at line 647 of file Mesh_object.cpp.

References point_set, and Point_set::rotate().

00648 {return point_set.rotate(n,angle);}

Here is the call graph for this function:

int Mesh_object::rotate ( double  n_x,
double  n_y,
double  n_z,
double  angle 
)

Rotate every vertex by a rotation of angle around the vector (nx,ny,nz).

Definition at line 649 of file Mesh_object.cpp.

References point_set, and Point_set::rotate().

00650 {return point_set.rotate(n_x,n_y,n_z,angle);}

Here is the call graph for this function:

int Mesh_object::rotate ( const double *  n,
double  angle 
)

Rotate every vertex by a rotation of angle around the vector n.

Definition at line 651 of file Mesh_object.cpp.

References point_set, and Point_set::rotate().

00652 {return point_set.rotate(n,angle);}

Here is the call graph for this function:

int Mesh_object::rotate_centered ( const V_3D n,
double  angle 
)

Rotate every vertex by a rotation of angle around the vector n centered to the barycenter of the points set.

Definition at line 655 of file Mesh_object.cpp.

References point_set, and Point_set::rotate_centered().

00656 {return point_set.rotate_centered(n,angle);}

Here is the call graph for this function:

int Mesh_object::rotate_centered ( double  n_x,
double  n_y,
double  n_z,
double  angle 
)

Rotate every vertex by a rotation of angle around the vector (nx,ny,nz) centered to the barycenter of the points set.

Definition at line 657 of file Mesh_object.cpp.

References point_set, and Point_set::rotate_centered().

00658 {return point_set.rotate_centered(n_x,n_y,n_z,angle);}

Here is the call graph for this function:

int Mesh_object::rotate_centered ( const double *  n,
double  angle 
)

Rotate every vertex by a rotation of angle around the vector n centered to the barycenter of the points set.

Definition at line 659 of file Mesh_object.cpp.

References point_set, and Point_set::rotate_centered().

00660 {return point_set.rotate_centered(n,angle);}

Here is the call graph for this function:

int Mesh_object::rotate ( const V_3D n,
double  angle,
const V_3D center 
)

Rotate every vertex by a rotation of angle around the vector n centered on the point: center.

Definition at line 662 of file Mesh_object.cpp.

References point_set, and Point_set::rotate().

00663 {return point_set.rotate(n,angle,center);}

Here is the call graph for this function:

int Mesh_object::rotate ( double  n_x,
double  n_y,
double  n_z,
double  angle,
const V_3D center 
)

Rotate every vertex by a rotation of angle around the vector (nx,ny,nz) centered on the point: center.

Definition at line 664 of file Mesh_object.cpp.

References point_set, and Point_set::rotate().

00665 {return point_set.rotate(n_x,n_y,n_z,angle,center);}

Here is the call graph for this function:

int Mesh_object::rotate ( const double *  n,
double  angle,
const V_3D center 
)

Rotate every vertex by a rotation of angle around the vector n centered on the point: center.

Definition at line 666 of file Mesh_object.cpp.

References point_set, and Point_set::rotate().

00667 {return point_set.rotate(n,angle,center);}

Here is the call graph for this function:

int Mesh_object::translate ( double  t_x,
double  t_y,
double  t_z 
)

Translate every vertex by the vector (tx,ty,tz).

Definition at line 669 of file Mesh_object.cpp.

References point_set, and Point_set::translate().

00670 {return point_set.translate(t_x,t_y,t_z);}

Here is the call graph for this function:

int Mesh_object::translate ( const double *  t  ) 

Translate every vertex by the vector t.

Definition at line 671 of file Mesh_object.cpp.

References point_set, and Point_set::translate().

00672 {return point_set.translate(t);}

Here is the call graph for this function:

int Mesh_object::translate ( const V_3D t  ) 

Translate every vertex by the vector t.

Definition at line 673 of file Mesh_object.cpp.

References point_set, and Point_set::translate().

00674 {return point_set.translate(t);}

Here is the call graph for this function:

int Mesh_object::scale ( double  s_x,
double  s_y,
double  s_z 
)

Scale every vertex by the factor (sx,sy,sz).

Definition at line 676 of file Mesh_object.cpp.

References point_set, and Point_set::scale().

00677 {return point_set.scale(s_x,s_y,s_z);}

Here is the call graph for this function:

int Mesh_object::scale ( const double *  s  ) 

Scale every vertex by the factor (s[0],s[1],s[2]).

Definition at line 678 of file Mesh_object.cpp.

References point_set, and Point_set::scale().

00679 {return point_set.scale(s);}

Here is the call graph for this function:

int Mesh_object::scale ( const V_3D s  ) 

Scale every vertex by the factor (s[0],s[1],s[2]).

Definition at line 680 of file Mesh_object.cpp.

References point_set, and Point_set::scale().

00681 {return point_set.scale(s);}

Here is the call graph for this function:

int Mesh_object::scale ( double  s  ) 

Scale every vertex by the factor s (the same in every direction).

Definition at line 682 of file Mesh_object.cpp.

References point_set, and Point_set::scale().

00683 {return point_set.scale(s);}

Here is the call graph for this function:

int Mesh_object::scale_centered ( double  s_x,
double  s_y,
double  s_z 
)

Scale every vertex by the factor (sx,sy,sz) centered on the barycenter of the mesh.

Definition at line 685 of file Mesh_object.cpp.

References point_set, and Point_set::scale_centered().

00686 {return point_set.scale_centered(s_x,s_y,s_z);}

Here is the call graph for this function:

int Mesh_object::scale_centered ( const double *  s  ) 

Scale every vertex by the factor (s[0],s[1],s[2]) centered on the barycenter of the mesh.

Definition at line 687 of file Mesh_object.cpp.

References point_set, and Point_set::scale_centered().

00688 {return point_set.scale_centered(s);}

Here is the call graph for this function:

int Mesh_object::scale_centered ( const V_3D s  ) 

Scale every vertex by the factor (s[0],s[1],s[2]) centered on the barycenter of the mesh.

Definition at line 689 of file Mesh_object.cpp.

References point_set, and Point_set::scale_centered().

00690 {return point_set.scale_centered(s);}

Here is the call graph for this function:

int Mesh_object::scale_centered ( double  s  ) 

Scale every vertex by the factor s (the same in every direction) centered on the barycenter of the mesh.

Definition at line 691 of file Mesh_object.cpp.

References point_set, and Point_set::scale_centered().

00692 {return point_set.scale_centered(s);}

Here is the call graph for this function:

V_3D Mesh_object::get_middle_point (  )  const

Return the middle of the Points Set.

Definition at line 1106 of file Mesh_object.cpp.

References Point_set::get_middle_point(), and point_set.

01106 {return point_set.get_middle_point();}

Here is the call graph for this function:

V_3D Mesh_object::get_min_point (  )  const

Return the min of the Points Set.

Definition at line 1107 of file Mesh_object.cpp.

References Point_set::get_min_point(), and point_set.

01107 {return point_set.get_min_point();}

Here is the call graph for this function:

V_3D Mesh_object::get_max_point (  )  const

Return the max of the Points Set.

Definition at line 1108 of file Mesh_object.cpp.

References Point_set::get_max_point(), and point_set.

01108 {return point_set.get_max_point();}

Here is the call graph for this function:

V_3D Mesh_object::get_size_mesh (  )  const

Return the size of the mesh.

Definition at line 1109 of file Mesh_object.cpp.

References Point_set::get_size_set(), and point_set.

01109 {return point_set.get_size_set();}

Here is the call graph for this function:

int Mesh_object::center_mesh (  ) 

Definition at line 1110 of file Mesh_object.cpp.

References Point_set::center_point_set(), and point_set.

01110 {return point_set.center_point_set();}

Here is the call graph for this function:

int Mesh_object::unitize_size (  ) 

Definition at line 1111 of file Mesh_object.cpp.

References point_set, and Point_set::unitize_size().

01111 {return point_set.unitize_size();}

Here is the call graph for this function:

double Mesh_object::get_closest_distance ( double  x,
double  y,
double  z,
int *  index 
) const

get the index which is the closest of (x,y,z)

return the distance to (x,y,z) and the index of the closest vertex in *index

Definition at line 694 of file Mesh_object.cpp.

References Point_set::get_closest_distance(), and point_set.

00695 {return point_set.get_closest_distance(x,y,z,index);}

Here is the call graph for this function:

double Mesh_object::get_closest_distance ( const double *  x,
int *  index 
) const

get the index which is the closest of x

return the distance to x and the index of the closest vertex in *index

Definition at line 696 of file Mesh_object.cpp.

References Point_set::get_closest_distance(), and point_set.

00697 {return point_set.get_closest_distance(x,index);}

Here is the call graph for this function:

double Mesh_object::get_closest_distance ( const V_3D x,
int *  index 
) const

get the index which is the closest of x

return the distance to x and the index of the closest vertex in *index

Definition at line 698 of file Mesh_object.cpp.

References Point_set::get_closest_distance(), and point_set.

00699 {return point_set.get_closest_distance(x,index);}

Here is the call graph for this function:

double Mesh_object::get_further_distance ( double  x,
double  y,
double  z,
int *  index 
) const

get the index which is the further of (x,y,z)

return the distance to (x,y,z) and the index of the further vertex in *index

Definition at line 701 of file Mesh_object.cpp.

References Point_set::get_further_distance(), and point_set.

00702 {return point_set.get_further_distance(x,y,z,index);}

Here is the call graph for this function:

double Mesh_object::get_further_distance ( const double *  x,
int *  index 
) const

get the index which is the further of x

return the distance to x and the index of the further vertex in *index

Definition at line 703 of file Mesh_object.cpp.

References Point_set::get_further_distance(), and point_set.

00704 {return point_set.get_further_distance(x,index);}

Here is the call graph for this function:

double Mesh_object::get_further_distance ( const V_3D x,
int *  index 
) const

get the index which is the further of x

return the distance to x and the index of the further vertex in *index

Definition at line 705 of file Mesh_object.cpp.

References Point_set::get_further_distance(), and point_set.

00706 {return point_set.get_further_distance(x,index);}

Here is the call graph for this function:

double Mesh_object::distance_to_index ( double  x,
double  y,
double  z,
int  index 
) const

get the distance of the point (x,y,z) to the vertex at position=index

Definition at line 708 of file Mesh_object.cpp.

References Point_set::distance_to_index(), and point_set.

00709 {return point_set.distance_to_index(x,y,z,index);}

Here is the call graph for this function:

double Mesh_object::distance_to_index ( const double *  x,
int  index 
) const

get the distance of the point x to the vertex at position=index

Definition at line 710 of file Mesh_object.cpp.

References Point_set::distance_to_index(), and point_set.

00711 {return point_set.distance_to_index(x,index);}

Here is the call graph for this function:

double Mesh_object::distance_to_index ( const V_3D x,
int  index 
) const

get the distance of the point x to the vertex at position=index

Definition at line 712 of file Mesh_object.cpp.

References Point_set::distance_to_index(), and point_set.

00713 {return point_set.distance_to_index(x,index);}

Here is the call graph for this function:

std::vector< int > Mesh_object::N_closest ( const V_3D center,
int  N_closest 
) const

get the N-closest vertices of the point center

Definition at line 715 of file Mesh_object.cpp.

References Point_set::N_closest(), and point_set.

00716 {return point_set.N_closest(center,_N_closest);}

Here is the call graph for this function:

std::vector< int > Mesh_object::N_closest ( double  x,
double  y,
double  z,
int  N_closest 
) const

get the N-closest vertices of the point (x,y,z)

Definition at line 717 of file Mesh_object.cpp.

References Point_set::N_closest(), and point_set.

00718 {return point_set.N_closest(x,y,z,_N_closest);}

Here is the call graph for this function:

std::vector< int > Mesh_object::N_closest ( double *  x,
int  N_closest 
) const

get the N-closest vertices of the point x

Definition at line 719 of file Mesh_object.cpp.

References Point_set::N_closest(), and point_set.

00720 {return point_set.N_closest(x,_N_closest);}

Here is the call graph for this function:

V_3D Mesh_object::get_closest_vertex ( const V_3D center  )  const

get the closest vertex

Definition at line 1797 of file Mesh_object.cpp.

References Point_set::get_closest_vertex(), and point_set.

01798 {return point_set.get_closest_vertex(center);}

Here is the call graph for this function:

V_3D Mesh_object::get_closest_vertex ( double  x,
double  y,
double  z 
) const

get the closest vertex

Definition at line 1799 of file Mesh_object.cpp.

References Point_set::get_closest_vertex(), and point_set.

01800 {return point_set.get_closest_vertex(x,y,z);}

Here is the call graph for this function:

V_3D Mesh_object::get_closest_vertex ( const double *  x  )  const

get the closest vertex

Definition at line 1801 of file Mesh_object.cpp.

References Point_set::get_closest_vertex(), and point_set.

01802 {return point_set.get_closest_vertex(x);}

Here is the call graph for this function:

int Mesh_object::get_index ( int  k_index  )  const

get index from k_index

Definition at line 122 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index().

00123 {return connectivity.get_index(k_index);}

Here is the call graph for this function:

int & Mesh_object::get_index ( int  k_index  ) 

get index from k_index

Definition at line 124 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index().

00125 {return connectivity.get_index(k_index);}

Here is the call graph for this function:

int Mesh_object::get_index ( int  k_polygon,
int  k_index 
) const

get index from k_index of k_polygon

Definition at line 126 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index().

00127 {return connectivity.get_index(k_polygon,k_index);}

Here is the call graph for this function:

int & Mesh_object::get_index ( int  k_polygon,
int  k_index 
)

get index from k_index of k_polygon

Definition at line 128 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index().

00129 {return connectivity.get_index(k_polygon,k_index);}

Here is the call graph for this function:

std::vector< int > Mesh_object::get_index_of_polygon ( int  k_polygon  )  const

get full_index of the given polygon

Definition at line 130 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index_of_polygon().

Referenced by get_polygon().

00131 {return connectivity.get_index_of_polygon(k_polygon);}

Here is the call graph for this function:

Here is the caller graph for this function:

const int * Mesh_object::get_index (  )  const

get_pointer

Definition at line 132 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index().

Referenced by fast_subdivide_barycenter_mid_edge(), fast_subdivide_mid_edge(), fast_subdivide_mixed_mid_edge(), get_per_vertex_color(), get_vertex_normal(), set_per_vertex_color(), and set_vertex_normal().

00133 {return connectivity.get_index();}

Here is the call graph for this function:

Here is the caller graph for this function:

Connectivity & Mesh_object::get_connectivity (  ) 

get the Connectivity class

Definition at line 1769 of file Mesh_object.cpp.

References connectivity.

01769 {return connectivity;}

const Connectivity & Mesh_object::get_connectivity (  )  const

get the Connectivity class

Definition at line 1770 of file Mesh_object.cpp.

References connectivity.

01770 {return connectivity;}

int Mesh_object::size_index (  )  const

size of the vector

Definition at line 136 of file Mesh_object.cpp.

References connectivity, and Connectivity::size_index().

00137 {return connectivity.size_index();}

Here is the call graph for this function:

int Mesh_object::polygon_number (  )  const

int Mesh_object::polygon_size ( int  k_polygon  )  const

get size of the given polygon

Definition at line 140 of file Mesh_object.cpp.

References connectivity, and Connectivity::polygon_size().

Referenced by build_normal_intermediate(), OpenGL_drawer::draw_mesh_grid(), OpenGL_drawer::draw_mesh_slow(), fast_subdivide_barycenter_mid_edge(), fast_subdivide_mid_edge(), fast_subdivide_mixed_mid_edge(), and set_per_polygon_and_vertex_color().

00141 {return connectivity.polygon_size(k_polygon);}

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::vertex_number (  )  const

int Mesh_object::get_index_triangulated ( int  k_index  )  const

get index of the triangulated version

Definition at line 146 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index_triangulated().

00147 {return connectivity.get_index_triangulated(k_index);}

Here is the call graph for this function:

int & Mesh_object::get_index_triangulated ( int  k_index  ) 

get index of the triangulated version

Definition at line 148 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index_triangulated().

00149 {return connectivity.get_index_triangulated(k_index);}

Here is the call graph for this function:

int Mesh_object::get_index_triangulated ( int  k_triangle,
int  k_index 
) const

get index of this triangle in the triangulated version

Definition at line 150 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index_triangulated().

00151 {return connectivity.get_index_triangulated(k_triangle,k_index);}

Here is the call graph for this function:

int & Mesh_object::get_index_triangulated ( int  k_triangle,
int  k_index 
)

get index of this triangle in the triangulated version

Definition at line 152 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index_triangulated().

00153 {return connectivity.get_index_triangulated(k_triangle,k_index);}

Here is the call graph for this function:

const int * Mesh_object::get_index_triangulated (  )  const

get pointer of the triangulation

Definition at line 154 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_index_triangulated().

Here is the call graph for this function:

int Mesh_object::get_triangle_number (  )  const

get number of triangules in the triangulated version

Definition at line 156 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_triangle_number().

Here is the call graph for this function:

int Mesh_object::find_polygon ( const std::vector< int > &  polygon  )  const

try to find a given polygon return polygon number or -1 if not found

Definition at line 158 of file Mesh_object.cpp.

References connectivity, and Connectivity::find_polygon().

00159 {return connectivity.find_polygon(polygon);}

Here is the call graph for this function:

int Mesh_object::build_connectivity_index (  ) 

rebuild the index

Call build_all_index in Connectivity

Definition at line 898 of file Mesh_object.cpp.

References Connectivity::build_all_index(), and connectivity.

Referenced by build_cube(), fast_subdivide_barycenter_mid_edge(), fast_subdivide_mid_edge(), fast_subdivide_mixed_mid_edge(), half_space_intersection(), subdivide_barycenter_mid_edge(), subdivide_mid_edge(), and subdivide_mixed_mid_edge().

00899 {return connectivity.build_all_index();}

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::triangulate (  ) 

Triangulate the mesh.

Definition at line 1627 of file Mesh_object.cpp.

References connectivity, and Connectivity::triangulate().

01628 {return connectivity.triangulate();}

Here is the call graph for this function:

int Mesh_object::get_polygon_access ( int  k_polygon  )  const

Get the polygon access from the connectivity.

Ordered such that for instance index0,index1,index2,-1,index3,index4,index5,index6,-1,index7,... => access(0)=0, access(1)=4, access(2)=9, ...

Definition at line 1731 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_polygon_access().

Referenced by get_intermediate_texture(), and set_intermediate_texture().

01732 {return connectivity.get_polygon_access(k_polygon);}

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::add_polygon ( const std::vector< int > &  polygon  ) 

add a full polygon

Definition at line 163 of file Mesh_object.cpp.

References Connectivity::add_polygon(), and connectivity.

Referenced by add_unique_polygon(), build_cube(), fast_subdivide_barycenter_mid_edge(), fast_subdivide_mid_edge(), and fast_subdivide_mixed_mid_edge().

00164 {return connectivity.add_polygon(polygon);}

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::add_polygon ( int  index_0,
int  index_1,
int  index_2,
int  index_3 
)

add a full quad

Definition at line 165 of file Mesh_object.cpp.

References Connectivity::add_polygon(), and connectivity.

00166 {return connectivity.add_polygon(index_0,index_1,index_2,index_3);}

Here is the call graph for this function:

int Mesh_object::add_polygon ( int  index_0,
int  index_1,
int  index_2 
)

add a full triangle

Definition at line 167 of file Mesh_object.cpp.

References Connectivity::add_polygon(), and connectivity.

00168 {return connectivity.add_polygon(index_0,index_1,index_2);}

Here is the call graph for this function:

int Mesh_object::add_index ( int  index  ) 

add index of polygon

does not ensure that the polygon end by -1 (should be manually included)

Definition at line 169 of file Mesh_object.cpp.

References Connectivity::add_index(), and connectivity.

00170 {return connectivity.add_index(index);}

Here is the call graph for this function:

int Mesh_object::set_polygon ( int  k_polygon,
const std::vector< int > &  polygon 
)

set polygon number k

slow, needs the re-calculation of the index Also assume that the access is already set-up

Definition at line 171 of file Mesh_object.cpp.

References connectivity, and Connectivity::set_polygon().

00172 {return connectivity.set_polygon(k_polygon,polygon);}

Here is the call graph for this function:

int Mesh_object::set_index ( int  k_polygon,
int  k_index,
int  index 
)

set index

should not be use, direct access to the index, does not ensure its correct with size

Definition at line 173 of file Mesh_object.cpp.

References connectivity, and Connectivity::set_index().

00174 {return connectivity.set_index(k_polygon,k_index,index);}

Here is the call graph for this function:

int Mesh_object::delete_polygon ( int  k_polygon  ) 

delete polygon

assume that all the index are already calculated. Slow, will recalculate everything at each time

Definition at line 175 of file Mesh_object.cpp.

References connectivity, and Connectivity::delete_polygon().

00176 {return connectivity.delete_polygon(k_polygon);}

Here is the call graph for this function:

int Mesh_object::delete_given_polygon ( const std::vector< int >  polygon  ) 

delete polygon from a given polygon

Definition at line 177 of file Mesh_object.cpp.

References connectivity, and Connectivity::delete_given_polygon().

00178 {return connectivity.delete_given_polygon(polygon);}

Here is the call graph for this function:

int Mesh_object::flip_polygon ( int  k_polygon  ) 

Flip a given polygon.

Inverse the sens of the polygon

Definition at line 179 of file Mesh_object.cpp.

References connectivity, and Connectivity::flip_polygon().

00180 {return connectivity.flip_polygon(k_polygon);}

Here is the call graph for this function:

int Mesh_object::flip_polygon (  ) 

Flip every polygon.

Definition at line 181 of file Mesh_object.cpp.

References connectivity, and Connectivity::flip_polygon().

00182 {return connectivity.flip_polygon();}

Here is the call graph for this function:

int_vector Mesh_object::get_one_ring ( int  k_polygon,
int  k_vertex 
) const

get one ring

Definition at line 572 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_one_ring().

Referenced by Laplacien_smooth().

00573 {return connectivity.get_one_ring(k_polygon,k_vertex);}

Here is the call graph for this function:

Here is the caller graph for this function:

int_vector Mesh_object::get_one_ring ( int  k_vertex  )  const

get one ring

Definition at line 574 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_one_ring().

00575 {return connectivity.get_one_ring(k_vertex);}

Here is the call graph for this function:

int_vector Mesh_object::get_polygon_ring ( int  k_polygon,
int  k_vertex 
) const

get Polygon ring

Definition at line 577 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_polygon_ring().

Referenced by build_normal_intermediate(), and build_normal_per_vertex().

00578 {return connectivity.get_polygon_ring(k_polygon,k_vertex);}

Here is the call graph for this function:

Here is the caller graph for this function:

int_vector Mesh_object::get_polygon_ring ( int  k_vertex  )  const

get Polygon ring

Definition at line 579 of file Mesh_object.cpp.

References connectivity, and Connectivity::get_polygon_ring().

00580 {return connectivity.get_polygon_ring(k_vertex);}

Here is the call graph for this function:

int Mesh_object::build_manifold (  ) 

build manifold if there is triangle inversion

Only works if there is repeted index between two triangles (not in the correct turning sense

Definition at line 1763 of file Mesh_object.cpp.

References Connectivity::build_manifold(), and connectivity.

01764 {return connectivity.build_manifold();}

Here is the call graph for this function:

int Mesh_object::build_edges (  ) 

build entire edges from polygons

Works on 2-manifold

Definition at line 1765 of file Mesh_object.cpp.

References Connectivity::build_edges(), and connectivity.

01766 {return connectivity.build_edges();}

Here is the call graph for this function:

int Mesh_object::build_normal_per_polygon (  ) 

build a normal for each polygon

Definition at line 329 of file Mesh_object.cpp.

References get_vertex_v3d(), parameters, and polygon_number().

Referenced by build_normal_intermediate(), and build_normal_per_vertex().

00330 {
00331   if(parameters.size()<1)
00332     parameters.resize(1);
00333   parameters[0].destroy();
00334 
00335   int N_polygons=polygon_number();
00336 
00337   // per polygon type
00338   parameters[0].resize_int(1);
00339   parameters[0].get_int(0).resize(1);
00340   parameters[0].get_int(0)[0]=1; //PER_POLYGON
00341 
00342   // fill polygon normals
00343   parameters[0].resize_double(1);
00344   parameters[0].get_double(0).resize(3*N_polygons);
00345   int k_polygon=0;
00346   V_3D x0,x1,x2;
00347   V_3D n;
00348 
00349   int k_dim=0;
00350   for(k_polygon=0;k_polygon<N_polygons;k_polygon++)
00351     {
00352       //the first triangle is enough
00353       x0=get_vertex_v3d(k_polygon,0);
00354       x1=get_vertex_v3d(k_polygon,1);
00355       x2=get_vertex_v3d(k_polygon,2);
00356       
00357       n=((x1-x0).vector_prod(x2-x0)).normalized();
00358       for(k_dim=0;k_dim<3;k_dim++)
00359         parameters[0].get_double(0)[3*k_polygon+k_dim]=n[k_dim];
00360     }
00361   
00362   return 0;
00363 
00364 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::build_normal_intermediate ( double  angle_threshold  ) 

build a different normal for every vertex of every polygon

One vertex and one polygon can have multiple normals

Definition at line 367 of file Mesh_object.cpp.

References double_vector::add(), V_3D::angle(), build_normal_per_polygon(), get_polygon_normal(), get_polygon_ring(), V_3D::normalized(), parameters, polygon_number(), polygon_size(), V_3D::set(), and int_vector::size().

00368 {
00369 
00370   int ok=0;
00371 
00372   //convert angle into degree
00373   if(angle_threshold>3.14159)
00374     angle_threshold = angle_threshold*3.14159/180.0;
00375 
00376   //first build one normal per polygon
00377   ok += build_normal_per_polygon();
00378 
00379   // second int vector will give the position
00380   parameters[0].resize_int(2);
00381   parameters[0].get_int(1).resize(polygon_number());
00382 
00383 
00384 
00385   int k_polygon=0,N_polygon=polygon_number();
00386   int k_vertex=0,N_vertex=0;
00387   V_3D n0,n1,normal,current_normal;
00388   int k_ring=0,k_ring_2=0,ring_size=0;
00389 
00390   double_vector normal_vector;
00391   int_vector polygon_ring;
00392   int is_sharp_edge=0;
00393   int count=0;
00394   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
00395     {
00396       // integrated position in the vector for a direct access
00397       parameters[0].get_int(1)[k_polygon] = count;
00398 
00399       N_vertex=polygon_size(k_polygon);
00400       for(k_vertex=0;k_vertex<N_vertex;k_vertex++)
00401         {
00402 
00403           //get polygon ring of this vertex
00404           polygon_ring=get_polygon_ring(k_polygon,k_vertex);
00405           ring_size=polygon_ring.size();
00406 
00407           //take the dot product between every normals of every polygon surrounding the current vertex
00408           is_sharp_edge=0;
00409           for(k_ring=0;(is_sharp_edge==0) && (k_ring<ring_size);k_ring++)
00410             {
00411               n0=get_polygon_normal(polygon_ring[k_ring]);
00412               for(k_ring_2=k_ring+1;(is_sharp_edge==0) && (k_ring_2<ring_size);k_ring_2++)
00413                 {
00414                   n1=get_polygon_normal(polygon_ring[k_ring_2]);
00415                   
00416                   if( n0.angle(n1)>angle_threshold )
00417                     is_sharp_edge=1;
00418                 }
00419             }
00420 
00421 
00422           // if is a sharp edge, then copy the polygon normal for the vertex
00423           normal = get_polygon_normal(k_polygon);
00424           if(is_sharp_edge==1)
00425             {normal_vector.add(normal[0]);normal_vector.add(normal[1]);normal_vector.add(normal[2]);}
00426 
00427           
00428           // if is a smooth edge, then copy the smooth normal for the vertex
00429           else
00430             {
00431 
00432               normal.set(0.0,0.0,0.0);
00433               for(k_ring=0;k_ring<ring_size;k_ring++) 
00434                 {
00435                   current_normal = get_polygon_normal(polygon_ring[k_ring]);
00436                   normal += current_normal;
00437                 }
00438               normal = normal.normalized();
00439               normal_vector.add(normal[0]);normal_vector.add(normal[1]);normal_vector.add(normal[2]);
00440             }
00441 
00442 
00443           count++;
00444         }
00445     }
00446 
00447 
00448   //replace the normal vector
00449   parameters[0].get_double(0) = normal_vector;
00450   parameters[0].get_int(0)[0]=3; //PER_VERTEX_AND_POLYGON
00451 
00452   return ok;
00453 }

int Mesh_object::build_normal_per_vertex (  ) 

build a smooth normal for every vertex

Definition at line 456 of file Mesh_object.cpp.

References double_vector::add(), build_normal_per_polygon(), get_polygon_normal(), get_polygon_ring(), V_3D::normalized(), parameters, V_3D::set(), int_vector::size(), and vertex_number().

Referenced by load_model_1(), load_model_2(), and load_model_3().

00457 {
00458   
00459   int ok=0;
00460 
00461   //first build one normal per polygon
00462   ok += build_normal_per_polygon();
00463 
00464   int k_ring=0,ring_size=0;
00465   int_vector polygon_ring;
00466   V_3D normal,n;
00467 
00468   double_vector normal_vector;
00469   int k_vertex=0,N_vertex=vertex_number();
00470   for(k_vertex=0;k_vertex<N_vertex;k_vertex++)
00471     {
00472       polygon_ring = get_polygon_ring(k_vertex);
00473       
00474       ring_size=polygon_ring.size();
00475       normal.set(0,0,0);
00476       for(k_ring=0;k_ring<ring_size;k_ring++)
00477         {
00478           n = get_polygon_normal(polygon_ring[k_ring]);
00479           normal += n;
00480         }
00481       normal = normal.normalized();
00482       normal_vector.add(normal[0]);normal_vector.add(normal[1]);normal_vector.add(normal[2]);
00483     }
00484 
00485 
00486   //replace the normal vector
00487   parameters[0].get_double(0) = normal_vector;
00488   parameters[0].get_int(0)[0]=2; //PER_VERTEX
00489 
00490 
00491 
00492   return ok;
00493   
00494 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::normal_type (  )  const

return the type of calculated normal (-1 if not)

Definition at line 497 of file Mesh_object.cpp.

References parameters.

Referenced by OpenGL_drawer::draw_mesh_slow(), get_polygon_and_vertex_normal(), get_polygon_normal(), get_vertex_normal(), and set_vertex_normal().

00498 {
00499   if(parameters.size()<1 || parameters[0].size_int()<1 || parameters[0].get_int(0).size()<1)
00500     return -1;
00501   else
00502     return parameters[0].get_int(0)[0];
00503 }

Here is the caller graph for this function:

V_3D Mesh_object::get_polygon_normal ( int  k_polygon  )  const

return the normal if they is one normal per polygon (type=1)

Definition at line 505 of file Mesh_object.cpp.

References normal_type(), parameters, and polygon_number().

Referenced by build_normal_intermediate(), build_normal_per_vertex(), and OpenGL_drawer::draw_mesh_slow().

00506 {
00507   if(normal_type()!=1 || parameters[0].get_double(0).size()!=3*polygon_number())
00508     {printf("Error in get_polygon_normal(%d), normal are not calculated for each polygons (type=%d)\n",k_polygon,normal_type());exit(-1);}
00509   
00510   V_3D normal;
00511   for(int k_dim=0;k_dim<3;k_dim++)
00512     normal[k_dim]=parameters[0].get_double(0)[3*k_polygon+k_dim];
00513 
00514   return normal;
00515 }

Here is the call graph for this function:

Here is the caller graph for this function:

V_3D Mesh_object::get_polygon_and_vertex_normal ( int  k_polygon,
int  k_vertex 
) const

return the normal if they is one normal per polygon per vertex (type=3)

Definition at line 517 of file Mesh_object.cpp.

References normal_type(), parameters, and polygon_number().

Referenced by OpenGL_drawer::draw_mesh_slow().

00518 {
00519   if(normal_type()!=3)
00520     {printf("Error in get_polygon_and_vertex_normal(%d,%d), normal are not calculated for each polygons_and_vertex (type=%d)\n",k_polygon,k_vertex,normal_type());exit(-1);}
00521   if(
00522      (parameters.size()<1) || 
00523      (parameters[0].size_int()<2) || 
00524      (parameters[0].get_int(1).size()<polygon_number())||
00525      (parameters[0].size_double()<1)
00526      )
00527     {printf("Error in get_polygon_and_vertex_normal(%d,%d), size are not correct\n",k_polygon,k_vertex);exit(-1);}
00528   
00529 
00530   int k_position=0;
00531   V_3D normal;
00532   k_position = parameters[0].get_int(1)[k_polygon]+k_vertex;
00533   for(int k_dim=0;k_dim<3;k_dim++)
00534     {
00535       if(3*k_position+2>=parameters[0].get_double(0).size())
00536         {printf("Error in get_polygon_and_vertex_normal(%d,%d), recored normal have size %d and not %d\n",k_polygon,k_vertex,parameters[0].get_double(0).size(),k_position);exit(-1);}
00537       normal[k_dim]=parameters[0].get_double(0)[3*k_position+k_dim];
00538     }
00539   return normal;
00540 }

Here is the call graph for this function:

Here is the caller graph for this function:

V_3D Mesh_object::get_vertex_normal ( int  k_vertex  )  const

return the normal if they is one normal per vertex (type=1)

Definition at line 541 of file Mesh_object.cpp.

References normal_type(), parameters, and vertex_number().

Referenced by OpenGL_drawer::draw_mesh_slow(), get_vertex_normal(), and Skinned::skinning().

00542 {
00543   if(normal_type()!=2 || parameters[0].get_double(0).size()!=3*vertex_number())
00544     {printf("Error in get_vertex_normal(%d), normal are not calculated for each vertex (type=%d)\n",k_vertex,normal_type());exit(-1);}
00545  
00546 
00547   V_3D normal;
00548   for(int k_dim=0;k_dim<3;k_dim++)
00549     normal[k_dim]=parameters[0].get_double(0)[3*k_vertex+k_dim];
00550 
00551   return normal;
00552 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_vertex_normal ( int  k_vertex,
const V_3D n 
)

set the normal per vertex (if they is one normal per vertex: type=1)

Definition at line 553 of file Mesh_object.cpp.

References normal_type(), parameters, and vertex_number().

Referenced by set_vertex_normal(), and Skinned::skinning().

00554 {
00555   if(normal_type()!=2 || parameters[0].get_double(0).size()!=3*vertex_number())
00556     {printf("Error in get_polygon_normal(%d), normal are not calculated for each polygons (type=%d)\n",k_vertex,normal_type());exit(-1);}
00557  
00558 
00559   for(int k_dim=0;k_dim<3;k_dim++)
00560     parameters[0].get_double(0)[3*k_vertex+k_dim]=n[k_dim];
00561 
00562   return 0;
00563 }

Here is the call graph for this function:

Here is the caller graph for this function:

V_3D Mesh_object::get_vertex_normal ( int  k_polygon,
int  k_vertex 
) const

return the normal if they is one normal per vertex (type=1)

Definition at line 565 of file Mesh_object.cpp.

References get_index(), and get_vertex_normal().

00566 {int k_index=get_index(k_polygon,k_vertex);return get_vertex_normal(k_index);}

Here is the call graph for this function:

int Mesh_object::set_vertex_normal ( int  k_polygon,
int  k_vertex,
const V_3D n 
)

set the normal per vertex (if they is one normal per vertex: type=1)

Definition at line 567 of file Mesh_object.cpp.

References get_index(), and set_vertex_normal().

00568 {int k_index=get_index(k_polygon,k_vertex);return set_vertex_normal(k_index,n);}

Here is the call graph for this function:

int Mesh_object::set_per_vertex_color (  ) 

Set up the vector parameter of color for a per vertex color.

Definition at line 910 of file Mesh_object.cpp.

References parameters, and vertex_number().

Referenced by fill_color(), and set_per_vertex_color().

00911 {
00912   if(parameters.size()<2)
00913     parameters.resize(2);
00914 
00915   // set double size
00916   if(parameters[1].size_double()<1)
00917     parameters[1].resize_double(1);
00918   if(parameters[1].size_double(0)!=4*vertex_number())
00919     parameters[1].resize_double(0,4*vertex_number());
00920 
00921   // set per polygon type
00922   if(parameters[1].size_int()<1)
00923     parameters[1].resize_int(1);
00924   if(parameters[1].size_int(0)<1)
00925     parameters[1].resize_int(0,1);
00926 
00927   parameters[1].get_int(0)[0]=1;
00928 
00929 
00930   return 0;
00931 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_per_polygon_color (  ) 

Set up the vector parameter of color for a per polygon color.

Definition at line 932 of file Mesh_object.cpp.

References parameters, and polygon_number().

Referenced by set_per_polygon_color().

00933 {
00934   if(parameters.size()<2)
00935     parameters.resize(2);
00936 
00937   // set double size
00938   if(parameters[1].size_double()<1)
00939     parameters[1].resize_double(1);
00940   if(parameters[1].size_double(0)!=4*polygon_number())
00941     parameters[1].resize_double(0,4*polygon_number());
00942 
00943   // set per polygon type
00944   if(parameters[1].size_int()<1)
00945     parameters[1].resize_int(1);
00946   if(parameters[1].size_int(0)<1)
00947     parameters[1].resize_int(0,1);
00948 
00949   parameters[1].get_int(0)[0]=2;
00950 
00951 
00952   return 0;
00953 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_per_polygon_and_vertex_color (  ) 

Set up the vector parameter of color for a per polygon_and_vertex color.

Definition at line 1034 of file Mesh_object.cpp.

References parameters, polygon_number(), polygon_size(), and vertex_number().

Referenced by set_per_polygon_and_vertex_color().

01035 {
01036   if(parameters.size()<2)
01037     parameters.resize(2);
01038 
01039   // set double size
01040   if(parameters[1].size_double()<1)
01041     parameters[1].resize_double(1);
01042   if(parameters[1].size_double(0)!=4*polygon_number()*vertex_number())
01043     parameters[1].resize_double(0,4*polygon_number()*vertex_number());
01044 
01045   // set per polygon type
01046   if(parameters[1].size_int()<2)
01047     parameters[1].resize_int(2);
01048   if(parameters[1].size_int(0)<1)
01049     parameters[1].resize_int(0,1);
01050 
01051   parameters[1].get_int(0)[0]=3;
01052 
01053 
01054   if(parameters[1].size_int(1)<polygon_number())
01055     parameters[1].resize_int(1,polygon_number());
01056 
01057   //now fill the access index
01058   int count=0;int N_polygon=polygon_number();
01059   for(int k_polygon=0;k_polygon<N_polygon;k_polygon++)
01060     {
01061       parameters[1].get_int(1)[k_polygon]=count;
01062       count+=polygon_size(k_polygon);
01063     }
01064 
01065 
01066   return 0;
01067 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::color_type (  )  const

Get the type of color.

return -1 if no color 1 per vertex 2 per polygon 3 per vertex and polygon

Definition at line 902 of file Mesh_object.cpp.

References parameters.

Referenced by OpenGL_drawer::draw_mesh_slow(), fill_color(), get_per_polygon_and_vertex_color(), get_per_polygon_color(), get_per_vertex_color(), increase_alpha(), set_per_polygon_and_vertex_color(), set_per_polygon_color(), and set_per_vertex_color().

00903 {
00904   if(parameters.size()<2 || parameters[1].size_int()<1 || parameters[1].size_int(0)<1)
00905     return -1;
00906   else
00907     return parameters[1].get_int(0)[0];
00908 }

Here is the caller graph for this function:

int Mesh_object::fill_color ( double  r,
double  g,
double  b,
double  t 
)

Fill the whole object with a given color.

Do by default a per vertex color

Definition at line 956 of file Mesh_object.cpp.

References color_type(), parameters, set_per_vertex_color(), and vertex_number().

Referenced by load_model_1(), load_model_2(), and load_model_3().

00957 {
00958   if(color_type()!=1 || parameters[1].size_double(0)!=4*vertex_number())
00959     set_per_vertex_color();
00960 
00961   int k_vertex=0,N_vertex=vertex_number();
00962   for(k_vertex=0;k_vertex<N_vertex;k_vertex++)
00963     {
00964       parameters[1].get_double(0)[4*k_vertex+0]=r;
00965       parameters[1].get_double(0)[4*k_vertex+1]=g;
00966       parameters[1].get_double(0)[4*k_vertex+2]=b;
00967       parameters[1].get_double(0)[4*k_vertex+3]=t;
00968 
00969     }
00970   return 0;
00971 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_per_polygon_color ( int  k_polygon,
double  r,
double  g,
double  b,
double  t 
)

Set per polygon color.

Definition at line 1000 of file Mesh_object.cpp.

References color_type(), parameters, polygon_number(), and set_per_polygon_color().

01001 {
01002   if(color_type()!=2 || parameters[1].size_double(0)!=4*polygon_number())
01003     set_per_polygon_color();
01004 
01005   parameters[1].get_double(0)[4*k_polygon+0]=r;
01006   parameters[1].get_double(0)[4*k_polygon+1]=g;
01007   parameters[1].get_double(0)[4*k_polygon+2]=b;
01008   parameters[1].get_double(0)[4*k_polygon+3]=t;
01009 
01010   return 0;
01011 }

Here is the call graph for this function:

int Mesh_object::get_per_polygon_color ( int  k_polygon,
double *  r,
double *  g,
double *  b,
double *  t 
) const

Get per polygon color.

Definition at line 985 of file Mesh_object.cpp.

References color_type(), parameters, and polygon_number().

Referenced by OpenGL_drawer::draw_mesh_slow().

00986 {
00987   if(color_type()!=2 || parameters[1].size_double(0)!=4*polygon_number())
00988     return -1;
00989   else
00990     {                                           
00991       *r = parameters[1].get_double(0)[4*k_polygon+0];
00992       *g = parameters[1].get_double(0)[4*k_polygon+1];
00993       *b = parameters[1].get_double(0)[4*k_polygon+2];
00994       *t = parameters[1].get_double(0)[4*k_polygon+3];
00995     }
00996   return 0;
00997 
00998 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_per_vertex_color ( int  k_vertex,
double  r,
double  g,
double  b,
double  t 
)

Set per vertex color (direct access).

Definition at line 972 of file Mesh_object.cpp.

References color_type(), parameters, set_per_vertex_color(), and vertex_number().

00973 {
00974   if(color_type()!=1 || parameters[1].size_double(0)!=4*vertex_number())
00975     set_per_vertex_color();
00976 
00977   parameters[1].get_double(0)[4*k_vertex+0]=r;
00978   parameters[1].get_double(0)[4*k_vertex+1]=g;
00979   parameters[1].get_double(0)[4*k_vertex+2]=b;
00980   parameters[1].get_double(0)[4*k_vertex+3]=t;
00981 
00982   return 0;
00983 }

Here is the call graph for this function:

int Mesh_object::get_per_vertex_color ( int  k_vertex,
double *  r,
double *  g,
double *  b,
double *  t 
) const

Get per vertex color (direct access).

Definition at line 1013 of file Mesh_object.cpp.

References color_type(), parameters, and vertex_number().

Referenced by OpenGL_drawer::draw_mesh_slow(), and get_per_vertex_color().

01014 {
01015   if(color_type()!=1 || parameters[1].size_double(0)!=4*vertex_number())
01016     return -1;
01017   else
01018     {                                           
01019       *r = parameters[1].get_double(0)[4*k_vertex+0];
01020       *g = parameters[1].get_double(0)[4*k_vertex+1];
01021       *b = parameters[1].get_double(0)[4*k_vertex+2];
01022       *t = parameters[1].get_double(0)[4*k_vertex+3];
01023     }
01024   return 0;
01025 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_per_vertex_color ( int  k_polygon,
int  k_vertex,
double  r,
double  g,
double  b,
double  t 
)

Set per vertex color.

Definition at line 1029 of file Mesh_object.cpp.

References get_index(), and set_per_vertex_color().

01030 {int index = get_index(k_polygon,k_vertex); return set_per_vertex_color(index,r,g,b,t);}

Here is the call graph for this function:

int Mesh_object::get_per_vertex_color ( int  k_polygon,
int  k_vertex,
double *  r,
double *  g,
double *  b,
double *  t 
) const

Get per vertex color.

Definition at line 1027 of file Mesh_object.cpp.

References get_index(), and get_per_vertex_color().

01028 {int index = get_index(k_polygon,k_vertex); return get_per_vertex_color(index,r,g,b,t);}

Here is the call graph for this function:

int Mesh_object::set_per_polygon_and_vertex_color ( int  k_polygon,
int  k_vertex,
double  r,
double  g,
double  b,
double  t 
)

Set per polygon_and_vertex color.

Definition at line 1069 of file Mesh_object.cpp.

References color_type(), parameters, polygon_number(), set_per_polygon_and_vertex_color(), and vertex_number().

01070 {
01071   if(color_type()!=3 || parameters[1].get_int(1).size()!=polygon_number() || parameters[1].get_double(0).size()!=4*vertex_number()*polygon_number())
01072     {set_per_polygon_and_vertex_color();}
01073 
01074 
01075   int k_position = parameters[1].get_int(1)[k_polygon]+k_vertex;
01076   if(4*k_position+3>=parameters[1].get_double(0).size())
01077     {printf("Error in set_per_polygon_and_vertex_color(%d,%d,%f,%f,%f,%f), size are not ok %d-%d\n",k_polygon,k_vertex,r,g,b,t,4*k_position+3,parameters[1].get_double(0).size());exit(-1);}
01078 
01079   parameters[1].get_double(0,4*k_position+0)=r;
01080   parameters[1].get_double(0,4*k_position+1)=g;
01081   parameters[1].get_double(0,4*k_position+2)=b;
01082   parameters[1].get_double(0,4*k_position+3)=t;
01083 
01084 
01085 
01086   return 0;
01087 }

Here is the call graph for this function:

int Mesh_object::get_per_polygon_and_vertex_color ( int  k_polygon,
int  k_vertex,
double *  r,
double *  g,
double *  b,
double *  t 
) const

Get per polygon_and_vertex color.

Definition at line 1089 of file Mesh_object.cpp.

References color_type(), parameters, polygon_number(), and vertex_number().

Referenced by OpenGL_drawer::draw_mesh_slow().

01090 {
01091   if(color_type()!=3 || parameters[1].get_int(1).size()!=polygon_number() || parameters[1].get_double(0).size()!=4*vertex_number()*polygon_number())
01092     {printf("Error in set_per_polygon_and_vertex_color(%d,%d,...), size is not correct\n",k_polygon,k_vertex);exit(-1);}
01093 
01094   int k_position = parameters[1].get_int(1)[k_polygon]+k_vertex;
01095   if(4*k_position+3>=parameters[1].get_double(0).size())
01096     {printf("Error in set_per_polygon_and_vertex_color(%d,%d,...), size is not ok %d-%d\n",k_polygon,k_vertex,4*k_position+3,parameters[1].get_double(0).size());exit(-1);}
01097 
01098   *r = parameters[1].get_double(0,4*k_position+0);
01099   *g = parameters[1].get_double(0,4*k_position+1);
01100   *b = parameters[1].get_double(0,4*k_position+2);
01101   *t = parameters[1].get_double(0,4*k_position+3);
01102 
01103   return 0;
01104 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::increase_alpha ( double  d_alpha  ) 

increase the transparency

Definition at line 1773 of file Mesh_object.cpp.

References color_type(), and parameters.

Referenced by decrease_alpha().

01774 {
01775   if(color_type()==-1)
01776     return -1;
01777   
01778   int k=0;
01779   int N=parameters[1].get_double(0).size();
01780   double current_alpha=0.0;
01781   double new_alpha;
01782   for(k=3;k<N;k+=4)
01783     {
01784       current_alpha=parameters[1].get_double(0)[k];
01785       new_alpha = current_alpha+d_alpha;
01786       if(new_alpha>1.0)
01787         new_alpha=1.0;
01788       else if(new_alpha<0.0)
01789         new_alpha=0.0;
01790       parameters[1].get_double(0)[k]=new_alpha;
01791     }
01792   return 0;
01793 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::decrease_alpha ( double  d_alpha  ) 

decrease the transparency

Definition at line 1794 of file Mesh_object.cpp.

References increase_alpha().

01795 {return increase_alpha(-d_alpha);}

Here is the call graph for this function:

int Mesh_object::set_intermediate_texture (  ) 

enable the intermediate texture (vector of texture and index)

Definition at line 1633 of file Mesh_object.cpp.

References parameters.

Referenced by add_intermediate_texture(), add_polygon_texture(), set_intermediate_texture(), and set_texture_number().

01634 {
01635   if(parameters.size()<3)
01636     parameters.resize(3);
01637 
01638   // set double size
01639   if(parameters[2].size_double()<1)
01640     parameters[2].resize_double(1);
01641   parameters[2].resize_double(0,0);
01642 
01643   // set per polygon type
01644   if(parameters[2].size_int()<1)
01645     parameters[2].resize_int(3);
01646   if(parameters[2].size_int(0)<1)
01647     parameters[2].resize_int(0,1);
01648   parameters[2].resize_int(1,1);
01649   parameters[2].resize_int(2,0);
01650 
01651   parameters[2].get_int(0)[0]=0;
01652   parameters[2].get_int(1)[0]=-1;
01653 
01654 
01655 
01656   return 0;
01657 }

Here is the caller graph for this function:

int Mesh_object::texture_type (  )  const

return if texture is enabled or not

-1: no texture 0: intermediate texture (vector+index)

Definition at line 1660 of file Mesh_object.cpp.

References parameters.

Referenced by add_intermediate_texture(), add_polygon_texture(), OpenGL_drawer::draw_mesh_slow(), get_intermediate_texture(), get_texture_number(), get_texture_polygon_number(), set_intermediate_texture(), and set_texture_number().

01661 {
01662   if(parameters.size()<3 || parameters[2].size_int()<1 || parameters[2].size_int(0)<1)
01663     return -1;
01664   else
01665     return parameters[2].get_int(0)[0];
01666 }

Here is the caller graph for this function:

int Mesh_object::get_intermediate_texture ( int  k_polygon,
int  k_vertex,
double *  t0,
double *  t1 
) const

get texture coords

Definition at line 1689 of file Mesh_object.cpp.

References get_polygon_access(), parameters, polygon_number(), texture_type(), and vertex_number().

Referenced by OpenGL_drawer::draw_mesh_slow().

01690 {
01691   if(texture_type()!=0)
01692     return -1;
01693   if(k_vertex>=vertex_number() || k_polygon>=polygon_number())
01694     return -1;
01695 
01696   int k_polygon_access=get_polygon_access(k_polygon);
01697   int k_index=k_polygon_access+k_vertex;
01698   if(k_index<0 || k_index>parameters[2].get_int(2).size())
01699     {printf("Error in get_intermediate_texture, k_index(%d) is wrong size(%d)\n",k_index,parameters[2].get_int(2).size());exit(-1);}
01700   int k_double_index = parameters[2].get_int(2)[k_index];
01701 
01702 
01703   if(2*k_double_index+0<0 || 2*k_double_index+1>parameters[2].get_double(0).size())
01704     {printf("Error in get_intermediate_texture in Mesh_object, texture_polygon %d in vertex %d has k_polyon_access %d, index %d, and array of texture has a size of %d\n",k_polygon,k_vertex,k_polygon_access,k_index,parameters[2].get_double(0).size()/2);exit(-1);}
01705 
01706   *t0=parameters[2].get_double(0)[2*k_double_index+0];
01707   *t1=parameters[2].get_double(0)[2*k_double_index+1];
01708   return 0;
01709   
01710 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_intermediate_texture ( int  k_polygon,
int  k_vertex,
double  t0,
double  t1 
)

set texture coords

Definition at line 1668 of file Mesh_object.cpp.

References get_polygon_access(), parameters, polygon_number(), set_intermediate_texture(), texture_type(), and vertex_number().

01669 {
01670   if(k_vertex>=vertex_number() || k_polygon>=polygon_number())
01671     {printf("Error in set_texture, k_vertex(%d),k_polygon(%d) is too large(%d)(%d)\n",k_vertex,k_polygon,vertex_number(),polygon_number());exit(-1);}
01672 
01673   if(texture_type()!=0)
01674     set_intermediate_texture();
01675   
01676   int k_polygon_access=get_polygon_access(k_polygon);
01677   int k_index=k_polygon_access+k_vertex;
01678   if(k_index<0 || k_index>parameters[2].get_int(2).size())
01679     {printf("Error in set_intermediate_texture, k_index(%d) is wrong size(%d)\n",k_index,parameters[2].get_int(2).size());exit(-1);}
01680 
01681   int k_double_index = parameters[2].get_int(2)[k_index];
01682 
01683   parameters[2].get_double(0)[2*k_double_index+0]=t0;
01684   parameters[2].get_double(0)[2*k_double_index+1]=t1;
01685   return 0;
01686 }

Here is the call graph for this function:

int Mesh_object::add_intermediate_texture ( double  t0,
double  t1 
)

Add 2-coords texture in the vector.

Definition at line 1712 of file Mesh_object.cpp.

References parameters, set_intermediate_texture(), and texture_type().

Referenced by Mesh_object_loader::load_collada_mesh_texture(), and Mesh_object_loader::load_obj_texture().

01713 {
01714   if(texture_type()!=0)
01715     set_intermediate_texture();
01716     
01717   parameters[2].get_double(0).add(t0);
01718   parameters[2].get_double(0).add(t1);
01719   return 0;
01720 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::add_polygon_texture ( const std::vector< int > &  index  ) 

Add polygon index in the texture vector.

Definition at line 1721 of file Mesh_object.cpp.

References parameters, set_intermediate_texture(), and texture_type().

Referenced by Mesh_object_loader::load_obj_texture(), Mesh_object_loader::load_polylist_texture(), and Mesh_object_loader::load_triangles_texture().

01722 {
01723   if(texture_type()!=0)
01724     set_intermediate_texture();
01725 
01726   parameters[2].get_int(2).add(index);
01727   parameters[2].get_int(2).add(-1);
01728   return 0;
01729 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::set_texture_number ( int  k_texture  ) 

set the texture number

Definition at line 1747 of file Mesh_object.cpp.

References parameters, set_intermediate_texture(), and texture_type().

Referenced by load_model_2(), and load_model_3().

01748 {
01749   if(texture_type()!=0)
01750     set_intermediate_texture();
01751 
01752   parameters[2].get_int(1)[0]=k_texture;
01753   return 0;
01754 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::get_texture_number (  )  const

get the texture number

Definition at line 1755 of file Mesh_object.cpp.

References parameters, and texture_type().

Referenced by OpenGL_drawer::draw_mesh_slow().

01756 {
01757   if(texture_type()!=0)
01758     return -1;
01759   
01760   return parameters[2].get_int(1)[0];
01761 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::get_texture_polygon_number (  )  const

get the number of polygon of texture loaded (should be equal to the polygon of the mesh)

Definition at line 1734 of file Mesh_object.cpp.

References parameters, and texture_type().

Referenced by Mesh_object_loader::load_collada_texture().

01735 {
01736   if(texture_type()!=0)
01737     return -1;
01738 
01739   int polygon_count=0;
01740   int k=0;
01741   for(k=0;k<parameters[2].get_int(2).size();k++)
01742     if(parameters[2].get_int(2)[k]==-1)
01743       polygon_count++;
01744   return polygon_count;
01745 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::check_texture (  )  const

check if texture are [ok] to be displayed

std::vector< int > Mesh_object::add_unique_polygon ( const Polygon polygon  ) 

Add the polygon in a unique sens.

Add the connectivity and the vertex if it does not exists yet. Return a vector containing the n. of connectivity.

Definition at line 840 of file Mesh_object.cpp.

References add_polygon(), add_vertex(), exist(), get_vertex_number(), and Polygon::size().

Referenced by half_space_intersection(), subdivide_barycenter_mid_edge(), subdivide_mid_edge(), and subdivide_mixed_mid_edge().

00841 {
00842 
00843   int k=0;
00844   int N_polygon=polygon.size();
00845   int index=0;
00846   std::vector <int> index_polygon;
00847   
00848   for(k=0;k<N_polygon;k++)
00849     {
00850       index = exist(polygon[k],0.00001);
00851       if(index==-1) //new polygon
00852         {
00853           add_vertex(polygon[k]);
00854           index_polygon.push_back(get_vertex_number()-1);
00855         }
00856       else //already exists
00857         index_polygon.push_back(index);
00858     }
00859 
00860   add_polygon(index_polygon);
00861   return index_polygon;
00862 
00863 }

Here is the call graph for this function:

Here is the caller graph for this function:

Polygon Mesh_object::get_polygon ( int  k_polygon  )  const

return the designated polygon

Definition at line 723 of file Mesh_object.cpp.

References get_index_of_polygon(), get_vertex_v3d(), and polygon_number().

Referenced by closest_mesh_point(), half_space_intersection(), plane_intersection(), subdivide_barycenter_mid_edge(), subdivide_mid_edge(), and subdivide_mixed_mid_edge().

00724 {
00725   if(k_polygon<0 || k_polygon>polygon_number())
00726     {printf("Error in get_polygon(%d) in Mesh_object, size=%d\n",k_polygon,polygon_number());exit(-1);}
00727 
00728   std::vector <int> poly_index=get_index_of_polygon(k_polygon);
00729   std::vector <V_3D> poly_geom;
00730   for(int k=0;k<int(poly_index.size());k++)
00731     poly_geom.push_back(get_vertex_v3d(poly_index[k]));
00732   
00733   Polygon P(poly_geom);
00734   return P;
00735 }

Here is the call graph for this function:

Here is the caller graph for this function:

V_3D Mesh_object::closest_mesh_point ( const V_3D x  )  const

find the closest point on the mesh surface

find the real closest point by checking every polygons

Definition at line 737 of file Mesh_object.cpp.

References Polygon::closest_point(), get_polygon(), polygon_number(), and Polygon::shortest_distance_to_point().

00738 {
00739 
00740   // check the distance to every polygon
00741   int k_polygon=0,N_polygon=polygon_number();
00742   double current_dist=0.0,min_dist=9999.9;
00743   V_3D closest_point;
00744 
00745   Polygon current_polygon;
00746   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
00747     {
00748       current_polygon=get_polygon(k_polygon);
00749       current_dist=current_polygon.shortest_distance_to_point(x);
00750 
00751       if(current_dist<min_dist)
00752         {
00753           min_dist=current_dist;
00754           closest_point=current_polygon.closest_point(x);
00755         }
00756     }
00757   return closest_point;
00758 }

Here is the call graph for this function:

std::vector< Curve_3D > Mesh_object::plane_intersection ( const V_3D n,
const V_3D x0 
) const

Get the intersection between the mesh and a plane.

The plane is defined by its normal n, and a point x0, so its equation is <n,x-x0>=0 Return the curve that intersect the mesh. This curve might be empty if no intersection. It might also be many curves in cases of non convex mesh, or non connected parts

Definition at line 762 of file Mesh_object.cpp.

References Curve_3D::add(), Curve_3D::add_first(), Curve_3D::destroy(), get_polygon(), Polygon::plane_intersection(), polygon_number(), and Curve_3D::size().

00763 {
00764   std::vector <Curve_3D> curves;
00765   int k_polygon=0,N_polygon=polygon_number();
00766 
00767   std::vector <Segment> s;int type=-1;
00768   std::vector <V_3D> temp;
00769   //check every intersection for every polygons
00770   //store the intersection in an unordered vector of Segment
00771   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
00772     {
00773       //check the intersection
00774       temp = get_polygon(k_polygon).plane_intersection(n,x0,&type);
00775       if(type==1 || type==3)
00776         s.push_back(Segment(temp[0],temp[1]));
00777     }
00778 
00779   int segment_number=s.size();
00780 
00781 
00782   // now order the segments in curve
00783   std::vector <int> is_segment_added;
00784   is_segment_added.resize(segment_number);
00785   
00786   Curve_3D current_curve;
00787   current_curve.add(s[0][0]);
00788   current_curve.add(s[0][1]);
00789   is_segment_added[0]=1;
00790   
00791   int k_segment=-1,is_addition=1;
00792   while(is_addition==1)//as long as there is segment to add
00793     {
00794       //check if there is at least one added segment during the whole pass
00795       is_addition=0;
00796 
00797       //add forward
00798       for(k_segment=0;k_segment<segment_number;k_segment++)
00799         if(is_segment_added[k_segment]==0)
00800           {
00801             if(s[k_segment][0]==current_curve[current_curve.size()-1])
00802               {current_curve.add(s[k_segment][1]);is_segment_added[k_segment]=1;is_addition=1;}
00803             else if(s[k_segment][1]==current_curve[current_curve.size()-1])
00804               {current_curve.add(s[k_segment][0]);is_segment_added[k_segment]=1;is_addition=1;}
00805           }
00806       //add back
00807       for(k_segment=0;k_segment<segment_number;k_segment++)
00808         if(is_segment_added[k_segment]==0)
00809           {
00810             if(s[k_segment][0]==current_curve[0])
00811               {current_curve.add_first(s[k_segment][1]);is_segment_added[k_segment]=1;is_addition=1;}
00812             else if(s[k_segment][1]==current_curve[0])
00813               {current_curve.add_first(s[k_segment][0]);is_segment_added[k_segment]=1;is_addition=1;}
00814           }
00815 
00816 
00817       //if there is no added segment, it might be non-connected cases
00818       if(is_addition==0)
00819         {
00820           // add this curve to the vector
00821           curves.push_back(current_curve);
00822           current_curve.destroy();
00823 
00824           //check if every segment has been added
00825           for(k_segment=0;is_addition==0 && k_segment<segment_number;k_segment++)
00826             if(is_segment_added[k_segment]==0)//Then add it in the next curve
00827               {
00828                 is_addition=1;
00829                 current_curve.add(s[k_segment][0]);current_curve.add(s[k_segment][1]);
00830                 is_segment_added[k_segment]=1;
00831               }
00832         }
00833     }
00834   
00835 
00836   return curves;
00837 }

Here is the call graph for this function:

Mesh_object Mesh_object::half_space_intersection ( const V_3D n,
const V_3D x0,
int *  type 
)

Return the intersection of the Mesh and the half space defined by the oriented plane <n,x-x0>=0.

3 Possibilies for type: 0 - unchanged Mesh 1 - partly cutted polygon 2 - no more Mesh at all

Definition at line 868 of file Mesh_object.cpp.

References add_unique_polygon(), build_connectivity_index(), get_polygon(), Polygon::half_space_intersection(), polygon_number(), and vertex_number().

Referenced by half_space_intersection().

00869 {
00870   Mesh_object new_mesh;
00871   int k_polygon=0;
00872   int N_polygon=polygon_number();
00873 
00874   *type = 0;
00875   Polygon p; int t=0;
00876   Polygon q;
00877   //cut every polygon
00878   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
00879     {
00880       p = get_polygon(k_polygon);
00881       q = p.half_space_intersection(n,x0,&t);
00882 
00883       if(t!=2)//add the polygon and build the connectivity
00884         new_mesh.add_unique_polygon(q);
00885       if(t!=0)//at least one polygon is cutted
00886         *type=1;
00887     }
00888 
00889 
00890   if(new_mesh.vertex_number()==0)//no more mesh at all
00891     *type=2;
00892   
00893   new_mesh.build_connectivity_index();
00894 
00895   return new_mesh;
00896 }

Here is the call graph for this function:

Here is the caller graph for this function:

Mesh_object Mesh_object::half_space_intersection ( const V_3D n,
const V_3D x0 
)

Return the intersection of the Mesh and the half space defined by the oriented plane <n,x-x0>=0.

Same as half_space_intersection with type

Definition at line 866 of file Mesh_object.cpp.

References half_space_intersection().

00867 {int type=0;return half_space_intersection(n,x0,&type);}

Here is the call graph for this function:

int Mesh_object::Laplacien_smooth ( double  lambda  ) 

Smooth a mesh using a Laplacien operator on the one ring.

Definition at line 1590 of file Mesh_object.cpp.

References get_one_ring(), get_vertex_v3d(), V_3D::set(), set_vertex(), int_vector::size(), and vertex_number().

Referenced by load_model_1().

01591 {
01592   int k_vertex=0;
01593   int N_vertex=vertex_number();
01594 
01595   int_vector one_ring;
01596 
01597   int k_one_ring=0;
01598   int N_one_ring=0;
01599   V_3D barycenter;
01600   V_3D x,u;
01601 
01602   std::vector <V_3D> temp;
01603   for(k_vertex=0;k_vertex<N_vertex;k_vertex++)
01604     {
01605       //get barycenter of the one ring
01606       barycenter.set(0,0,0);
01607       one_ring = get_one_ring(k_vertex);
01608       N_one_ring=one_ring.size();
01609       for(k_one_ring=0;k_one_ring<N_one_ring;k_one_ring++)
01610         barycenter+=get_vertex_v3d(one_ring[k_one_ring]);
01611       barycenter/=N_one_ring;
01612 
01613       // set x = x+lambda*Delta(x)
01614       x = get_vertex_v3d(k_vertex);
01615       u = barycenter-x;
01616       temp.push_back(x+lambda*u);
01617     }
01618   for(k_vertex=0;k_vertex<N_vertex;k_vertex++)
01619     set_vertex(k_vertex,temp[k_vertex]);
01620 
01621 
01622 
01623   return 0;
01624 }

Here is the call graph for this function:

Here is the caller graph for this function:

int Mesh_object::build_cube (  ) 

build a unit cube from [0,1]x[0,1]x[0,1]

Definition at line 1118 of file Mesh_object.cpp.

References add_polygon(), add_vertex(), build_connectivity_index(), and destroy().

01119 {
01120   V_3D x0(0,0,0),x1(1,0,0),x2(1,1,0),x3(0,1,0),x4(0,0,1),x5(1,0,1),x6(1,1,1),x7(0,1,1);
01121   destroy();
01122 
01123   //add the vertices
01124   add_vertex(x0);add_vertex(x1);add_vertex(x2);add_vertex(x3);
01125   add_vertex(x4);add_vertex(x5);add_vertex(x6);add_vertex(x7);
01126 
01127   // build the connectivity
01128   add_polygon(0,1,2,3);
01129   add_polygon(0,3,7,4);
01130   add_polygon(4,7,6,2);
01131   add_polygon(2,1,5,6);
01132   add_polygon(0,4,5,1);
01133   add_polygon(3,2,6,7);
01134 
01135   // build the index
01136   build_connectivity_index();
01137 
01138 
01139   return 0;
01140 
01141 }

Here is the call graph for this function:

int Mesh_object::subdivide_mid_edge (  ) 

subdivide the mesh by linking consecutives middle points of the edges

add the unique new polygon and the associated connectivity (long)

Definition at line 1143 of file Mesh_object.cpp.

References add_unique_polygon(), add_vertex(), build_connectivity_index(), get_polygon(), get_vertex_v3d(), mesh2, polygon_number(), Polygon::subdivide_mid_edge(), and vertex_number().

01144 {
01145   // create a new temp mesh
01146   Mesh_object mesh2;
01147 
01148   // just to save the order of the vertices
01149   int N_vertex=vertex_number();
01150   for(int k=0;k<N_vertex;k++)
01151     mesh2.add_vertex(get_vertex_v3d(k));
01152 
01153   // now get every new polygons
01154   std::vector <Polygon> new_polygons;
01155   int N_polygon=polygon_number();
01156   int k=0,k2=0;int poly_size=0;
01157   for(k=0;k<N_polygon;k++)
01158     {
01159       new_polygons = get_polygon(k).subdivide_mid_edge();
01160       poly_size=new_polygons.size();
01161 
01163       for(k2=0;k2<poly_size;k2++)
01164         mesh2.add_unique_polygon(new_polygons[k2]);
01165     }
01166 
01167   //exchange the meshes
01168   (*this)=mesh2;
01169 
01170   return build_connectivity_index();
01171 }

Here is the call graph for this function:

int Mesh_object::subdivide_barycenter_mid_edge (  ) 

subdivide the mesh by linking consecutives middle points of the edges to the barycenter

add the unique new polygon and the associated connectivity (long)

Definition at line 1173 of file Mesh_object.cpp.

References add_unique_polygon(), add_vertex(), build_connectivity_index(), get_polygon(), get_vertex_v3d(), mesh2, polygon_number(), Polygon::subdivide_barycenter_mid_edge(), and vertex_number().

01174 {
01175   // create a new temp mesh
01176   Mesh_object mesh2;
01177 
01178   // just to save the order of the vertices
01179   int N_vertex=vertex_number();
01180   for(int k=0;k<N_vertex;k++)
01181     mesh2.add_vertex(get_vertex_v3d(k));
01182 
01183   // now get every new polygons
01184   std::vector <Polygon> new_polygons;
01185   int N_polygon=polygon_number();
01186   int k=0,k2=0;int poly_size=0;
01187   for(k=0;k<N_polygon;k++)
01188     {
01189       new_polygons = get_polygon(k).subdivide_barycenter_mid_edge();
01190       poly_size=new_polygons.size();
01191 
01193       for(k2=0;k2<poly_size;k2++)
01194         mesh2.add_unique_polygon(new_polygons[k2]);
01195     }
01196 
01197   //exchange the meshes
01198   (*this)=mesh2;
01199 
01200   return build_connectivity_index();
01201 }

Here is the call graph for this function:

int Mesh_object::subdivide_mixed_mid_edge (  ) 

subdivide the mesh with the middle edge. If it is a triangle, then

add the unique new polygon and the associated connectivity (long)

Definition at line 1203 of file Mesh_object.cpp.

References add_unique_polygon(), add_vertex(), build_connectivity_index(), get_polygon(), get_vertex_v3d(), mesh2, polygon_number(), Polygon::size(), Polygon::subdivide_barycenter_mid_edge(), Polygon::subdivide_mid_edge(), and vertex_number().

01204 {
01205   // create a new temp mesh
01206   Mesh_object mesh2;
01207 
01208   // just to save the order of the vertices
01209   int N_vertex=vertex_number();
01210   for(int k=0;k<N_vertex;k++)
01211     mesh2.add_vertex(get_vertex_v3d(k));
01212 
01213   // now get every new polygons
01214   std::vector <Polygon> new_polygons;
01215   int N_polygon=polygon_number();
01216   int k=0,k2=0;int poly_size=0;
01217   Polygon current;
01218   for(k=0;k<N_polygon;k++)
01219     {
01220       current = get_polygon(k);
01221       if(current.size()==3) //if a triangle
01222         new_polygons = current.subdivide_mid_edge();
01223       else // not a triangle => barycenter
01224         new_polygons = current.subdivide_barycenter_mid_edge();
01225       poly_size=new_polygons.size();
01226 
01228       for(k2=0;k2<poly_size;k2++)
01229         mesh2.add_unique_polygon(new_polygons[k2]);
01230     }
01231 
01232   //exchange the meshes
01233   (*this)=mesh2;
01234 
01235   return build_connectivity_index();  
01236 }

int Mesh_object::fast_subdivide_mid_edge (  ) 

subdivide the mesh by linking consecutives middle points of the edges

fast but uses more memory in recording every edges twice

Definition at line 1239 of file Mesh_object.cpp.

References add_polygon(), add_vertex(), build_connectivity_index(), get_index(), get_vertex_v3d(), mesh2, polygon_number(), polygon_size(), and vertex_number().

01240 {
01241 
01242   //the subdivided Mesh
01243   Mesh_object mesh2;
01244   
01245   std::vector <int_vector> index_mid_point; //the index of the mid point
01246   std::vector <int_vector> already_existing_mid_point; //the already existing edges
01247   index_mid_point.resize(vertex_number());
01248   already_existing_mid_point.resize(vertex_number());
01249 
01250   int k_polygon=0;
01251   int N_polygon=polygon_number();
01252   int size_polygon=0;
01253   int k_edge=0;
01254 
01255   int index_v0=0,index_v1=0;
01256   int k_position_index=0;
01257 
01258 
01259   //first add the old vertices
01260   int k_vertex=0,N_vertex=vertex_number();
01261   for(k_vertex=0;k_vertex<N_vertex;k_vertex++)
01262     mesh2.add_vertex(get_vertex_v3d(k_vertex));
01263 
01264 
01265   // record the mid_points first
01266   int current_vertex=vertex_number();
01267   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
01268     {
01269       size_polygon=polygon_size(k_polygon);
01270       for(k_edge=0;k_edge<size_polygon;k_edge++)
01271         {
01272           index_v0=get_index(k_polygon,k_edge);
01273           index_v1=get_index(k_polygon,(k_edge+1)%size_polygon);
01274 
01275           k_position_index=index_mid_point[index_v0].exists(index_v1);
01276           if( k_position_index==-1 )//edge does not exists yet
01277             {
01278               // add the order of the positioning of the mid_points
01279               index_mid_point[index_v0].add(index_v1);
01280               index_mid_point[index_v1].add(index_v0);
01281 
01282               // add the index in the vector
01283               already_existing_mid_point[index_v0].add(current_vertex);
01284               already_existing_mid_point[index_v1].add(current_vertex);
01285 
01286               // the grometrical mid_point
01287               mesh2.add_vertex(0.5*(get_vertex_v3d(index_v0)+get_vertex_v3d(index_v1)));
01288 
01289               current_vertex++;
01290             }
01291         }
01292     }
01293 
01294   int k_position_index2=0,index_mid2=0;
01295   int index_vm1=0;
01296   int index_mid=0;
01297   std::vector <int> temp_poly;
01298   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
01299     {
01300       // the triangles/mid_edges-barycenter
01301       size_polygon=polygon_size(k_polygon);
01302       for(k_edge=0;k_edge<size_polygon;k_edge++)
01303         {
01304           index_v0  = get_index(k_polygon,k_edge);
01305           index_v1  = get_index(k_polygon,(k_edge+1)%size_polygon);
01306           index_vm1 = get_index(k_polygon,(k_edge-1>=0?k_edge-1:size_polygon-1));
01307 
01308           k_position_index  = index_mid_point[index_v0].exists(index_v1);
01309           k_position_index2 = index_mid_point[index_v0].exists(index_vm1);
01310 
01311           index_mid  = already_existing_mid_point[index_v0][k_position_index];
01312           index_mid2 = already_existing_mid_point[index_v0][k_position_index2];
01313 
01314 
01315           mesh2.add_polygon(index_v0,index_mid,index_mid2);
01316         }
01317 
01318       //add the non triangular part linking every barycenters
01319       temp_poly.resize(0);
01320       for(k_edge=0;k_edge<size_polygon;k_edge++)
01321         {
01322           index_v0  = get_index(k_polygon,k_edge);
01323           index_v1  = get_index(k_polygon,(k_edge+1)%size_polygon);
01324 
01325           k_position_index = index_mid_point[index_v0].exists(index_v1);
01326           index_mid=already_existing_mid_point[index_v0][k_position_index];
01327           temp_poly.push_back(index_mid);
01328         }
01329       mesh2.add_polygon(temp_poly);
01330     }
01331   
01332 
01333 
01334   mesh2.build_connectivity_index();
01335   (*this)=mesh2;
01336   return 0;
01337   
01338 }

Here is the call graph for this function:

int Mesh_object::fast_subdivide_barycenter_mid_edge (  ) 

subdivide the mesh by linking consecutives middle points of the edges to the barycenter

fast but uses more memory in recording every edges twice

false hash table

Definition at line 1341 of file Mesh_object.cpp.

References add_polygon(), add_vertex(), build_connectivity_index(), get_index(), get_vertex_v3d(), mesh2, polygon_number(), polygon_size(), int_vector::resize(), V_3D::set(), and vertex_number().

01342 {
01343 
01344 
01345   //the subdivided Mesh
01346   Mesh_object mesh2;
01347   
01349   std::vector <int_vector> index_mid_point; //the index of the mid point
01350   std::vector <int_vector> already_existing_mid_point; //the already existing edges
01351   index_mid_point.resize(vertex_number());
01352   already_existing_mid_point.resize(vertex_number());
01353 
01354   //the index of the barycenter
01355   int_vector barycenter_index;
01356   barycenter_index.resize(polygon_number());
01357 
01358   int k_polygon=0;
01359   int N_polygon=polygon_number();
01360   int size_polygon=0;
01361   int k_edge=0;
01362 
01363   int index_v0=0,index_v1=0;
01364   int k_position_index=0;
01365 
01366 
01367   //first add the old vertices
01368   int k_vertex=0,N_vertex=vertex_number();
01369   for(k_vertex=0;k_vertex<N_vertex;k_vertex++)
01370     mesh2.add_vertex(get_vertex_v3d(k_vertex));
01371 
01372 
01373   // record the mid_points first
01374   int current_vertex=vertex_number();
01375   V_3D temp_barycenter;
01376   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
01377     {
01378       size_polygon=polygon_size(k_polygon);
01379       temp_barycenter.set(0,0,0);
01380       for(k_edge=0;k_edge<size_polygon;k_edge++)
01381         {
01382           index_v0=get_index(k_polygon,k_edge);
01383           index_v1=get_index(k_polygon,(k_edge+1)%size_polygon);
01384 
01385           k_position_index=index_mid_point[index_v0].exists(index_v1);
01386           if( k_position_index==-1 )//edge does not exists yet
01387             {
01388               // add the order of the positioning of the mid_points
01389               index_mid_point[index_v0].add(index_v1);
01390               index_mid_point[index_v1].add(index_v0);
01391 
01392               // add the index in the vector
01393               already_existing_mid_point[index_v0].add(current_vertex);
01394               already_existing_mid_point[index_v1].add(current_vertex);
01395 
01396               // the geometrical mid_point
01397               mesh2.add_vertex(0.5*(get_vertex_v3d(index_v0)+get_vertex_v3d(index_v1)));
01398 
01399               current_vertex++;
01400             }
01401           temp_barycenter+=get_vertex_v3d(index_v0);
01402         }
01403 
01404       temp_barycenter/=double(size_polygon);
01405       barycenter_index[k_polygon]=current_vertex;
01406       mesh2.add_vertex(temp_barycenter);
01407       current_vertex++;
01408     }
01409 
01410 
01411 
01412 
01413 
01414 
01415   //2. Fill the new mesh with the connectivity
01416   int k_position_index2=0,index_mid2=0;
01417   int index_vm1=0;
01418   int index_mid=0;
01419   int index_barycenter=0;
01420   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
01421     {
01422       // the triangles/mid_edges-barycenter
01423       size_polygon=polygon_size(k_polygon);
01424       index_barycenter = barycenter_index[k_polygon];
01425       for(k_edge=0;k_edge<size_polygon;k_edge++)
01426         {
01427           index_v0  = get_index(k_polygon,k_edge);
01428           index_v1  = get_index(k_polygon,(k_edge+1)%size_polygon);
01429           index_vm1 = get_index(k_polygon,(k_edge-1>=0?k_edge-1:size_polygon-1));
01430 
01431           k_position_index  = index_mid_point[index_v0].exists(index_v1);
01432           k_position_index2 = index_mid_point[index_v0].exists(index_vm1);
01433 
01434           index_mid  = already_existing_mid_point[index_v0][k_position_index];
01435           index_mid2 = already_existing_mid_point[index_v0][k_position_index2];
01436 
01437           mesh2.add_polygon(index_v0,index_mid,index_barycenter,index_mid2);
01438         }
01439     }
01440 
01441 
01442 
01443   mesh2.build_connectivity_index();
01444   (*this)=mesh2;
01445   return 0;
01446 
01447 
01448 
01449 }

int Mesh_object::fast_subdivide_mixed_mid_edge (  ) 

subdivide the mesh by mixing the mid edge and the barycenter method for quads and triangles.

fast but uses more memory in recording every edges twice Do barycenter method for quads Do mid edges for other polygons (triangles)

Definition at line 1454 of file Mesh_object.cpp.

References add_polygon(), add_vertex(), build_connectivity_index(), get_index(), get_vertex_v3d(), mesh2, polygon_number(), polygon_size(), int_vector::resize(), V_3D::set(), and vertex_number().

Referenced by load_model_1().

01455 {
01456 
01457 
01458   //the subdivided Mesh
01459   Mesh_object mesh2;
01460   
01461   std::vector <int_vector> index_mid_point; //the index of the mid point
01462   std::vector <int_vector> already_existing_mid_point; //the already existing edges
01463   index_mid_point.resize(vertex_number());
01464   already_existing_mid_point.resize(vertex_number());
01465 
01466   //the index of the barycenter
01467   int_vector barycenter_index;
01468   barycenter_index.resize(polygon_number());
01469 
01470   int k_polygon=0;
01471   int N_polygon=polygon_number();
01472   int size_polygon=0;
01473   int k_edge=0;
01474 
01475   int index_v0=0,index_v1=0;
01476   int k_position_index=0;
01477 
01478 
01479   //first add the old vertices
01480   int k_vertex=0,N_vertex=vertex_number();
01481   for(k_vertex=0;k_vertex<N_vertex;k_vertex++)
01482     mesh2.add_vertex(get_vertex_v3d(k_vertex));
01483 
01484 
01485   // record the mid_points first
01486   int current_vertex=vertex_number();
01487   V_3D temp_barycenter;
01488   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
01489     {
01490       size_polygon=polygon_size(k_polygon);
01491       temp_barycenter.set(0,0,0);
01492       for(k_edge=0;k_edge<size_polygon;k_edge++)
01493         {
01494           index_v0=get_index(k_polygon,k_edge);
01495           index_v1=get_index(k_polygon,(k_edge+1)%size_polygon);
01496 
01497           k_position_index=index_mid_point[index_v0].exists(index_v1);
01498           if( k_position_index==-1 )//edge does not exists yet
01499             {
01500               // add the order of the positioning of the mid_points
01501               index_mid_point[index_v0].add(index_v1);
01502               index_mid_point[index_v1].add(index_v0);
01503 
01504               // add the index in the vector
01505               already_existing_mid_point[index_v0].add(current_vertex);
01506               already_existing_mid_point[index_v1].add(current_vertex);
01507 
01508               // the geometrical mid_point
01509               mesh2.add_vertex(0.5*(get_vertex_v3d(index_v0)+get_vertex_v3d(index_v1)));
01510 
01511               current_vertex++;
01512             }
01513 
01514           temp_barycenter+=get_vertex_v3d(index_v0);
01515         }
01516 
01517       temp_barycenter/=double(size_polygon);
01518       barycenter_index[k_polygon]=current_vertex;
01519       if(size_polygon!=3)
01520         {
01521           mesh2.add_vertex(temp_barycenter);
01522           current_vertex++;
01523         }
01524     }
01525 
01526 
01527 
01528 
01529 
01530 
01531   //2. Fill the new mesh with the connectivity
01532   int k_position_index2=0,index_mid2=0;
01533   int index_vm1=0;
01534   int index_mid=0;
01535   int index_barycenter=0;
01536   std::vector <int> temp_poly;
01537   for(k_polygon=0;k_polygon<N_polygon;k_polygon++)
01538     {
01539       // the triangles/mid_edges-barycenter
01540       size_polygon=polygon_size(k_polygon);
01541       index_barycenter = barycenter_index[k_polygon];
01542       for(k_edge=0;k_edge<size_polygon;k_edge++)
01543         {
01544           index_v0  = get_index(k_polygon,k_edge);
01545           index_v1  = get_index(k_polygon,(k_edge+1)%size_polygon);
01546           index_vm1 = get_index(k_polygon,(k_edge-1>=0?k_edge-1:size_polygon-1));
01547 
01548           k_position_index  = index_mid_point[index_v0].exists(index_v1);
01549           k_position_index2 = index_mid_point[index_v0].exists(index_vm1);
01550 
01551           index_mid  = already_existing_mid_point[index_v0][k_position_index];
01552           index_mid2 = already_existing_mid_point[index_v0][k_position_index2];
01553 
01554           if(size_polygon!=3)
01555             mesh2.add_polygon(index_v0,index_mid,index_barycenter,index_mid2);
01556           else
01557             mesh2.add_polygon(index_v0,index_mid,index_mid2);
01558         }
01559 
01560 
01561       //add the non triangular part linking every barycenters
01562       if(size_polygon==3)
01563         {
01564           temp_poly.resize(0);
01565           for(k_edge=0;k_edge<size_polygon;k_edge++)
01566             {
01567               index_v0  = get_index(k_polygon,k_edge);
01568               index_v1  = get_index(k_polygon,(k_edge+1)%size_polygon);
01569               
01570               k_position_index = index_mid_point[index_v0].exists(index_v1);
01571               index_mid=already_existing_mid_point[index_v0][k_position_index];
01572               temp_poly.push_back(index_mid);
01573             }
01574           mesh2.add_polygon(temp_poly);
01575         }
01576 
01577     }
01578 
01579 
01580 
01581   mesh2.build_connectivity_index();
01582   (*this)=mesh2;
01583   return 0;
01584 
01585 
01586 
01587 }

Here is the caller graph for this function:

int Mesh_object::load_off_file ( const char *  filename  ) 

Load a OFF file.

Definition at line 187 of file Mesh_object.cpp.

00188 {return load_off_file(std::string(filename));}

int Mesh_object::load_off_file ( const std::string &  filename  ) 

Load a OFF file.

Definition at line 189 of file Mesh_object.cpp.

References connectivity, destroy(), Connectivity::load_off_file(), Point_set::load_off_file(), and point_set.

00190 {
00191   int ok=0;
00192   ok += destroy();
00193   ok += point_set.load_off_file(filename);
00194   ok += connectivity.load_off_file(filename);
00195   return ok;
00196 }

Here is the call graph for this function:

int Mesh_object::save_off_file ( const char *  filename  )  const

Save Mesh as a OFF file.

Definition at line 254 of file Mesh_object.cpp.

00255 {return save_off_file(std::string(filename));}

int Mesh_object::save_off_file ( const std::string &  filename  )  const

Save Mesh as a OFF file.

Definition at line 256 of file Mesh_object.cpp.

References connectivity, Connectivity::edge_number(), name, point_set, Connectivity::polygon_number(), Point_set::size(), Connectivity::write_off_type(), and Point_set::write_off_type().

00257 {
00258   int ok=0;
00259   FILE *fid=NULL;
00260   
00261   fid=fopen(filename.data(),"w");
00262   if(fid==NULL)
00263     {printf("ERROR loading %s in save_off_file in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00264 
00265 
00266   //Just header
00267 
00268   fprintf(fid,"# Geometrical Mesh [%s] in [%s]\n",name.data(),filename.data());
00269   time_t current_time=time(NULL);
00270   fprintf(fid,"# Mesh Exported on %s",asctime(localtime(&current_time)));
00271   fprintf(fid,"#\n");
00272   fprintf(fid,"# N_vertices [%d]\n",point_set.size());
00273   fprintf(fid,"# N_polygons [%d]\n",connectivity.polygon_number());
00274   if(connectivity.edge_number()!=0)
00275     fprintf(fid,"# N_edges [%d]\n",connectivity.edge_number());
00276   fprintf(fid,"#\n");
00277 
00278   //OFF Header
00279   fprintf(fid,"OFF\n");
00280   fprintf(fid,"%d %d %d\n",point_set.size(),connectivity.polygon_number(),connectivity.edge_number());
00281 
00282   if(fclose(fid)!=0)
00283     {printf("ERROR closing %s in write_off_file in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00284 
00285 
00286   //write geometry
00287   point_set.write_off_type(filename);
00288   
00289   //write connectivity
00290   connectivity.write_off_type(filename);
00291 
00292 
00293 
00294   //write end
00295   fid=NULL;
00296   fid=fopen(filename.data(),"a");
00297   if(fid==NULL)
00298     {printf("ERROR loading %s in save_off_file in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00299 
00300   fprintf(fid,"EOF Mesh Geometry %s [OK]\n",filename.data());
00301 
00302   if(fclose(fid)!=0)
00303     {printf("ERROR closing %s in write_off_file in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00304 
00305 
00306   return ok;
00307 
00308 }

Here is the call graph for this function:

int Mesh_object::load_obj_file ( const char *  filename  ) 

Load a OBJ file.

Definition at line 582 of file Mesh_object.cpp.

Referenced by load_model_1().

00583 {std::string file=filename;return load_obj_file(file);}

Here is the caller graph for this function:

int Mesh_object::load_obj_file ( const std::string &  filename  ) 

Load a OBJ file.

Definition at line 584 of file Mesh_object.cpp.

References connectivity, destroy(), Connectivity::load_obj_file(), Point_set::load_obj_file(), and point_set.

00585 {
00586   int ok=0;
00587   ok += destroy();
00588   ok += point_set.load_obj_file(filename);
00589   ok += connectivity.load_obj_file(filename);
00590 
00591   return ok;
00592 }

Here is the call graph for this function:

int Mesh_object::save_obj_file ( const char *  filename  ) 

Save Mesh as a OBJ file.

Definition at line 594 of file Mesh_object.cpp.

00595 {std::string file=filename;return save_obj_file(file);}

int Mesh_object::save_obj_file ( const std::string &  filename  ) 

Save Mesh as a OBJ file.

Definition at line 596 of file Mesh_object.cpp.

References connectivity, Connectivity::edge_number(), name, point_set, Connectivity::polygon_number(), Point_set::size(), Connectivity::write_obj_type(), and Point_set::write_obj_type().

00597 {
00598   int ok=0;
00599   FILE *fid=NULL;
00600 
00601   //Just the header
00602   fid=fopen(filename.data(),"w");
00603   if(fid==NULL)
00604     {printf("ERROR loading %s in save_obj_type in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00605 
00606   fprintf(fid,"# Geometrical Mesh [%s] in [%s]\n",name.data(),filename.data());
00607   time_t current_time=time(NULL);
00608   fprintf(fid,"# Mesh Exported on %s",asctime(localtime(&current_time)));
00609   fprintf(fid,"#\n");
00610   fprintf(fid,"# N_vertices [%d]\n",point_set.size());
00611   fprintf(fid,"# N_polygons [%d]\n",connectivity.polygon_number());
00612   if(connectivity.edge_number()!=0)
00613     fprintf(fid,"# N_edges [%d]\n",connectivity.edge_number());
00614   fprintf(fid,"#\n");
00615   
00616   if(fclose(fid)!=0)
00617     {printf("ERROR closing %s in write_off_type in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00618 
00619 
00620   //write geometry
00621   point_set.write_obj_type(filename);
00622 
00623   //write connectivity
00624   connectivity.write_obj_type(filename);
00625   
00626   //write end
00627   fid=NULL;
00628   fid=fopen(filename.data(),"a");
00629   if(fid==NULL)
00630     {printf("ERROR loading %s in save_obj_type in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00631 
00632   fprintf(fid,"EOF Mesh Geometry %s [OK]\n",filename.data());
00633 
00634   if(fclose(fid)!=0)
00635     {printf("ERROR closing %s in write_obj_type in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00636 
00637 
00638   return ok;
00639 }

Here is the call graph for this function:

int Mesh_object::load_collada_file ( const char *  filename  ) 

Load a COLLADA file.

Load every polygons of the file

Definition at line 311 of file Mesh_object.cpp.

Referenced by load_collada_file(), load_model_2(), and load_model_3().

00312 {return load_collada_file(std::string(filename),std::string("_ALL_"));}

Here is the caller graph for this function:

int Mesh_object::load_collada_file ( const std::string &  filename  ) 

Load a COLLADA file.

Load every polygons of the file

Definition at line 313 of file Mesh_object.cpp.

References load_collada_file().

00314 {return load_collada_file(filename,std::string("_ALL_"));}

Here is the call graph for this function:

int Mesh_object::load_collada_file ( const char *  filename,
const char *  geometry_name 
)

Load a COLLADA file.

Load every polygons of the file

Definition at line 315 of file Mesh_object.cpp.

References load_collada_file().

00316 {return load_collada_file(std::string(filename),std::string(geometry_name));}

Here is the call graph for this function:

int Mesh_object::load_collada_file ( const std::string &  filename,
const std::string &  geometry_name 
)

Load a COLLADA file.

Load every polygons of the file

Definition at line 317 of file Mesh_object.cpp.

References connectivity, destroy(), Connectivity::load_collada_file(), Point_set::load_collada_file(), and point_set.

00318 {
00319   int ok=0;
00320   ok += destroy();
00321   ok += point_set.load_collada_file(filename,geometry_name);
00322   ok += connectivity.load_collada_file(filename,geometry_name);
00323   return ok;
00324 }

Here is the call graph for this function:

int Mesh_object::load_g_file ( const char *  filename  ) 

Load a g file.

Definition at line 198 of file Mesh_object.cpp.

00199 {return load_g_file(std::string(filename));}

int Mesh_object::load_g_file ( const std::string &  filename  ) 

Load a g file.

Definition at line 200 of file Mesh_object.cpp.

References connectivity, destroy(), Connectivity::load_g_file(), Point_set::load_g_file(), and point_set.

00201 {
00202   int ok=0;
00203   ok += destroy();
00204   ok += point_set.load_g_file(filename);
00205   ok += connectivity.load_g_file(filename);
00206   return ok;
00207 }

Here is the call graph for this function:

int Mesh_object::save_g_file ( const char *  filename  )  const

save a g file

Definition at line 209 of file Mesh_object.cpp.

00210 {return save_g_file(std::string(filename));}

int Mesh_object::save_g_file ( const std::string &  filename  )  const

save a g file

Definition at line 211 of file Mesh_object.cpp.

References connectivity, name, point_set, Connectivity::polygon_number(), Point_set::size(), Connectivity::write_g_type(), and Point_set::write_g_type().

00212 {
00213 
00214   int ok=0;
00215   FILE *fid=NULL;
00216   
00217   fid=fopen(filename.data(),"w");
00218   if(fid==NULL)
00219     {printf("ERROR loading %s in save_g_file in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00220 
00221   //Just header
00222   fprintf(fid,"%d %d\n",point_set.size(),connectivity.polygon_number());
00223 
00224   if(fclose(fid)!=0)
00225     {printf("ERROR closing %s in write_off_file in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00226 
00227 
00228   //write geometry
00229   point_set.write_g_type(filename);
00230   
00231   //write connectivity
00232   connectivity.write_g_type(filename);
00233 
00234 
00235 
00236   //write end
00237   fid=NULL;
00238   fid=fopen(filename.data(),"a");
00239   if(fid==NULL)
00240     {printf("ERROR loading %s in save_off_file in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00241 
00242   fprintf(fid,"EOF Mesh Geometry %s [OK]\n",filename.data());
00243 
00244   if(fclose(fid)!=0)
00245     {printf("ERROR closing %s in write_g_file in Mesh [%s]\n",filename.data(),name.data());exit(-1);}
00246 
00247 
00248   return ok;
00249 
00250 }

Here is the call graph for this function:

int Mesh_object::set_name ( const char *  name  ) 

set the mesh name

Definition at line 1113 of file Mesh_object.cpp.

References name.

01113 {name=_name;return 0;}

int Mesh_object::set_name ( const std::string &  name  ) 

set the mesh name

Definition at line 1114 of file Mesh_object.cpp.

References name.

01114 {name=_name;return 0;}

std::string Mesh_object::get_name (  )  const

get the mesh name

Definition at line 1115 of file Mesh_object.cpp.

References name.

01115 {return name;}

std::string & Mesh_object::get_name (  ) 

get the mesh name

Definition at line 1116 of file Mesh_object.cpp.

References name.

01116 {return name;}


Member Data Documentation

std::vector<Vector_parameter> Mesh_object::parameters [private]

std::string Mesh_object::name [private]

name of the mesh

Type (saved in parameters[0].get_int(0)[0]): 1=per_polygon 2=per_vertex 3=per_vertex_and_polygon

Definition at line 751 of file Mesh_object.h.

Referenced by destroy(), get_name(), Mesh_object(), save_g_file(), save_obj_file(), save_off_file(), and set_name().


The documentation for this class was generated from the following files:

Generated on Mon Mar 30 16:57:39 2009 by  doxygen 1.5.6