Merge branch 'devel' of github.com:cnr-isti-vclab/vcglib into devel

This commit is contained in:
Luigi Malomo 2021-03-29 10:09:26 +02:00
commit a41a1fb8dc
131 changed files with 1702 additions and 520 deletions

View File

@ -1,12 +1,12 @@
name: BuildSamplesUbuntu
name: BuildExamplesLinux
on:
[push, pull_request]
jobs:
ubuntu_build_tests:
name: Build Samples (Ubuntu)
runs-on: ubuntu-latest #in order to deploy, need to use oldest supported version
name: Build Examples (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -14,5 +14,7 @@ jobs:
uses: jurplel/install-qt-action@v2
- name: Build Samples
run: |
qmake apps/sample/sample.pro
mkdir build
cd build
cmake -DVCG_BUILD_EXAMPLES=ON ..
make -j4

View File

@ -1,11 +1,11 @@
name: BuildSamplesMacOS
name: BuildExamplesMacOS
on:
[push, pull_request]
jobs:
macos_build_tests:
name: Build Samples (MacOS)
name: Build Examples (MacOS)
runs-on: macos-latest
steps:
@ -14,5 +14,7 @@ jobs:
uses: jurplel/install-qt-action@v2
- name: Build Samples
run: |
qmake apps/sample/sample.pro
mkdir build
cd build
cmake -DVCG_BUILD_EXAMPLES=ON ..
make -j4

View File

@ -1,10 +1,10 @@
name: BuildSamplesWindows
name: BuildExamplesWindows
on: [push, pull_request]
jobs:
windows_build_tests:
name: Build Samples (Windows)
name: Build Examples (Windows)
runs-on: windows-latest
steps:
@ -25,5 +25,7 @@ jobs:
uses: jurplel/install-qt-action@v2
- name: Build Samples
run: |
qmake apps/sample/sample.pro
mkdir build
cd build
cmake -G "NMake Makefiles" -DVCG_BUILD_EXAMPLES=ON ..
jom -j4

View File

@ -13,6 +13,9 @@ option(ALLOW_SYSTEM_EIGEN "Allow use of system-provided Eigen" ON)
option(VCG_HEADER_ONLY "Use VCG library in header only mode" ON)
option(VCG_BUILD_EXAMPLES "Build a set of examples of the library" OFF)
set (VCG_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR})
set (VCG_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR} PARENT_SCOPE)
# Prefer GLVND
if(POLICY CMP0072)
cmake_policy(SET CMP0072 NEW)
@ -272,6 +275,9 @@ set(VCG_HEADERS
vcg/connectors/halfedge_pos.h
vcg/connectors/hedge.h
vcg/connectors/hedge_component.h
#wrap
wrap/callback.h
)
set(SOURCES
@ -293,4 +299,5 @@ endif()
if(VCG_BUILD_EXAMPLES)
#TODO make the list of samples to build
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/apps)
endif()

View File

