diff --git a/docs/doxygen.conf b/docs/doxygen.conf index cb99be93f..dd9d8cd03 100644 --- a/docs/doxygen.conf +++ b/docs/doxygen.conf @@ -1024,7 +1024,7 @@ EXCLUDE_PATTERNS = # wildcard * is used, a substring. Examples: ANamespace, AClass, # ANamespace::AClass, ANamespace::*Test -EXCLUDE_SYMBOLS = +EXCLUDE_SYMBOLS = igl::FastWindingNumber* igl::tinyply* igl::anttweakbar* # The EXAMPLE_PATH tag can be used to specify one or more files or directories # that contain example code fragments that are included (see the \include diff --git a/include/igl/Camera.h b/include/igl/Camera.h deleted file mode 100644 index 9c8a47519..000000000 --- a/include/igl/Camera.h +++ /dev/null @@ -1,362 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_CAMERA_H -#define IGL_CAMERA_H - -// you're idiot, M$! -#if defined(_WIN32) -#undef far -#undef near -#endif - -#include -#include -#include "PI.h" - -#define IGL_CAMERA_MIN_ANGLE 5.0 -namespace igl -{ - - /// A simple camera class. The camera stores projection parameters (field of - /// view angle, aspect ratio, near and far clips) as well as a rigid - /// transformation *of the camera as if it were also a scene object*. Thus, the - /// **inverse** of this rigid transformation is the modelview transformation. - /// - /// \deprecated This is not maintained. - /// @private - class Camera - { - public: - // On windows you might need: -fno-delayed-template-parsing - //static constexpr double IGL_CAMERA_MIN_ANGLE = 5.; - // m_angle Field of view angle in degrees {45} - // m_aspect Aspect ratio {1} - // m_near near clipping plane {1e-2} - // m_far far clipping plane {100} - // m_at_dist distance of looking at point {1} - // m_orthographic whether to use othrographic projection {false} - // m_rotation_conj Conjugate of rotation part of rigid transformation of - // camera {identity}. Note: we purposefully store the conjugate because - // this is what TW_TYPE_QUAT4D is expecting. - // m_translation Translation part of rigid transformation of camera - // {(0,0,1)} - double m_angle, m_aspect, m_near, m_far, m_at_dist; - bool m_orthographic; - Eigen::Quaterniond m_rotation_conj; - Eigen::Vector3d m_translation; - public: - inline Camera(); - inline virtual ~Camera(){} - // Return projection matrix that takes relative camera coordinates and - // transforms it to viewport coordinates - // - // Note: - // - // if(m_angle > 0) - // { - // gluPerspective(m_angle,m_aspect,m_near,m_at_dist+m_far); - // }else - // { - // gluOrtho(-0.5*aspect,0.5*aspect,-0.5,0.5,m_at_dist+m_near,m_far); - // } - // - // Is equivalent to - // - // glMultMatrixd(projection().data()); - // - inline Eigen::Matrix4d projection() const; - // Return an Affine transformation (rigid actually) that - // takes relative coordinates and tramsforms them into world 3d - // coordinates: moves the camera into the scene. - inline Eigen::Affine3d affine() const; - // Return an Affine transformation (rigid actually) that puts the takes a - // world 3d coordinate and transforms it into the relative camera - // coordinates: moves the scene in front of the camera. - // - // Note: - // - // gluLookAt( - // eye()(0), eye()(1), eye()(2), - // at()(0), at()(1), at()(2), - // up()(0), up()(1), up()(2)); - // - // Is equivalent to - // - // glMultMatrixd(camera.inverse().matrix().data()); - // - // See also: affine, eye, at, up - inline Eigen::Affine3d inverse() const; - // Returns world coordinates position of center or "eye" of camera. - inline Eigen::Vector3d eye() const; - // Returns world coordinate position of a point "eye" is looking at. - inline Eigen::Vector3d at() const; - // Returns world coordinate unit vector of "up" vector - inline Eigen::Vector3d up() const; - // Return top right corner of unit plane in relative coordinates, that is - // (w/2,h/2,1) - inline Eigen::Vector3d unit_plane() const; - // Move dv in the relative coordinate frame of the camera (move the FPS) - // - // Inputs: - // dv (x,y,z) displacement vector - // - inline void dolly(const Eigen::Vector3d & dv); - // "Scale zoom": Move `eye`, but leave `at` - // - // Input: - // s amount to scale distance to at - inline void push_away(const double s); - // Aka "Hitchcock", "Vertigo", "Spielberg" or "Trombone" zoom: - // simultaneously dolly while changing angle so that `at` not only stays - // put in relative coordinates but also projected coordinates. That is - // - // Inputs: - // da change in angle in degrees - inline void dolly_zoom(const double da); - // Turn around eye so that rotation is now q - // - // Inputs: - // q new rotation as quaternion - inline void turn_eye(const Eigen::Quaterniond & q); - // Orbit around at so that rotation is now q - // - // Inputs: - // q new rotation as quaternion - inline void orbit(const Eigen::Quaterniond & q); - // Rotate and translate so that camera is situated at "eye" looking at "at" - // with "up" pointing up. - // - // Inputs: - // eye (x,y,z) coordinates of eye position - // at (x,y,z) coordinates of at position - // up (x,y,z) coordinates of up vector - inline void look_at( - const Eigen::Vector3d & eye, - const Eigen::Vector3d & at, - const Eigen::Vector3d & up); - // Needed any time Eigen Structures are used as class members - // http://eigen.tuxfamily.org/dox-devel/group__TopicStructHavingEigenMembers.html - public: - EIGEN_MAKE_ALIGNED_OPERATOR_NEW - }; -} - -// Implementation -#include "PI.h" -#include "EPS.h" -#include -#include -#include - -inline igl::Camera::Camera(): - m_angle(45.0),m_aspect(1),m_near(1e-2),m_far(100),m_at_dist(1), - m_orthographic(false), - m_rotation_conj(1,0,0,0), - m_translation(0,0,1) -{ -} - -inline Eigen::Matrix4d igl::Camera::projection() const -{ - Eigen::Matrix4d P; - using namespace std; - const double far = m_at_dist + m_far; - const double near = m_near; - // http://stackoverflow.com/a/3738696/148668 - if(m_orthographic) - { - const double f = 0.5; - const double left = -f*m_aspect; - const double right = f*m_aspect; - const double bottom = -f; - const double top = f; - const double tx = (right+left)/(right-left); - const double ty = (top+bottom)/(top-bottom); - const double tz = (far+near)/(far-near); - const double z_fix = 0.5 /m_at_dist / tan(m_angle*0.5 * (igl::PI/180.) ); - P<< - z_fix*2./(right-left), 0, 0, -tx, - 0, z_fix*2./(top-bottom), 0, -ty, - 0, 0, -z_fix*2./(far-near), -tz, - 0, 0, 0, 1; - }else - { - const double yScale = tan(PI*0.5 - 0.5*m_angle*PI/180.); - // http://stackoverflow.com/a/14975139/148668 - const double xScale = yScale/m_aspect; - P<< - xScale, 0, 0, 0, - 0, yScale, 0, 0, - 0, 0, -(far+near)/(far-near), -1, - 0, 0, -2.*near*far/(far-near), 0; - P = P.transpose().eval(); - } - return P; -} - -inline Eigen::Affine3d igl::Camera::affine() const -{ - using namespace Eigen; - Affine3d t = Affine3d::Identity(); - t.rotate(m_rotation_conj.conjugate()); - t.translate(m_translation); - return t; -} - -inline Eigen::Affine3d igl::Camera::inverse() const -{ - using namespace Eigen; - Affine3d t = Affine3d::Identity(); - t.translate(-m_translation); - t.rotate(m_rotation_conj); - return t; -} - -inline Eigen::Vector3d igl::Camera::eye() const -{ - using namespace Eigen; - return affine() * Vector3d(0,0,0); -} - -inline Eigen::Vector3d igl::Camera::at() const -{ - using namespace Eigen; - return affine() * (Vector3d(0,0,-1)*m_at_dist); -} - -inline Eigen::Vector3d igl::Camera::up() const -{ - using namespace Eigen; - Affine3d t = Affine3d::Identity(); - t.rotate(m_rotation_conj.conjugate()); - return t * Vector3d(0,1,0); -} - -inline Eigen::Vector3d igl::Camera::unit_plane() const -{ - // Distance of center pixel to eye - const double d = 1.0; - const double a = m_aspect; - const double theta = m_angle*PI/180.; - const double w = - 2.*sqrt(-d*d/(a*a*pow(tan(0.5*theta),2.)-1.))*a*tan(0.5*theta); - const double h = w/a; - return Eigen::Vector3d(w*0.5,h*0.5,-d); -} - -inline void igl::Camera::dolly(const Eigen::Vector3d & dv) -{ - m_translation += dv; -} - -inline void igl::Camera::push_away(const double s) -{ - using namespace Eigen; -#ifndef NDEBUG - Vector3d old_at = at(); -#endif - const double old_at_dist = m_at_dist; - m_at_dist = old_at_dist * s; - dolly(Vector3d(0,0,1)*(m_at_dist - old_at_dist)); - assert((old_at-at()).squaredNorm() < DOUBLE_EPS); -} - -inline void igl::Camera::dolly_zoom(const double da) -{ - using namespace std; - using namespace Eigen; -#ifndef NDEBUG - Vector3d old_at = at(); -#endif - const double old_angle = m_angle; - if(old_angle + da < IGL_CAMERA_MIN_ANGLE) - { - m_orthographic = true; - }else if(old_angle + da > IGL_CAMERA_MIN_ANGLE) - { - m_orthographic = false; - } - if(!m_orthographic) - { - m_angle += da; - m_angle = min(89.,max(IGL_CAMERA_MIN_ANGLE,m_angle)); - // change in distance - const double s = - (2.*tan(old_angle/2./180.*igl::PI)) / - (2.*tan(m_angle/2./180.*igl::PI)) ; - const double old_at_dist = m_at_dist; - m_at_dist = old_at_dist * s; - dolly(Vector3d(0,0,1)*(m_at_dist - old_at_dist)); - assert((old_at-at()).squaredNorm() < DOUBLE_EPS); - } -} - -inline void igl::Camera::turn_eye(const Eigen::Quaterniond & q) -{ - using namespace Eigen; - Vector3d old_eye = eye(); - // eye should be fixed - // - // eye_1 = R_1 * t_1 = eye_0 - // t_1 = R_1' * eye_0 - m_rotation_conj = q.conjugate(); - m_translation = m_rotation_conj * old_eye; - assert((old_eye - eye()).squaredNorm() < DOUBLE_EPS); -} - -inline void igl::Camera::orbit(const Eigen::Quaterniond & q) -{ - using namespace Eigen; - Vector3d old_at = at(); - // at should be fixed - // - // at_1 = R_1 * t_1 - R_1 * z = at_0 - // t_1 = R_1' * (at_0 + R_1 * z) - m_rotation_conj = q.conjugate(); - m_translation = - m_rotation_conj * - (old_at + - m_rotation_conj.conjugate() * Vector3d(0,0,1) * m_at_dist); - assert((old_at - at()).squaredNorm() < DOUBLE_EPS); -} - -inline void igl::Camera::look_at( - const Eigen::Vector3d & eye, - const Eigen::Vector3d & at, - const Eigen::Vector3d & up) -{ - using namespace Eigen; - using namespace std; - // http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml - // Normalize vector from at to eye - Vector3d F = eye-at; - m_at_dist = F.norm(); - F.normalize(); - // Project up onto plane orthogonal to F and normalize - assert(up.cross(F).norm() > DOUBLE_EPS && "(eye-at) x up ≈ 0"); - const Vector3d proj_up = (up-(up.dot(F))*F).normalized(); - Quaterniond a,b; - a.setFromTwoVectors(Vector3d(0,0,-1),-F); - b.setFromTwoVectors(a*Vector3d(0,1,0),proj_up); - m_rotation_conj = (b*a).conjugate(); - m_translation = m_rotation_conj * eye; - //cout<<"m_at_dist: "<eye().transpose()<at().transpose()<eye()-this->at()).normalized().transpose()<eye(): "<<(eye-this->eye()).squaredNorm()<eye()).squaredNorm() < DOUBLE_EPS); - //assert((F-(this->eye()-this->at()).normalized()).squaredNorm() < - // DOUBLE_EPS); - assert( (at-this->at()).squaredNorm() < DOUBLE_EPS); - //assert( (proj_up-this->up()).squaredNorm() < DOUBLE_EPS); -} - -#endif diff --git a/include/igl/FastWindingNumberForSoups.h b/include/igl/FastWindingNumberForSoups.h index 1aab23212..a93d34714 100644 --- a/include/igl/FastWindingNumberForSoups.h +++ b/include/igl/FastWindingNumberForSoups.h @@ -85,7 +85,9 @@ #include #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { /* * Integer types @@ -242,7 +244,9 @@ typedef union SYS_FPRealUnionT SYS_FPRealUnionD; #include #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { // NOTE: // These have been carefully written so that in the case of equality @@ -383,7 +387,9 @@ static inline fpreal64 SYSabs(fpreal64 a) { return ::fabs(a); } #pragma warning(pop) #endif -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { typedef __m128 v4sf; typedef __m128i v4si; @@ -745,7 +751,9 @@ vm_allbits(const v4si &a) #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { struct v4si { int32 v[4]; @@ -1174,7 +1182,9 @@ int SYS_FORCE_INLINE _mm_movemask_ps(const v4sf& v) { -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { class v4uf; @@ -1628,7 +1638,9 @@ typedef v4uu v4ui; #include #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { /// This routine describes how to change the size of an array. /// It must increase the current_size by at least one! @@ -2423,7 +2435,9 @@ private: #include #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { // Implemented in UT_Array.C extern void ut_ArrayImplFree(void *p); @@ -3086,7 +3100,9 @@ UT_Array::operator!=(const UT_Array &a) const #include #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { /// An array class with the small buffer optimization, making it ideal for /// cases when you know it will only contain a few elements at the expense of @@ -3242,7 +3258,9 @@ private: -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { template class UT_FixedVector @@ -3646,7 +3664,9 @@ struct UT_FixedVectorTraits > #include // This is just included for std::thread::hardware_concurrency() -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { namespace UT_Thread { inline int getNumProcessors() { return std::thread::hardware_concurrency(); }} @@ -3879,7 +3899,9 @@ namespace UT_Thread { inline int getNumProcessors() { #include #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { template class UT_Array; class v4uf; @@ -4440,12 +4462,14 @@ using UT_BVH = UT::BVH; -#include +#include "parallel_for.h" #include #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { namespace HDK_Sample { namespace UT { @@ -6008,7 +6032,9 @@ void BVH::debugDump() const { #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { namespace HDK_Sample { template @@ -6373,7 +6399,9 @@ private: #include -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { // This needs to be here or else the warning suppression doesn't work because // the templated calling code won't otherwise be compiled until after we've @@ -6423,7 +6451,7 @@ inline void ut_ArrayImplFree(void *p) -#include +#include "parallel_for.h" #include #include @@ -6440,7 +6468,9 @@ inline void ut_ArrayImplFree(void *p) #define TAYLOR_SERIES_ORDER 2 -namespace igl { namespace FastWindingNumber { +namespace igl { + /// @private + namespace FastWindingNumber { namespace HDK_Sample { diff --git a/include/igl/HalfEdgeIterator.h b/include/igl/HalfEdgeIterator.h index 1a35146fe..fb962ac71 100644 --- a/include/igl/HalfEdgeIterator.h +++ b/include/igl/HalfEdgeIterator.h @@ -11,7 +11,7 @@ #include #include -#include +#include "igl_inline.h" namespace igl diff --git a/include/igl/WindingNumberTree.h b/include/igl/WindingNumberTree.h index 7c9175039..3270c0759 100644 --- a/include/igl/WindingNumberTree.h +++ b/include/igl/WindingNumberTree.h @@ -142,8 +142,8 @@ namespace igl #include "triangle_fan.h" #include "exterior_edges.h" -#include -#include +#include "PI.h" +#include "remove_duplicate_vertices.h" #include #include diff --git a/include/igl/angular_distance.cpp b/include/igl/angular_distance.cpp index 803c290c9..574145bf0 100644 --- a/include/igl/angular_distance.cpp +++ b/include/igl/angular_distance.cpp @@ -6,8 +6,8 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "angular_distance.h" -#include -#include +#include "EPS.h" +#include "PI.h" IGL_INLINE double igl::angular_distance( const Eigen::Quaterniond & A, const Eigen::Quaterniond & B) diff --git a/include/igl/any_of.cpp b/include/igl/any_of.cpp deleted file mode 100644 index 9defd0339..000000000 --- a/include/igl/any_of.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#include "any_of.h" -#include -template -IGL_INLINE bool igl::any_of(const Mat & S) -{ - return std::any_of(S.data(),S.data()+S.size(),[](bool s){return s;}); -} - -#ifdef IGL_STATIC_LIBRARY -// Explicit template instantiation -template bool igl::any_of >(Eigen::Matrix const&); -#endif - diff --git a/include/igl/any_of.h b/include/igl/any_of.h deleted file mode 100644 index 99c0434c3..000000000 --- a/include/igl/any_of.h +++ /dev/null @@ -1,27 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_ANY_OF_H -#define IGL_ANY_OF_H -#include "igl_inline.h" -namespace igl -{ - /// Wrapper for STL `any_of` for matrix types - /// - /// @param[in] S matrix - /// @return whether any entries are true - /// - /// \deprecated Seems that Eigen (now) implements this for `Eigen::Array` - /// - /// \see any - template - IGL_INLINE bool any_of(const Mat & S); -} -#ifndef IGL_STATIC_LIBRARY -# include "any_of.cpp" -#endif -#endif diff --git a/include/igl/arap_dof.cpp b/include/igl/arap_dof.cpp index eaf2ea71f..c6e11d35d 100644 --- a/include/igl/arap_dof.cpp +++ b/include/igl/arap_dof.cpp @@ -25,7 +25,6 @@ #include "verbose.h" #include "print_ijv.h" -#include "get_seconds_hires.h" //#include "MKLEigenInterface.h" #include "kkt_inverse.h" #include "get_seconds.h" @@ -548,12 +547,12 @@ IGL_INLINE bool igl::arap_dof_recomputation( MatrixXd A_eqfull(A_eq); MatrixXd M_Solve; - double timer0_start = get_seconds_hires(); + double timer0_start = get_seconds(); bool use_lu = data.effective_dim != 2; //use_lu = false; //printf("use_lu: %s\n",(use_lu?"TRUE":"FALSE")); kkt_inverse(Qfull, A_eqfull, use_lu,M_Solve); - double timer0_end = get_seconds_hires(); + double timer0_end = get_seconds(); verbose("Bob timing: %.20f\n", (timer0_end - timer0_start)*1000.0); // Precompute full solve matrix: @@ -616,7 +615,7 @@ IGL_INLINE bool igl::arap_dof_update( using namespace Eigen; typedef Matrix MatrixXS; #ifdef ARAP_GLOBAL_TIMING - double timer_start = get_seconds_hires(); + double timer_start = get_seconds(); #endif // number of dimensions @@ -686,7 +685,7 @@ IGL_INLINE bool igl::arap_dof_update( MatrixXS L_part1(data.dim * (data.dim + 1) * data.m, 1); #ifdef ARAP_GLOBAL_TIMING - double timer_prepFinished = get_seconds_hires(); + double timer_prepFinished = get_seconds(); #endif #ifdef IGL_ARAP_DOF_FIXED_ITERATIONS_COUNT @@ -697,7 +696,7 @@ IGL_INLINE bool igl::arap_dof_update( { if(data.print_timings) { - sec_start = get_seconds_hires(); + sec_start = get_seconds(); } #ifndef IGL_ARAP_DOF_FIXED_ITERATIONS_COUNT @@ -722,7 +721,7 @@ IGL_INLINE bool igl::arap_dof_update( if(data.print_timings) { - sec_covGather = get_seconds_hires(); + sec_covGather = get_seconds(); } #ifdef EXTREME_VERBOSE @@ -747,7 +746,7 @@ IGL_INLINE bool igl::arap_dof_update( if(data.print_timings) { - sec_fitRotations = get_seconds_hires(); + sec_fitRotations = get_seconds(); } /////////////////////////////////////////////////////////////////////////// @@ -766,7 +765,7 @@ IGL_INLINE bool igl::arap_dof_update( if(data.print_timings) { - sec_prepMult = get_seconds_hires(); + sec_prepMult = get_seconds(); } L_part1xyz = data.CSolveBlock1 * Rxyz; @@ -824,7 +823,7 @@ IGL_INLINE bool igl::arap_dof_update( if(data.print_timings) { - sec_solve = get_seconds_hires(); + sec_solve = get_seconds(); } #ifndef IGL_ARAP_DOF_FIXED_ITERATIONS_COUNT @@ -835,7 +834,7 @@ IGL_INLINE bool igl::arap_dof_update( if(data.print_timings) { - sec_end = get_seconds_hires(); + sec_end = get_seconds(); #ifndef WIN32 // trick to get sec_* variables to compile without warning on mac if(false) @@ -861,7 +860,7 @@ IGL_INLINE bool igl::arap_dof_update( assert(L.cols() == 1); #ifdef ARAP_GLOBAL_TIMING - double timer_finito = get_seconds_hires(); + double timer_finito = get_seconds(); printf( "ARAP preparation = %f, " "all %i iterations = %f [ms]\n", diff --git a/include/igl/arap_linear_block.h b/include/igl/arap_linear_block.h index f29616c9c..80bfdf2bc 100644 --- a/include/igl/arap_linear_block.h +++ b/include/igl/arap_linear_block.h @@ -10,7 +10,7 @@ #include "igl_inline.h" #include -#include +#include "ARAPEnergyType.h" namespace igl { diff --git a/include/igl/arap_rhs.h b/include/igl/arap_rhs.h index 1afc25d12..20e009cb2 100644 --- a/include/igl/arap_rhs.h +++ b/include/igl/arap_rhs.h @@ -8,10 +8,10 @@ #ifndef IGL_ARAP_RHS_H #define IGL_ARAP_RHS_H #include "igl_inline.h" +#include "ARAPEnergyType.h" #include #include -#include namespace igl { diff --git a/include/igl/bbw.h b/include/igl/bbw.h index aaab90240..116e6eb99 100644 --- a/include/igl/bbw.h +++ b/include/igl/bbw.h @@ -10,7 +10,7 @@ #include "igl_inline.h" #include -#include +#include "active_set.h" namespace igl { diff --git a/include/igl/bfs_orient.h b/include/igl/bfs_orient.h index 9a60e1985..6d3c80488 100644 --- a/include/igl/bfs_orient.h +++ b/include/igl/bfs_orient.h @@ -8,7 +8,7 @@ #ifndef IGL_BFS_ORIENT_H #define IGL_BFS_ORIENT_H #include -#include +#include "igl_inline.h" namespace igl { diff --git a/include/igl/bounding_box_diagonal.cpp b/include/igl/bounding_box_diagonal.cpp index 1023abb50..410953a85 100644 --- a/include/igl/bounding_box_diagonal.cpp +++ b/include/igl/bounding_box_diagonal.cpp @@ -6,8 +6,8 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "bounding_box_diagonal.h" -#include "mat_max.h" -#include "mat_min.h" +#include "max.h" +#include "min.h" #include IGL_INLINE double igl::bounding_box_diagonal( @@ -16,8 +16,8 @@ IGL_INLINE double igl::bounding_box_diagonal( using namespace Eigen; VectorXd maxV,minV; VectorXi maxVI,minVI; - mat_max(V,1,maxV,maxVI); - mat_min(V,1,minV,minVI); + igl::max(V,1,maxV,maxVI); + igl::min(V,1,minV,minVI); return sqrt((maxV-minV).array().square().sum()); } diff --git a/include/igl/copyleft/cgal/remesh_intersections.cpp b/include/igl/copyleft/cgal/remesh_intersections.cpp index 30b7ae6ee..10882da80 100644 --- a/include/igl/copyleft/cgal/remesh_intersections.cpp +++ b/include/igl/copyleft/cgal/remesh_intersections.cpp @@ -515,6 +515,8 @@ IGL_INLINE void igl::copyleft::cgal::remesh_intersections( #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation +template void igl::copyleft::cgal::remesh_intersections, Eigen::Matrix, CGAL::Epick, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector, std::allocator > > const&, std::map::Index, std::vector::Index, CGAL::Object>, std::allocator::Index, CGAL::Object> > >, std::less::Index>, std::allocator::Index const, std::vector::Index, CGAL::Object>, std::allocator::Index, CGAL::Object> > > > > > const&, bool, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +template void igl::copyleft::cgal::remesh_intersections, Eigen::Matrix, CGAL::Epick, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector, std::allocator > > const&, std::map::Index, std::vector::Index, CGAL::Object>, std::allocator::Index, CGAL::Object> > >, std::less::Index>, std::allocator::Index const, std::vector::Index, CGAL::Object>, std::allocator::Index, CGAL::Object> > > > > > const&, bool, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::copyleft::cgal::remesh_intersections, Eigen::Matrix, CGAL::Epeck, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector, std::allocator > > const&, std::map::Index, std::vector::Index, CGAL::Object>, std::allocator::Index, CGAL::Object> > >, std::less::Index>, std::allocator::Index const, std::vector::Index, CGAL::Object>, std::allocator::Index, CGAL::Object> > > > > > const&, bool, bool, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); // diff --git a/include/igl/copyleft/cgal/resolve_intersections.h b/include/igl/copyleft/cgal/resolve_intersections.h index f842acc0b..ec34d4ba0 100644 --- a/include/igl/copyleft/cgal/resolve_intersections.h +++ b/include/igl/copyleft/cgal/resolve_intersections.h @@ -14,6 +14,8 @@ namespace igl { namespace copyleft { + namespace cgal + { /// Given a list of possible intersecting segments with endpoints, split /// segments to overlap only at endpoints /// @@ -24,8 +26,6 @@ namespace igl /// @param[out] EI #EI by 2 list of segment indices into V, #EI ≥ #E /// @param[out] J #EI list of indices into E revealing "parent segments" /// @param[out] IM #VI list of indices into VV of unique vertices. - namespace cgal - { template < typename DerivedV, typename DerivedE, diff --git a/include/igl/copyleft/comiso/frame_field.cpp b/include/igl/copyleft/comiso/frame_field.cpp index c3549eeff..d4c9002f5 100644 --- a/include/igl/copyleft/comiso/frame_field.cpp +++ b/include/igl/copyleft/comiso/frame_field.cpp @@ -7,10 +7,10 @@ // obtain one at http://mozilla.org/MPL/2.0/. #include "frame_field.h" -#include -#include -#include -#include +#include "../../triangle_triangle_adjacency.h" +#include "../../edge_topology.h" +#include "../../per_face_normals.h" +#include "nrosy.h" #include namespace igl diff --git a/include/igl/copyleft/comiso/frame_field.h b/include/igl/copyleft/comiso/frame_field.h index a0a45954a..8b2bca837 100644 --- a/include/igl/copyleft/comiso/frame_field.h +++ b/include/igl/copyleft/comiso/frame_field.h @@ -8,8 +8,8 @@ #ifndef IGL_COMISO_FRAMEFIELD_H #define IGL_COMISO_FRAMEFIELD_H -#include -#include +#include "../../igl_inline.h" +#include "../../PI.h" #include #include diff --git a/include/igl/copyleft/comiso/nrosy.cpp b/include/igl/copyleft/comiso/nrosy.cpp index 591a33f7f..84af51d40 100644 --- a/include/igl/copyleft/comiso/nrosy.cpp +++ b/include/igl/copyleft/comiso/nrosy.cpp @@ -8,10 +8,10 @@ #include "nrosy.h" -#include -#include -#include -#include +#include "nrosy.h" +#include "../../triangle_triangle_adjacency.h" +#include "../../edge_topology.h" +#include "../../per_face_normals.h" #include #include "../../PI.h" diff --git a/include/igl/cotmatrix.cpp b/include/igl/cotmatrix.cpp index 205a2c677..646e74f91 100644 --- a/include/igl/cotmatrix.cpp +++ b/include/igl/cotmatrix.cpp @@ -80,7 +80,6 @@ IGL_INLINE void igl::cotmatrix( #include "massmatrix.h" #include "cotmatrix_entries.h" -#include "diag.h" #include "massmatrix.h" #include #include @@ -198,7 +197,7 @@ IGL_INLINE void igl::cotmatrix( const Eigen::SparseMatrix PTMP = P.transpose() * Mf * P; // Lump M const VectorXS Mdiag = PTMP * VectorXS::Ones(n,1); - igl::diag(Mdiag,M); + M = Eigen::SparseMatrix(Mdiag.asDiagonal()); MatrixXS Vf = P*V; Eigen::MatrixXi Ff(I.size(),3); diff --git a/include/igl/covariance_scatter_matrix.cpp b/include/igl/covariance_scatter_matrix.cpp index 24fe9f760..6cb6a5a0f 100644 --- a/include/igl/covariance_scatter_matrix.cpp +++ b/include/igl/covariance_scatter_matrix.cpp @@ -8,7 +8,6 @@ #include "covariance_scatter_matrix.h" #include "arap_linear_block.h" #include "cotmatrix.h" -#include "diag.h" #include "sum.h" #include "edges.h" #include "verbose.h" diff --git a/include/igl/cross_field_mismatch.cpp b/include/igl/cross_field_mismatch.cpp index fa4df32af..0592b925a 100644 --- a/include/igl/cross_field_mismatch.cpp +++ b/include/igl/cross_field_mismatch.cpp @@ -11,13 +11,13 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include +#include "comb_cross_field.h" +#include "per_face_normals.h" +#include "is_border_vertex.h" +#include "vertex_triangle_adjacency.h" +#include "triangle_triangle_adjacency.h" +#include "rotation_matrix_from_directions.h" +#include "PI.h" namespace igl { template diff --git a/include/igl/cut_mesh.cpp b/include/igl/cut_mesh.cpp index fa35c3c24..3ce7c41f3 100644 --- a/include/igl/cut_mesh.cpp +++ b/include/igl/cut_mesh.cpp @@ -5,10 +5,10 @@ // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#include -#include -#include -#include +#include "cut_mesh.h" +#include "triangle_triangle_adjacency.h" +#include "HalfEdgeIterator.h" +#include "is_border_vertex.h" // wrapper for input/output style template diff --git a/include/igl/cut_mesh_from_singularities.cpp b/include/igl/cut_mesh_from_singularities.cpp index 5f6150da5..f92694327 100644 --- a/include/igl/cut_mesh_from_singularities.cpp +++ b/include/igl/cut_mesh_from_singularities.cpp @@ -8,8 +8,8 @@ #include "cut_mesh_from_singularities.h" -#include -#include +#include "triangle_triangle_adjacency.h" +#include "edge_topology.h" #include #include diff --git a/include/igl/deprecated.h b/include/igl/deprecated.h deleted file mode 100644 index 6820dd320..000000000 --- a/include/igl/deprecated.h +++ /dev/null @@ -1,51 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2015 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_DEPRECATED_H -#define IGL_DEPRECATED_H -// Macro for marking a function as deprecated. -// Use C++14 feature [[deprecated]] if available. -// See also https://stackoverflow.com/questions/295120/c-mark-as-deprecated/21265197#21265197 - -#ifdef __has_cpp_attribute -# define IGL_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x) -#else -# define IGL_HAS_CPP_ATTRIBUTE(x) 0 -#endif - -#ifdef _MSC_VER -# define IGL_MSC_VER _MSC_VER -#else -# define IGL_MSC_VER 0 -#endif - -#ifndef IGL_DEPRECATED -# if (IGL_HAS_CPP_ATTRIBUTE(deprecated) && __cplusplus >= 201402L) || \ - IGL_MSC_VER >= 1900 -# define IGL_DEPRECATED [[deprecated]] -# else -# if defined(__GNUC__) || defined(__clang__) -# define IGL_DEPRECATED __attribute__((deprecated)) -# elif IGL_MSC_VER -# define IGL_DEPRECATED __declspec(deprecated) -# else -# pragma message("WARNING: You need to implement IGL_DEPRECATED for this compiler") -# define IGL_DEPRECATED /* deprecated */ -# endif -# endif -#endif - -// Usage: -// -// template -// IGL_INLINE void my_func(Arg1 a); -// -// becomes -// -// template -// IGL_DEPRECATED IGL_INLINE void my_func(Arg1 a); -#endif diff --git a/include/igl/diag.cpp b/include/igl/diag.cpp deleted file mode 100644 index dc025cd62..000000000 --- a/include/igl/diag.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#include "diag.h" - -#include "verbose.h" - -// Bug in unsupported/Eigen/SparseExtra needs iostream first -#include -#include - -template -IGL_INLINE void igl::diag( - const Eigen::SparseMatrix& X, - Eigen::SparseVector& V) -{ - assert(false && "Just call X.diagonal().sparseView() directly"); - V = X.diagonal().sparseView(); -} - -template -IGL_INLINE void igl::diag( - const Eigen::SparseMatrix& X, - Eigen::MatrixBase & V) -{ - assert(false && "Just call X.diagonal() directly"); - V = X.diagonal(); -} - -template -IGL_INLINE void igl::diag( - const Eigen::SparseVector& V, - Eigen::SparseMatrix& X) -{ - // clear and resize output - std::vector > Xijv; - const int n = V.size(); - const int nnz = V.nonZeros(); - Xijv.reserve(nnz); - // loop over non-zeros - for(typename Eigen::SparseVector::InnerIterator it(V); it; ++it) - { - Xijv.emplace_back(it.index(),it.index(),it.value()); - } - X.resize(n,n); - X.setFromTriplets(Xijv.begin(),Xijv.end()); -} - -template -IGL_INLINE void igl::diag( - const Eigen::MatrixBase & V, - Eigen::SparseMatrix& X) -{ - assert(V.rows() == 1 || V.cols() == 1); - // clear and resize output - std::vector > Xijv; - const int n = V.size(); - Xijv.reserve(n); - // loop over non-zeros - for(int i = 0;i >(Eigen::SparseMatrix const&, Eigen::MatrixBase >&); -template void igl::diag(Eigen::SparseMatrix const&, Eigen::SparseVector&); -template void igl::diag >(Eigen::MatrixBase > const&, Eigen::SparseMatrix&); -template void igl::diag(Eigen::SparseVector const&, Eigen::SparseMatrix&); -#endif diff --git a/include/igl/diag.h b/include/igl/diag.h deleted file mode 100644 index 2a1ca6b0b..000000000 --- a/include/igl/diag.h +++ /dev/null @@ -1,60 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_DIAG_H -#define IGL_DIAG_H -#include "igl_inline.h" -#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET -#include - -namespace igl -{ - /// Extracts the main diagonal of a matrix as a vector. Like matlab's `diag`. - /// - /// - /// @tparam T should be a eigen sparse matrix primitive type like int or double - /// @param[in] X an m by n sparse matrix - /// @param[out] V a min(m,n) sparse vector - /// - /// http://forum.kde.org/viewtopic.php?f=74&t=117476&p=292388#p292388 - /// - /// \deprecated Use - /// `VectorXd V = X.diagonal()` and - /// `SparseVector V = X.diagonal().sparseView()` - /// `SparseMatrix X = V.asDiagonal().sparseView()` - /// - /// - template - IGL_INLINE void diag( - const Eigen::SparseMatrix& X, - Eigen::SparseVector& V); - /// \overload - template - IGL_INLINE void diag( - const Eigen::SparseMatrix& X, - Eigen::MatrixBase& V); - /// Builds a sparse matrix with a given vector along the main diagonal. - /// - /// @tparam T should be a eigen sparse matrix primitive type like int or double - /// @param[in] V a m sparse vector - /// @param[out] X a m by m sparse matrix - template - IGL_INLINE void diag( - const Eigen::SparseVector& V, - Eigen::SparseMatrix& X); - /// \overload - template - IGL_INLINE void diag( - const Eigen::MatrixBase& V, - Eigen::SparseMatrix& X); -} - -#ifndef IGL_STATIC_LIBRARY -# include "diag.cpp" -#endif - -#endif diff --git a/include/igl/dot_row.h b/include/igl/dot_row.h index a740f5e6a..8bfa6c393 100644 --- a/include/igl/dot_row.h +++ b/include/igl/dot_row.h @@ -20,7 +20,9 @@ namespace igl /// @param[in] B eigen matrix r by c /// @param[out] d a column vector with r entries that contains the dot product of each corresponding row of A and B /// - /// \deprecated Use Eigen's `.rowwise().dot()` instead + /// \note Unfortunately, Eigen does not support `A.rowwise().dot(B.rowwise())` + /// so this function is a wrapper around the less obvious and less convenient + /// `(A.array() * B.array()).rowwise().sum()`. template IGL_INLINE DerivedV dot_row( const Eigen::PlainObjectBase& A, diff --git a/include/igl/ears.cpp b/include/igl/ears.cpp index 428ba161b..7e98fe0c7 100644 --- a/include/igl/ears.cpp +++ b/include/igl/ears.cpp @@ -2,7 +2,7 @@ #include "on_boundary.h" #include "find.h" #include "slice.h" -#include "mat_min.h" +#include "min.h" #include template < @@ -24,7 +24,7 @@ IGL_INLINE void igl::ears( Eigen::Array Bear; slice(B, ear, 1, Bear); Eigen::Array M; - mat_min(Bear,2,M,ear_opp); + igl::min(Bear,2,M,ear_opp); } #ifdef IGL_STATIC_LIBRARY diff --git a/include/igl/embree/EmbreeIntersector.cpp b/include/igl/embree/EmbreeIntersector.cpp index 0bf8c9492..d0495fc7b 100644 --- a/include/igl/embree/EmbreeIntersector.cpp +++ b/include/igl/embree/EmbreeIntersector.cpp @@ -2,7 +2,7 @@ #include "EmbreeIntersector.h" // Implementation -#include +#include "../EPS.h" IGL_INLINE igl::embree::EmbreeIntersector::EmbreeIntersector() : diff --git a/include/igl/embree/EmbreeRenderer.h b/include/igl/embree/EmbreeRenderer.h index d2e6bb1d5..45fafd1f3 100644 --- a/include/igl/embree/EmbreeRenderer.h +++ b/include/igl/embree/EmbreeRenderer.h @@ -13,7 +13,7 @@ #ifndef IGL_EMBREE_EMBREE_RENDERER_H #define IGL_EMBREE_EMBREE_RENDERER_H -#include +#include "../colormap.h" #include #include diff --git a/include/igl/embree/bone_heat.cpp b/include/igl/embree/bone_heat.cpp index 8a85af98c..82a9b610c 100644 --- a/include/igl/embree/bone_heat.cpp +++ b/include/igl/embree/bone_heat.cpp @@ -11,7 +11,7 @@ #include "../project_to_line_segment.h" #include "../cotmatrix.h" #include "../massmatrix.h" -#include "../mat_min.h" +#include "../min.h" #include bool igl::embree::bone_heat( @@ -81,7 +81,7 @@ bool igl::embree::bone_heat( VectorXd min_D; VectorXd Hdiag = VectorXd::Zero(n); VectorXi J; - mat_min(D,2,min_D,J); + igl::min(D,2,min_D,J); for(int i = 0;i +#include "../igl_inline.h" #include #include "EmbreeIntersector.h" namespace igl diff --git a/include/igl/embree/line_mesh_intersection.cpp b/include/igl/embree/line_mesh_intersection.cpp index 0f6e02b8c..dd51ed2af 100644 --- a/include/igl/embree/line_mesh_intersection.cpp +++ b/include/igl/embree/line_mesh_intersection.cpp @@ -12,8 +12,8 @@ #include #include -#include -#include +#include "../per_vertex_normals.h" +#include "EmbreeIntersector.h" template IGL_INLINE ScalarMatrix igl::embree::line_mesh_intersection diff --git a/include/igl/embree/line_mesh_intersection.h b/include/igl/embree/line_mesh_intersection.h index 5f96ad2ea..91f93de9b 100644 --- a/include/igl/embree/line_mesh_intersection.h +++ b/include/igl/embree/line_mesh_intersection.h @@ -7,7 +7,7 @@ // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_EMBREE_LINE_MESH_INTERSECTION_H #define IGL_EMBREE_LINE_MESH_INTERSECTION_H -#include +#include "../igl_inline.h" #include #include diff --git a/include/igl/embree/unproject_in_mesh.h b/include/igl/embree/unproject_in_mesh.h index aa280cbf9..c8fe238c5 100644 --- a/include/igl/embree/unproject_in_mesh.h +++ b/include/igl/embree/unproject_in_mesh.h @@ -7,7 +7,7 @@ // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_EMBREE_UNPROJECT_IN_MESH #define IGL_EMBREE_UNPROJECT_IN_MESH -#include +#include "../igl_inline.h" #include #include diff --git a/include/igl/embree/unproject_onto_mesh.h b/include/igl/embree/unproject_onto_mesh.h index e7c48018f..0f1759f2d 100644 --- a/include/igl/embree/unproject_onto_mesh.h +++ b/include/igl/embree/unproject_onto_mesh.h @@ -7,7 +7,7 @@ // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_EMBREE_UNPROJECT_ONTO_MESH_H #define IGL_EMBREE_UNPROJECT_ONTO_MESH_H -#include +#include "../igl_inline.h" #include #include diff --git a/include/igl/euler_characteristic.cpp b/include/igl/euler_characteristic.cpp index c3ca6303b..a5c28cbc7 100644 --- a/include/igl/euler_characteristic.cpp +++ b/include/igl/euler_characteristic.cpp @@ -9,24 +9,6 @@ #include "edge_topology.h" #include "edges.h" - -template -IGL_INLINE int igl::euler_characteristic( - const Eigen::MatrixBase & V, - const Eigen::MatrixBase & F) -{ - - int euler_v = V.rows(); - Eigen::MatrixXi EV, FE, EF; - igl::edge_topology(V, F, EV, FE, EF); - int euler_e = EV.rows(); - int euler_f = F.rows(); - - int euler_char = euler_v - euler_e + euler_f; - return euler_char; - -} - template IGL_INLINE int igl::euler_characteristic( const Eigen::MatrixBase & F) @@ -41,6 +23,5 @@ IGL_INLINE int igl::euler_characteristic( #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation -template int igl::euler_characteristic, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&); template int igl::euler_characteristic >(Eigen::MatrixBase > const&); #endif diff --git a/include/igl/euler_characteristic.h b/include/igl/euler_characteristic.h index 315133781..1445411d8 100644 --- a/include/igl/euler_characteristic.h +++ b/include/igl/euler_characteristic.h @@ -22,21 +22,6 @@ namespace igl template IGL_INLINE int euler_characteristic( const Eigen::MatrixBase & F); - /// Computes the Euler characteristic of a given mesh (V,F) - /// - /// @tparam Scalar should be a floating point number type - /// @tparam Index should be an integer type - /// @param[in] V #V by dim list of mesh vertex positions - /// @param[in] F #F by dim list of mesh faces (must be triangles) - /// @return int containing the Euler characteristic - /// - /// \deprecated This version is inferior to the one above because it - /// unecessarily requires V and expensively calls edge_topology - template - IGL_INLINE int euler_characteristic( - const Eigen::MatrixBase & V, - const Eigen::MatrixBase & F); - } #ifndef IGL_STATIC_LIBRARY diff --git a/include/igl/exact_geodesic.cpp b/include/igl/exact_geodesic.cpp index 06c029282..ad78adff2 100644 --- a/include/igl/exact_geodesic.cpp +++ b/include/igl/exact_geodesic.cpp @@ -12,7 +12,7 @@ //Code from https://code.google.com/archive/p/geodesic/ // Compiled into a single file by Zhongshi Jiang -#include +#include "PI.h" #include #include #include diff --git a/include/igl/false_barycentric_subdivision.cpp b/include/igl/false_barycentric_subdivision.cpp index 8ea807a50..c1b573472 100644 --- a/include/igl/false_barycentric_subdivision.cpp +++ b/include/igl/false_barycentric_subdivision.cpp @@ -9,7 +9,7 @@ #include "verbose.h" #include -#include +#include "barycenter.h" template IGL_INLINE void igl::false_barycentric_subdivision( diff --git a/include/igl/fast_winding_number.h b/include/igl/fast_winding_number.h index 51d391424..7fb00d6d4 100644 --- a/include/igl/fast_winding_number.h +++ b/include/igl/fast_winding_number.h @@ -130,13 +130,18 @@ namespace igl const Eigen::MatrixBase& Q, Eigen::PlainObjectBase& WN); /// @private - namespace FastWindingNumber { namespace HDK_Sample{ template class UT_SolidAngle;} } + namespace FastWindingNumber { + /// @private + namespace HDK_Sample{ + /// @private + template class UT_SolidAngle;} } /// Structure for caching precomputation for fast winding number for triangle /// soups struct FastWindingNumberBVH { /// @private FastWindingNumber::HDK_Sample::UT_SolidAngle ut_solid_angle; // Need copies of these so they stay alive between calls. + /// @private std::vector > U; std::vector F; }; diff --git a/include/igl/find_cross_field_singularities.cpp b/include/igl/find_cross_field_singularities.cpp index f3e3f491d..010de6c19 100644 --- a/include/igl/find_cross_field_singularities.cpp +++ b/include/igl/find_cross_field_singularities.cpp @@ -9,10 +9,10 @@ #include "find_cross_field_singularities.h" #include -#include -#include -#include -#include +#include "cross_field_mismatch.h" +#include "is_border_vertex.h" +#include "vertex_triangle_adjacency.h" +#include "is_border_vertex.h" template diff --git a/include/igl/frame_field_deformer.cpp b/include/igl/frame_field_deformer.cpp index c22200f1b..97587bcfd 100644 --- a/include/igl/frame_field_deformer.cpp +++ b/include/igl/frame_field_deformer.cpp @@ -11,9 +11,9 @@ #include #include -#include -#include -#include +#include "cotmatrix_entries.h" +#include "cotmatrix.h" +#include "vertex_triangle_adjacency.h" namespace igl { diff --git a/include/igl/frame_to_cross_field.cpp b/include/igl/frame_to_cross_field.cpp index e4d6bc713..824d1754d 100644 --- a/include/igl/frame_to_cross_field.cpp +++ b/include/igl/frame_to_cross_field.cpp @@ -6,8 +6,8 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "frame_to_cross_field.h" -#include -#include +#include "local_basis.h" +#include "dot_row.h" IGL_INLINE void igl::frame_to_cross_field( const Eigen::MatrixXd& V, diff --git a/include/igl/get_seconds.cpp b/include/igl/get_seconds.cpp index fac4a3a69..01f81312a 100644 --- a/include/igl/get_seconds.cpp +++ b/include/igl/get_seconds.cpp @@ -6,6 +6,21 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "get_seconds.h" + +#if _WIN32 +// Alec: Why is this more "hires" than chrono? +# include +# include +IGL_INLINE double igl::get_seconds() +{ + LARGE_INTEGER li_freq, li_current; + const bool ret = QueryPerformanceFrequency(&li_freq); + const bool ret2 = QueryPerformanceCounter(&li_current); + assert(ret && ret2); + assert(li_freq.QuadPart > 0); + return double(li_current.QuadPart) / double(li_freq.QuadPart); +} +#else #include IGL_INLINE double igl::get_seconds() { @@ -13,3 +28,4 @@ IGL_INLINE double igl::get_seconds() std::chrono::duration( std::chrono::system_clock::now().time_since_epoch()).count(); } +#endif diff --git a/include/igl/get_seconds.h b/include/igl/get_seconds.h index 752819331..05f92736d 100644 --- a/include/igl/get_seconds.h +++ b/include/igl/get_seconds.h @@ -9,6 +9,15 @@ #define IGL_GET_SECONDS_H #include "igl_inline.h" +#define IGL_TICTOC_LAMBDA \ + const auto & tictoc = []() \ + { \ + static double t_start = igl::get_seconds(); \ + double diff = igl::get_seconds()-t_start; \ + t_start += diff; \ + return diff; \ + }; + namespace igl { /// Current time in seconds diff --git a/include/igl/get_seconds_hires.cpp b/include/igl/get_seconds_hires.cpp deleted file mode 100644 index 15f26dc9e..000000000 --- a/include/igl/get_seconds_hires.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#include "get_seconds_hires.h" - -#if _WIN32 -# include -# include -IGL_INLINE double igl::get_seconds_hires() -{ - LARGE_INTEGER li_freq, li_current; - const bool ret = QueryPerformanceFrequency(&li_freq); - const bool ret2 = QueryPerformanceCounter(&li_current); - assert(ret && ret2); - assert(li_freq.QuadPart > 0); - return double(li_current.QuadPart) / double(li_freq.QuadPart); -} -#else -# include "get_seconds.h" -IGL_INLINE double igl::get_seconds_hires() -{ - // Sorry I've no idea how performance counters work on Mac... - return igl::get_seconds(); -} -#endif diff --git a/include/igl/get_seconds_hires.h b/include/igl/get_seconds_hires.h deleted file mode 100644 index ee405b8a0..000000000 --- a/include/igl/get_seconds_hires.h +++ /dev/null @@ -1,26 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_GET_SECONDS_HIRES_H -#define IGL_GET_SECONDS_HIRES_H -#include "igl_inline.h" - -namespace igl -{ - /// Current time in seconds - /// - /// @return the current time in seconds using performance counters - /// - /// \deprecated just use get_seconds instead - IGL_INLINE double get_seconds_hires(); -} - -#ifndef IGL_STATIC_LIBRARY -# include "get_seconds_hires.cpp" -#endif - -#endif diff --git a/include/igl/harmonic.cpp b/include/igl/harmonic.cpp index 139ae7fd8..761f2c08d 100644 --- a/include/igl/harmonic.cpp +++ b/include/igl/harmonic.cpp @@ -8,7 +8,6 @@ #include "harmonic.h" #include "adjacency_matrix.h" #include "cotmatrix.h" -#include "diag.h" #include "invert_diag.h" #include "isdiag.h" #include "massmatrix.h" @@ -59,12 +58,11 @@ IGL_INLINE bool igl::harmonic( SparseMatrix A; adjacency_matrix(F,A); // sum each row - SparseVector Asum; - sum(A,1,Asum); - // Convert row sums into diagonal of sparse matrix - SparseMatrix Adiag; - diag(Asum,Adiag); - SparseMatrix L = A-Adiag; + Eigen::VectorXd Asum; + igl::sum(A,1,Asum); + // Eigen 3.4 still struggles to do arithmetic with sparse and diagonal matrices + Eigen::SparseMatrix L = A - Eigen::SparseMatrix(Asum.asDiagonal()); + SparseMatrix M; speye(L.rows(),M); return harmonic(L,M,b,bc,k,W); diff --git a/include/igl/internal_angles.h b/include/igl/internal_angles.h index 48c83c5be..14a824b8d 100644 --- a/include/igl/internal_angles.h +++ b/include/igl/internal_angles.h @@ -8,7 +8,6 @@ #ifndef IGL_INTERNAL_ANGLES_H #define IGL_INTERNAL_ANGLES_H #include "igl_inline.h" -#include "deprecated.h" #include namespace igl { diff --git a/include/igl/is_border_vertex.h b/include/igl/is_border_vertex.h index b31aa9896..bb5ce9525 100644 --- a/include/igl/is_border_vertex.h +++ b/include/igl/is_border_vertex.h @@ -8,7 +8,6 @@ #ifndef IGL_IS_BORDER_VERTEX_H #define IGL_IS_BORDER_VERTEX_H #include "igl_inline.h" -#include "deprecated.h" #include #include diff --git a/include/igl/kelvinlets.h b/include/igl/kelvinlets.h index 8c8c9d8e1..3fe4d6299 100644 --- a/include/igl/kelvinlets.h +++ b/include/igl/kelvinlets.h @@ -3,7 +3,7 @@ #include #include -#include +#include "igl_inline.h" namespace igl { diff --git a/include/igl/line_field_mismatch.cpp b/include/igl/line_field_mismatch.cpp index 27a2dd2e6..26118d2d2 100644 --- a/include/igl/line_field_mismatch.cpp +++ b/include/igl/line_field_mismatch.cpp @@ -10,17 +10,17 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "comb_line_field.h" +#include "rotate_vectors.h" +#include "comb_cross_field.h" +#include "comb_line_field.h" +#include "per_face_normals.h" +#include "is_border_vertex.h" +#include "vertex_triangle_adjacency.h" +#include "triangle_triangle_adjacency.h" +#include "rotation_matrix_from_directions.h" +#include "local_basis.h" +#include "PI.h" namespace igl { template diff --git a/include/igl/loop.cpp b/include/igl/loop.cpp index e353e4643..9d5136f61 100644 --- a/include/igl/loop.cpp +++ b/include/igl/loop.cpp @@ -8,9 +8,9 @@ #include "loop.h" -#include -#include -#include +#include "adjacency_list.h" +#include "triangle_triangle_adjacency.h" +#include "unique.h" #include diff --git a/include/igl/loop.h b/include/igl/loop.h index d335225a8..5a0124061 100644 --- a/include/igl/loop.h +++ b/include/igl/loop.h @@ -9,7 +9,7 @@ #ifndef IGL_LOOP_H #define IGL_LOOP_H -#include +#include "igl_inline.h" #include #include diff --git a/include/igl/massmatrix.cpp b/include/igl/massmatrix.cpp index dec665700..a91d1128e 100644 --- a/include/igl/massmatrix.cpp +++ b/include/igl/massmatrix.cpp @@ -8,7 +8,6 @@ #include "massmatrix.h" #include "massmatrix_intrinsic.h" #include "edge_lengths.h" -#include "normalize_row_sums.h" #include "sparse.h" #include "doublearea.h" #include "volume.h" diff --git a/include/igl/massmatrix_intrinsic.cpp b/include/igl/massmatrix_intrinsic.cpp index 49debcda1..60cc8ee92 100644 --- a/include/igl/massmatrix_intrinsic.cpp +++ b/include/igl/massmatrix_intrinsic.cpp @@ -7,7 +7,6 @@ // obtain one at http://mozilla.org/MPL/2.0/. #include "massmatrix_intrinsic.h" #include "edge_lengths.h" -#include "normalize_row_sums.h" #include "sparse.h" #include "doublearea.h" #include "repmat.h" @@ -82,7 +81,9 @@ IGL_INLINE void igl::massmatrix_intrinsic( cosines.col(2) = (l.col(1).array().pow(2)+l.col(0).array().pow(2)-l.col(2).array().pow(2))/(l.col(0).array()*l.col(1).array()*2.0); Matrix barycentric = cosines.array() * l.array(); - normalize_row_sums(barycentric,barycentric); + // Replace this: normalize_row_sums(barycentric,barycentric); + barycentric = (barycentric.array().colwise() / barycentric.array().rowwise().sum()).eval(); + Matrix partial = barycentric; partial.col(0).array() *= dblA.array() * 0.5; partial.col(1).array() *= dblA.array() * 0.5; diff --git a/include/igl/mat_max.cpp b/include/igl/mat_max.cpp deleted file mode 100644 index c5da97569..000000000 --- a/include/igl/mat_max.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#include "mat_max.h" - -template -IGL_INLINE void igl::mat_max( - const Eigen::DenseBase & X, - const int dim, - Eigen::PlainObjectBase & Y, - Eigen::PlainObjectBase & I) -{ - assert(dim==1||dim==2); - - // output size - int n = (dim==1?X.cols():X.rows()); - // resize output - Y.resize(n); - I.resize(n); - - // loop over dimension opposite of dim - for(int j = 0;j, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); -#endif diff --git a/include/igl/mat_max.h b/include/igl/mat_max.h deleted file mode 100644 index 7214b348d..000000000 --- a/include/igl/mat_max.h +++ /dev/null @@ -1,44 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_MAT_MAX_H -#define IGL_MAT_MAX_H -#include "igl_inline.h" -#include - -namespace igl -{ - /// Max function for matrices to act like matlab's max function. Specifically - /// like [Y,I] = max(X,[],dim); - /// - /// @tparam T should be a eigen matrix primitive type like int or double - /// @param[in] X m by n matrix - /// @param[in] dim dimension along which to take max - /// @param[out] Y n-long vector (if dim == 1), or - /// m-long vector (if dim == 2) - /// @param[out] I vector the same size as Y containing the indices along dim - /// of maximum entries - /// - /// Compare to: - /// - /// X.colwise().maxCoeff() - /// X.rowwise().maxCoeff() - /// - /// \see mat_min - template - IGL_INLINE void mat_max( - const Eigen::DenseBase & X, - const int dim, - Eigen::PlainObjectBase & Y, - Eigen::PlainObjectBase & I); -} - -#ifndef IGL_STATIC_LIBRARY -# include "mat_max.cpp" -#endif - -#endif diff --git a/include/igl/mat_min.cpp b/include/igl/mat_min.cpp deleted file mode 100644 index c34e993fe..000000000 --- a/include/igl/mat_min.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#include "mat_min.h" - -template -IGL_INLINE void igl::mat_min( - const Eigen::DenseBase & X, - const int dim, - Eigen::PlainObjectBase & Y, - Eigen::PlainObjectBase & I) -{ - assert(dim==1||dim==2); - - // output size - int n = (dim==1?X.cols():X.rows()); - // resize output - Y.resize(n,1); - I.resize(n,1); - - // loop over dimension opposite of dim - for(int j = 0;j -//IGL_INLINE Eigen::Matrix igl::mat_min( -// const Eigen::Matrix & X, -// const int dim) -//{ -// Eigen::Matrix Y; -// Eigen::Matrix I; -// mat_min(X,dim,Y,I); -// return Y; -//} - -#ifdef IGL_STATIC_LIBRARY -// Explicit template instantiation -// generated by autoexplicit.sh -template void igl::mat_min, Eigen::Array, Eigen::Matrix >(Eigen::DenseBase > const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); -// generated by autoexplicit.sh -template void igl::mat_min, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); -#endif diff --git a/include/igl/mat_min.h b/include/igl/mat_min.h deleted file mode 100644 index 33d09e7cc..000000000 --- a/include/igl/mat_min.h +++ /dev/null @@ -1,44 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_MAT_MIN_H -#define IGL_MAT_MIN_H -#include "igl_inline.h" -#include - -namespace igl -{ - /// Min function for matrices to act like matlab's min function. Specifically - /// like [Y,I] = min(X,[],dim); - /// - /// @tparam T should be a eigen matrix primitive type like int or double - /// @param[in] X m by n matrix - /// @param[in] dim dimension along which to take min - /// @param[out] Y n-long vector (if dim == 1), or - /// m-long vector (if dim == 2) - /// @param[out] I vector the same size as Y containing the indices along dim - /// of minimum entries - /// - /// Compare to: - /// - /// X.colwise().minCoeff() - /// X.rowwise().minCoeff() - /// - /// \see mat_max - template - IGL_INLINE void mat_min( - const Eigen::DenseBase & X, - const int dim, - Eigen::PlainObjectBase & Y, - Eigen::PlainObjectBase & I); -} - -#ifndef IGL_STATIC_LIBRARY -# include "mat_min.cpp" -#endif - -#endif diff --git a/include/igl/matlab/matlabinterface.cpp b/include/igl/matlab/matlabinterface.cpp index 6c03485de..960a0a140 100644 --- a/include/igl/matlab/matlabinterface.cpp +++ b/include/igl/matlab/matlabinterface.cpp @@ -5,7 +5,7 @@ // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#include +#include "matlabinterface.h" // Implementation diff --git a/include/igl/matlab/parse_rhs.h b/include/igl/matlab/parse_rhs.h index d700297dd..876611d26 100644 --- a/include/igl/matlab/parse_rhs.h +++ b/include/igl/matlab/parse_rhs.h @@ -7,7 +7,7 @@ // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_MATLAB_PARSE_RHS_H #define IGL_MATLAB_PARSE_RHS_H -#include +#include "../igl_inline.h" #include #include #include diff --git a/include/igl/matlab/prepare_lhs.h b/include/igl/matlab/prepare_lhs.h index eeeaf0e3c..9781b853c 100644 --- a/include/igl/matlab/prepare_lhs.h +++ b/include/igl/matlab/prepare_lhs.h @@ -7,7 +7,7 @@ // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_MATLAB_PREPARE_LHS_H #define IGL_MATLAB_PREPARE_LHS_H -#include +#include "../igl_inline.h" #include #include #include diff --git a/include/igl/max.cpp b/include/igl/max.cpp index e451c3b15..d53a786eb 100644 --- a/include/igl/max.cpp +++ b/include/igl/max.cpp @@ -39,8 +39,40 @@ IGL_INLINE void igl::max( } } +template +IGL_INLINE void igl::max( + const Eigen::DenseBase & X, + const int dim, + Eigen::PlainObjectBase & Y, + Eigen::PlainObjectBase & I) +{ + assert(dim==1||dim==2); + + // output size + int n = (dim==1?X.cols():X.rows()); + // resize output + Y.resize(n); + I.resize(n); + + // loop over dimension opposite of dim + for(int j = 0;j, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::max, Eigen::Matrix >(Eigen::SparseMatrix const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif diff --git a/include/igl/max.h b/include/igl/max.h index 39e1be92a..47553d69d 100644 --- a/include/igl/max.h +++ b/include/igl/max.h @@ -5,20 +5,29 @@ #include namespace igl { + /// Compute the maximum along dimension dim of a matrix X + /// /// \param[in] X m by n matrix /// \param[in] dim dimension along which to take max - /// \param[out] Y n-long vector (if dim == 1) - /// or + /// @param[out] Y + /// n-long vector (if dim == 1) /// Y m-long vector (if dim == 2) - /// I vector the same size as Y containing the indices along dim of maximum + /// @param[out] I vector the same size as Y containing the indices along dim of minimum /// entries - /// \deprecated seems like a duplicate of mat_max + /// template IGL_INLINE void max( const Eigen::SparseMatrix & A, const int dim, Eigen::PlainObjectBase & B, Eigen::PlainObjectBase & I); + /// \overload + template + IGL_INLINE void max( + const Eigen::DenseBase & X, + const int dim, + Eigen::PlainObjectBase & Y, + Eigen::PlainObjectBase & I); } #ifndef IGL_STATIC_LIBRARY # include "max.cpp" diff --git a/include/igl/min.cpp b/include/igl/min.cpp index ce8ba328e..69ce670d5 100644 --- a/include/igl/min.cpp +++ b/include/igl/min.cpp @@ -39,3 +39,40 @@ IGL_INLINE void igl::min( } } +template +IGL_INLINE void igl::min( + const Eigen::DenseBase & X, + const int dim, + Eigen::PlainObjectBase & Y, + Eigen::PlainObjectBase & I) +{ + assert(dim==1||dim==2); + + // output size + int n = (dim==1?X.cols():X.rows()); + // resize output + Y.resize(n,1); + I.resize(n,1); + + // loop over dimension opposite of dim + for(int j = 0;j, Eigen::Array, Eigen::Matrix >(Eigen::DenseBase > const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +template void igl::min, Eigen::Matrix, Eigen::Matrix >(Eigen::DenseBase > const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); +#endif diff --git a/include/igl/min.h b/include/igl/min.h index c8037b7ed..f9eda4a41 100644 --- a/include/igl/min.h +++ b/include/igl/min.h @@ -5,21 +5,28 @@ #include namespace igl { + /// Compute the minimum along dimension dim of a matrix X + /// /// @param[in] X m by n matrix /// @param[in] dim dimension along which to take min /// @param[out] Y - /// Y n-long vector (if dim == 1) - /// or + /// n-long vector (if dim == 1) /// Y m-long vector (if dim == 2) - /// I vector the same size as Y containing the indices along dim of minimum + /// @param[out] I vector the same size as Y containing the indices along dim of minimum /// entries - /// \deprecated seems like a duplicate of mat_min template IGL_INLINE void min( const Eigen::SparseMatrix & A, const int dim, Eigen::PlainObjectBase & B, Eigen::PlainObjectBase & I); + /// \overload + template + IGL_INLINE void min( + const Eigen::DenseBase & X, + const int dim, + Eigen::PlainObjectBase & Y, + Eigen::PlainObjectBase & I); } #ifndef IGL_STATIC_LIBRARY # include "min.cpp" diff --git a/include/igl/min_quad_with_fixed.impl.h b/include/igl/min_quad_with_fixed.impl.h index b5632723b..cf6a1b07f 100644 --- a/include/igl/min_quad_with_fixed.impl.h +++ b/include/igl/min_quad_with_fixed.impl.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include "matlab_format.h" #include template diff --git a/include/igl/normalize_row_lengths.cpp b/include/igl/normalize_row_lengths.cpp deleted file mode 100644 index 3d7e566e8..000000000 --- a/include/igl/normalize_row_lengths.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#include "normalize_row_lengths.h" - -template -IGL_INLINE void igl::normalize_row_lengths( - const Eigen::PlainObjectBase& A, - Eigen::PlainObjectBase & B) -{ - // Resize output - B.resizeLike(A); - - // loop over rows - for(int i = 0; i < A.rows();i++) - { - B.row(i) = A.row(i).normalized(); - } - //// Or just: - //B = A; - //B.rowwise().normalize(); -} -#ifdef IGL_STATIC_LIBRARY -// Explicit template instantiation -// generated by autoexplicit.sh -template void igl::normalize_row_lengths >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); -template void igl::normalize_row_lengths >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); -template void igl::normalize_row_lengths >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); -#endif diff --git a/include/igl/normalize_row_lengths.h b/include/igl/normalize_row_lengths.h deleted file mode 100644 index 4cf7f8ff3..000000000 --- a/include/igl/normalize_row_lengths.h +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_NORMALIZE_ROW_LENGTHS_H -#define IGL_NORMALIZE_ROW_LENGTHS_H -#include "igl_inline.h" -#include - -// History: -// March 24, 2012: Alec changed function name from normalize_rows to -// normalize_row_lengths to avoid confusion with normalize_row_sums - -namespace igl -{ - /// \deprecated just use A.rowwise().normalize() or B=A.rowwise().normalized(); - /// - /// Normalize the rows in A so that their lengths are each 1 and place the new - /// entries in B - /// - /// @param[in] A #rows by k input matrix - /// @param[out] B #rows by k input matrix, can be the same as A - template - IGL_INLINE void normalize_row_lengths( - const Eigen::PlainObjectBase& A, - Eigen::PlainObjectBase & B); -} - -#ifndef IGL_STATIC_LIBRARY -# include "normalize_row_lengths.cpp" -#endif - -#endif diff --git a/include/igl/normalize_row_sums.cpp b/include/igl/normalize_row_sums.cpp deleted file mode 100644 index 1204e073d..000000000 --- a/include/igl/normalize_row_sums.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#include "normalize_row_sums.h" - -template -IGL_INLINE void igl::normalize_row_sums( - const Eigen::MatrixBase& A, - Eigen::MatrixBase & B) -{ -#ifndef NDEBUG - // loop over rows - for(int i = 0; i < A.rows();i++) - { - typename DerivedB::Scalar sum = A.row(i).sum(); - assert(sum != 0); - } -#endif - B = (A.array().colwise() / A.rowwise().sum().array()).eval(); -} -#ifdef IGL_STATIC_LIBRARY -// Explicit template instantiation -template void igl::normalize_row_sums, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase >&); -template void igl::normalize_row_sums, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::MatrixBase >&); -#endif diff --git a/include/igl/normalize_row_sums.h b/include/igl/normalize_row_sums.h deleted file mode 100644 index 0e264b596..000000000 --- a/include/igl/normalize_row_sums.h +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_NORMALIZE_ROW_SUMS_H -#define IGL_NORMALIZE_ROW_SUMS_H -#include "igl_inline.h" -#include - -namespace igl -{ - /// Normalize the rows in A so that their sums are each 1 and place the new - /// entries in B - /// - /// @param[in] A #rows by k input matrix - /// @param[out] B #rows by k input matrix, can be the same as A - /// - /// \deprecated This is just calling an Eigen one-liner: - /// - /// B = A.array().colwise() / A.array().rowwise().sum(); - /// - template - IGL_INLINE void normalize_row_sums( - const Eigen::MatrixBase& A, - Eigen::MatrixBase & B); -} - -#ifndef IGL_STATIC_LIBRARY -# include "normalize_row_sums.cpp" -#endif - -#endif diff --git a/include/igl/opengl/MeshGL.h b/include/igl/opengl/MeshGL.h index 34e02bf8c..d2ac9c554 100644 --- a/include/igl/opengl/MeshGL.h +++ b/include/igl/opengl/MeshGL.h @@ -9,7 +9,7 @@ #define IGL_OPENGL_MESHGL_H -#include +#include "../igl_inline.h" #include namespace igl diff --git a/include/igl/opengl/ViewerCore.h b/include/igl/opengl/ViewerCore.h index cd8c6c186..ee9e70975 100644 --- a/include/igl/opengl/ViewerCore.h +++ b/include/igl/opengl/ViewerCore.h @@ -8,9 +8,9 @@ #ifndef IGL_OPENGL_VIEWERCORE_H #define IGL_OPENGL_VIEWERCORE_H -#include +#include "MeshGL.h" -#include +#include "../igl_inline.h" #include #include @@ -237,7 +237,7 @@ public: } } -#include +#include "../serialize.h" namespace igl { namespace serialization { diff --git a/include/igl/opengl/ViewerData.h b/include/igl/opengl/ViewerData.h index e645f1072..d39a8cdcd 100644 --- a/include/igl/opengl/ViewerData.h +++ b/include/igl/opengl/ViewerData.h @@ -9,8 +9,8 @@ #define IGL_VIEWERDATA_H #include "MeshGL.h" -#include -#include +#include "../igl_inline.h" +#include "../colormap.h" #include #include #include @@ -363,7 +363,7 @@ public: //////////////////////////////////////////////////////////////////////////////// -#include +#include "../serialize.h" namespace igl { namespace serialization diff --git a/include/igl/opengl/glfw/Viewer.cpp b/include/igl/opengl/glfw/Viewer.cpp index 34ae6154a..0881ee95a 100644 --- a/include/igl/opengl/glfw/Viewer.cpp +++ b/include/igl/opengl/glfw/Viewer.cpp @@ -27,23 +27,23 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "../../project.h" +#include "../../get_seconds.h" +#include "../../readOBJ.h" +#include "../../read_triangle_mesh.h" +#include "../../adjacency_list.h" +#include "../../writeOBJ.h" +#include "../../writeOFF.h" +#include "../../massmatrix.h" +#include "../../file_dialog_open.h" +#include "../../file_dialog_save.h" +#include "../../quat_mult.h" +#include "../../axis_angle_to_quat.h" +#include "../../trackball.h" +#include "../../two_axis_valuator_fixed_up.h" +#include "../../snap_to_canonical_view_quat.h" +#include "../../unproject.h" +#include "../../serialize.h" // Internal global variables used for glfw event handling static igl::opengl::glfw::Viewer * __viewer; diff --git a/include/igl/opengl/glfw/ViewerPlugin.h b/include/igl/opengl/glfw/ViewerPlugin.h index c7e5f1ffb..8b9a1187f 100644 --- a/include/igl/opengl/glfw/ViewerPlugin.h +++ b/include/igl/opengl/glfw/ViewerPlugin.h @@ -14,7 +14,7 @@ // * remove Preview3D from comments // * clean comments #include -#include +#include "../../igl_inline.h" #include namespace igl diff --git a/include/igl/opengl/glfw/imgui/ImGuiPlugin.cpp b/include/igl/opengl/glfw/imgui/ImGuiPlugin.cpp index 25ad27cad..ce5ac08d7 100644 --- a/include/igl/opengl/glfw/imgui/ImGuiPlugin.cpp +++ b/include/igl/opengl/glfw/imgui/ImGuiPlugin.cpp @@ -9,7 +9,7 @@ //////////////////////////////////////////////////////////////////////////////// #include "ImGuiPlugin.h" #include "ImGuiHelpers.h" -#include +#include "../../../project.h" #include #include #include diff --git a/include/igl/opengl/verasansmono_compressed.h b/include/igl/opengl/verasansmono_compressed.h index 300187df6..9b917e291 100644 --- a/include/igl/opengl/verasansmono_compressed.h +++ b/include/igl/opengl/verasansmono_compressed.h @@ -1,7 +1,7 @@ #ifndef IGL_OPENGL_VERASANSMONO_COMPRESSED_H #define IGL_OPENGL_VERASANSMONO_COMPRESSED_H -#include +#include "../igl_inline.h" namespace igl { diff --git a/include/igl/opengl/vertex_array.cpp b/include/igl/opengl/vertex_array.cpp index c07113ad3..23e1e3117 100644 --- a/include/igl/opengl/vertex_array.cpp +++ b/include/igl/opengl/vertex_array.cpp @@ -1,5 +1,5 @@ #include "vertex_array.h" -#include +#include "report_gl_error.h" template < typename DerivedV, diff --git a/include/igl/opengl/vertex_array.h b/include/igl/opengl/vertex_array.h index 15b5c786d..24fa36738 100644 --- a/include/igl/opengl/vertex_array.h +++ b/include/igl/opengl/vertex_array.h @@ -1,7 +1,7 @@ #ifndef IGL_OPENGL_VERTEX_ARRAY_H #define IGL_OPENGL_VERTEX_ARRAY_H -#include -#include +#include "../igl_inline.h" +#include "gl.h" #include namespace igl { diff --git a/include/igl/orientable_patches.h b/include/igl/orientable_patches.h index 90be11656..f5fcca909 100644 --- a/include/igl/orientable_patches.h +++ b/include/igl/orientable_patches.h @@ -7,7 +7,7 @@ // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_ORIENTABLE_PATCHES_H #define IGL_ORIENTABLE_PATCHES_H -#include +#include "igl_inline.h" #include #include namespace igl diff --git a/include/igl/parallel_transport_angles.cpp b/include/igl/parallel_transport_angles.cpp index 0e3803df2..f73d8d3ea 100644 --- a/include/igl/parallel_transport_angles.cpp +++ b/include/igl/parallel_transport_angles.cpp @@ -5,7 +5,7 @@ // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#include +#include "parallel_transport_angles.h" #include template diff --git a/include/igl/partition.cpp b/include/igl/partition.cpp index d2ef34c94..ef526b774 100644 --- a/include/igl/partition.cpp +++ b/include/igl/partition.cpp @@ -6,7 +6,7 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "partition.h" -#include "mat_min.h" +#include "min.h" IGL_INLINE void igl::partition( const Eigen::MatrixXd & W, @@ -51,7 +51,7 @@ IGL_INLINE void igl::partition( // get minimum of old D and distance to this seed, C == 1 if new distance // was smaller Eigen::Matrix C; - igl::mat_min(DDs,2,D,C); + igl::min(DDs,2,D,C); G = (C.array() ==0).select(G,i); } diff --git a/include/igl/pinv.h b/include/igl/pinv.h index 2d75e90a4..350e8d3cd 100644 --- a/include/igl/pinv.h +++ b/include/igl/pinv.h @@ -1,7 +1,6 @@ #ifndef IGL_PINV_H #define IGL_PINV_H #include "igl_inline.h" -#include "deprecated.h" #include namespace igl { @@ -15,13 +14,13 @@ namespace igl /// \deprecated Use `Eigen::CompleteOrthogonalDecomposition` /// `.solve()` or `.pseudoinverse()` instead. template - IGL_DEPRECATED void pinv( + void pinv( const Eigen::MatrixBase & A, typename DerivedA::Scalar tol, Eigen::PlainObjectBase & X); /// \overload template - IGL_DEPRECATED void pinv( + void pinv( const Eigen::MatrixBase & A, Eigen::PlainObjectBase & X); } diff --git a/include/igl/png/render_to_png.h b/include/igl/png/render_to_png.h index f5d868377..25dfb97c5 100644 --- a/include/igl/png/render_to_png.h +++ b/include/igl/png/render_to_png.h @@ -7,7 +7,7 @@ // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_PNG_RENDER_TO_PNG_H #define IGL_PNG_RENDER_TO_PNG_H -#include +#include "../igl_inline.h" #include namespace igl diff --git a/include/igl/png/render_to_png_async.h b/include/igl/png/render_to_png_async.h index 69cc34eb4..78ed5ccaa 100644 --- a/include/igl/png/render_to_png_async.h +++ b/include/igl/png/render_to_png_async.h @@ -7,7 +7,7 @@ // obtain one at http://mozilla.org/MPL/2.0/. #ifndef IGL_PNG_RENDER_TO_PNG_ASYNC_H #define IGL_PNG_RENDER_TO_PNG_ASYNC_H -#include +#include "../igl_inline.h" #include //#include diff --git a/include/igl/png/texture_from_png.cpp b/include/igl/png/texture_from_png.cpp index 280e42aaa..dbbcef445 100644 --- a/include/igl/png/texture_from_png.cpp +++ b/include/igl/png/texture_from_png.cpp @@ -46,38 +46,3 @@ IGL_INLINE bool igl::png::texture_from_png(const std::string png_file, GLuint & } -IGL_INLINE bool igl::png::texture_from_png( - const std::string png_file, - Eigen::Matrix& R, - Eigen::Matrix& G, - Eigen::Matrix& B, - Eigen::Matrix& A -) -{ - int width,height,n; - unsigned char *data = stbi_load(png_file.c_str(), &width, &height, &n, 4); - if(data == NULL) { - return false; - } - - R.resize(height,width); - G.resize(height,width); - B.resize(height,width); - A.resize(height,width); - - for (unsigned j=0; j& R, - Eigen::Matrix& G, - Eigen::Matrix& B, - Eigen::Matrix& A - ); } } diff --git a/include/igl/predicates/ear_clipping.cpp b/include/igl/predicates/ear_clipping.cpp index fc3cd1b79..a029277e7 100644 --- a/include/igl/predicates/ear_clipping.cpp +++ b/include/igl/predicates/ear_clipping.cpp @@ -6,7 +6,7 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#include +#include "../slice.h" #include "ear_clipping.h" #include "point_inside_convex_polygon.h" #include "predicates.h" diff --git a/include/igl/predicates/predicates.cpp b/include/igl/predicates/predicates.cpp index ca38d76bd..4576f49ab 100644 --- a/include/igl/predicates/predicates.cpp +++ b/include/igl/predicates/predicates.cpp @@ -5,7 +5,8 @@ // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#include +#include "./predicates.h" +// This is a different file also called predicates.h #include #include diff --git a/include/igl/predicates/predicates.h b/include/igl/predicates/predicates.h index 3df16b614..f27e0762e 100644 --- a/include/igl/predicates/predicates.h +++ b/include/igl/predicates/predicates.h @@ -9,7 +9,7 @@ #ifndef IGL_PREDICATES_PREDICATES_H #define IGL_PREDICATES_PREDICATES_H -#include +#include "../igl_inline.h" #include namespace igl { diff --git a/include/igl/predicates/segment_segment_intersect.h b/include/igl/predicates/segment_segment_intersect.h index 48f0e6162..8cc1ad62f 100644 --- a/include/igl/predicates/segment_segment_intersect.h +++ b/include/igl/predicates/segment_segment_intersect.h @@ -9,9 +9,9 @@ #ifndef IGL_PREDICATES_SEGMENT_SEGMENT_INTERSECT_H #define IGL_PREDICATES_SEGMENT_SEGMENT_INTERSECT_H -#include -#include +#include "../igl_inline.h" #include "predicates.h" +#include namespace igl { namespace predicates diff --git a/include/igl/principal_curvature.cpp b/include/igl/principal_curvature.cpp index ab874b2db..c71bfc3fd 100644 --- a/include/igl/principal_curvature.cpp +++ b/include/igl/principal_curvature.cpp @@ -18,11 +18,11 @@ #include // Lib IGL includes -#include -#include -#include -#include -#include +#include "adjacency_list.h" +#include "per_face_normals.h" +#include "per_vertex_normals.h" +#include "avg_edge_length.h" +#include "vertex_triangle_adjacency.h" typedef enum { diff --git a/include/igl/principal_curvature.h b/include/igl/principal_curvature.h index 640d3fd1b..e2d981c6e 100644 --- a/include/igl/principal_curvature.h +++ b/include/igl/principal_curvature.h @@ -15,8 +15,6 @@ #include #include "igl_inline.h" -//#include -//#include diff --git a/include/igl/pso.h b/include/igl/pso.h index 8f252c88f..6113373c3 100644 --- a/include/igl/pso.h +++ b/include/igl/pso.h @@ -1,6 +1,6 @@ #ifndef IGL_PSO_H #define IGL_PSO_H -#include +#include "igl_inline.h" #include #include diff --git a/include/igl/quad_grid.h b/include/igl/quad_grid.h index b0a054418..e03e09b7e 100644 --- a/include/igl/quad_grid.h +++ b/include/igl/quad_grid.h @@ -8,7 +8,7 @@ #ifndef IGL_QUAD_GRID_H #define IGL_QUAD_GRID_H -#include +#include "igl_inline.h" #include namespace igl diff --git a/include/igl/random_dir.cpp b/include/igl/random_dir.cpp index f30783418..76a3fac4a 100644 --- a/include/igl/random_dir.cpp +++ b/include/igl/random_dir.cpp @@ -6,7 +6,7 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "random_dir.h" -#include +#include "PI.h" #include IGL_INLINE Eigen::Vector3d igl::random_dir() diff --git a/include/igl/readPLY.h b/include/igl/readPLY.h index 135ca3395..affb22049 100644 --- a/include/igl/readPLY.h +++ b/include/igl/readPLY.h @@ -1,6 +1,6 @@ #ifndef IGL_READPLY_H #define IGL_READPLY_H -#include +#include "igl_inline.h" #include #include #include diff --git a/include/igl/reorder.cpp b/include/igl/reorder.cpp deleted file mode 100644 index c3dd9ba79..000000000 --- a/include/igl/reorder.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#include "reorder.h" -#include "SortableRow.h" -#ifndef IGL_NO_EIGEN -#include -#endif - -// This implementation is O(n), but also uses O(n) extra memory -template< class T > -IGL_INLINE void igl::reorder( - const std::vector & unordered, - std::vector const & index_map, - std::vector & ordered) -{ - // copy for the reorder according to index_map, because unsorted may also be - // sorted - std::vector copy = unordered; - ordered.resize(index_map.size()); - for(int i = 0; i<(int)index_map.size();i++) - { - ordered[i] = copy[index_map[i]]; - } -} - -#ifdef IGL_STATIC_LIBRARY -// Explicit template instantiation -// generated by autoexplicit.sh -template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); -// generated by autoexplicit.sh -template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); -template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); -template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); -# ifndef IGL_NO_EIGEN - template void igl::reorder > >(std::vector >, std::allocator > > > const&, std::vector > const&, std::vector >, std::allocator > > >&); - template void igl::reorder > >(std::vector >, std::allocator > > > const&, std::vector > const&, std::vector >, std::allocator > > >&); -# endif -template void igl::reorder(std::vector > const&, std::vector > const&, std::vector >&); -#ifdef WIN32 -template void igl::reorder(class std::vector > const &,class std::vector > const &,class std::vector > &); -template void igl::reorder(class std::vector > const &,class std::vector > const &,class std::vector > &); -template void igl::reorder<__int64>(class std::vector<__int64,class std::allocator<__int64> > const &,class std::vector > const &,class std::vector<__int64,class std::allocator<__int64> > &); -#endif -#endif diff --git a/include/igl/reorder.h b/include/igl/reorder.h deleted file mode 100644 index dce5aaf35..000000000 --- a/include/igl/reorder.h +++ /dev/null @@ -1,41 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_REORDER_H -#define IGL_REORDER_H -#include "igl_inline.h" -#include -// For size_t -#include -#include - -namespace igl -{ - /// Act like matlab's Y = X(I) for std vectors - /// where I contains a vector of indices so that after, - /// Y[j] = X[I[j]] for index j - /// this implies that Y.size() == I.size() - /// X and Y are allowed to be the same reference - /// - /// @param[in] X list of elements - /// @param[in] I list of indices - /// @param[out] Y list of elements in X reordered by I - /// - /// \deprecated This is the same as slice but for std::vectors. Used only by - /// igl::sort internally. - template< class T > - IGL_INLINE void reorder( - const std::vector & X, - std::vector const & I, - std::vector & Y); -} - -#ifndef IGL_STATIC_LIBRARY -# include "reorder.cpp" -#endif - -#endif diff --git a/include/igl/screen_space_selection.cpp b/include/igl/screen_space_selection.cpp index 819ddfb92..cd9094b00 100644 --- a/include/igl/screen_space_selection.cpp +++ b/include/igl/screen_space_selection.cpp @@ -1,11 +1,11 @@ #include "screen_space_selection.h" -#include -#include -#include -#include -#include -#include +#include "AABB.h" +#include "winding_number.h" +#include "project.h" +#include "unproject.h" +#include "Hit.h" +#include "parallel_for.h" template < typename DerivedV, diff --git a/include/igl/shapeup.cpp b/include/igl/shapeup.cpp index f352d22bf..9b4644094 100644 --- a/include/igl/shapeup.cpp +++ b/include/igl/shapeup.cpp @@ -6,12 +6,12 @@ // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#include -#include -#include -#include -#include -#include +#include "shapeup.h" +#include "min_quad_with_fixed.h" +#include "igl_inline.h" +#include "setdiff.h" +#include "cat.h" +#include "PI.h" #include #include diff --git a/include/igl/shapeup.h b/include/igl/shapeup.h index 7f3c3b33c..ab4bebda7 100644 --- a/include/igl/shapeup.h +++ b/include/igl/shapeup.h @@ -8,13 +8,13 @@ #ifndef IGL_SHAPEUP_H #define IGL_SHAPEUP_H -#include -#include -#include -#include +#include "min_quad_with_fixed.h" +#include "igl_inline.h" +#include "setdiff.h" +#include "cat.h" #include #include -#include +#include "PI.h" //This file implements the following algorithm: diff --git a/include/igl/sharp_edges.cpp b/include/igl/sharp_edges.cpp index 8f1c053f7..698fea507 100644 --- a/include/igl/sharp_edges.cpp +++ b/include/igl/sharp_edges.cpp @@ -1,7 +1,7 @@ #include "sharp_edges.h" -#include -#include -#include +#include "unique_edge_map.h" +#include "per_face_normals.h" +#include "PI.h" #include template < diff --git a/include/igl/sharp_edges.h b/include/igl/sharp_edges.h index a66436569..1fa769aa3 100644 --- a/include/igl/sharp_edges.h +++ b/include/igl/sharp_edges.h @@ -1,7 +1,7 @@ #ifndef IGL_SHARP_EDGES_H #define IGL_SHARP_EDGES_H -#include +#include "igl_inline.h" #include #include diff --git a/include/igl/slice.cpp b/include/igl/slice.cpp index dd3d00ef2..f773d1a77 100644 --- a/include/igl/slice.cpp +++ b/include/igl/slice.cpp @@ -186,6 +186,23 @@ IGL_INLINE DerivedX igl::slice( return Y; } +template< class T > +IGL_INLINE void igl::slice( + const std::vector & unordered, + std::vector const & index_map, + std::vector & ordered) +{ + // copy for the slice according to index_map, because unordered may also be + // ordered + std::vector copy = unordered; + ordered.resize(index_map.size()); + for(int i = 0; i<(int)index_map.size();i++) + { + ordered[i] = copy[index_map[i]]; + } +} + + #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation template Eigen::Matrix igl::slice, Eigen::Matrix >(Eigen::DenseBase > const&, Eigen::DenseBase > const&); @@ -263,6 +280,18 @@ template void igl::slice >,class Eigen::Matrix<__int64,-1,1,0,-1,1>,class Eigen::PlainObjectBase > >(class Eigen::MatrixBase > const &,class Eigen::DenseBase > const &,int,class Eigen::PlainObjectBase > &); template void igl::slice, Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase>>(Eigen::Matrix<__int64, -1, 1, 0, -1, 1> const &, Eigen::DenseBase> const &, int, Eigen::PlainObjectBase> &); template void igl::slice>, Eigen::Matrix<__int64, -1, 1, 0, -1, 1>, Eigen::PlainObjectBase>>(Eigen::PlainObjectBase> const &, Eigen::DenseBase> const &, int, Eigen::PlainObjectBase> &); +template void igl::slice(class std::vector > const &,class std::vector > const &,class std::vector > &); +template void igl::slice(class std::vector > const &,class std::vector > const &,class std::vector > &); +template void igl::slice<__int64>(class std::vector<__int64,class std::allocator<__int64> > const &,class std::vector > const &,class std::vector<__int64,class std::allocator<__int64> > &); #endif +template void igl::slice(std::vector > const&, std::vector > const&, std::vector >&); +template void igl::slice(std::vector > const&, std::vector > const&, std::vector >&); +template void igl::slice(std::vector > const&, std::vector > const&, std::vector >&); +template void igl::slice(std::vector > const&, std::vector > const&, std::vector >&); +template void igl::slice(std::vector > const&, std::vector > const&, std::vector >&); +#include "SortableRow.h" +template void igl::slice > >(std::vector >, std::allocator > > > const&, std::vector > const&, std::vector >, std::allocator > > >&); +template void igl::slice > >(std::vector >, std::allocator > > > const&, std::vector > const&, std::vector >, std::allocator > > >&); + #endif diff --git a/include/igl/slice.h b/include/igl/slice.h index 2919d664a..99a27c460 100644 --- a/include/igl/slice.h +++ b/include/igl/slice.h @@ -10,6 +10,7 @@ #include "igl_inline.h" #include +#include namespace igl { /// Act like the matlab X(row_indices,col_indices) operator, where @@ -84,6 +85,12 @@ namespace igl const Eigen::DenseBase& X, const Eigen::DenseBase & R, const int dim); + /// \overload + template< class T > + IGL_INLINE void slice( + const std::vector & X, + std::vector const & R, + std::vector & Y); } diff --git a/include/igl/slim.h b/include/igl/slim.h index 1db38b116..85cbdd35d 100644 --- a/include/igl/slim.h +++ b/include/igl/slim.h @@ -20,7 +20,7 @@ #define SLIM_CACHED #ifdef SLIM_CACHED -#include +#include "AtA_cached.h" #endif namespace igl diff --git a/include/igl/sort.cpp b/include/igl/sort.cpp index 22a9035d6..2aeb105c2 100644 --- a/include/igl/sort.cpp +++ b/include/igl/sort.cpp @@ -8,7 +8,7 @@ #include "sort.h" #include "SortableRow.h" -#include "reorder.h" +#include "slice.h" #include "IndexComparison.h" #include "colon.h" #include "parallel_for.h" @@ -322,7 +322,7 @@ if(!ascending) // make space for output without clobbering sorted.resize(unsorted.size()); // reorder unsorted into sorted using index map - igl::reorder(unsorted,index_map,sorted); + igl::slice(unsorted,index_map,sorted); } #ifdef IGL_STATIC_LIBRARY diff --git a/include/igl/sort_vectors_ccw.cpp b/include/igl/sort_vectors_ccw.cpp index ea613c51b..1d45b03d8 100644 --- a/include/igl/sort_vectors_ccw.cpp +++ b/include/igl/sort_vectors_ccw.cpp @@ -5,8 +5,8 @@ // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. -#include -#include +#include "sort_vectors_ccw.h" +#include "sort.h" #include template diff --git a/include/igl/spectra/eigs.cpp b/include/igl/spectra/eigs.cpp index 435a4f9fa..53b292e43 100644 --- a/include/igl/spectra/eigs.cpp +++ b/include/igl/spectra/eigs.cpp @@ -1,6 +1,6 @@ #include "eigs.h" -#include -#include +#include "../sort.h" +#include "../slice.h" #include #include diff --git a/include/igl/split_nonmanifold.cpp b/include/igl/split_nonmanifold.cpp index db4abe8ff..eb4c1bec6 100644 --- a/include/igl/split_nonmanifold.cpp +++ b/include/igl/split_nonmanifold.cpp @@ -12,7 +12,7 @@ #include "slice_mask.h" #include "connected_components.h" #include "remove_unreferenced.h" -#include +#include "matlab_format.h" #include template < diff --git a/include/igl/tet_tet_adjacency.h b/include/igl/tet_tet_adjacency.h index 1cdbf0fd3..51192817b 100644 --- a/include/igl/tet_tet_adjacency.h +++ b/include/igl/tet_tet_adjacency.h @@ -11,7 +11,7 @@ #include -#include +#include "igl_inline.h" namespace igl { diff --git a/include/igl/tinyply.h b/include/igl/tinyply.h index 73c35a73f..efa815236 100644 --- a/include/igl/tinyply.h +++ b/include/igl/tinyply.h @@ -22,7 +22,7 @@ #ifndef tinyply_h #define tinyply_h -#include +#include "igl_inline.h" #include #include diff --git a/include/igl/uniformly_sample_two_manifold.cpp b/include/igl/uniformly_sample_two_manifold.cpp index d35f74113..0a074e10d 100644 --- a/include/igl/uniformly_sample_two_manifold.cpp +++ b/include/igl/uniformly_sample_two_manifold.cpp @@ -10,7 +10,6 @@ #include "slice.h" #include "colon.h" #include "all_pairs_distances.h" -#include "mat_max.h" #include "vertex_triangle_adjacency.h" #include "get_seconds.h" #include "cat.h" diff --git a/include/igl/writePLY.h b/include/igl/writePLY.h index dd90dc94c..3ec1116d1 100644 --- a/include/igl/writePLY.h +++ b/include/igl/writePLY.h @@ -1,7 +1,7 @@ #ifndef IGL_WRITEPLY_H #define IGL_WRITEPLY_H -#include -#include +#include "igl_inline.h" +#include "FileEncoding.h" #include #include diff --git a/include/igl/writeSTL.h b/include/igl/writeSTL.h index 5704fd145..01ff06ae1 100644 --- a/include/igl/writeSTL.h +++ b/include/igl/writeSTL.h @@ -8,7 +8,7 @@ #ifndef IGL_WRITESTL_H #define IGL_WRITESTL_H #include "igl_inline.h" -#include +#include "FileEncoding.h" #ifndef IGL_NO_EIGEN # include diff --git a/include/igl/write_triangle_mesh.h b/include/igl/write_triangle_mesh.h index f50ddbf3b..11b168d09 100644 --- a/include/igl/write_triangle_mesh.h +++ b/include/igl/write_triangle_mesh.h @@ -8,7 +8,7 @@ #ifndef IGL_WRITE_TRIANGLE_MESH_H #define IGL_WRITE_TRIANGLE_MESH_H #include "igl_inline.h" -#include +#include "FileEncoding.h" #include #include diff --git a/include/igl/xml/ReAntTweakBarXMLSerialization.h b/include/igl/xml/ReAntTweakBarXMLSerialization.h deleted file mode 100644 index c43af0c80..000000000 --- a/include/igl/xml/ReAntTweakBarXMLSerialization.h +++ /dev/null @@ -1,269 +0,0 @@ -// This file is part of libigl, a simple c++ geometry processing library. -// -// Copyright (C) 2013 Alec Jacobson -// -// This Source Code Form is subject to the terms of the Mozilla Public License -// v. 2.0. If a copy of the MPL was not distributed with this file, You can -// obtain one at http://mozilla.org/MPL/2.0/. -#ifndef IGL_XML_REANTTWEAKBAR_XML_SERIALIZATION_H -#define IGL_XML_REANTTWEAKBAR_XML_SERIALIZATION_H -#include "../igl_inline.h" -#include "serialize_xml.h" - -#undef IGL_HEADER_ONLY -#include "../anttweakbar/ReAntTweakBar.h" - -// Forward declarations -namespace igl -{ - namespace anttweakbar - { - class ReTwBar; - } -}; -namespace tinyxml2 -{ - class XMLDocument; -}; - -namespace igl -{ - namespace xml - { - -// namespace -// { - -// IGL_INLINE bool save_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, const char* file_name); -// IGL_INLINE bool save_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, tinyxml2::XMLDocument* doc); -// IGL_INLINE bool load_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, const char *file_name); -// IGL_INLINE bool load_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, tinyxml2::XMLDocument* doc); - - - IGL_INLINE bool save_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, const char* file_name) - { - const char * name_chars = TwGetBarName(bar->bar); - std::string name = std::string(name_chars) + "_AntTweakBar"; - - const std::vector< ::igl::anttweakbar::ReTwRWItem>& rw_items = bar->get_rw_items(); - for(std::vector< ::igl::anttweakbar::ReTwRWItem>::const_iterator it = rw_items.begin(); it != rw_items.end(); it++) - { - std::string val = bar->get_value_as_string(it->var,it->type); - //::igl::XMLSerializer::SaveObject(val,it->name,name,file_name,false); - ::igl::serialize_xml(val,it->name,file_name,false,false); - } - - char var[REANTTWEAKBAR_MAX_CB_VAR_SIZE]; - // Print all CB variables - const std::vector< ::igl::anttweakbar::ReTwCBItem>& cb_items = bar->get_cb_items(); - for(std::vector< ::igl::anttweakbar::ReTwCBItem>::const_iterator it = cb_items.begin(); it != cb_items.end(); it++) - { - TwType type = it->type; - //TwSetVarCallback setCallback = it->setCallback; - TwGetVarCallback getCallback = it->getCallback; - void * clientData = it->clientData; - // I'm not sure how to do what I want to do. getCallback needs to be sure - // that it can write to var. So var needs to point to a valid and big - // enough chunk of memory - getCallback(var,clientData); - - std::string val = bar->get_value_as_string(var,type); - //::igl::XMLSerializer::SaveObject(val,it->name,name,file_name,false); - ::igl::serialize_xml(val,it->name,file_name,false,false); - } - - return true; - } - - /*IGL_INLINE bool save_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, tinyxml2::XMLDocument* doc) - { - std::vector buffer; - - const char * name_chars = TwGetBarName(bar->bar); - std::string name = std::string(name_chars) + "_AntTweakBar"; - ::igl::XMLSerializer* s = new ::igl::XMLSerializer(name); - - const std::vector< ::igl::anttweakbar::ReTwRWItem>& rw_items = bar->get_rw_items(); - for(std::vector< ::igl::anttweakbar::ReTwRWItem>::const_iterator it = rw_items.begin(); it != rw_items.end(); it++) - { - std::string val = bar->get_value_as_string(it->var,it->type); - char** cval = new char*; // create char* on heap - *cval = new char[val.size()+1]; - buffer.push_back(cval); - strcpy(*cval,val.c_str()); - s->Add(*cval,it->name); - } - - char var[REANTTWEAKBAR_MAX_CB_VAR_SIZE]; - // Print all CB variables - const std::vector< ::igl::anttweakbar::ReTwCBItem>& cb_items = bar->get_cb_items(); - for(std::vector< ::igl::anttweakbar::ReTwCBItem>::const_iterator it = cb_items.begin(); it != cb_items.end(); it++) - { - TwType type = it->type; - //TwSetVarCallback setCallback = it->setCallback; - TwGetVarCallback getCallback = it->getCallback; - void * clientData = it->clientData; - // I'm not sure how to do what I want to do. getCallback needs to be sure - // that it can write to var. So var needs to point to a valid and big - // enough chunk of memory - getCallback(var,clientData); - - std::string val = bar->get_value_as_string(var,type); - char** cval = new char*; // create char* on heap - *cval = new char[val.size()+1]; - buffer.push_back(cval); - strcpy(*cval,val.c_str()); - s->Add(*cval,it->name); - } - - s->SaveToXMLDoc(name,doc); - - // delete pointer buffers - for(unsigned int i=0;ibar); - std::string name = std::string(name_chars) + "_AntTweakBar"; - - const std::vector< ::igl::anttweakbar::ReTwRWItem>& rw_items = bar->get_rw_items(); - for(std::vector< ::igl::anttweakbar::ReTwRWItem>::const_iterator it = rw_items.begin(); it != rw_items.end(); it++) - { - char* val; - //::igl::XMLSerializer::LoadObject(val,it->name,name,file_name); - ::igl::deserialize_xml(val,it->name,file_name); - sscanf(val,"%s %[^\n]",type_str,value_str); - - if(!bar->type_from_string(type_str,type)) - { - printf("ERROR: %s type not found... Skipping...\n",type_str); - continue; - } - - bar->set_value_from_string(it->name.c_str(),type,value_str); - delete[] val; - } - - const std::vector< ::igl::anttweakbar::ReTwCBItem>& cb_items = bar->get_cb_items(); - for(std::vector< ::igl::anttweakbar::ReTwCBItem>::const_iterator it = cb_items.begin(); it != cb_items.end(); it++) - { - char* val; - //::igl::XMLSerializer::LoadObject(val,it->name,name,file_name); - ::igl::deserialize_xml(val,it->name,file_name); - sscanf(val,"%s %[^\n]",type_str,value_str); - - if(!bar->type_from_string(type_str,type)) - { - printf("ERROR: %s type not found... Skipping...\n",type_str); - continue; - } - - bar->set_value_from_string(it->name.c_str(),type,value_str); - delete[] val; - } - - return true; - } - - /*IGL_INLINE bool load_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, tinyxml2::XMLDocument* doc) - { - std::map variables; - std::map cbVariables; - - const char * name_chars = TwGetBarName(bar->bar); - std::string name = std::string(name_chars) + "_AntTweakBar"; - ::igl::XMLSerializer* s = new ::igl::XMLSerializer(name); - - std::map::iterator iter; - const std::vector< ::igl::anttweakbar::ReTwRWItem>& rw_items = bar->get_rw_items(); - for(std::vector< ::igl::anttweakbar::ReTwRWItem>::const_iterator it = rw_items.begin(); it != rw_items.end(); it++) - { - variables[it->name] = NULL; - iter = variables.find(it->name); - s->Add(iter->second,iter->first); - } - - // Add all CB variables - const std::vector< ::igl::anttweakbar::ReTwCBItem>& cb_items = bar->get_cb_items(); - for(std::vector< ::igl::anttweakbar::ReTwCBItem>::const_iterator it = cb_items.begin(); it != cb_items.end(); it++) - { - cbVariables[it->name] = NULL; - iter = cbVariables.find(it->name); - s->Add(iter->second,iter->first); - } - - s->LoadFromXMLDoc(doc); - - // Set loaded values - char type_str[REANTTWEAKBAR_MAX_WORD]; - char value_str[REANTTWEAKBAR_MAX_WORD]; - TwType type; - - for(iter = variables.begin(); iter != variables.end(); iter++) - { - if(iter->second == NULL) - { - printf("ERROR: '%s' entry not found... Skipping...\n",iter->first.c_str()); - continue; - } - - sscanf(iter->second,"%s %[^\n]",type_str,value_str); - - if(!bar->type_from_string(type_str,type)) - { - printf("ERROR: Type '%s' of '%s' not found... Skipping...\n",type_str,iter->first.c_str()); - continue; - } - - bar->set_value_from_string(iter->first.c_str(),type,value_str); - } - - for(iter = cbVariables.begin(); iter != cbVariables.end(); iter++) - { - if(iter->second == NULL) - { - printf("ERROR: '%s' entry not found... Skipping...\n",iter->first.c_str()); - continue; - } - - sscanf(iter->second,"%s %[^\n]",type_str,value_str); - - if(!bar->type_from_string(type_str,type)) - { - printf("ERROR: Type '%s' of '%s' not found... Skipping...\n",type_str,iter->first.c_str()); - continue; - } - - bar->set_value_from_string(iter->first.c_str(),type,value_str); - } - - // delete buffers - for(iter = variables.begin(); iter != variables.end(); iter++) - delete[] iter->second; - - for(iter = cbVariables.begin(); iter != cbVariables.end(); iter++) - delete[] iter->second; - - delete s; - - return true; - }*/ - -// } - } -} - -#endif diff --git a/include/igl/xml/serialization_test.skip b/include/igl/xml/serialization_test.skip index 5888075c4..0661d573e 100644 --- a/include/igl/xml/serialization_test.skip +++ b/include/igl/xml/serialization_test.skip @@ -7,7 +7,6 @@ //#ifndef IGL_SERIALIZATION_TEST_H //#define IGL_SERIALIZATION_TEST_H -//#include #include "serialize_xml.h" #include "XMLSerializable.h" diff --git a/tests/include/igl/decimate.cpp b/tests/include/igl/decimate.cpp index 0b889253f..8d853837a 100644 --- a/tests/include/igl/decimate.cpp +++ b/tests/include/igl/decimate.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/include/igl/diag.cpp b/tests/include/igl/diag.cpp deleted file mode 100644 index 0ac96a1b2..000000000 --- a/tests/include/igl/diag.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include - -TEST_CASE("diag: dense-vector-to-sparse", "[igl]") -{ - const Eigen::VectorXd v = (Eigen::VectorXd(3)<<1,2,3).finished(); - Eigen::SparseMatrix X; - igl::diag(v,X); - const Eigen::MatrixXd X_exact = - (Eigen::MatrixXd(3,3)<<1,0,0,0,2,0,0,0,3).finished(); - test_common::assert_eq(Eigen::MatrixXd(X),X_exact); -} - -TEST_CASE("diag: sparse-vector-to-sparse", "[igl]") -{ - const Eigen::SparseVector v = (Eigen::VectorXd(3)<<1,0,3).finished().sparseView(); - Eigen::SparseMatrix X; - igl::diag(v,X); - const Eigen::MatrixXd X_exact = - (Eigen::MatrixXd(3,3)<<1,0,0,0,0,0,0,0,3).finished(); - test_common::assert_eq(Eigen::MatrixXd(X),X_exact); -} diff --git a/tutorial/403_BoundedBiharmonicWeights/main.cpp b/tutorial/403_BoundedBiharmonicWeights/main.cpp index 7634d794b..b96a2d7e1 100755 --- a/tutorial/403_BoundedBiharmonicWeights/main.cpp +++ b/tutorial/403_BoundedBiharmonicWeights/main.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -139,7 +138,7 @@ int main(int argc, char *argv[]) //W.topLeftCorner(Wsurf.rows(),Wsurf.cols()) = Wsurf = Wsurf = Wsurf = Wsurf; // Normalize weights to sum to one - igl::normalize_row_sums(W,W); + W = (W.array().colwise() / W.array().rowwise().sum()).eval(); // precompute linear blend skinning matrix igl::lbs_matrix(V,W,M); diff --git a/tutorial/406_FastAutomaticSkinningTransformations/main.cpp b/tutorial/406_FastAutomaticSkinningTransformations/main.cpp index 2fa44b4c0..ad034248b 100755 --- a/tutorial/406_FastAutomaticSkinningTransformations/main.cpp +++ b/tutorial/406_FastAutomaticSkinningTransformations/main.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include @@ -162,7 +162,7 @@ int main(int argc, char *argv[]) // vertices corresponding to handles (those with maximum weight) { VectorXd maxW; - igl::mat_max(W,1,maxW,b); + igl::max(W,1,maxW,b); } // Precomputation for FAST diff --git a/tutorial/709_SLIM/main.cpp b/tutorial/709_SLIM/main.cpp index 4205bbad0..0e43627d5 100644 --- a/tutorial/709_SLIM/main.cpp +++ b/tutorial/709_SLIM/main.cpp @@ -269,7 +269,7 @@ void check_mesh_for_issues(Eigen::MatrixXd& V, Eigen::MatrixXi& F) { if (connected_components!=1) { cout << "Error! Input has multiple connected components" << endl; exit(1); } - int euler_char = igl::euler_characteristic(V, F); + int euler_char = igl::euler_characteristic(F); if (euler_char!=1) { cout <<