8 #include "aims/io/reader.h" 9 #include "aims/io/writer.h" 10 #include "aims/mesh/surface.h" 11 #include "aims/mesh/texture.h" 12 #include "aims/utility/anytype_reader.h" 13 #include "aims/vector/vector.h" 35 template <
typename T,
int D >
37 bool operator < (const AimsVector<T,D> &v1,
38 const AimsVector<T,D> &v2)
40 for (
int d = 0; d < D; ++d)
42 if (v1.item(d) < v2.item(d))
44 else if (v2.item(d) < v1.item(d))
58 return static_cast<const char**
>(
static_cast<void*
>(argv));
73 template <
class T,
int D >
74 inline std::size_t
size(
const AimsVector<T,D> &)
79 template <
typename T,
int D >
81 add(AimsVector<T,D> & v1,
const AimsVector<T,D> & v2)
85 template <
typename T,
int D>
86 void mul(AimsVector<T,D> &v, T d)
91 template <
typename T,
int D >
111 :
public std::binary_function<boost::array<size_t, 3> &, const AimsVector<uint, 3> &, void>
116 y[0] = x[0]; y[1] = x[1]; y[2] = x[2];
122 :
public std::binary_function<AimsVector<uint, 3> &, const boost::array<size_t, 3> &, void>
128 y[0] = x[0]; y[1] = x[1]; y[2] = x[2];
134 :
public std::binary_function<numeric_array<size_t, 3> &, const AimsVector<uint, 3> &, void>
139 y[0] = x[0]; y[1] = x[1]; y[2] = x[2];
145 :
public std::binary_function<AimsVector<uint, 3> &, const numeric_array<size_t, 3> &, void>
151 y[0] = x[0]; y[1] = x[1]; y[2] = x[2];
157 :
public std::binary_function<numeric_array<float,3> &, const AimsVector<float,3> &, void>
163 y[0] = x[0]; y[1] = x[1]; y[2] = x[2];
169 :
public std::binary_function<AimsVector<float,3> &, const numeric_array<float,3> &, void>
175 y[0] = x[0]; y[1] = x[1]; y[2] = x[2];
204 template <
typename TContainer>
206 :
public std::binary_function<Texture1d &, const TContainer &, void>
212 for (std::size_t i=0; i<
size(c); ++i)
244 template <
typename TContainer>
245 inline void convert(
const TContainer &c, Texture1d & t)
247 for (std::size_t i=0; i<
size(c); ++i)
286 template <
int D,
class T >
291 enum { has_faces_indices = 1 };
374 std::set<AimsVector<uint, 2> >
375 getEdges(
const AimsSurfaceTriangle *surf);
383 template <
int D,
class T >
388 static const bool has_edges =
false;
389 static const bool has_faces =
false;
390 static const bool has_faces_indices =
true;
472 template <
int D,
class T >
476 return mesh.vertex();
479 template <
int D,
class T >
483 return mesh.vertex();
486 template <
int D,
class T >
493 const AimsSurface<D,T> & mesh,
494 const std::vector<AimsVector<unsigned int, 3> >::const_iterator & iFC,
498 return mesh.vertex()[(*iFC)[i]];
502 template <
int D,
class T >
507 return mesh.polygon();
520 template <
int D,
class T >
525 return mesh.polygon();
548 template <
int D,
class T >
552 return mesh.vertex();
555 template <
int D,
class T >
559 return mesh.vertex();
564 template <
int D,
class T >
571 const AimsTimeSurface<D,T> & mesh,
572 const std::vector<AimsVector<unsigned int, 3> >::const_iterator & iFC,
576 return mesh.vertex()[(*iFC)[i]];
578 template <
int D,
class T >
582 return mesh.polygon();
586 template <
int D,
class T >
590 return mesh.polygon();
666 template <
typename TParam,
typename T >
667 typename boost::enable_if<boost::is_pointer<typename TParam::FaceIndex::value_type> >
::type 673 template <
typename TParam,
typename T >
674 typename boost::disable_if<boost::is_pointer<typename TParam::FaceIndex::value_type> >
::type 681 template <
typename TParam,
typename T >
682 typename boost::enable_if<boost::is_pointer<typename TParam::FaceIndex::value_type> >
::type 688 template <
typename TParam,
typename T >
689 typename boost::disable_if<boost::is_pointer<typename TParam::FaceIndex::value_type> >
::type 696 template <
typename TParam >
698 :
public std::binary_function<Mesh<TParam> &, const AimsSurfaceTriangle &, void>
709 template <
typename TParam >
711 :
public std::binary_function<Mesh<TParam> &, const AimsSurface<3,Void> &, void>
721 template <
typename T >
723 :
public std::binary_function<AimsSurfaceTriangle &, const T &, void>
727 operator()(AimsSurfaceTriangle & aimsMesh,
const T & mesh)
const 750 template <
typename T >
752 :
public std::binary_function<AimsSurface<3,Void> &, const T &, void>
756 operator()(AimsSurface<3,Void> & aimsMesh,
const T & mesh)
const 765 template <
typename TVertex,
typename TFace >
766 void write_mesh(
const std::vector<TVertex> & vertices,
const std::vector<TFace> & faces, aims::Writer<AimsSurfaceTriangle> w)
768 AimsSurfaceTriangle s;
776 template <
typename TVertex,
typename TFace >
777 void write_mesh(
const std::vector<TVertex> & vertices,
const std::vector<TFace> & faces,
const char * name)
779 write_mesh(vertices, faces, (aims::Writer<AimsSurfaceTriangle>(name)));
782 template <
typename TMesh >
788 template <
typename T >
792 t.reserve(data.size());
793 for (std::size_t i = 0; i < data.size(); ++i) t.push_back(data[i]);
794 aims::Writer<Texture1d> w(name);
798 template <
typename T >
801 AimsSurfaceTriangle s;
808 template <
typename T,
typename TVertexCollection,
typename TFaceCollection >
809 void read_mesh(aims::Reader<T>
const & r, TVertexCollection & vertices, TFaceCollection & faces)
817 template <
typename T >
820 aims::AnyTypeReader<AimsData<float> > r(name);
824 template <
typename T >
827 aims::Writer<T> w(name);
831 template <
typename TIterator1,
typename TIterator2 >
834 for (; begin1 != end1; ++begin1, ++begin2)
840 template <
typename VertexCollection,
typename FaceCollection >
841 void convert_mesh(AimsSurface<3, Void>
const & mesh, VertexCollection & vertices, FaceCollection & faces)
843 vertices.resize(mesh.vertex().size());
845 faces.resize(mesh.polygon().size());
849 template <
typename VertexCollection,
typename FaceCollection >
850 void convert_mesh(VertexCollection
const & vertices, FaceCollection
const & faces, AimsSurface<3, Void> & mesh)
852 mesh.vertex().resize(vertices.size());
854 mesh.polygon().resize(faces.size());
void operator()(AimsVector< float, 3 > &y, const numeric_array< float, 3 > &x) const
void convert_collection(TIterator1 begin1, TIterator1 end1, TIterator2 begin2)
A class to represent a very basic mesh, consisting of a set of vertices and a set of edges...
void convert(TTo &x, const TFrom &y)
TIL_DECLARE_IS_SPEC_T(3DPoint, typename T, boost::array< T TIL_COMMA 3 >)
void read_mesh(aims::Reader< T > &r, Mesh_N &mesh)
void operator()(Texture1d &t, const TContainer &c)
void convert_mesh1Toaimsmesh(const til::Mesh1 &meshFrom, AimsTimeSurface< 3, Void > &meshTo)
void operator()(AimsSurfaceTriangle &aimsMesh, const T &mesh) const
void operator()(numeric_array< size_t, 3 > &y, const AimsVector< uint, 3 > &x) const
Belongs to package Box Do not include directly, include til/Box.h instead.
void operator()(AimsSurface< 3, Void > &aimsMesh, const T &mesh) const
void operator()(numeric_array< float, 3 > &y, const AimsVector< float, 3 > &x) const
numeric_array< T, D > size(const Box< T, D > &box)
Return the size of a box.
const Point3df & getFaceVertex(const AimsSurface< D, T > &mesh, const std::vector< AimsVector< unsigned int, 3 > >::const_iterator &iFC, int i)
std::vector< FaceIndex > FaceIndexCollection
std::vector< Vertex > VertexCollection
std::set< AimsVector< uint, 2 > > getEdges(const AimsSurfaceTriangle *surf)
Get all edges in mesh.
functor::Convertor< T > convert2(const T &from)
void convert_mesh_3(const TMeshFrom &meshFrom, TMeshTo &meshTo)
std::vector< FaceIndex > FaceIndexCollection
void operator()(boost::array< size_t, 3 > &y, const AimsVector< uint, 3 > &x) const
void operator()(AimsVector< uint, 3 > &y, const boost::array< size_t, 3 > &x) const
void read_anyType(T &data, const std::string name)
Default values for MeshTraits.
void write_mesh(const std::vector< TVertex > &vertices, const std::vector< TFace > &faces, aims::Writer< AimsSurfaceTriangle > w)
void convert_mesh_2(const TMeshFrom &meshFrom, TMeshTo &meshTo)
When indices of from are numbers and two are pointers.
AimsVector< uint, D > FaceIndex
detail::AddNeighborIndexAttribute< Mesh< TParam > > addNeighborsToMesh(const Mesh< TParam > &mesh)
const MeshTraits< AimsSurface< D, T > >::FaceIndexCollection & getFaceIndices(const AimsSurface< D, T > &mesh)
boost::disable_if< boost::is_pointer< typename TParam::FaceIndex::value_type > >::type convertAimsMesh(T &aimsmesh, const Mesh< TParam > &mesh)
AimsVector< uint, D > FaceIndex
std::vector< Vertex > VertexCollection
void operator()(AimsVector< uint, 3 > &y, const numeric_array< size_t, 3 > &x) const
void convert_aimsmeshTomesh1(const AimsTimeSurface< 3, Void > &meshFrom, til::Mesh1 &meshTo)
This class enhance a mesh class with a neighbor index attribute.
void convert_mesh(AimsSurface< 3, Void > const &mesh, VertexCollection &vertices, FaceCollection &faces)
void operator()(Mesh< TParam > &mesh, const AimsSurfaceTriangle &aimsMesh) const
Externalization of the standard value_type member typedef.
void operator()(Mesh< TParam > &mesh, const AimsSurface< 3, Void > &aimsMesh) const
void aimswrite(const T &data, const std::string name)
const MeshTraits< AimsSurface< D, T > >::VertexCollection & getVertices(const AimsSurface< D, T > &mesh)
const char ** aims_const_hack(char **argv)
Hack around bad AimsApplication definition.
void writeTexture(const T &data, const char *name)