@ -1,8 +1,8 @@
The **_Visualization and Computer Graphics Library_** (VCGlib for short) is a open source, portable, C++, templated, no dependency, library for manipulation, processing, cleaning, simplifying triangle meshes.
![BuildSamplesUbuntu](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildSamplesUbuntu/badge.svg)
![BuildSamplesMacOS](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildSamplesMacOS/badge.svg)
![BuildSamplesWindows](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildSamplesWindows/badge.svg)
![BuildExamplesLinux](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesLinux/badge.svg)
![BuildExamplesMacOS](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesMacOS/badge.svg)
![BuildExamplesWindows](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesWindows/badge.svg)
The library, composed by more than 100k lines of code, is released under the GPL license, and it is the base of most of the software tools of the [Visual Computing Lab](http://vcg.isti.cnr.it) of the Italian National Research Council Institute ISTI, like MeshLab, metro and many others.
@ -28,17 +28,10 @@ A number of applications have been developed using the vcglib:
- Metro, the tool for measuring differences between meshes
- The first high quality out-of-core mesh simplifier that was used by the Stanford Digital Michelangelo project to process their huge 3D scanned models.
## Contributing
In case of bugs please report them [here](https://github.com/cnr-isti-vclab/vcglib/issues).
Copyright of the library is fully owned by CNR. Contributing means signing an appropriate [license agreement](https://github.com/cnr-isti-vclab/vcglib/blob/master/docs/ContributorLicenseAgreement.pdf) .
Pull requests about trivial, small, questionable updates (e.g. small stylistic changes like int -> uint8_t) will be rejected without discussion.
## Contacts
For any info about licensing (portion of) the library please contact us:
Paolo Cignoni (p.cignoni@isti.cnr.it)
Visual Computing Lab of the Italian National Research Council - ISTI
In case of bugs please report them [here](https://github.com/cnr-isti-vclab/vcglib/issues) .

View File

@ -1,9 +1,7 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
include_directories(../)
include_directories(../eigenlib)
cmake_minimum_required(VERSION 3.13)
project(VCGApps)
add_subdirectory(sample)
add_subdirectory(metro)
add_subdirectory(tridecimator)

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -64,10 +64,10 @@ class CMesh : public vcg::tri::TriMesh< std::vector<CVertex>, std::vector<CFac
class GLArea:public QGLWidget
{
Q_OBJECT
Q_OBJECT
public:
GLArea (QWidget * parent = 0);
/// we choosed a subset of the avaible drawing modes
/// we chose a subset of the available drawing modes
enum DrawMode{SMOOTH=0,POINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
public slots:
/// widget-based user interaction slots
@ -89,7 +89,7 @@ protected:
void mousePressEvent(QMouseEvent*e);
void mouseMoveEvent(QMouseEvent*e);
void mouseReleaseEvent(QMouseEvent*e);
void wheelEvent(QWheelEvent*e);
void wheelEvent(QWheelEvent*e);
private:
/// the active mesh instance
CMesh mesh;

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -65,13 +65,13 @@ public:
class GLArea:public QGLWidget
{
Q_OBJECT
Q_OBJECT
public:
GLArea (SharedDataOpenGLContext* sharedcontext,MainWindow* parent);
~GLArea();
void resetTrackBall();
//unsigned int getId() const {return areaid;}
/// we choosed a subset of the avaible drawing modes
/// we chose a subset of the available drawing modes
signals:
/// signal for setting the statusbar message
@ -88,7 +88,7 @@ protected:
void mousePressEvent(QMouseEvent*e);
void mouseMoveEvent(QMouseEvent*e);
void mouseReleaseEvent(QMouseEvent*e);
void wheelEvent(QWheelEvent*e);
void wheelEvent(QWheelEvent*e);
private:
MainWindow* parwin;

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -24,7 +24,7 @@
/**
* Minimal trimesh viewer made with AntTweakBar and freglut
*
* This sample shows how to use togheter:
* This sample shows how to use togheter:
* - the trimesh loading and initialization
* - basic usage of the default manipulators (the "Trackball")
*/
@ -75,7 +75,7 @@ vcg::Trackball track;
/// window size
int width,height;
/// we choosed a subset of the avaible drawing modes
/// we chose a subset of the available drawing modes
enum DrawMode{SMOOTH=0,PERPOINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
/// the current drawmode
@ -101,7 +101,7 @@ static vcg::Trackball::Button GLUT2VCG (int glut_button, int )
return vcg::Trackball::Button (vcgbt);
}
@ -124,29 +124,29 @@ void Display(){
glPushMatrix();
float d=1.0f/mesh.bbox.Diag();
vcg::glScale(d);
glTranslate(-glWrap.m->bbox.Center());
glTranslate(-glWrap.m->bbox.Center());
// the trimesh drawing calls
switch(drawmode)
{
case SMOOTH:
case SMOOTH:
glWrap.Draw<vcg::GLW::DMSmooth, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case PERPOINTS:
case PERPOINTS:
glWrap.Draw<vcg::GLW::DMPoints, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case WIRE:
case WIRE:
glWrap.Draw<vcg::GLW::DMWire, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case FLATWIRE:
case FLATWIRE:
glWrap.Draw<vcg::GLW::DMFlatWire, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case HIDDEN:
case HIDDEN:
glWrap.Draw<vcg::GLW::DMHidden, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case FLAT:
case FLAT:
glWrap.Draw<vcg::GLW::DMFlat, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
default:
default:
break;
}
@ -185,7 +185,7 @@ void initMesh()
}
void TW_CALL loadMesh(void *)
{
{
if(filename==0) return;
int err=vcg::tri::io::ImporterPLY<CMesh>::Open(mesh,(char*)filename);
if(err!=0){
@ -276,7 +276,7 @@ int main(int argc, char *argv[])
// (note that AntTweakBar could also be intialized after GLUT, no matter)
if( !TwInit(TW_OPENGL, NULL) )
{
// A fatal error occured
// A fatal error occured
fprintf(stderr, "AntTweakBar initialization failed: %s\n", TwGetLastError());
return 1;
}
@ -311,12 +311,12 @@ int main(int argc, char *argv[])
glutKeyboardFunc(keyPressEvent);
glutKeyboardUpFunc(keyReleaseEvent);
glutMouseWheelFunc(wheelEvent);
bar = TwNewBar("TweakBar");
TwCopyCDStringToClientFunc (CopyCDStringToClient);
TwAddVarRW(bar,"Input",TW_TYPE_CDSTRING,&filename," label='Filepath' group=SetMesh help=` Name of the file to load` ");
TwAddButton(bar,"Load from file",loadMesh,0, " label='Load Mesh' group=SetMesh help=`load the mesh` ");
TwAddButton(bar,"Use tetrahedron",loadTetrahedron,0, " label='Make Tetrahedron' group=SetMesh help=`use tetrahedron.` ");

View File

@ -1,2 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project (metro)
add_executable(metro metro.cpp ../../wrap/ply/plylib.cpp)
if (VCG_HEADER_ONLY)
set(SOURCES
metro.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(metro
${SOURCES})
target_link_libraries(
metro
PUBLIC
vcglib
)

View File

@ -112,7 +112,7 @@ template<class TriMeshType>
// ALNParser::ParseALN(rmaps, alnName);
// for(size_t i=0; i<rmaps.size(); i++)
// AddSingleMesh(rmaps[i].filename.c_str(), rmaps[i].trasformation, rmaps[i].quality);
// AddSingleMesh(rmaps[i].filename.c_str(), rmaps[i].transformation, rmaps[i].quality);
return true;
}

View File

@ -0,0 +1,64 @@
cmake_minimum_required(VERSION 3.13)
project(VCGExamples)
set(VCG_EXAMPLE_PROJECTS
aabb_binary_tree
colorspace
polygonmesh_base
polygonmesh_dual
polygonmesh_optimize
polygonmesh_polychord_collapse
polygonmesh_smooth
space_index_2d
space_packer
space_rasterized_packer
trimesh_align_pair
trimesh_allocate
trimesh_attribute
trimesh_attribute_saving
trimesh_ball_pivoting
trimesh_base
trimesh_closest
trimesh_clustering
trimesh_color
trimesh_copy
trimesh_create
trimesh_curvature
trimesh_cylinder_clipping
trimesh_disk_parametrization
trimesh_fitting
trimesh_geodesic
trimesh_harmonic
trimesh_hole
trimesh_implicit_smooth
trimesh_indexing
trimesh_inertia
trimesh_intersection_plane
trimesh_intersection_mesh
trimesh_isosurface
trimesh_join
trimesh_kdtree
trimesh_montecarlo_sampling
trimesh_normal
trimesh_optional
trimesh_pointmatching
trimesh_pointcloud_sampling
trimesh_ray
trimesh_refine
trimesh_remeshing
trimesh_sampling
trimesh_select
trimesh_smooth
trimesh_split_vertex
trimesh_texture
trimesh_texture_clean
trimesh_topology
trimesh_topological_cut
trimesh_voronoi
trimesh_voronoiatlas
trimesh_voronoiclustering
trimesh_voronoisampling)
foreach(VCG_EXAMPLE ${VCG_EXAMPLE_PROJECTS})
add_subdirectory(${VCG_EXAMPLE})
endforeach()

View File

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.13)
project(aabb_binary_tree)
set(SOURCES
aabb_binary_tree.cpp)
add_executable(aabb_binary_tree
${SOURCES})
target_link_libraries(
aabb_binary_tree
PUBLIC
vcglib
)

View File

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.13)
project(colorspace)
set(SOURCES
colorspace.cpp)
add_executable(colorspace
${SOURCES})
target_link_libraries(
colorspace
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_base)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_base
${SOURCES})
target_link_libraries(
polygonmesh_base
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_dual)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh_dual.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_dual
${SOURCES})
target_link_libraries(
polygonmesh_dual
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_optimize)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh_optimize.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_optimize
${SOURCES})
target_link_libraries(
polygonmesh_optimize
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_polychord_collapse)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh_polychord_collapse.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_polychord_collapse
${SOURCES})
target_link_libraries(
polygonmesh_polychord_collapse
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_smooth)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh_smooth.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_smooth
${SOURCES})
target_link_libraries(
polygonmesh_smooth
PUBLIC
vcglib
)

View File

@ -60,4 +60,4 @@ SUBDIRS = \
trimesh_voronoi \
trimesh_voronoiatlas \
trimesh_voronoiclustering \
trimesh_voronoisampling \
trimesh_voronoisampling

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(space_index_2d)
if (VCG_HEADER_ONLY)
set(SOURCES
space_index_2d.cpp)
endif()
add_executable(space_index_2d
${SOURCES})
target_link_libraries(
space_index_2d
PUBLIC
vcglib
)

View File

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.13)
project(space_packer)
find_package(
Qt5
COMPONENTS OpenGL Svg)
if (TARGET Qt5::OpenGL AND TARGET Qt5::Svg)
if (VCG_HEADER_ONLY)
set(SOURCES
space_packer.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/Outline2ToQImage.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/outline2_rasterizer.cpp)
endif()
add_executable(space_packer
${SOURCES})
target_link_libraries(
space_packer
PUBLIC
vcglib
Qt5::OpenGL
Qt5::Svg
)
else()
message(
STATUS "VCG examples - Skipping space_packer example")
endif()

View File

@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.13)
project(space_rasterized_packer)
find_package(
Qt5
COMPONENTS OpenGL Svg)
if (TARGET Qt5::OpenGL AND TARGET Qt5::Svg)
if (VCG_HEADER_ONLY)
set(SOURCES
space_rasterized_packer.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/Outline2ToQImage.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/outline2_rasterizer.cpp)
endif()
add_executable(space_rasterized_packer
${SOURCES})
target_link_libraries(
space_rasterized_packer
PUBLIC
vcglib
Qt5::OpenGL
Qt5::Svg
)
else()
message(
STATUS "VCG examples - Skipping space_rasterized_packer example")
endif()

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_align_pair)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_align_pair.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_align_pair
${SOURCES})
target_link_libraries(
trimesh_align_pair
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_allocate)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_allocate.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_allocate
${SOURCES})
target_link_libraries(
trimesh_allocate
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_attribute)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_attribute.cpp)
endif()
add_executable(trimesh_attribute
${SOURCES})
target_link_libraries(
trimesh_attribute
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_attribute_saving)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_attribute_saving.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_attribute_saving
${SOURCES})
target_link_libraries(
trimesh_attribute_saving
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_ball_pivoting)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_ball_pivoting.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_ball_pivoting
${SOURCES})
target_link_libraries(
trimesh_ball_pivoting
PUBLIC
vcglib
)

View File

@ -1,8 +1,16 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
project (trimesh_base)
add_executable(trimesh_base trimesh_base.cpp)
include_directories(../../..)
include_directories(../../../eigenlib)
cmake_minimum_required(VERSION 3.13)
project(trimesh_base)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_base.cpp)
endif()
add_executable(trimesh_base
${SOURCES})
target_link_libraries(
trimesh_base
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_closest)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_closest.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_closest
${SOURCES})
target_link_libraries(
trimesh_closest
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_clustering)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_clustering.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_clustering
${SOURCES})
target_link_libraries(
trimesh_clustering
PUBLIC vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_color)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_color.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_color
${SOURCES})
target_link_libraries(
trimesh_color
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_copy)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_copy.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_copy
${SOURCES})
target_link_libraries(
trimesh_copy
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_create)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_create.cpp)
endif()
add_executable(trimesh_create
${SOURCES})
target_link_libraries(
trimesh_create
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_curvature)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_curvature.cpp)
endif()
add_executable(trimesh_curvature
${SOURCES})
target_link_libraries(
trimesh_curvature
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_cylinder_clipping)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_cylinder_clipping.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_cylinder_clipping
${SOURCES})
target_link_libraries(
trimesh_cylinder_clipping
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_disk_parametrization)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_disk_parametrization.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_disk_parametrization
${SOURCES})
target_link_libraries(
trimesh_disk_parametrization
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_fitting)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_fitting.cpp)
endif()
add_executable(trimesh_fitting
${SOURCES})
target_link_libraries(
trimesh_fitting
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_geodesic)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_geodesic.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_geodesic
${SOURCES})
target_link_libraries(
trimesh_geodesic
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_harmonic)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_harmonic.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_harmonic
${SOURCES})
target_link_libraries(
trimesh_harmonic
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_hole)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_hole.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_hole
${SOURCES})
target_link_libraries(
trimesh_hole
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_implicit_smooth)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_implicit_smooth.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_implicit_smooth
${SOURCES})
target_link_libraries(
trimesh_implicit_smooth
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_indexing)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_indexing.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_indexing
${SOURCES})
target_link_libraries(
trimesh_indexing
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_inertia)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_inertia.cpp)
endif()
add_executable(trimesh_inertia
${SOURCES})
target_link_libraries(
trimesh_inertia
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_intersection_mesh)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_intersection_mesh.cpp)
endif()
add_executable(trimesh_intersection_mesh
${SOURCES})
target_link_libraries(
trimesh_intersection_mesh
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_intersection_plane)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_intersection_plane.cpp)
endif()
add_executable(trimesh_intersection_plane
${SOURCES})
target_link_libraries(
trimesh_intersection_plane
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_isosurface)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_isosurface.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_isosurface
${SOURCES})
target_link_libraries(
trimesh_isosurface
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_join)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_join.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_join
${SOURCES})
target_link_libraries(
trimesh_join
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_kdtree)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_kdtree.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_kdtree
${SOURCES})
target_link_libraries(
trimesh_kdtree
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_montecarlo_sampling)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_montecarlo_sampling.cpp)
endif()
add_executable(trimesh_montecarlo_sampling
${SOURCES})
target_link_libraries(
trimesh_montecarlo_sampling
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_normal)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_normal.cpp)
endif()
add_executable(trimesh_normal
${SOURCES})
target_link_libraries(
trimesh_normal
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_optional)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_optional.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_optional
${SOURCES})
target_link_libraries(
trimesh_optional
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_pointcloud_sampling)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_pointcloud_sampling.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_pointcloud_sampling
${SOURCES})
target_link_libraries(
trimesh_pointcloud_sampling
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_pointmatching)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_pointmatching.cpp)
endif()
add_executable(trimesh_pointmatching
${SOURCES})
target_link_libraries(
trimesh_pointmatching
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_ray)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_ray.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_ray
${SOURCES})
target_link_libraries(
trimesh_ray
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_refine)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_refine.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_refine
${SOURCES})
target_link_libraries(
trimesh_refine
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_remeshing)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_remeshing.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_remeshing
${SOURCES})
target_link_libraries(
trimesh_remeshing
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_sampling)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_sampling.cpp)
endif()
add_executable(trimesh_sampling
${SOURCES})
target_link_libraries(
trimesh_sampling
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_select)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_select.cpp)
endif()
add_executable(trimesh_select
${SOURCES})
target_link_libraries(
trimesh_select
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_smooth)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_smooth.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_smooth
${SOURCES})
target_link_libraries(
trimesh_smooth
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_split_vertex)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_split_vertex.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_split_vertex
${SOURCES})
target_link_libraries(
trimesh_split_vertex
PUBLIC
vcglib
)

View File

@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_texture)
find_package(
Qt5
COMPONENTS OpenGL Svg)
if (TARGET Qt5::OpenGL AND TARGET Qt5::Svg)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_texture.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/Outline2ToQImage.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/outline2_rasterizer.cpp)
endif()
add_executable(trimesh_texture
${SOURCES})
target_link_libraries(
trimesh_texture
PUBLIC
vcglib
Qt5::OpenGL
Qt5::Svg
)
else()
message(
STATUS "VCG examples - Skipping trimesh_texture example")
endif()

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_texture_clean)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_texture_clean.cpp)
endif()
add_executable(trimesh_texture_clean
${SOURCES})
target_link_libraries(
trimesh_texture_clean
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_topological_cut)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_topological_cut.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_topological_cut
${SOURCES})
target_link_libraries(
trimesh_topological_cut
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_topology)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_topology.cpp)
endif()
add_executable(trimesh_topology
${SOURCES})
target_link_libraries(
trimesh_topology
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_voronoi)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_voronoi.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_voronoi
${SOURCES})
target_link_libraries(
trimesh_voronoi
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_voronoiatlas)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_voronoiatlas.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_voronoiatlas
${SOURCES})
target_link_libraries(
trimesh_voronoiatlas
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_voronoiclustering)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_voronoiclustering.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_voronoiclustering
${SOURCES})
target_link_libraries(
trimesh_voronoiclustering
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_voronoisampling)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_voronoisampling.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_voronoisampling
${SOURCES})
target_link_libraries(
trimesh_voronoisampling
PUBLIC
vcglib
)

View File

@ -1,2 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project (tridecimator)
add_executable(tridecimator tridecimator.cpp ../../wrap/ply/plylib.cpp)
if (VCG_HEADER_ONLY)
set(SOURCES
tridecimator.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(tridecimator
${SOURCES})
target_link_libraries(
tridecimator
PUBLIC
vcglib
)

View File

@ -1529,7 +1529,7 @@ public:
std::vector< VertexPointer > minVertVec;
std::vector< VertexPointer > maxVertVec;
// The set of directions to be choosen
// The set of directions to be chosen
std::vector< CoordType > dirVec;
dirVec.push_back(CoordType(1,0,0));
dirVec.push_back(CoordType(0,1,0));

View File

@ -235,19 +235,19 @@ public:
ScalarT cotB = 0;
// Get the edge (a pair of vertices)
VertexType * v0 = f.cV(edge);
VertexType * v1 = f.cV((edge+1)%f.VN());
const VertexType * v0 = f.cV(edge);
const VertexType * v1 = f.cV((edge+1)%f.VN());
if (fp != NULL &&
fp != &f)
{
// not a border edge
VertexType * vb = fp->cV((f.cFFi(edge)+2)%fp->VN());
const VertexType * vb = fp->cV((f.cFFi(edge)+2)%fp->VN());
ScalarT angleB = ComputeAngle<ScalarT>(v0, vb, v1);
cotB = vcg::math::Cos(angleB) / vcg::math::Sin(angleB);
}
VertexType * va = f.cV((edge+2)%f.VN());
const VertexType * va = f.cV((edge+2)%f.VN());
ScalarT angleA = ComputeAngle<ScalarT>(v0, va, v1);
cotA = vcg::math::Cos(angleA) / vcg::math::Sin(angleA);

View File

@ -813,7 +813,7 @@ private:
{
if (faces[i]->IsFaceEdgeS(VtoE(vIdxes[i], (vIdxes[i]+1)%3)) && !vcg::tri::IsMarked(*params.m, faces[i]->cV1(vIdxes[i])))
{
vcg::tri::Mark(*params.m,faces[i]->cV1(vIdxes[i]));
vcg::tri::Mark(*params.m,faces[i]->V1(vIdxes[i]));
incidentFeatures++;
CoordType movingEdgeVector0 = (faces[i]->cP1(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
if (std::fabs(movingEdgeVector0 * dEdgeVector) < .9f || !p.IsEdgeS())
@ -821,7 +821,7 @@ private:
}
if (faces[i]->IsFaceEdgeS(VtoE(vIdxes[i], (vIdxes[i]+2)%3)) && !vcg::tri::IsMarked(*params.m, faces[i]->cV2(vIdxes[i])))
{
vcg::tri::Mark(*params.m,faces[i]->cV2(vIdxes[i]));
vcg::tri::Mark(*params.m,faces[i]->V2(vIdxes[i]));
incidentFeatures++;
CoordType movingEdgeVector1 = (faces[i]->cP2(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
if (std::fabs(movingEdgeVector1 * dEdgeVector) < .9f || !p.IsEdgeS())

View File

@ -23,6 +23,10 @@
#ifndef __VCGLIB_MESH_ASSERT
#define __VCGLIB_MESH_ASSERT
#include <vcg/complex/exception.h>
#include <vcg/simplex/edge/pos.h>
#include <vcg/complex/algorithms/update/flag.h>
namespace vcg {
namespace tri {
/**

View File

@ -1005,7 +1005,7 @@ static void AllEdge(MeshType & m, VertexSampler &ps)
// Regular Uniform Edge sampling
// Each edge is subdivided in a number of pieces proprtional to its length
// Sample are choosen without touching the vertices.
// Samples are chosen without touching the vertices.
static void EdgeUniform(MeshType & m, VertexSampler &ps,int sampleNum, bool sampleFauxEdge=true)
{

View File

@ -303,7 +303,7 @@ Given a mesh the following function refines it according to two functor objects:
- a predicate that tells if a given edge must be splitted
- a functor that gives you the new poistion of the created vertices (starting from an edge)
- a functor that gives you the new position of the created vertices (starting from an edge)
If RefineSelected is true only selected faces are taken into account for being splitted.

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -45,13 +45,13 @@ namespace tri
/* Base class for all Texture Optimizers*/
template<class MESH_TYPE>
template<class MESH_TYPE>
class TextureOptimizer{
protected:
MESH_TYPE &m;
SimpleTempData<typename MESH_TYPE::VertContainer, int > isFixed;
public:
/* Tpyes */
typedef MESH_TYPE MeshType;
typedef typename MESH_TYPE::VertexIterator VertexIterator;
@ -59,26 +59,26 @@ public:
typedef typename MESH_TYPE::VertexType VertexType;
typedef typename MESH_TYPE::FaceType FaceType;
typedef typename MESH_TYPE::ScalarType ScalarType;
/* Access functions */
const MeshType & Mesh() const {return m;}
MeshType & Mesh() {return m;}
/* Constructior */
TextureOptimizer(MeshType &_m):m(_m),isFixed(_m.vert){
assert(m.HasPerVertexTexture());
}
// initializes on current geometry
// initializes on current geometry
virtual void TargetCurrentGeometry()=0;
// performs an interation. Returns largest movement.
// performs an iteration. Returns largest movement.
virtual ScalarType Iterate()=0;
// performs an iteration (faster, but it does not tell how close it is to stopping)
virtual void IterateBlind()=0;
// performs <steps> iteration
virtual ScalarType IterateN(int step){
for (int i=0; i<step-1; i++) {
@ -86,7 +86,7 @@ public:
}
if (step>1) return this->Iterate(); else return 0;
}
// performs iterations until convergence.
bool IterateUntilConvergence(ScalarType threshold=0.0001, int maxite=5000){
int i;
@ -95,34 +95,34 @@ public:
}
return true;
}
// desctuctor: free temporary field
~TextureOptimizer(){
isFixed.Stop();
};
// set the current border as fixed (forced to stay in position during text optimization)
void SetBorderAsFixed(){
isFixed.Start();
for (VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) {
isFixed[v]=(v->IsB())?1:0;
}
isFixed[v]=(v->IsB())?1:0;
}
}
// everything moves, no vertex must fixed during texture optimization)
void SetNothingAsFixed(){
isFixed.Start();
for (VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) {
isFixed[v]=0;
}
isFixed[v]=0;
}
}
// fix a given vertex
void FixVertex(const VertexType *v, bool fix=true){
isFixed[v]=(fix)?1:0;
}
};
@ -130,12 +130,12 @@ public:
/*
AREA PRESERVING TEXTURE OPTIMIZATION
as in: Degener, P., Meseth, J., Klein, R.
as in: Degener, P., Meseth, J., Klein, R.
"An adaptable surface parameterization method."
Proc. of the 12th International Meshing oundtable, 201213 [2003].
Proc. of the 12th International Meshing oundtable, 201-213 [2003].
Features:
:) - Balances angle and area distortions (best results!).
:) - Can choose how to balance area and angle preservation (see SetTheta)
theta=0 -> pure conformal (use MIPS instead!)
@ -144,12 +144,12 @@ Features:
:( - Slowest method.
:( - Requires a fixed boundary, else expands forever in texture space (unless theta=0).
:( - Diverges in presence of flipped faces (unless theta=0).
:( - Requires a speed parameter to be set.
:( - Requires a speed parameter to be set.
Speed too large => when close, bounces back and forth around minimum, w/o getting any closer.
Lower speed => longer convercence times
*/
template<class MESH_TYPE>
template<class MESH_TYPE>
class AreaPreservingTextureOptimizer:public TextureOptimizer<MESH_TYPE>{
public:
/* Types */
@ -159,34 +159,34 @@ public:
typedef typename MESH_TYPE::VertexType VertexType;
typedef typename MESH_TYPE::FaceType FaceType;
typedef typename MESH_TYPE::ScalarType ScalarType;
private:
typedef TextureOptimizer<MESH_TYPE> Super; // superclass (commodity)
// extra data per face: [0..3] -> cotangents. [4] -> area*2
SimpleTempData<typename MESH_TYPE::FaceContainer, Point4<ScalarType> > data;
SimpleTempData<typename MESH_TYPE::VertContainer, Point2<ScalarType> > sum;
ScalarType totArea;
ScalarType speed;
int theta;
public:
// constructor and destructor
AreaPreservingTextureOptimizer(MeshType &_m):Super(_m),data(_m.face),sum(_m.vert){
speed=0.001;
theta=3;
}
~AreaPreservingTextureOptimizer(){
data.Stop();
sum.Stop();
Super::isFixed.Stop();
}
void SetSpeed(ScalarType _speed){
speed=_speed;
}
@ -194,7 +194,7 @@ public:
ScalarType GetSpeed(){
return speed;
}
// sets the parameter theta:
// good parameters are in 1..3
// 0 = converge to pure conformal, ignore area preservation
@ -207,16 +207,16 @@ public:
int GetTheta(){
return theta;
}
void IterateBlind(){
/* todo: do as iterate, but without */
/* todo: do as iterate, but without */
Iterate();
}
ScalarType Iterate(){
ScalarType max; // max displacement
#define v0 (f->V0(i)->T().P())
#define v1 (f->V1(i)->T().P())
#define v2 (f->V2(i)->T().P())
@ -236,15 +236,15 @@ public:
for (FaceIterator f=Super::m.face.begin(); f!=Super::m.face.end(); f++) {
int i=0; ScalarType area2 = ((v1-v0) ^ (v2-v0));
for (i=0; i<3; i++){
ScalarType
ScalarType
a = (v1-v0).Norm(),
b = ((v1-v0) * (v2-v0))/a,
c = area2 / a,
m0= data[f][i] / area2,
m1= data[f][(i+1)%3] / area2,
m2= data[f][(i+2)%3] / area2,
mx= (b-a)/area2,
my= c/area2, // 1.0/a
mA= data[f][3]/area2 * scale,
@ -258,35 +258,35 @@ public:
/* linear weightings
dx= (OMEGA) * (my * M2) +
dx= (OMEGA) * (my * M2) +
(1-OMEGA) * ( px - 2.0*qx),
dy= (OMEGA) * (-mx * M2) +
dy= (OMEGA) * (-mx * M2) +
(1-OMEGA) * ( py - 2.0*qy),*/
// exponential weighting
// 2d gradient
dx=// M1
//*M1 // ^ theta-1
//*M1 // ^ theta-1
pow(M1,theta-1)
*(px*(M1+ theta*M2) - 2.0*qx*M1),
*(px*(M1+ theta*M2) - 2.0*qx*M1),
dy=// M1
//*M1 // ^ theta-1
//*M1 // ^ theta-1
pow(M1,theta-1)
*(py*(M1+ theta*M2) - 2.0*qy*M1),
*(py*(M1+ theta*M2) - 2.0*qy*M1),
gy= dy/c,
gx= (dx - gy*b) / a;
// 3d gradient
sum[f->V(i)]+= ( (v1-v0) * gx + (v2-v0) * gy ) * data[f][3];
sum[f->V(i)]+= ( (v1-v0) * gx + (v2-v0) * gy ) * data[f][3];
}
}
max=0; // max displacement
max=0; // max displacement
speed=0.001;
for (VertexIterator v=Super::m.vert.begin(); v!=Super::m.vert.end(); v++)
if ( !Super::isFixed[v] ) //if (!v->IsB())
for (VertexIterator v=Super::m.vert.begin(); v!=Super::m.vert.end(); v++)
if ( !Super::isFixed[v] ) //if (!v->IsB())
{
ScalarType n=sum[v].Norm();
if ( n > 1 ) { sum[v]/=n; n=1.0;}
@ -298,17 +298,17 @@ public:
}
return max;
#undef v0
#undef v1
#undef v2
#undef v1
#undef v2
//printf("rejected %d\n",rejected);
}
void TargetCurrentGeometry(){
Super::isFixed.Start();
data.Start();
sum.Start();
totArea=0;
for (FaceIterator f=Super::m.face.begin(); f!=Super::m.face.end(); f++) {
double area2 = ((f->V(1)->P() - f->V(0)->P() )^(f->V(2)->P() - f->V(0)->P() )).Norm();
@ -322,7 +322,7 @@ public:
}
}
}
};
@ -333,12 +333,12 @@ public:
// returns false if any fold is present (faster than MarkFolds)
template<class MESH_TYPE>
bool IsFoldFree(MESH_TYPE &m){
assert(m.HasPerVertexTexture());
typedef typename MESH_TYPE::VertexType::TextureType::PointType PointType;
typedef typename MESH_TYPE::VertexType::TextureType::PointType::ScalarType ScalarType;
ScalarType lastsign=0;
for (typename MESH_TYPE::FaceIterator f=m.face.begin(); f!=m.face.end(); f++){
ScalarType sign=((f->V(1)->T().P()-f->V(0)->T().P()) ^ (f->V(2)->T().P()-f->V(0)->T().P()));
@ -354,16 +354,16 @@ bool IsFoldFree(MESH_TYPE &m){
// returns number of folded faces
template<class MESH_TYPE>
int MarkFolds(MESH_TYPE &m){
assert(m.HasPerVertexTexture());
assert(m.HasPerFaceQuality());
typedef typename MESH_TYPE::VertexType::TextureType::PointType PointType;
typedef typename MESH_TYPE::VertexType::TextureType::PointType::ScalarType ScalarType;
SimpleTempData<typename MESH_TYPE::FaceContainer, short> sign(m.face);
sign.Start(0);
// first pass, determine predominant sign
int npos=0, nneg=0;
ScalarType lastsign=0;
@ -372,7 +372,7 @@ int MarkFolds(MESH_TYPE &m){
if (fsign<0) { sign[f]=-1; nneg++; }
if (fsign>0) { sign[f]=+1; npos++; }
}
// second pass, detect folded faces
int res=0;
short gsign= (nneg>npos)?-1:+1;
@ -382,28 +382,28 @@ int MarkFolds(MESH_TYPE &m){
f->Q()=0;
} else f->Q()=1;
}
sign.Stop();
return res;
}
// Smooths texture coords.
// (can be useful to remove folds,
// (can be useful to remove folds,
// e.g. these created when obtaining tecture coordinates after projections)
template<class MESH_TYPE>
void SmoothTextureCoords(MESH_TYPE &m){
assert(m.HasPerVertexTexture());
typedef typename MESH_TYPE::VertexType::TextureType::PointType PointType;
SimpleTempData<typename MESH_TYPE::VertContainer, int> div(m.vert);
SimpleTempData<typename MESH_TYPE::VertContainer, PointType > sum(m.vert);
div.Start();
sum.Start();
for (typename MESH_TYPE::VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) {
sum[v].SetZero();
div[v]=0;
@ -415,13 +415,13 @@ void SmoothTextureCoords(MESH_TYPE &m){
div[f->V(2)] +=2; sum[f->V(2)] += f->V(1)->T().P(); sum[f->V(2)] += f->V(0)->T().P();
}
for (typename MESH_TYPE::VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) // if (!v->IsB())
for (typename MESH_TYPE::VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) // if (!v->IsB())
{
if (v->div>0) {
v->T().P() = sum[v]/div[v];
}
}
div.Stop();
sum.Stop();

View File

@ -23,6 +23,10 @@
#ifndef __VCG_TRI_UPDATE_FLAGS
#define __VCG_TRI_UPDATE_FLAGS
#include <vcg/simplex/face/pos.h>
#include <vcg/simplex/tetrahedron/pos.h>
#include <vcg/simplex/edge/pos.h>
namespace vcg {
namespace tri {
/// \ingroup trimesh

View File

@ -24,8 +24,13 @@
#ifndef __VCG_TRI_UPDATE_NORMALS
#define __VCG_TRI_UPDATE_NORMALS
#include <vcg/space/triangle3.h>
#include <vcg/complex/base.h>
#include <vcg/complex/algorithms/polygon_support.h>
#include "flag.h"
namespace vcg {
namespace tri {

View File

@ -23,6 +23,13 @@
#ifndef __VCG_TRI_UPDATE_SELECTION
#define __VCG_TRI_UPDATE_SELECTION
#include <deque>
#include <vcg/complex/base.h>
#include <vcg/simplex/face/topology.h>
#include "flag.h"
namespace vcg {
namespace tri {
/// \ingroup trimesh

View File

@ -24,6 +24,12 @@
#ifndef __VCG_TRI_UPDATE_TOPOLOGY
#define __VCG_TRI_UPDATE_TOPOLOGY
#include <cassert>
#include <vcg/complex/base.h>
#include <vcg/simplex/face/topology.h>
#include <vcg/simplex/edge/pos.h>
namespace vcg {
namespace tri {
/// \ingroup trimesh

View File

@ -23,9 +23,12 @@
#ifndef __VCGLIB_TRIALLOCATOR
#define __VCGLIB_TRIALLOCATOR
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#include <vector>
#include <set>
#include <vcg/container/simple_temporary_data.h>
#include "used_types.h"
namespace vcg {
namespace tri {

View File

@ -23,9 +23,8 @@
#ifndef __VCGLIB_APPEND
#define __VCGLIB_APPEND
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#include <vcg/complex/allocate.h>
#include <vcg/complex/algorithms/update/selection.h>
namespace vcg {
namespace tri {

View File

@ -20,12 +20,17 @@
* for more details. *
* *
****************************************************************************/
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#ifndef __VCG_COMPLEX_BASE
#define __VCG_COMPLEX_BASE
#include <typeindex>
#include <set>
#include <vcg/container/simple_temporary_data.h>
#include "used_types.h"
namespace vcg {
class PointerToAttribute
@ -596,7 +601,7 @@ template <class MeshType> inline bool IsMarked(const MeshType & m,typename MeshT
@param m the mesh containing the element
@param t tetra pointer */
template <class MeshType>
inline bool IsMarked(MeshType &m, typename MeshType::ConstTetraPointer t) { return t->cIMark() == m.imark; }
inline bool IsMarked(const MeshType &m, typename MeshType::ConstTetraPointer t) { return t->cIMark() == m.imark; }
/** \brief Set the vertex incremental mark of the vertex to the one of the mesh.
@param m the mesh containing the element

View File

@ -23,6 +23,9 @@
#ifndef __VCG_EXCEPTION_H
#define __VCG_EXCEPTION_H
#include <stdexcept>
#include <iostream>
namespace vcg
{
class MissingComponentException : public std::runtime_error

View File

@ -24,9 +24,7 @@
#ifndef VCG__FOREACH_H
#define VCG__FOREACH_H
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#include <vcg/simplex/face/pos.h>
namespace vcg {
namespace tri {

View File

@ -23,7 +23,6 @@
#ifndef VCG_USED_TYPES_H
#define VCG_USED_TYPES_H
#include <vcg/space/point3.h>
#include <vcg/space/box3.h>
#include <vcg/space/color4.h>
#include <vcg/math/shot.h>

View File

@ -20,11 +20,18 @@
* for more details. *
* *
****************************************************************************/
#include <vcg/complex/complex.h>
#ifndef __VCG_HEDGE_
#define __VCG_HEDGE_
#include <vector>
#include <string>
#include <vcg/complex/all_types.h>
#include <vcg/container/derivation_chain.h>
#include "hedge_component.h"
namespace vcg {
/*------------------------------------------------------------------*/

View File

@ -20,11 +20,14 @@
* for more details. *
* *
****************************************************************************/
#include <vcg/complex/complex.h>
#ifndef __VCG_HEDGE_COMPONENT
#define __VCG_HEDGE_COMPONENT
#include <cassert>
#include <vector>
#include <string>
namespace vcg {
namespace hedge {
/*

View File

@ -24,10 +24,11 @@
#ifndef __VCGLIB_SIMPLE__
#define __VCGLIB_SIMPLE__
#include <string.h>
#include <string>
#include <cstring>
#include <limits>
#include <vector>
#include <assert.h>
#include <cassert>
namespace vcg
{

View File

@ -566,7 +566,7 @@ bool Decompose(Matrix44<T> &M, Point3<T> &ScaleV, Point3<T> &ShearV, Point3<T> &
return false;
if(math::Abs(M.Determinant())<1e-10) return false; // matrix should be at least invertible...
// First Step recover the traslation
// First Step recover the translation
TranV=M.GetColumn3(3);
// Second Step Recover Scale and Shearing interleaved

View File

@ -207,7 +207,7 @@ public:
}
/* multiply the current reference frame for the matrix passed
note: it is up to the caller to check the the matrix passed is a pure rototraslation
note: it is up to the caller to check the the matrix passed is a pure rototranslation
*/
void MultMatrix( vcg::Matrix44<S> m44)
{
@ -218,7 +218,7 @@ public:
}
/* multiply the current reference frame for the similarity passed
note: it is up to the caller to check the the matrix passed is a pure rototraslation
note: it is up to the caller to check the the matrix passed is a pure rototranslation
*/
void MultSimilarity( const Similarity<S> & s){ MultMatrix(s.Matrix());}

View File

@ -20,11 +20,19 @@
* for more details. *
* *
****************************************************************************/
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#ifndef __VCG_EDGE_PLUS
#define __VCG_EDGE_PLUS
#include <cassert>
#include <string>
#include <vector>
#include <vcg/complex/all_types.h>
#include <vcg/container/derivation_chain.h>
#include "component.h"
namespace vcg {
/*------------------------------------------------------------------*/
/*

View File

@ -20,12 +20,17 @@
* for more details. *
* *
****************************************************************************/
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#ifndef __VCG_EDGE_PLUS_COMPONENT
#define __VCG_EDGE_PLUS_COMPONENT
#include <cassert>
#include <vector>
#include <string>
#include <vcg/space/color4.h>
namespace vcg {
namespace edge {

View File

@ -24,6 +24,8 @@
#ifndef __VCG_EDGE_POS
#define __VCG_EDGE_POS
#include <cassert>
namespace vcg {
namespace edge {

View File

@ -24,6 +24,12 @@
#ifndef _VCG_EDGE_TOPOLOGY
#define _VCG_EDGE_TOPOLOGY
#include <vector>
#include <vcg/complex/allocate.h>
#include "pos.h"
#include "component.h"
namespace vcg {
namespace edge {
/** \addtogroup edge */

View File

@ -20,12 +20,18 @@
* for more details. *
* *
****************************************************************************/
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#ifndef __VCG_FACE_PLUS
#define __VCG_FACE_PLUS
#include <vector>
#include <string>
#include <vcg/complex/all_types.h>
#include <vcg/container/derivation_chain.h>
#include "component.h"
namespace vcg {
/*------------------------------------------------------------------*/
@ -163,16 +169,16 @@ public:
/// select the Face
void SetS() {this->Flags() |=SELECTED;}
/// Un-select a Face
void ClearS() {this->Flags() &= ~SELECTED;}
void ClearS() {this->Flags() &= ~SELECTED;}
/// select the Face
void SetV() {this->Flags() |=VISITED;}
/// Un-select a Face
void ClearV() {this->Flags() &= ~VISITED;}
void ClearV() {this->Flags() &= ~VISITED;}
/// This function checks if the face is selected
bool IsB(int i) const {return (this->cFlags() & (BORDER0<<i)) != 0;}
/// This function select the face
void SetB(int i) {this->Flags() |=(BORDER0<<i);}
void SetB(int i) {this->Flags() |=(BORDER0<<i);}
/// This funcion execute the inverse operation of SetS()
void ClearB(int i) {this->Flags() &= (~(BORDER0<<i));}

View File

@ -20,12 +20,16 @@
* for more details. *
* *
****************************************************************************/
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#ifndef __VCG_FACE_PLUS_COMPONENT
#define __VCG_FACE_PLUS_COMPONENT
#include <cassert>
#include <vector>
#include <string>
#include <vcg/space/color4.h>
#include <vcg/space/texcoord2.h>
namespace vcg {
namespace face {
@ -36,15 +40,15 @@ namespace face {
template <class T> class EmptyCore: public T {
public:
inline typename T::VertexType * &V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * cV( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * &FVp( const int i ) { return this->V(i); }
inline typename T::VertexType * FVp( const int i ) const { return this->cV(i); }
inline typename T::VertexType * cFVp( const int i ) const { return this->cV(i); }
inline typename T::CoordType &P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::CoordType P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::CoordType cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::VertexType * &V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
inline const typename T::VertexType * V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline const typename T::VertexType * cV( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * &FVp( const int i ) { return this->V(i); }
inline const typename T::VertexType * FVp( const int i ) const { return this->cV(i); }
inline const typename T::VertexType * cFVp( const int i ) const { return this->cV(i); }
inline typename T::CoordType &P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::CoordType P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline typename T::CoordType cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
static bool HasVertexRef() { return false; }
static bool HasFVAdjacency() { return false; }
@ -196,7 +200,7 @@ public:
inline typename T::VertexType * &V( const int j ) { assert(j>=0 && j<3); return v[j]; } /// \brief The pointer to the i-th vertex
inline const typename T::VertexType * V (const int j) const { assert(j>=0 && j<3); return v[j]; }
inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
inline const typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
inline CoordType &P( const int j ) { assert(j>=0 && j<3); return v[j]->P(); } /// \brief Shortcut: the position of the i-th vertex (equivalent to \c V(i)->P() )
inline const CoordType &P( const int j ) const { assert(j>=0 && j<3); return v[j]->P(); }
@ -208,9 +212,9 @@ public:
inline const typename T::VertexType * V0( const int j ) const { return V(j);} /** \brief Return the pointer to the j-th vertex of the face. */
inline const typename T::VertexType * V1( const int j ) const { return V((j+1)%3);} /** \brief Return the pointer to the ((j+1)%3)-th vertex of the face. */
inline const typename T::VertexType * V2( const int j ) const { return V((j+2)%3);} /** \brief Return the pointer to the ((j+2)%3)-th vertex of the face. */
inline typename T::VertexType * cV0( const int j ) const { return cV(j);}
inline typename T::VertexType * cV1( const int j ) const { return cV((j+1)%3);}
inline typename T::VertexType * cV2( const int j ) const { return cV((j+2)%3);}
inline const typename T::VertexType * cV0( const int j ) const { return cV(j);}
inline const typename T::VertexType * cV1( const int j ) const { return cV((j+1)%3);}
inline const typename T::VertexType * cV2( const int j ) const { return cV((j+2)%3);}
inline CoordType & P0( const int j ) { return V(j)->P();}
inline CoordType & P1( const int j ) { return V((j+1)%3)->P();}

View File

@ -26,9 +26,6 @@ OCC = Optional Component Compact
compare with OCF(Optional Component Fast)
*/
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#ifndef __VCG_FACE_PLUS_COMPONENT_OCC
#define __VCG_FACE_PLUS_COMPONENT_OCC

View File

@ -22,9 +22,12 @@
****************************************************************************/
#ifndef __VCG_FACE_PLUS_COMPONENT_OCF
#define __VCG_FACE_PLUS_COMPONENT_OCF
#ifndef __VCG_MESH
#error "This file should not be included alone. It is automatically included by complex.h"
#endif
#include <vector>
#include <string>
#include <vcg/space/color4.h>
#include <vcg/space/texcoord2.h>
namespace vcg {
namespace face {

Some files were not shown because too many files have changed in this diff Show More