Merge branch 'devel' of https://github.com/cnr-isti-vclab/vcglib into devel
This commit is contained in:
commit
42abe0a955
|
@ -1,12 +1,12 @@
|
||||||
name: BuildSamplesUbuntu
|
name: BuildExamplesLinux
|
||||||
|
|
||||||
on:
|
on:
|
||||||
[push, pull_request]
|
[push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ubuntu_build_tests:
|
ubuntu_build_tests:
|
||||||
name: Build Samples (Ubuntu)
|
name: Build Examples (Linux)
|
||||||
runs-on: ubuntu-latest #in order to deploy, need to use oldest supported version
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
@ -14,5 +14,7 @@ jobs:
|
||||||
uses: jurplel/install-qt-action@v2
|
uses: jurplel/install-qt-action@v2
|
||||||
- name: Build Samples
|
- name: Build Samples
|
||||||
run: |
|
run: |
|
||||||
qmake apps/sample/sample.pro
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DVCG_BUILD_EXAMPLES=ON ..
|
||||||
make -j4
|
make -j4
|
|
@ -1,11 +1,11 @@
|
||||||
name: BuildSamplesMacOS
|
name: BuildExamplesMacOS
|
||||||
|
|
||||||
on:
|
on:
|
||||||
[push, pull_request]
|
[push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
macos_build_tests:
|
macos_build_tests:
|
||||||
name: Build Samples (MacOS)
|
name: Build Examples (MacOS)
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -14,5 +14,7 @@ jobs:
|
||||||
uses: jurplel/install-qt-action@v2
|
uses: jurplel/install-qt-action@v2
|
||||||
- name: Build Samples
|
- name: Build Samples
|
||||||
run: |
|
run: |
|
||||||
qmake apps/sample/sample.pro
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -DVCG_BUILD_EXAMPLES=ON ..
|
||||||
make -j4
|
make -j4
|
|
@ -1,10 +1,10 @@
|
||||||
name: BuildSamplesWindows
|
name: BuildExamplesWindows
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows_build_tests:
|
windows_build_tests:
|
||||||
name: Build Samples (Windows)
|
name: Build Examples (Windows)
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -25,5 +25,7 @@ jobs:
|
||||||
uses: jurplel/install-qt-action@v2
|
uses: jurplel/install-qt-action@v2
|
||||||
- name: Build Samples
|
- name: Build Samples
|
||||||
run: |
|
run: |
|
||||||
qmake apps/sample/sample.pro
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -G "NMake Makefiles" -DVCG_BUILD_EXAMPLES=ON ..
|
||||||
jom -j4
|
jom -j4
|
|
@ -0,0 +1,303 @@
|
||||||
|
# Copyright 2019, 2020, Collabora, Ltd.
|
||||||
|
# Copyright 2019, 2021, Visual Computing Lab, ISTI - Italian National Research Council
|
||||||
|
# SPDX-License-Identifier: BSL-1.0
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
|
project(VCGLib)
|
||||||
|
|
||||||
|
# Eigen options
|
||||||
|
option(ALLOW_BUNDLED_EIGEN "Allow use of bundled Eigen source" ON)
|
||||||
|
option(ALLOW_SYSTEM_EIGEN "Allow use of system-provided Eigen" ON)
|
||||||
|
|
||||||
|
# VCG options
|
||||||
|
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)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
### Build settings
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
|
### Eigen
|
||||||
|
set(VCG_EIGEN_DIR ${CMAKE_CURRENT_LIST_DIR}/eigenlib)
|
||||||
|
|
||||||
|
if(ALLOW_SYSTEM_EIGEN AND EIGEN3_INCLUDE_DIR)
|
||||||
|
message(STATUS "- Eigen - using system-provided library")
|
||||||
|
set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
|
||||||
|
elseif(ALLOW_BUNDLED_EIGEN AND EXISTS "${VCG_EIGEN_DIR}/Eigen/Eigen")
|
||||||
|
message(STATUS "- Eigen - using bundled source")
|
||||||
|
set(EIGEN_INCLUDE_DIRS ${VCG_EIGEN_DIR})
|
||||||
|
else()
|
||||||
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"Eigen is required - at least one of ALLOW_SYSTEM_EIGEN or ALLOW_BUNDLED_EIGEN must be enabled and found.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
### VCGLib headers and sources
|
||||||
|
|
||||||
|
set(VCG_HEADERS
|
||||||
|
vcg/complex/append.h
|
||||||
|
vcg/complex/all_types.h
|
||||||
|
vcg/complex/complex.h
|
||||||
|
vcg/complex/allocate.h
|
||||||
|
vcg/complex/exception.h
|
||||||
|
vcg/complex/algorithms/overlap_estimation.h
|
||||||
|
vcg/complex/algorithms/dual_meshing.h
|
||||||
|
vcg/complex/algorithms/intersection.h
|
||||||
|
vcg/complex/algorithms/clip.h
|
||||||
|
vcg/complex/algorithms/geodesic.h
|
||||||
|
vcg/complex/algorithms/parametrization/poisson_solver.h
|
||||||
|
vcg/complex/algorithms/parametrization/uv_utils.h
|
||||||
|
vcg/complex/algorithms/parametrization/distortion.h
|
||||||
|
vcg/complex/algorithms/parametrization/tangent_field_operators.h
|
||||||
|
vcg/complex/algorithms/parametrization/voronoi_atlas.h
|
||||||
|
vcg/complex/algorithms/edge_collapse.h
|
||||||
|
vcg/complex/algorithms/hole.h
|
||||||
|
vcg/complex/algorithms/align_pair.h
|
||||||
|
vcg/complex/algorithms/closest.h
|
||||||
|
vcg/complex/algorithms/tetra_implicit_smooth.h
|
||||||
|
vcg/complex/algorithms/bitquad_support.h
|
||||||
|
vcg/complex/algorithms/skeleton.h
|
||||||
|
vcg/complex/algorithms/symmetry.h
|
||||||
|
vcg/complex/algorithms/voronoi_volume_sampling.h
|
||||||
|
vcg/complex/algorithms/polygon_polychord_collapse.h
|
||||||
|
vcg/complex/algorithms/inside.h
|
||||||
|
vcg/complex/algorithms/local_optimization/tri_edge_flip.h
|
||||||
|
vcg/complex/algorithms/local_optimization/quad_diag_collapse.h
|
||||||
|
vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric.h
|
||||||
|
vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric_tex.h
|
||||||
|
vcg/complex/algorithms/local_optimization/tri_edge_collapse.h
|
||||||
|
vcg/complex/algorithms/local_optimization/tetra_edge_collapse.h
|
||||||
|
vcg/complex/algorithms/polygonal_algorithms.h
|
||||||
|
vcg/complex/algorithms/inertia.h
|
||||||
|
vcg/complex/algorithms/mesh_assert.h
|
||||||
|
vcg/complex/algorithms/cut_tree.h
|
||||||
|
vcg/complex/algorithms/nring.h
|
||||||
|
vcg/complex/algorithms/tetra/tetfuse_collapse.h
|
||||||
|
vcg/complex/algorithms/stat.h
|
||||||
|
vcg/complex/algorithms/ransac_matching.h
|
||||||
|
vcg/complex/algorithms/refine.h
|
||||||
|
vcg/complex/algorithms/outline_support.h
|
||||||
|
vcg/complex/algorithms/convex_hull.h
|
||||||
|
vcg/complex/algorithms/clean.h
|
||||||
|
vcg/complex/algorithms/mesh_to_matrix.h
|
||||||
|
vcg/complex/algorithms/quadrangulator.h
|
||||||
|
vcg/complex/algorithms/isotropic_remeshing.h
|
||||||
|
vcg/complex/algorithms/smooth.h
|
||||||
|
vcg/complex/algorithms/autoalign_4pcs.h
|
||||||
|
vcg/complex/algorithms/local_optimization.h
|
||||||
|
vcg/complex/algorithms/curve_on_manifold.h
|
||||||
|
vcg/complex/algorithms/clustering.h
|
||||||
|
vcg/complex/algorithms/refine_loop.h
|
||||||
|
vcg/complex/algorithms/cylinder_clipping.h
|
||||||
|
vcg/complex/algorithms/pointcloud_normal.h
|
||||||
|
vcg/complex/algorithms/bitquad_creation.h
|
||||||
|
vcg/complex/algorithms/crease_cut.h
|
||||||
|
vcg/complex/algorithms/implicit_smooth.h
|
||||||
|
vcg/complex/algorithms/voronoi_remesher.h
|
||||||
|
vcg/complex/algorithms/polygon_support.h
|
||||||
|
vcg/complex/algorithms/point_sampling.h
|
||||||
|
vcg/complex/algorithms/create/mc_lookup_table.h
|
||||||
|
vcg/complex/algorithms/create/mc_trivial_walker.h
|
||||||
|
vcg/complex/algorithms/create/extrude.h
|
||||||
|
vcg/complex/algorithms/create/resampler.h
|
||||||
|
vcg/complex/algorithms/create/ball_pivoting.h
|
||||||
|
vcg/complex/algorithms/create/readme.txt
|
||||||
|
vcg/complex/algorithms/create/zonohedron.h
|
||||||
|
vcg/complex/algorithms/create/platonic.h
|
||||||
|
vcg/complex/algorithms/create/marching_cubes.h
|
||||||
|
vcg/complex/algorithms/create/plymc/voxel.h
|
||||||
|
vcg/complex/algorithms/create/plymc/simplemeshprovider.h
|
||||||
|
vcg/complex/algorithms/create/plymc/tri_edge_collapse_mc.h
|
||||||
|
vcg/complex/algorithms/create/plymc/volume.h
|
||||||
|
vcg/complex/algorithms/create/plymc/plymc.h
|
||||||
|
vcg/complex/algorithms/create/plymc/svoxel.h
|
||||||
|
vcg/complex/algorithms/create/tetramesh_support.h
|
||||||
|
vcg/complex/algorithms/create/advancing_front.h
|
||||||
|
vcg/complex/algorithms/textcoord_optimization.h
|
||||||
|
vcg/complex/algorithms/bitquad_optimization.h
|
||||||
|
vcg/complex/algorithms/halfedge_quad_clean.h
|
||||||
|
vcg/complex/algorithms/voronoi_processing.h
|
||||||
|
vcg/complex/algorithms/update/quality.h
|
||||||
|
vcg/complex/algorithms/update/selection.h
|
||||||
|
vcg/complex/algorithms/update/fitmaps.h
|
||||||
|
vcg/complex/algorithms/update/component_ep.h
|
||||||
|
vcg/complex/algorithms/update/texture.h
|
||||||
|
vcg/complex/algorithms/update/curvature_fitting.h
|
||||||
|
vcg/complex/algorithms/update/normal.h
|
||||||
|
vcg/complex/algorithms/update/position.h
|
||||||
|
vcg/complex/algorithms/update/halfedge_topology.h
|
||||||
|
vcg/complex/algorithms/update/topology.h
|
||||||
|
vcg/complex/algorithms/update/flag.h
|
||||||
|
vcg/complex/algorithms/update/bounding.h
|
||||||
|
vcg/complex/algorithms/update/halfedge_indexed.h
|
||||||
|
vcg/complex/algorithms/update/color.h
|
||||||
|
vcg/complex/algorithms/update/curvature.h
|
||||||
|
vcg/complex/algorithms/point_outlier.h
|
||||||
|
vcg/complex/algorithms/harmonic.h
|
||||||
|
vcg/complex/algorithms/point_matching_scale.h
|
||||||
|
vcg/complex/algorithms/attribute_seam.h
|
||||||
|
vcg/complex/foreach.h
|
||||||
|
vcg/complex/base.h
|
||||||
|
vcg/complex/used_types.h
|
||||||
|
vcg/container/entries_allocation_table.h
|
||||||
|
vcg/container/container_allocation_table.h
|
||||||
|
vcg/container/derivation_chain.h
|
||||||
|
vcg/container/vector_occ.h
|
||||||
|
vcg/container/simple_temporary_data.h
|
||||||
|
vcg/space/segment2.h
|
||||||
|
vcg/space/fitting3.h
|
||||||
|
vcg/space/tetra3.h
|
||||||
|
vcg/space/triangle2.h
|
||||||
|
vcg/space/ray2.h
|
||||||
|
vcg/space/deprecated_point2.h
|
||||||
|
vcg/space/point4.h
|
||||||
|
vcg/space/box2.h
|
||||||
|
vcg/space/ray3.h
|
||||||
|
vcg/space/planar_polygon_tessellation.h
|
||||||
|
vcg/space/texcoord2.h
|
||||||
|
vcg/space/deprecated_point3.h
|
||||||
|
vcg/space/intersection/triangle_triangle3.h
|
||||||
|
vcg/space/distance2.h
|
||||||
|
vcg/space/point3.h
|
||||||
|
vcg/space/deprecated_point.h
|
||||||
|
vcg/space/space.h
|
||||||
|
vcg/space/point.h
|
||||||
|
vcg/space/colorspace.h
|
||||||
|
vcg/space/rect_packer.h
|
||||||
|
vcg/space/triangle3.h
|
||||||
|
vcg/space/obox3.h
|
||||||
|
vcg/space/point2.h
|
||||||
|
vcg/space/smallest_enclosing.h
|
||||||
|
vcg/space/color4.h
|
||||||
|
vcg/space/polygon3.h
|
||||||
|
vcg/space/line3.h
|
||||||
|
vcg/space/index/octree.h
|
||||||
|
vcg/space/index/grid_util2d.h
|
||||||
|
vcg/space/index/grid_closest.h
|
||||||
|
vcg/space/index/grid_static_ptr.h
|
||||||
|
vcg/space/index/grid_util.h
|
||||||
|
vcg/space/index/spatial_hashing.h
|
||||||
|
vcg/space/index/closest2d.h
|
||||||
|
vcg/space/index/grid_static_obj.h
|
||||||
|
vcg/space/index/kdtree/kdtree.h
|
||||||
|
vcg/space/index/kdtree/priorityqueue.h
|
||||||
|
vcg/space/index/kdtree/kdtree_face.h
|
||||||
|
vcg/space/index/kdtree/mlsutils.h
|
||||||
|
vcg/space/index/octree_template.h
|
||||||
|
vcg/space/index/aabb_binary_tree/kclosest.h
|
||||||
|
vcg/space/index/aabb_binary_tree/closest.h
|
||||||
|
vcg/space/index/aabb_binary_tree/ray.h
|
||||||
|
vcg/space/index/aabb_binary_tree/frustum_cull.h
|
||||||
|
vcg/space/index/aabb_binary_tree/aabb_binary_tree.h
|
||||||
|
vcg/space/index/aabb_binary_tree/base.h
|
||||||
|
vcg/space/index/grid_closest2d.h
|
||||||
|
vcg/space/index/spatial_hashing2d.h
|
||||||
|
vcg/space/index/space_iterators.h
|
||||||
|
vcg/space/index/grid_static_ptr2d.h
|
||||||
|
vcg/space/index/base2d.h
|
||||||
|
vcg/space/index/base.h
|
||||||
|
vcg/space/index/perfect_spatial_hashing.h
|
||||||
|
vcg/space/index/space_iterators2d.h
|
||||||
|
vcg/space/line2.h
|
||||||
|
vcg/space/point_matching.h
|
||||||
|
vcg/space/intersection3.h
|
||||||
|
vcg/space/deprecated_point4.h
|
||||||
|
vcg/space/rasterized_outline2_packer.h
|
||||||
|
vcg/space/box.h
|
||||||
|
vcg/space/plane3.h
|
||||||
|
vcg/space/outline2_packer.h
|
||||||
|
vcg/space/segment3.h
|
||||||
|
vcg/space/intersection2.h
|
||||||
|
vcg/space/sphere3.h
|
||||||
|
vcg/space/box3.h
|
||||||
|
vcg/space/distance3.h
|
||||||
|
vcg/math/quadric5.h
|
||||||
|
vcg/math/factorial.h
|
||||||
|
vcg/math/eigen_matrix_addons.h
|
||||||
|
vcg/math/quadric.h
|
||||||
|
vcg/math/perlin_noise.h
|
||||||
|
vcg/math/shot.h
|
||||||
|
vcg/math/spherical_harmonics.h
|
||||||
|
vcg/math/eigen_matrixbase_addons.h
|
||||||
|
vcg/math/quaternion.h
|
||||||
|
vcg/math/similarity.h
|
||||||
|
vcg/math/disjoint_set.h
|
||||||
|
vcg/math/random_generator.h
|
||||||
|
vcg/math/camera.h
|
||||||
|
vcg/math/linear.h
|
||||||
|
vcg/math/matrix44.h
|
||||||
|
vcg/math/eigen.h
|
||||||
|
vcg/math/old_lin_algebra.h
|
||||||
|
vcg/math/similarity2.h
|
||||||
|
vcg/math/gen_normal.h
|
||||||
|
vcg/math/old_matrix44.h
|
||||||
|
vcg/math/old_deprecated_matrix.h
|
||||||
|
vcg/math/old_matrix33.h
|
||||||
|
vcg/math/polar_decomposition.h
|
||||||
|
vcg/math/base.h
|
||||||
|
vcg/math/histogram.h
|
||||||
|
vcg/math/legendre.h
|
||||||
|
vcg/math/matrix33.h
|
||||||
|
vcg/math/old_matrix.h
|
||||||
|
vcg/simplex/edge/distance.h
|
||||||
|
vcg/simplex/edge/topology.h
|
||||||
|
vcg/simplex/edge/pos.h
|
||||||
|
vcg/simplex/edge/component.h
|
||||||
|
vcg/simplex/edge/base.h
|
||||||
|
vcg/simplex/tetrahedron/tetrahedron.h
|
||||||
|
vcg/simplex/tetrahedron/topology.h
|
||||||
|
vcg/simplex/tetrahedron/pos.h
|
||||||
|
vcg/simplex/tetrahedron/component.h
|
||||||
|
vcg/simplex/tetrahedron/base.h
|
||||||
|
vcg/simplex/face/component_occ.h
|
||||||
|
vcg/simplex/face/component_ep.h
|
||||||
|
vcg/simplex/face/jumping_pos.h
|
||||||
|
vcg/simplex/face/distance.h
|
||||||
|
vcg/simplex/face/component_polygon.h
|
||||||
|
vcg/simplex/face/topology.h
|
||||||
|
vcg/simplex/face/pos.h
|
||||||
|
vcg/simplex/face/component.h
|
||||||
|
vcg/simplex/face/component_ocf.h
|
||||||
|
vcg/simplex/face/base.h
|
||||||
|
vcg/simplex/vertex/component_occ.h
|
||||||
|
vcg/simplex/vertex/component_sph.h
|
||||||
|
vcg/simplex/vertex/distance.h
|
||||||
|
vcg/simplex/vertex/component.h
|
||||||
|
vcg/simplex/vertex/component_ocf.h
|
||||||
|
vcg/simplex/vertex/base.h
|
||||||
|
vcg/connectors/halfedge_pos.h
|
||||||
|
vcg/connectors/hedge.h
|
||||||
|
vcg/connectors/hedge_component.h
|
||||||
|
|
||||||
|
#wrap
|
||||||
|
wrap/callback.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
)
|
||||||
|
|
||||||
|
if (VCG_HEADER_ONLY)
|
||||||
|
add_library(vcglib INTERFACE)
|
||||||
|
target_include_directories(
|
||||||
|
vcglib INTERFACE
|
||||||
|
${CMAKE_CURRENT_LIST_DIR}
|
||||||
|
${EIGEN_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
#just to show headers in ide
|
||||||
|
add_custom_target(vcglib_ide SOURCES ${VCG_HEADERS})
|
||||||
|
else()
|
||||||
|
#TODO make vcglib that includes all the wrap sources, checking everytime
|
||||||
|
# if the the required targets (e.g. qt, gl, glew...) exists
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(VCG_BUILD_EXAMPLES)
|
||||||
|
#TODO make the list of samples to build
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/apps)
|
||||||
|
endif()
|
15
README.md
15
README.md
|
@ -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.
|
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.
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
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.
|
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
|
- 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.
|
- 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
|
## Contacts
|
||||||
|
|
||||||
For any info about licensing (portion of) the library please contact us:
|
For any info about licensing (portion of) the library please contact us:
|
||||||
Paolo Cignoni (p.cignoni@isti.cnr.it)
|
Paolo Cignoni (p.cignoni@isti.cnr.it)
|
||||||
Visual Computing Lab of the Italian National Research Council - ISTI
|
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) .
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
project(VCGApps)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
|
add_subdirectory(sample)
|
||||||
include_directories(../)
|
|
||||||
include_directories(../eigenlib)
|
|
||||||
add_subdirectory(metro)
|
add_subdirectory(metro)
|
||||||
add_subdirectory(tridecimator)
|
add_subdirectory(tridecimator)
|
||||||
|
|
|
@ -67,7 +67,7 @@ class GLArea:public QGLWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GLArea (QWidget * parent = 0);
|
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};
|
enum DrawMode{SMOOTH=0,POINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
|
||||||
public slots:
|
public slots:
|
||||||
/// widget-based user interaction slots
|
/// widget-based user interaction slots
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
~GLArea();
|
~GLArea();
|
||||||
void resetTrackBall();
|
void resetTrackBall();
|
||||||
//unsigned int getId() const {return areaid;}
|
//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:
|
signals:
|
||||||
/// signal for setting the statusbar message
|
/// signal for setting the statusbar message
|
||||||
|
|
|
@ -75,7 +75,7 @@ vcg::Trackball track;
|
||||||
/// window size
|
/// window size
|
||||||
int width,height;
|
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};
|
enum DrawMode{SMOOTH=0,PERPOINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
|
||||||
|
|
||||||
/// the current drawmode
|
/// the current drawmode
|
||||||
|
|
|
@ -1,2 +1,17 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project (metro)
|
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
|
||||||
|
)
|
||||||
|
|
|
@ -112,7 +112,7 @@ template<class TriMeshType>
|
||||||
// ALNParser::ParseALN(rmaps, alnName);
|
// ALNParser::ParseALN(rmaps, alnName);
|
||||||
|
|
||||||
// for(size_t i=0; i<rmaps.size(); i++)
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -60,4 +60,4 @@ SUBDIRS = \
|
||||||
trimesh_voronoi \
|
trimesh_voronoi \
|
||||||
trimesh_voronoiatlas \
|
trimesh_voronoiatlas \
|
||||||
trimesh_voronoiclustering \
|
trimesh_voronoiclustering \
|
||||||
trimesh_voronoisampling \
|
trimesh_voronoisampling
|
||||||
|
|
|
@ -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
|
||||||
|
)
|
|
@ -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()
|
|
@ -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()
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -1,8 +1,16 @@
|
||||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
project(trimesh_base)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
|
if (VCG_HEADER_ONLY)
|
||||||
project (trimesh_base)
|
set(SOURCES
|
||||||
add_executable(trimesh_base trimesh_base.cpp)
|
trimesh_base.cpp)
|
||||||
include_directories(../../..)
|
endif()
|
||||||
include_directories(../../../eigenlib)
|
|
||||||
|
add_executable(trimesh_base
|
||||||
|
${SOURCES})
|
||||||
|
|
||||||
|
target_link_libraries(
|
||||||
|
trimesh_base
|
||||||
|
PUBLIC
|
||||||
|
vcglib
|
||||||
|
)
|
||||||
|
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -1,3 +1,8 @@
|
||||||
include(../common.pri)
|
include(../common.pri)
|
||||||
TARGET = trimesh_sampling
|
TARGET = trimesh_sampling
|
||||||
SOURCES += trimesh_sampling.cpp
|
SOURCES += trimesh_sampling.cpp
|
||||||
|
|
||||||
|
# Awful..
|
||||||
|
win32{
|
||||||
|
DEFINES += NOMINMAX
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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()
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -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
|
||||||
|
)
|
|
@ -1,2 +1,17 @@
|
||||||
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project (tridecimator)
|
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
|
||||||
|
)
|
||||||
|
|
|
@ -168,6 +168,7 @@ public:
|
||||||
typedef CleanMeshType MeshType;
|
typedef CleanMeshType MeshType;
|
||||||
typedef typename MeshType::VertexType VertexType;
|
typedef typename MeshType::VertexType VertexType;
|
||||||
typedef typename MeshType::VertexPointer VertexPointer;
|
typedef typename MeshType::VertexPointer VertexPointer;
|
||||||
|
typedef typename MeshType::ConstVertexPointer ConstVertexPointer;
|
||||||
typedef typename MeshType::VertexIterator VertexIterator;
|
typedef typename MeshType::VertexIterator VertexIterator;
|
||||||
typedef typename MeshType::ConstVertexIterator ConstVertexIterator;
|
typedef typename MeshType::ConstVertexIterator ConstVertexIterator;
|
||||||
typedef typename MeshType::EdgeIterator EdgeIterator;
|
typedef typename MeshType::EdgeIterator EdgeIterator;
|
||||||
|
@ -941,20 +942,28 @@ public:
|
||||||
* as a intuitive proof think to a internal vertex that is collapsed onto a border of a polygon:
|
* as a intuitive proof think to a internal vertex that is collapsed onto a border of a polygon:
|
||||||
* it deletes 2 faces, 1 faux edges and 1 vertex so to keep the balance you have to add back the removed vertex.
|
* it deletes 2 faces, 1 faux edges and 1 vertex so to keep the balance you have to add back the removed vertex.
|
||||||
*/
|
*/
|
||||||
static int CountBitLargePolygons(MeshType &m)
|
static int CountBitLargePolygons(const MeshType &m)
|
||||||
{
|
{
|
||||||
tri::RequirePerFaceFlags(m);
|
//note - using unordered_map to set visited vertices because
|
||||||
UpdateFlags<MeshType>::VertexSetV(m);
|
//the mesh is const (before, the function used vertex flags...).
|
||||||
|
//could be used std::vector<bool> if the vertex has the Index()
|
||||||
|
//member function...
|
||||||
|
std::unordered_map<ConstVertexPointer, bool> vertVisited;
|
||||||
|
for (ConstVertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
|
||||||
|
if (!vi->IsD()) vertVisited[&(*vi)] = true;
|
||||||
|
|
||||||
// First loop Clear all referenced vertices
|
// First loop Clear all referenced vertices
|
||||||
for (FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
|
for (ConstFaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
|
||||||
if (!fi->IsD())
|
if (!fi->IsD())
|
||||||
for(int i=0;i<3;++i) fi->V(i)->ClearV();
|
for(int i=0;i<3;++i){
|
||||||
|
vertVisited[fi->V(i)] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Second Loop, count (twice) faux edges and mark all vertices touched by non faux edges
|
// Second Loop, count (twice) faux edges and mark all vertices touched by non faux edges
|
||||||
// (e.g vertexes on the boundary of a polygon)
|
// (e.g vertexes on the boundary of a polygon)
|
||||||
int countE = 0;
|
int countE = 0;
|
||||||
for (FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
|
for (ConstFaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
|
||||||
if (!fi->IsD()) {
|
if (!fi->IsD()) {
|
||||||
for(int i=0;i<3;++i)
|
for(int i=0;i<3;++i)
|
||||||
{
|
{
|
||||||
|
@ -962,16 +971,16 @@ public:
|
||||||
countE++;
|
countE++;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fi->V0(i)->SetV();
|
vertVisited[fi->V0(i)] = true;
|
||||||
fi->V1(i)->SetV();
|
vertVisited[fi->V1(i)] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Third Loop, count the number of referenced vertexes that are completely surrounded by faux edges.
|
// Third Loop, count the number of referenced vertexes that are completely surrounded by faux edges.
|
||||||
|
|
||||||
int countV = 0;
|
int countV = 0;
|
||||||
for (VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
|
for (ConstVertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
|
||||||
if (!vi->IsD() && !vi->IsV()) countV++;
|
if (!vi->IsD() && !(vertVisited[&(*vi)])) countV++;
|
||||||
|
|
||||||
return m.fn - countE/2 + countV ;
|
return m.fn - countE/2 + countV ;
|
||||||
}
|
}
|
||||||
|
@ -1520,7 +1529,7 @@ public:
|
||||||
std::vector< VertexPointer > minVertVec;
|
std::vector< VertexPointer > minVertVec;
|
||||||
std::vector< VertexPointer > maxVertVec;
|
std::vector< VertexPointer > maxVertVec;
|
||||||
|
|
||||||
// The set of directions to be choosen
|
// The set of directions to be chosen
|
||||||
std::vector< CoordType > dirVec;
|
std::vector< CoordType > dirVec;
|
||||||
dirVec.push_back(CoordType(1,0,0));
|
dirVec.push_back(CoordType(1,0,0));
|
||||||
dirVec.push_back(CoordType(0,1,0));
|
dirVec.push_back(CoordType(0,1,0));
|
||||||
|
|
|
@ -235,19 +235,19 @@ public:
|
||||||
ScalarT cotB = 0;
|
ScalarT cotB = 0;
|
||||||
|
|
||||||
// Get the edge (a pair of vertices)
|
// Get the edge (a pair of vertices)
|
||||||
VertexType * v0 = f.cV(edge);
|
const VertexType * v0 = f.cV(edge);
|
||||||
VertexType * v1 = f.cV((edge+1)%f.VN());
|
const VertexType * v1 = f.cV((edge+1)%f.VN());
|
||||||
|
|
||||||
if (fp != NULL &&
|
if (fp != NULL &&
|
||||||
fp != &f)
|
fp != &f)
|
||||||
{
|
{
|
||||||
// not a border edge
|
// 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);
|
ScalarT angleB = ComputeAngle<ScalarT>(v0, vb, v1);
|
||||||
cotB = vcg::math::Cos(angleB) / vcg::math::Sin(angleB);
|
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);
|
ScalarT angleA = ComputeAngle<ScalarT>(v0, va, v1);
|
||||||
cotA = vcg::math::Cos(angleA) / vcg::math::Sin(angleA);
|
cotA = vcg::math::Cos(angleA) / vcg::math::Sin(angleA);
|
||||||
|
|
||||||
|
|
|
@ -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])))
|
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++;
|
incidentFeatures++;
|
||||||
CoordType movingEdgeVector0 = (faces[i]->cP1(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
|
CoordType movingEdgeVector0 = (faces[i]->cP1(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
|
||||||
if (std::fabs(movingEdgeVector0 * dEdgeVector) < .9f || !p.IsEdgeS())
|
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])))
|
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++;
|
incidentFeatures++;
|
||||||
CoordType movingEdgeVector1 = (faces[i]->cP2(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
|
CoordType movingEdgeVector1 = (faces[i]->cP2(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
|
||||||
if (std::fabs(movingEdgeVector1 * dEdgeVector) < .9f || !p.IsEdgeS())
|
if (std::fabs(movingEdgeVector1 * dEdgeVector) < .9f || !p.IsEdgeS())
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
#ifndef __VCGLIB_MESH_ASSERT
|
#ifndef __VCGLIB_MESH_ASSERT
|
||||||
#define __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 vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -96,11 +96,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
///calculate the BBox in UV space
|
///calculate the BBox in UV space
|
||||||
static vcg::Box2<ScalarType> PerVertUVBox(MeshType &m)
|
static vcg::Box2<ScalarType> PerVertUVBox(const MeshType &m)
|
||||||
{
|
{
|
||||||
vcg::Box2<ScalarType> UVBox;
|
vcg::Box2<ScalarType> UVBox;
|
||||||
VertexIterator vi;
|
for (auto vi=m.vert.begin();vi!=m.vert.end();vi++)
|
||||||
for (vi=m.vert.begin();vi!=m.vert.end();vi++)
|
|
||||||
{
|
{
|
||||||
if ((*vi).IsD()) continue;
|
if ((*vi).IsD()) continue;
|
||||||
UVBox.Add((*vi).T().P());
|
UVBox.Add((*vi).T().P());
|
||||||
|
|
|
@ -35,6 +35,7 @@ sampling strategies (montecarlo, stratified etc).
|
||||||
#ifndef __VCGLIB_POINT_SAMPLING
|
#ifndef __VCGLIB_POINT_SAMPLING
|
||||||
#define __VCGLIB_POINT_SAMPLING
|
#define __VCGLIB_POINT_SAMPLING
|
||||||
|
|
||||||
|
#include <random>
|
||||||
|
|
||||||
#include <vcg/math/random_generator.h>
|
#include <vcg/math/random_generator.h>
|
||||||
#include <vcg/complex/algorithms/closest.h>
|
#include <vcg/complex/algorithms/closest.h>
|
||||||
|
@ -712,8 +713,10 @@ static void FillAndShuffleFacePointerVector(MeshType & m, std::vector<FacePointe
|
||||||
|
|
||||||
assert((int)faceVec.size()==m.fn);
|
assert((int)faceVec.size()==m.fn);
|
||||||
|
|
||||||
unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
//unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||||
std::random_shuffle(faceVec.begin(),faceVec.end(), p_myrandom);
|
std::random_device rd;
|
||||||
|
std::mt19937 g(rd());
|
||||||
|
std::shuffle(faceVec.begin(),faceVec.end(), g);
|
||||||
}
|
}
|
||||||
static void FillAndShuffleVertexPointerVector(MeshType & m, std::vector<VertexPointer> &vertVec)
|
static void FillAndShuffleVertexPointerVector(MeshType & m, std::vector<VertexPointer> &vertVec)
|
||||||
{
|
{
|
||||||
|
@ -722,8 +725,10 @@ static void FillAndShuffleVertexPointerVector(MeshType & m, std::vector<VertexPo
|
||||||
|
|
||||||
assert((int)vertVec.size()==m.vn);
|
assert((int)vertVec.size()==m.vn);
|
||||||
|
|
||||||
unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
//unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||||
std::random_shuffle(vertVec.begin(),vertVec.end(), p_myrandom);
|
std::random_device rd;
|
||||||
|
std::mt19937 g(rd());
|
||||||
|
std::shuffle(vertVec.begin(),vertVec.end(), g);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sample the vertices in a uniform way. Each vertex has the same probabiltiy of being chosen.
|
/// Sample the vertices in a uniform way. Each vertex has the same probabiltiy of being chosen.
|
||||||
|
@ -1000,7 +1005,7 @@ static void AllEdge(MeshType & m, VertexSampler &ps)
|
||||||
|
|
||||||
// Regular Uniform Edge sampling
|
// Regular Uniform Edge sampling
|
||||||
// Each edge is subdivided in a number of pieces proprtional to its length
|
// 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)
|
static void EdgeUniform(MeshType & m, VertexSampler &ps,int sampleNum, bool sampleFauxEdge=true)
|
||||||
{
|
{
|
||||||
|
@ -1928,8 +1933,10 @@ static void PoissonDiskPruning(VertexSampler &ps, MeshType &montecarloMesh,
|
||||||
if(pp.adaptiveRadiusFlag)
|
if(pp.adaptiveRadiusFlag)
|
||||||
InitRadiusHandleFromQuality(montecarloMesh, rH, diskRadius, pp.radiusVariance, pp.invertQuality);
|
InitRadiusHandleFromQuality(montecarloMesh, rH, diskRadius, pp.radiusVariance, pp.invertQuality);
|
||||||
|
|
||||||
unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
//unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||||
std::random_shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), p_myrandom);
|
std::random_device rd;
|
||||||
|
std::mt19937 g(rd());
|
||||||
|
std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g);
|
||||||
int t1 = clock();
|
int t1 = clock();
|
||||||
pp.pds.montecarloSampleNum = montecarloMesh.vn;
|
pp.pds.montecarloSampleNum = montecarloMesh.vn;
|
||||||
pp.pds.sampleNum =0;
|
pp.pds.sampleNum =0;
|
||||||
|
@ -2062,8 +2069,10 @@ static void HierarchicalPoissonDisk(MeshType &origMesh, VertexSampler &ps, MeshT
|
||||||
montecarloSHT.UpdateAllocatedCells();
|
montecarloSHT.UpdateAllocatedCells();
|
||||||
}
|
}
|
||||||
// shuffle active cells
|
// shuffle active cells
|
||||||
unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
//unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||||
std::random_shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), p_myrandom);
|
std::random_device rd;
|
||||||
|
std::mt19937 g(rd());
|
||||||
|
std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g);
|
||||||
|
|
||||||
// generate a sample inside C by choosing one of the contained pre-generated samples
|
// generate a sample inside C by choosing one of the contained pre-generated samples
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -141,7 +141,8 @@ namespace tri {
|
||||||
{
|
{
|
||||||
std::vector<typename TriMeshType::VertexPointer> vs;// vertices of the polygon
|
std::vector<typename TriMeshType::VertexPointer> vs;// vertices of the polygon
|
||||||
ExtractPolygon(&*tfi,vs);
|
ExtractPolygon(&*tfi,vs);
|
||||||
std::reverse(vs.begin(),vs.end());
|
if (vs.size() > 3)
|
||||||
|
std::reverse(vs.begin(), vs.end());
|
||||||
//now vs contains all the vertices of the polygon (still in the trimesh)
|
//now vs contains all the vertices of the polygon (still in the trimesh)
|
||||||
if (vs.size()==0)continue;
|
if (vs.size()==0)continue;
|
||||||
typename PolyMeshType::FaceIterator pfi = tri::Allocator<PolyMeshType>::AddFaces(pm,1);
|
typename PolyMeshType::FaceIterator pfi = tri::Allocator<PolyMeshType>::AddFaces(pm,1);
|
||||||
|
|
|
@ -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 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.
|
If RefineSelected is true only selected faces are taken into account for being splitted.
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
// initializes on current geometry
|
// initializes on current geometry
|
||||||
virtual void TargetCurrentGeometry()=0;
|
virtual void TargetCurrentGeometry()=0;
|
||||||
|
|
||||||
// performs an interation. Returns largest movement.
|
// performs an iteration. Returns largest movement.
|
||||||
virtual ScalarType Iterate()=0;
|
virtual ScalarType Iterate()=0;
|
||||||
|
|
||||||
// performs an iteration (faster, but it does not tell how close it is to stopping)
|
// performs an iteration (faster, but it does not tell how close it is to stopping)
|
||||||
|
@ -132,7 +132,7 @@ 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."
|
"An adaptable surface parameterization method."
|
||||||
Proc. of the 12th International Meshing oundtable, 201–213 [2003].
|
Proc. of the 12th International Meshing oundtable, 201-213 [2003].
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,10 @@
|
||||||
#ifndef __VCG_TRI_UPDATE_FLAGS
|
#ifndef __VCG_TRI_UPDATE_FLAGS
|
||||||
#define __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 vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
/// \ingroup trimesh
|
/// \ingroup trimesh
|
||||||
|
|
|
@ -24,8 +24,13 @@
|
||||||
#ifndef __VCG_TRI_UPDATE_NORMALS
|
#ifndef __VCG_TRI_UPDATE_NORMALS
|
||||||
#define __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 <vcg/complex/algorithms/polygon_support.h>
|
||||||
|
|
||||||
|
#include "flag.h"
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,13 @@
|
||||||
#ifndef __VCG_TRI_UPDATE_SELECTION
|
#ifndef __VCG_TRI_UPDATE_SELECTION
|
||||||
#define __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 vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
/// \ingroup trimesh
|
/// \ingroup trimesh
|
||||||
|
|
|
@ -24,6 +24,12 @@
|
||||||
#ifndef __VCG_TRI_UPDATE_TOPOLOGY
|
#ifndef __VCG_TRI_UPDATE_TOPOLOGY
|
||||||
#define __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 vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
/// \ingroup trimesh
|
/// \ingroup trimesh
|
||||||
|
|
|
@ -23,9 +23,12 @@
|
||||||
#ifndef __VCGLIB_TRIALLOCATOR
|
#ifndef __VCGLIB_TRIALLOCATOR
|
||||||
#define __VCGLIB_TRIALLOCATOR
|
#define __VCGLIB_TRIALLOCATOR
|
||||||
|
|
||||||
#ifndef __VCG_MESH
|
#include <vector>
|
||||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
#include <set>
|
||||||
#endif
|
|
||||||
|
#include <vcg/container/simple_temporary_data.h>
|
||||||
|
|
||||||
|
#include "used_types.h"
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
|
@ -1423,7 +1426,8 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/*! \brief Check if an handle to a Per-Vertex Attribute is valid
|
/**
|
||||||
|
* @brief Checks if a handle to a Per-Vertex Attribute is valid
|
||||||
*/
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
|
@ -1434,6 +1438,18 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if a const handle to a Per-Vertex Attribute is valid
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
bool IsValidHandle( const MeshType & m, const typename MeshType::template ConstPerVertexAttributeHandle<ATTR_TYPE> & a){
|
||||||
|
if(a._handle == nullptr) return false;
|
||||||
|
for(AttrIterator i = m.vert_attr.begin(); i!=m.vert_attr.end();++i)
|
||||||
|
if ( (*i).n_attr == a.n_attr ) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*! \brief Add a Per-Vertex Attribute of the given ATTR_TYPE with the given name.
|
/*! \brief Add a Per-Vertex Attribute of the given ATTR_TYPE with the given name.
|
||||||
|
|
||||||
No attribute with that name must exists (even of different type)
|
No attribute with that name must exists (even of different type)
|
||||||
|
@ -1483,20 +1499,16 @@ public:
|
||||||
return AddPerVertexAttribute<ATTR_TYPE>(m,name);
|
return AddPerVertexAttribute<ATTR_TYPE>(m,name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief gives a handle to a per-vertex attribute with a given name and ATTR_TYPE
|
/*! \brief gives a const handle to a per-vertex attribute with a given name and ATTR_TYPE
|
||||||
\returns a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it.
|
\returns a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it.
|
||||||
Otherwise, returns an invalid handle (check it using IsValidHandle).
|
Otherwise, returns an invalid handle (check it using IsValidHandle).
|
||||||
*/
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
typename MeshType::template ConstPerVertexAttributeHandle<ATTR_TYPE>
|
||||||
GetPerVertexAttribute( const MeshType & m, std::string name = std::string("")){
|
GetPerVertexAttribute( const MeshType & m, std::string name = std::string("")){
|
||||||
typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE> h;
|
|
||||||
if(!name.empty()){
|
|
||||||
return FindPerVertexAttribute<ATTR_TYPE>(m,name);
|
return FindPerVertexAttribute<ATTR_TYPE>(m,name);
|
||||||
}
|
}
|
||||||
return typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE>(nullptr,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! \brief Try to retrieve an handle to an attribute with a given name and ATTR_TYPE
|
/*! \brief Try to retrieve an handle to an attribute with a given name and ATTR_TYPE
|
||||||
\returns a invalid handle if no attribute with that name and type exists.
|
\returns a invalid handle if no attribute with that name and type exists.
|
||||||
|
@ -1526,37 +1538,40 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as the one above, but without modifying the attribute if it is found.
|
* @brief Try to retrieve a const handle to an attribute with a given name
|
||||||
* (A "find" function should never modify the container in which is looking for..)
|
* and ATTR_TYPE, from the given const mesh.
|
||||||
* Input mesh is const.
|
* If not found, an invalid handle will be returned.
|
||||||
|
* Check it with the function IsValidHandle
|
||||||
*/
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
static typename MeshType::template ConstPerVertexAttributeHandle<ATTR_TYPE>
|
||||||
FindPerVertexAttribute( const MeshType & m, const std::string & name)
|
FindPerVertexAttribute( const MeshType & m, const std::string & name)
|
||||||
{
|
{
|
||||||
assert(!name.empty());
|
if(!name.empty()){
|
||||||
PointerToAttribute h1; h1._name = name;
|
PointerToAttribute h1; h1._name = name;
|
||||||
typename std::set<PointerToAttribute > :: iterator i;
|
typename std::set<PointerToAttribute > :: iterator i;
|
||||||
|
|
||||||
i =m.vert_attr.find(h1);
|
i =m.vert_attr.find(h1);
|
||||||
if(i!=m.vert_attr.end())
|
if(i!=m.vert_attr.end()){
|
||||||
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||||
return typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
return typename MeshType::template ConstPerVertexAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
||||||
}
|
}
|
||||||
return typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE>(nullptr,0);
|
}
|
||||||
|
}
|
||||||
|
return typename MeshType:: template ConstPerVertexAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief query the mesh for all the attributes per vertex
|
/*! \brief query the mesh for all the attributes per vertex
|
||||||
\returns the name of all attributes with a non-empy name.
|
\returns the name of all attributes with a non-empy name.
|
||||||
*/
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static void GetAllPerVertexAttribute(MeshType & m, std::vector<std::string> &all){
|
static void GetAllPerVertexAttribute(const MeshType & m, std::vector<std::string> &all){
|
||||||
all.clear();
|
all.clear();
|
||||||
typename std::set<PointerToAttribute > ::const_iterator i;
|
typename std::set<PointerToAttribute > ::const_iterator i;
|
||||||
for(i = m.vert_attr.begin(); i != m.vert_attr.end(); ++i )
|
for(i = m.vert_attr.begin(); i != m.vert_attr.end(); ++i )
|
||||||
if(!(*i)._name.empty())
|
if(!(*i)._name.empty())
|
||||||
{
|
{
|
||||||
typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE> hh;
|
typename MeshType:: template ConstPerVertexAttributeHandle<ATTR_TYPE> hh;
|
||||||
hh = Allocator<MeshType>:: template FindPerVertexAttribute <ATTR_TYPE>(m,(*i)._name);
|
hh = Allocator<MeshType>:: template FindPerVertexAttribute <ATTR_TYPE>(m,(*i)._name);
|
||||||
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||||
all.push_back((*i)._name);
|
all.push_back((*i)._name);
|
||||||
|
@ -1616,6 +1631,15 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
bool IsValidHandle( const MeshType & m, const typename MeshType::template ConstPerEdgeAttributeHandle<ATTR_TYPE> & a){
|
||||||
|
if(a._handle == nullptr) return false;
|
||||||
|
for(AttrIterator i = m.edge_attr.begin(); i!=m.edge_attr.end();++i)
|
||||||
|
if ( (*i).n_attr == a.n_attr ) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE>
|
typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE>
|
||||||
|
@ -1662,6 +1686,12 @@ public:
|
||||||
return AddPerEdgeAttribute<ATTR_TYPE>(m,name);
|
return AddPerEdgeAttribute<ATTR_TYPE>(m,name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
typename MeshType::template ConstPerEdgeAttributeHandle<ATTR_TYPE>
|
||||||
|
GetPerEdgeAttribute( const MeshType & m, std::string name = std::string("")){
|
||||||
|
return FindPerEdgeAttribute<ATTR_TYPE>(m,name);
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
|
@ -1688,6 +1718,24 @@ public:
|
||||||
return typename MeshType:: template PerEdgeAttributeHandle<ATTR_TYPE>(nullptr,0);
|
return typename MeshType:: template PerEdgeAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
typename MeshType::template ConstPerEdgeAttributeHandle<ATTR_TYPE>
|
||||||
|
FindPerEdgeAttribute( const MeshType & m, const std::string & name){
|
||||||
|
if(!name.empty()){
|
||||||
|
PointerToAttribute h1; h1._name = name;
|
||||||
|
typename std::set<PointerToAttribute > ::const_iterator i;
|
||||||
|
|
||||||
|
i =m.edge_attr.find(h1);
|
||||||
|
if(i!=m.edge_attr.end()){
|
||||||
|
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||||
|
return typename MeshType::template ConstPerEdgeAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return typename MeshType:: template ConstPerEdgeAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static void GetAllPerEdgeAttribute(const MeshType & m, std::vector<std::string> &all){
|
static void GetAllPerEdgeAttribute(const MeshType & m, std::vector<std::string> &all){
|
||||||
all.clear();
|
all.clear();
|
||||||
|
@ -1695,7 +1743,7 @@ public:
|
||||||
for(i = m.edge_attr.begin(); i != m.edge_attr.end(); ++i )
|
for(i = m.edge_attr.begin(); i != m.edge_attr.end(); ++i )
|
||||||
if(!(*i)._name.empty())
|
if(!(*i)._name.empty())
|
||||||
{
|
{
|
||||||
typename MeshType:: template PerEdgeAttributeHandle<ATTR_TYPE> hh;
|
typename MeshType:: template ConstPerEdgeAttributeHandle<ATTR_TYPE> hh;
|
||||||
hh = Allocator<MeshType>:: template FindPerEdgeAttribute <ATTR_TYPE>(m,(*i)._name);
|
hh = Allocator<MeshType>:: template FindPerEdgeAttribute <ATTR_TYPE>(m,(*i)._name);
|
||||||
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||||
all.push_back((*i)._name);
|
all.push_back((*i)._name);
|
||||||
|
@ -1731,6 +1779,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Per Face Attributes
|
/// Per Face Attributes
|
||||||
|
/**
|
||||||
|
* @brief Checks if a handle to a Per-Face attribute is valid
|
||||||
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
bool IsValidHandle( const MeshType & m, const typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE> & a){
|
bool IsValidHandle( const MeshType & m, const typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE> & a){
|
||||||
|
@ -1740,6 +1791,18 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks if a const handle to a Per-Face attribute is valid
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
bool IsValidHandle( const MeshType & m, const typename MeshType::template ConstPerFaceAttributeHandle<ATTR_TYPE> & a){
|
||||||
|
if(a._handle == nullptr) return false;
|
||||||
|
for(AttrIterator i = m.face_attr.begin(); i!=m.face_attr.end();++i)
|
||||||
|
if ( (*i).n_attr == a.n_attr ) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
||||||
|
@ -1792,14 +1855,10 @@ public:
|
||||||
*/
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
typename MeshType::template ConstPerFaceAttributeHandle<ATTR_TYPE>
|
||||||
GetPerFaceAttribute( const MeshType & m, std::string name = std::string("")){
|
GetPerFaceAttribute( const MeshType & m, std::string name = std::string("")){
|
||||||
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE> h;
|
|
||||||
if(!name.empty()){
|
|
||||||
return FindPerFaceAttribute<ATTR_TYPE>(m,name);
|
return FindPerFaceAttribute<ATTR_TYPE>(m,name);
|
||||||
}
|
}
|
||||||
return typename MeshType:: template PerFaceAttributeHandle<ATTR_TYPE>(nullptr,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
|
@ -1826,34 +1885,37 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as the one above, but without modifying the attribute if it is found.
|
* @brief Try to retrieve a const handle to an attribute with a given name
|
||||||
* (A "find" function should never modify the container in which is looking for..)
|
* and ATTR_TYPE, from the given const mesh.
|
||||||
* Input mesh is const.
|
* If not found, an invalid handle will be returned.
|
||||||
|
* Check it with the function IsValidHandle
|
||||||
*/
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
typename MeshType::template ConstPerFaceAttributeHandle<ATTR_TYPE>
|
||||||
FindPerFaceAttribute( const MeshType & m, const std::string & name){
|
FindPerFaceAttribute( const MeshType & m, const std::string & name){
|
||||||
assert(!name.empty());
|
if(!name.empty()){
|
||||||
PointerToAttribute h1; h1._name = name;
|
PointerToAttribute h1; h1._name = name;
|
||||||
typename std::set<PointerToAttribute > ::iterator i;
|
typename std::set<PointerToAttribute > ::iterator i;
|
||||||
|
|
||||||
i =m.face_attr.find(h1);
|
i =m.face_attr.find(h1);
|
||||||
if(i!=m.face_attr.end())
|
if(i!=m.face_attr.end()){
|
||||||
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||||
return typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
return typename MeshType::template ConstPerFaceAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
||||||
}
|
}
|
||||||
return typename MeshType:: template PerFaceAttributeHandle<ATTR_TYPE>(nullptr,0);
|
}
|
||||||
|
}
|
||||||
|
return typename MeshType:: template ConstPerFaceAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static void GetAllPerFaceAttribute(MeshType & m, std::vector<std::string> &all){
|
static void GetAllPerFaceAttribute(const MeshType & m, std::vector<std::string> &all){
|
||||||
all.clear();
|
all.clear();
|
||||||
typename std::set<PointerToAttribute > :: const_iterator i;
|
typename std::set<PointerToAttribute > :: const_iterator i;
|
||||||
for(i = m.face_attr.begin(); i != m.face_attr.end(); ++i )
|
for(i = m.face_attr.begin(); i != m.face_attr.end(); ++i )
|
||||||
if(!(*i)._name.empty())
|
if(!(*i)._name.empty())
|
||||||
{
|
{
|
||||||
typename MeshType:: template PerFaceAttributeHandle<ATTR_TYPE> hh;
|
typename MeshType:: template ConstPerFaceAttributeHandle<ATTR_TYPE> hh;
|
||||||
hh = Allocator<MeshType>:: template FindPerFaceAttribute <ATTR_TYPE>(m,(*i)._name);
|
hh = Allocator<MeshType>:: template FindPerFaceAttribute <ATTR_TYPE>(m,(*i)._name);
|
||||||
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||||
all.push_back((*i)._name);
|
all.push_back((*i)._name);
|
||||||
|
@ -1898,6 +1960,17 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static bool IsValidHandle(const MeshType & m, const typename MeshType::template ConstPerTetraAttributeHandle<ATTR_TYPE> & a)
|
||||||
|
{
|
||||||
|
if (a._handle == nullptr)
|
||||||
|
return false;
|
||||||
|
for (AttrIterator i = m.tetra_attr.begin(); i != m.tetra_attr.end(); ++i)
|
||||||
|
if ((*i).n_attr == a.n_attr)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static typename MeshType::template PerTetraAttributeHandle<ATTR_TYPE> AddPerTetraAttribute(MeshType & m, std::string name)
|
static typename MeshType::template PerTetraAttributeHandle<ATTR_TYPE> AddPerTetraAttribute(MeshType & m, std::string name)
|
||||||
{
|
{
|
||||||
|
@ -1943,6 +2016,12 @@ public:
|
||||||
return AddPerTetraAttribute<ATTR_TYPE>(m, name);
|
return AddPerTetraAttribute<ATTR_TYPE>(m, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static typename MeshType::template ConstPerTetraAttributeHandle<ATTR_TYPE> GetPerTetraAttribute(const MeshType &m, std::string name = std::string(""))
|
||||||
|
{
|
||||||
|
return FindPerTetraAttribute<ATTR_TYPE>(m, name);
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static typename MeshType::template PerTetraAttributeHandle<ATTR_TYPE> FindPerTetraAttribute(MeshType &m, const std::string &name)
|
static typename MeshType::template PerTetraAttributeHandle<ATTR_TYPE> FindPerTetraAttribute(MeshType &m, const std::string &name)
|
||||||
{
|
{
|
||||||
|
@ -1970,14 +2049,33 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static void GetAllPerTetraAttribute(MeshType &m, std::vector<std::string> &all)
|
static typename MeshType::template ConstPerTetraAttributeHandle<ATTR_TYPE> FindPerTetraAttribute(MeshType &m, const std::string &name)
|
||||||
|
{
|
||||||
|
if(!name.empty()){
|
||||||
|
PointerToAttribute h1;
|
||||||
|
h1._name = name;
|
||||||
|
typename std::set<PointerToAttribute>::iterator i;
|
||||||
|
|
||||||
|
i = m.tetra_attr.find(h1);
|
||||||
|
if (i != m.tetra_attr.end()){
|
||||||
|
if ((*i)._sizeof == sizeof(ATTR_TYPE))
|
||||||
|
{
|
||||||
|
return typename MeshType::template ConstPerTetraAttributeHandle<ATTR_TYPE>((*i)._handle, (*i).n_attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return typename MeshType::template ConstPerTetraAttributeHandle<ATTR_TYPE>(nullptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static void GetAllPerTetraAttribute(const MeshType &m, std::vector<std::string> &all)
|
||||||
{
|
{
|
||||||
all.clear();
|
all.clear();
|
||||||
typename std::set<PointerToAttribute>::const_iterator i;
|
typename std::set<PointerToAttribute>::const_iterator i;
|
||||||
for (i = m.tetra_attr.begin(); i != m.tetra_attr.end(); ++i)
|
for (i = m.tetra_attr.begin(); i != m.tetra_attr.end(); ++i)
|
||||||
if (!(*i)._name.empty())
|
if (!(*i)._name.empty())
|
||||||
{
|
{
|
||||||
typename MeshType::template PerTetraAttributeHandle<ATTR_TYPE> hh;
|
typename MeshType::template ConstPerTetraAttributeHandle<ATTR_TYPE> hh;
|
||||||
hh = Allocator<MeshType>::template FindPerTetraAttribute<ATTR_TYPE>(m, (*i)._name);
|
hh = Allocator<MeshType>::template FindPerTetraAttribute<ATTR_TYPE>(m, (*i)._name);
|
||||||
if (IsValidHandle<ATTR_TYPE>(m, hh))
|
if (IsValidHandle<ATTR_TYPE>(m, hh))
|
||||||
all.push_back((*i)._name);
|
all.push_back((*i)._name);
|
||||||
|
@ -2026,6 +2124,15 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
bool IsValidHandle(const MeshType & m, const typename MeshType::template ConstPerMeshAttributeHandle<ATTR_TYPE> & a){
|
||||||
|
if(a._handle == nullptr) return false;
|
||||||
|
for(AttrIterator i = m.mesh_attr.begin(); i!=m.mesh_attr.end();++i)
|
||||||
|
if ( (*i).n_attr == a.n_attr ) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
||||||
|
@ -2064,6 +2171,13 @@ public:
|
||||||
return AddPerMeshAttribute<ATTR_TYPE>(m,name);
|
return AddPerMeshAttribute<ATTR_TYPE>(m,name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
typename MeshType::template ConstPerMeshAttributeHandle<ATTR_TYPE>
|
||||||
|
GetPerMeshAttribute(const MeshType & m, std::string name = std::string("")){
|
||||||
|
return FindPerMeshAttribute<ATTR_TYPE>(m,name);
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
||||||
|
@ -2090,6 +2204,24 @@ public:
|
||||||
return typename MeshType:: template PerMeshAttributeHandle<ATTR_TYPE>(nullptr,0);
|
return typename MeshType:: template PerMeshAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
typename MeshType::template ConstPerMeshAttributeHandle<ATTR_TYPE>
|
||||||
|
FindPerMeshAttribute( const MeshType & m, const std::string & name){
|
||||||
|
if (!name.empty()){
|
||||||
|
PointerToAttribute h1; h1._name = name;
|
||||||
|
typename std::set<PointerToAttribute > ::iterator i;
|
||||||
|
i =m.mesh_attr.find(h1);
|
||||||
|
if(i!=m.mesh_attr.end()){
|
||||||
|
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||||
|
return typename MeshType::template ConstPerMeshAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return typename MeshType:: template ConstPerMeshAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static void GetAllPerMeshAttribute(const MeshType & m, std::vector<std::string> &all){
|
static void GetAllPerMeshAttribute(const MeshType & m, std::vector<std::string> &all){
|
||||||
typename std::set<PointerToAttribute > :: iterator i;
|
typename std::set<PointerToAttribute > :: iterator i;
|
||||||
|
@ -2245,7 +2377,7 @@ public:
|
||||||
|
|
||||||
// copy the padded container in the new one
|
// copy the padded container in the new one
|
||||||
char * ptr = (char*)( ((Attribute<ATTR_TYPE> *)pa._handle)->DataBegin());
|
char * ptr = (char*)( ((Attribute<ATTR_TYPE> *)pa._handle)->DataBegin());
|
||||||
memcpy((void*)_handle->attribute ,(void*) &(ptr[0]) ,sizeof(ATTR_TYPE));
|
memcpy((void*)_handle->DataBegin() ,(void*) &(ptr[0]) ,sizeof(ATTR_TYPE));
|
||||||
|
|
||||||
// remove the padded container
|
// remove the padded container
|
||||||
delete ( (Attribute<ATTR_TYPE> *) pa._handle);
|
delete ( (Attribute<ATTR_TYPE> *) pa._handle);
|
||||||
|
|
|
@ -23,9 +23,8 @@
|
||||||
#ifndef __VCGLIB_APPEND
|
#ifndef __VCGLIB_APPEND
|
||||||
#define __VCGLIB_APPEND
|
#define __VCGLIB_APPEND
|
||||||
|
|
||||||
#ifndef __VCG_MESH
|
#include <vcg/complex/allocate.h>
|
||||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
#include <vcg/complex/algorithms/update/selection.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
|
@ -674,12 +673,15 @@ static void MeshAppendConst(
|
||||||
typename std::set< PointerToAttribute >::iterator al, ar;
|
typename std::set< PointerToAttribute >::iterator al, ar;
|
||||||
|
|
||||||
// per vertex attributes
|
// per vertex attributes
|
||||||
for(al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
|
for (al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
|
||||||
if(!(*al)._name.empty()){
|
if(!(*al)._name.empty())
|
||||||
|
{
|
||||||
ar = mr.vert_attr.find(*al);
|
ar = mr.vert_attr.find(*al);
|
||||||
if(ar!= mr.vert_attr.end()){
|
if (ar != mr.vert_attr.end())
|
||||||
|
{
|
||||||
id_r = 0;
|
id_r = 0;
|
||||||
for (auto v: mr.vert){
|
for (const auto & v : mr.vert)
|
||||||
|
{
|
||||||
if( !v.IsD() && (!selected || v.IsS()))
|
if( !v.IsD() && (!selected || v.IsS()))
|
||||||
(*al)._handle->CopyValue(remap.vert[Index(mr,v)], id_r, (*ar)._handle);
|
(*al)._handle->CopyValue(remap.vert[Index(mr,v)], id_r, (*ar)._handle);
|
||||||
++id_r;
|
++id_r;
|
||||||
|
@ -688,12 +690,15 @@ static void MeshAppendConst(
|
||||||
}
|
}
|
||||||
|
|
||||||
// per edge attributes
|
// per edge attributes
|
||||||
for(al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
|
for (al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
|
||||||
if(!(*al)._name.empty()){
|
if (!(*al)._name.empty())
|
||||||
|
{
|
||||||
ar = mr.edge_attr.find(*al);
|
ar = mr.edge_attr.find(*al);
|
||||||
if(ar!= mr.edge_attr.end()){
|
if (ar!= mr.edge_attr.end())
|
||||||
|
{
|
||||||
id_r = 0;
|
id_r = 0;
|
||||||
for (auto e: mr.edge){
|
for (const auto & e : mr.edge)
|
||||||
|
{
|
||||||
if( !e.IsD() && (!selected || e.IsS()))
|
if( !e.IsD() && (!selected || e.IsS()))
|
||||||
(*al)._handle->CopyValue(remap.edge[Index(mr,e)], id_r, (*ar)._handle);
|
(*al)._handle->CopyValue(remap.edge[Index(mr,e)], id_r, (*ar)._handle);
|
||||||
++id_r;
|
++id_r;
|
||||||
|
@ -702,12 +707,15 @@ static void MeshAppendConst(
|
||||||
}
|
}
|
||||||
|
|
||||||
// per face attributes
|
// per face attributes
|
||||||
for(al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
|
for (al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
|
||||||
if(!(*al)._name.empty()){
|
if (!(*al)._name.empty())
|
||||||
|
{
|
||||||
ar = mr.face_attr.find(*al);
|
ar = mr.face_attr.find(*al);
|
||||||
if(ar!= mr.face_attr.end()){
|
if (ar!= mr.face_attr.end())
|
||||||
|
{
|
||||||
id_r = 0;
|
id_r = 0;
|
||||||
for (auto f: mr.face) {
|
for (const auto & f : mr.face)
|
||||||
|
{
|
||||||
if( !f.IsD() && (!selected || f.IsS()))
|
if( !f.IsD() && (!selected || f.IsS()))
|
||||||
(*al)._handle->CopyValue(remap.face[Index(mr,f)], id_r, (*ar)._handle);
|
(*al)._handle->CopyValue(remap.face[Index(mr,f)], id_r, (*ar)._handle);
|
||||||
++id_r;
|
++id_r;
|
||||||
|
@ -716,12 +724,15 @@ static void MeshAppendConst(
|
||||||
}
|
}
|
||||||
|
|
||||||
// per tetra attributes
|
// per tetra attributes
|
||||||
for(al = ml.tetra_attr.begin(); al != ml.tetra_attr.end(); ++al)
|
for (al = ml.tetra_attr.begin(); al != ml.tetra_attr.end(); ++al)
|
||||||
if(!(*al)._name.empty()){
|
if (!(*al)._name.empty())
|
||||||
|
{
|
||||||
ar = mr.tetra_attr.find(*al);
|
ar = mr.tetra_attr.find(*al);
|
||||||
if(ar!= mr.tetra_attr.end()){
|
if (ar!= mr.tetra_attr.end())
|
||||||
|
{
|
||||||
id_r = 0;
|
id_r = 0;
|
||||||
for (auto t: mr.tetra) {
|
for (const auto & t: mr.tetra)
|
||||||
|
{
|
||||||
if( !t.IsD() && (!selected || t.IsS()))
|
if( !t.IsD() && (!selected || t.IsS()))
|
||||||
(*al)._handle->CopyValue(remap.tetra[Index(mr, t)], id_r, (*ar)._handle);
|
(*al)._handle->CopyValue(remap.tetra[Index(mr, t)], id_r, (*ar)._handle);
|
||||||
++id_r;
|
++id_r;
|
||||||
|
|
|
@ -20,12 +20,17 @@
|
||||||
* for more details. *
|
* 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
|
#ifndef __VCG_COMPLEX_BASE
|
||||||
#define __VCG_COMPLEX_BASE
|
#define __VCG_COMPLEX_BASE
|
||||||
|
|
||||||
|
#include <typeindex>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
|
#include <vcg/container/simple_temporary_data.h>
|
||||||
|
|
||||||
|
#include "used_types.h"
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
|
|
||||||
class PointerToAttribute
|
class PointerToAttribute
|
||||||
|
@ -297,6 +302,25 @@ public:
|
||||||
void resize(size_t /*size*/) { };
|
void resize(size_t /*size*/) { };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class ATTR_TYPE, class CONT>
|
||||||
|
class ConstAttributeHandle{
|
||||||
|
public:
|
||||||
|
ConstAttributeHandle(){_handle=(SimpleTempData<CONT,ATTR_TYPE> *)nullptr;}
|
||||||
|
ConstAttributeHandle( const void *ah,const int & n):_handle ( (const SimpleTempData<CONT,ATTR_TYPE> *)ah ),n_attr(n){}
|
||||||
|
|
||||||
|
|
||||||
|
//pointer to the SimpleTempData that stores the attribute
|
||||||
|
const SimpleTempData<CONT,ATTR_TYPE> * _handle;
|
||||||
|
|
||||||
|
// its attribute number
|
||||||
|
int n_attr;
|
||||||
|
|
||||||
|
// access function
|
||||||
|
template <class RefType>
|
||||||
|
const ATTR_TYPE & operator [](const RefType & i) const {return (*_handle)[i];}
|
||||||
|
void resize(size_t /*size*/) { };
|
||||||
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerVertexAttributeHandle: public AttributeHandle<ATTR_TYPE,VertContainer>{
|
class PerVertexAttributeHandle: public AttributeHandle<ATTR_TYPE,VertContainer>{
|
||||||
public:
|
public:
|
||||||
|
@ -304,6 +328,12 @@ public:
|
||||||
PerVertexAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,VertContainer>(ah,n){}
|
PerVertexAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,VertContainer>(ah,n){}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
class ConstPerVertexAttributeHandle: public ConstAttributeHandle<ATTR_TYPE,VertContainer>{
|
||||||
|
public:
|
||||||
|
ConstPerVertexAttributeHandle():ConstAttributeHandle<ATTR_TYPE,VertContainer>(){}
|
||||||
|
ConstPerVertexAttributeHandle( const void *ah,const int & n):ConstAttributeHandle<ATTR_TYPE,VertContainer>(ah,n){}
|
||||||
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerFaceAttributeHandle: public AttributeHandle<ATTR_TYPE,FaceContainer>{
|
class PerFaceAttributeHandle: public AttributeHandle<ATTR_TYPE,FaceContainer>{
|
||||||
|
@ -312,6 +342,13 @@ public:
|
||||||
PerFaceAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,FaceContainer>(ah,n){}
|
PerFaceAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,FaceContainer>(ah,n){}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
class ConstPerFaceAttributeHandle: public ConstAttributeHandle<ATTR_TYPE,FaceContainer>{
|
||||||
|
public:
|
||||||
|
ConstPerFaceAttributeHandle():ConstAttributeHandle<ATTR_TYPE,FaceContainer>(){}
|
||||||
|
ConstPerFaceAttributeHandle( void *ah,const int & n):ConstAttributeHandle<ATTR_TYPE,FaceContainer>(ah,n){}
|
||||||
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerEdgeAttributeHandle: public AttributeHandle<ATTR_TYPE,EdgeContainer>{
|
class PerEdgeAttributeHandle: public AttributeHandle<ATTR_TYPE,EdgeContainer>{
|
||||||
public:
|
public:
|
||||||
|
@ -319,6 +356,13 @@ public:
|
||||||
PerEdgeAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,EdgeContainer>(ah,n){}
|
PerEdgeAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,EdgeContainer>(ah,n){}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
class ConstPerEdgeAttributeHandle: public ConstAttributeHandle<ATTR_TYPE,EdgeContainer>{
|
||||||
|
public:
|
||||||
|
ConstPerEdgeAttributeHandle():ConstAttributeHandle<ATTR_TYPE,EdgeContainer>(){}
|
||||||
|
ConstPerEdgeAttributeHandle( void *ah,const int & n):ConstAttributeHandle<ATTR_TYPE,EdgeContainer>(ah,n){}
|
||||||
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerTetraAttributeHandle : public AttributeHandle<ATTR_TYPE, TetraContainer>
|
class PerTetraAttributeHandle : public AttributeHandle<ATTR_TYPE, TetraContainer>
|
||||||
{
|
{
|
||||||
|
@ -327,6 +371,14 @@ public:
|
||||||
PerTetraAttributeHandle(void *ah, const int &n) : AttributeHandle<ATTR_TYPE, TetraContainer>(ah, n) {}
|
PerTetraAttributeHandle(void *ah, const int &n) : AttributeHandle<ATTR_TYPE, TetraContainer>(ah, n) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
class ConstPerTetraAttributeHandle : public ConstAttributeHandle<ATTR_TYPE, TetraContainer>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ConstPerTetraAttributeHandle() : ConstAttributeHandle<ATTR_TYPE, TetraContainer>() {}
|
||||||
|
ConstPerTetraAttributeHandle(void *ah, const int &n) : ConstAttributeHandle<ATTR_TYPE, TetraContainer>(ah, n) {}
|
||||||
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
class PerMeshAttributeHandle{
|
class PerMeshAttributeHandle{
|
||||||
public:
|
public:
|
||||||
|
@ -340,7 +392,18 @@ public:
|
||||||
|
|
||||||
Attribute<ATTR_TYPE> * _handle;
|
Attribute<ATTR_TYPE> * _handle;
|
||||||
int n_attr;
|
int n_attr;
|
||||||
ATTR_TYPE & operator ()(){ return *((Attribute<ATTR_TYPE> *)_handle)->attribute;}
|
ATTR_TYPE & operator ()(){ return *((ATTR_TYPE*) (_handle->DataBegin()));}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
class ConstPerMeshAttributeHandle{
|
||||||
|
public:
|
||||||
|
ConstPerMeshAttributeHandle(){_handle=nullptr;}
|
||||||
|
ConstPerMeshAttributeHandle(const void *ah,const int & n):_handle ( (const Attribute<ATTR_TYPE> *)ah ),n_attr(n){}
|
||||||
|
|
||||||
|
const Attribute<ATTR_TYPE> * _handle;
|
||||||
|
int n_attr;
|
||||||
|
const ATTR_TYPE & operator ()(){ return *((const ATTR_TYPE*)(_handle->DataBegin()));}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Some common Handle typedefs to simplify use
|
// Some common Handle typedefs to simplify use
|
||||||
|
@ -538,7 +601,7 @@ template <class MeshType> inline bool IsMarked(const MeshType & m,typename MeshT
|
||||||
@param m the mesh containing the element
|
@param m the mesh containing the element
|
||||||
@param t tetra pointer */
|
@param t tetra pointer */
|
||||||
template <class MeshType>
|
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.
|
/** \brief Set the vertex incremental mark of the vertex to the one of the mesh.
|
||||||
@param m the mesh containing the element
|
@param m the mesh containing the element
|
||||||
|
|
|
@ -23,6 +23,9 @@
|
||||||
#ifndef __VCG_EXCEPTION_H
|
#ifndef __VCG_EXCEPTION_H
|
||||||
#define __VCG_EXCEPTION_H
|
#define __VCG_EXCEPTION_H
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
namespace vcg
|
namespace vcg
|
||||||
{
|
{
|
||||||
class MissingComponentException : public std::runtime_error
|
class MissingComponentException : public std::runtime_error
|
||||||
|
|
|
@ -24,9 +24,7 @@
|
||||||
#ifndef VCG__FOREACH_H
|
#ifndef VCG__FOREACH_H
|
||||||
#define VCG__FOREACH_H
|
#define VCG__FOREACH_H
|
||||||
|
|
||||||
#ifndef __VCG_MESH
|
#include <vcg/simplex/face/pos.h>
|
||||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tri {
|
namespace tri {
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#ifndef VCG_USED_TYPES_H
|
#ifndef VCG_USED_TYPES_H
|
||||||
#define VCG_USED_TYPES_H
|
#define VCG_USED_TYPES_H
|
||||||
|
|
||||||
#include <vcg/space/point3.h>
|
|
||||||
#include <vcg/space/box3.h>
|
#include <vcg/space/box3.h>
|
||||||
#include <vcg/space/color4.h>
|
#include <vcg/space/color4.h>
|
||||||
#include <vcg/math/shot.h>
|
#include <vcg/math/shot.h>
|
||||||
|
|
|
@ -20,11 +20,18 @@
|
||||||
* for more details. *
|
* for more details. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <vcg/complex/complex.h>
|
|
||||||
|
|
||||||
#ifndef __VCG_HEDGE_
|
#ifndef __VCG_HEDGE_
|
||||||
#define __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 {
|
namespace vcg {
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
|
|
|
@ -20,11 +20,14 @@
|
||||||
* for more details. *
|
* for more details. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <vcg/complex/complex.h>
|
|
||||||
|
|
||||||
#ifndef __VCG_HEDGE_COMPONENT
|
#ifndef __VCG_HEDGE_COMPONENT
|
||||||
#define __VCG_HEDGE_COMPONENT
|
#define __VCG_HEDGE_COMPONENT
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace hedge {
|
namespace hedge {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -24,6 +24,12 @@
|
||||||
#ifndef __VCGLIB_SIMPLE__
|
#ifndef __VCGLIB_SIMPLE__
|
||||||
#define __VCGLIB_SIMPLE__
|
#define __VCGLIB_SIMPLE__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
#include <limits>
|
||||||
|
#include <vector>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
namespace vcg
|
namespace vcg
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -36,45 +42,44 @@ public:
|
||||||
virtual void Reorder(std::vector<size_t> &newVertIndex) = 0;
|
virtual void Reorder(std::vector<size_t> &newVertIndex) = 0;
|
||||||
virtual size_t SizeOf() const = 0;
|
virtual size_t SizeOf() const = 0;
|
||||||
virtual void *DataBegin() = 0;
|
virtual void *DataBegin() = 0;
|
||||||
|
virtual const void* DataBegin() const = 0;
|
||||||
|
|
||||||
virtual void *At(size_t i) = 0;
|
virtual void *At(size_t i) = 0;
|
||||||
virtual const void *At(size_t i) const = 0;
|
virtual const void *At(size_t i) const = 0;
|
||||||
virtual void CopyValue(const size_t to, const size_t from, const SimpleTempDataBase *other) = 0;
|
virtual void CopyValue(const size_t to, const size_t from, const SimpleTempDataBase *other) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class TYPE>
|
template <class TYPE, class ...p>
|
||||||
class VectorNBW : public std::vector<TYPE>
|
class VectorNBW : public std::vector<TYPE, p...>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <class ...p>
|
||||||
class VectorNBW<bool>
|
class VectorNBW<bool, p...>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VectorNBW() : data(0), datasize(0), datareserve(0) {}
|
VectorNBW() : booldata(nullptr), datasize(0), datareserve(0) {}
|
||||||
|
|
||||||
~VectorNBW()
|
~VectorNBW()
|
||||||
{
|
{
|
||||||
if (data)
|
if (booldata)
|
||||||
delete[] data;
|
delete[] booldata;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool *data;
|
void reserve(size_t sz)
|
||||||
|
|
||||||
void reserve(const int &sz)
|
|
||||||
{
|
{
|
||||||
if (sz <= datareserve)
|
if (sz <= datareserve)
|
||||||
return;
|
return;
|
||||||
bool *newdataLoc = new bool[sz];
|
bool *newdataLoc = new bool[sz];
|
||||||
if (datasize != 0)
|
if (datasize != 0)
|
||||||
memcpy(newdataLoc, data, sizeof(datasize));
|
memcpy(newdataLoc, booldata, sizeof(bool) * sizeof(datasize));
|
||||||
std::swap(data, newdataLoc);
|
std::swap(booldata, newdataLoc);
|
||||||
if (newdataLoc != 0)
|
if (newdataLoc != 0)
|
||||||
delete[] newdataLoc;
|
delete[] newdataLoc;
|
||||||
datareserve = sz;
|
datareserve = sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
void resize(const int &sz)
|
void resize(size_t sz)
|
||||||
{
|
{
|
||||||
int oldDatasize = datasize;
|
int oldDatasize = datasize;
|
||||||
if (sz <= oldDatasize)
|
if (sz <= oldDatasize)
|
||||||
|
@ -82,12 +87,12 @@ public:
|
||||||
if (sz > datareserve)
|
if (sz > datareserve)
|
||||||
reserve(sz);
|
reserve(sz);
|
||||||
datasize = sz;
|
datasize = sz;
|
||||||
memset(&data[oldDatasize], 0, datasize - oldDatasize);
|
memset(&booldata[oldDatasize], 0, datasize - oldDatasize);
|
||||||
}
|
}
|
||||||
void push_back(const bool &v)
|
void push_back(const bool &v)
|
||||||
{
|
{
|
||||||
resize(datasize + 1);
|
resize(datasize + 1);
|
||||||
data[datasize] = v;
|
booldata[datasize] = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() { datasize = 0; }
|
void clear() { datasize = 0; }
|
||||||
|
@ -96,14 +101,16 @@ public:
|
||||||
|
|
||||||
bool empty() const { return datasize == 0; }
|
bool empty() const { return datasize == 0; }
|
||||||
|
|
||||||
bool *begin() const { return data; }
|
bool* data() {return booldata;}
|
||||||
|
const bool *data() const { return booldata; }
|
||||||
|
|
||||||
bool &operator[](const int &i) { return data[i]; }
|
bool &operator[](size_t i) { return booldata[i]; }
|
||||||
const bool &operator[](const int &i) const { return data[i]; }
|
const bool &operator[](size_t i) const { return booldata[i]; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int datasize;
|
bool *booldata;
|
||||||
int datareserve;
|
size_t datasize;
|
||||||
|
size_t datareserve;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class STL_CONT, class ATTR_TYPE>
|
template <class STL_CONT, class ATTR_TYPE>
|
||||||
|
@ -114,16 +121,16 @@ public:
|
||||||
typedef SimpleTempData<STL_CONT, ATTR_TYPE> SimpTempDataType;
|
typedef SimpleTempData<STL_CONT, ATTR_TYPE> SimpTempDataType;
|
||||||
typedef ATTR_TYPE AttrType;
|
typedef ATTR_TYPE AttrType;
|
||||||
|
|
||||||
STL_CONT &c;
|
const STL_CONT &c;
|
||||||
VectorNBW<ATTR_TYPE> data;
|
VectorNBW<ATTR_TYPE> data;
|
||||||
int padding;
|
int padding;
|
||||||
|
|
||||||
SimpleTempData(STL_CONT &_c) : c(_c), padding(0)
|
SimpleTempData(const STL_CONT &_c) : c(_c), padding(0)
|
||||||
{
|
{
|
||||||
data.reserve(c.capacity());
|
data.reserve(c.capacity());
|
||||||
data.resize(c.size());
|
data.resize(c.size());
|
||||||
};
|
};
|
||||||
SimpleTempData(STL_CONT &_c, const ATTR_TYPE &val) : c(_c)
|
SimpleTempData(const STL_CONT &_c, const ATTR_TYPE &val) : c(_c)
|
||||||
{
|
{
|
||||||
data.reserve(c.capacity());
|
data.reserve(c.capacity());
|
||||||
data.resize(c.size());
|
data.resize(c.size());
|
||||||
|
@ -142,11 +149,13 @@ public:
|
||||||
// access to data
|
// access to data
|
||||||
ATTR_TYPE &operator[](const typename STL_CONT::value_type &v) { return data[&v - &*c.begin()]; }
|
ATTR_TYPE &operator[](const typename STL_CONT::value_type &v) { return data[&v - &*c.begin()]; }
|
||||||
ATTR_TYPE &operator[](const typename STL_CONT::value_type *v) { return data[v - &*c.begin()]; }
|
ATTR_TYPE &operator[](const typename STL_CONT::value_type *v) { return data[v - &*c.begin()]; }
|
||||||
|
ATTR_TYPE &operator[](const typename STL_CONT::const_iterator &cont) { return data[&(*cont) - &*c.begin()]; }
|
||||||
ATTR_TYPE &operator[](const typename STL_CONT::iterator &cont) { return data[&(*cont) - &*c.begin()]; }
|
ATTR_TYPE &operator[](const typename STL_CONT::iterator &cont) { return data[&(*cont) - &*c.begin()]; }
|
||||||
ATTR_TYPE &operator[](size_t i) { return data[i]; }
|
ATTR_TYPE &operator[](size_t i) { return data[i]; }
|
||||||
|
|
||||||
const ATTR_TYPE &operator[](const typename STL_CONT::value_type &v) const { return data[&v - &*c.begin()]; }
|
const ATTR_TYPE &operator[](const typename STL_CONT::value_type &v) const { return data[&v - &*c.begin()]; }
|
||||||
const ATTR_TYPE &operator[](const typename STL_CONT::value_type *v) const { return data[v - &*c.begin()]; }
|
const ATTR_TYPE &operator[](const typename STL_CONT::value_type *v) const { return data[v - &*c.begin()]; }
|
||||||
|
const ATTR_TYPE &operator[](const typename STL_CONT::const_iterator &cont) const { return data[&(*cont) - &*c.begin()]; }
|
||||||
const ATTR_TYPE &operator[](const typename STL_CONT::iterator &cont) const { return data[&(*cont) - &*c.begin()]; }
|
const ATTR_TYPE &operator[](const typename STL_CONT::iterator &cont) const { return data[&(*cont) - &*c.begin()]; }
|
||||||
const ATTR_TYPE &operator[](size_t i) const { return data[i]; }
|
const ATTR_TYPE &operator[](size_t i) const { return data[i]; }
|
||||||
|
|
||||||
|
@ -177,7 +186,7 @@ public:
|
||||||
|
|
||||||
void Reorder(std::vector<size_t> &newVertIndex)
|
void Reorder(std::vector<size_t> &newVertIndex)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < data.size(); ++i)
|
for (size_t i = 0; i < data.size(); ++i)
|
||||||
{
|
{
|
||||||
if (newVertIndex[i] != (std::numeric_limits<size_t>::max)())
|
if (newVertIndex[i] != (std::numeric_limits<size_t>::max)())
|
||||||
data[newVertIndex[i]] = data[i];
|
data[newVertIndex[i]] = data[i];
|
||||||
|
@ -185,7 +194,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t SizeOf() const { return sizeof(ATTR_TYPE); }
|
size_t SizeOf() const { return sizeof(ATTR_TYPE); }
|
||||||
void *DataBegin() { return data.empty() ? NULL : &(*data.begin()); }
|
void *DataBegin() { return data.empty() ? nullptr : data.data(); }
|
||||||
|
const void *DataBegin() const { return data.empty() ? nullptr : data.data(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
|
@ -193,11 +203,11 @@ class Attribute : public SimpleTempDataBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef ATTR_TYPE AttrType;
|
typedef ATTR_TYPE AttrType;
|
||||||
AttrType *attribute;
|
|
||||||
Attribute() { attribute = new ATTR_TYPE(); }
|
Attribute() { attribute = new ATTR_TYPE(); }
|
||||||
~Attribute() { delete attribute; }
|
~Attribute() { delete attribute; }
|
||||||
size_t SizeOf() const { return sizeof(ATTR_TYPE); }
|
size_t SizeOf() const { return sizeof(ATTR_TYPE); }
|
||||||
void *DataBegin() { return attribute; }
|
void *DataBegin() { return attribute; }
|
||||||
|
const void* DataBegin() const {return attribute;}
|
||||||
|
|
||||||
void Resize(size_t) { assert(0); }
|
void Resize(size_t) { assert(0); }
|
||||||
void Reorder(std::vector<size_t> &) { assert(0); }
|
void Reorder(std::vector<size_t> &) { assert(0); }
|
||||||
|
@ -213,6 +223,8 @@ public:
|
||||||
return (void *)0;
|
return (void *)0;
|
||||||
}
|
}
|
||||||
void CopyValue(const size_t, const size_t, const SimpleTempDataBase *) { assert(0); }
|
void CopyValue(const size_t, const size_t, const SimpleTempDataBase *) { assert(0); }
|
||||||
|
private:
|
||||||
|
AttrType *attribute;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace vcg
|
} // end namespace vcg
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace math {
|
||||||
|
|
||||||
/* Some <math.h> files do not define M_PI... */
|
/* Some <math.h> files do not define M_PI... */
|
||||||
#ifndef M_PI
|
#ifndef M_PI
|
||||||
#define M_PI 3.14159265358979323846
|
#define M_PI 3.14159265358979323846264338327950288
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SQRT_TWO
|
#ifndef SQRT_TWO
|
||||||
|
|
|
@ -566,7 +566,7 @@ bool Decompose(Matrix44<T> &M, Point3<T> &ScaleV, Point3<T> &ShearV, Point3<T> &
|
||||||
return false;
|
return false;
|
||||||
if(math::Abs(M.Determinant())<1e-10) return false; // matrix should be at least invertible...
|
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);
|
TranV=M.GetColumn3(3);
|
||||||
|
|
||||||
// Second Step Recover Scale and Shearing interleaved
|
// Second Step Recover Scale and Shearing interleaved
|
||||||
|
|
|
@ -207,7 +207,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* multiply the current reference frame for the matrix passed
|
/* 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)
|
void MultMatrix( vcg::Matrix44<S> m44)
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* multiply the current reference frame for the similarity passed
|
/* 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());}
|
void MultSimilarity( const Similarity<S> & s){ MultMatrix(s.Matrix());}
|
||||||
|
|
||||||
|
|
|
@ -20,11 +20,19 @@
|
||||||
* for more details. *
|
* 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
|
#ifndef __VCG_EDGE_PLUS
|
||||||
#define __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 {
|
namespace vcg {
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -20,12 +20,17 @@
|
||||||
* for more details. *
|
* 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
|
#ifndef __VCG_EDGE_PLUS_COMPONENT
|
||||||
#define __VCG_EDGE_PLUS_COMPONENT
|
#define __VCG_EDGE_PLUS_COMPONENT
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <vcg/space/color4.h>
|
||||||
|
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace edge {
|
namespace edge {
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#ifndef __VCG_EDGE_POS
|
#ifndef __VCG_EDGE_POS
|
||||||
#define __VCG_EDGE_POS
|
#define __VCG_EDGE_POS
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace edge {
|
namespace edge {
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,12 @@
|
||||||
#ifndef _VCG_EDGE_TOPOLOGY
|
#ifndef _VCG_EDGE_TOPOLOGY
|
||||||
#define _VCG_EDGE_TOPOLOGY
|
#define _VCG_EDGE_TOPOLOGY
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <vcg/complex/allocate.h>
|
||||||
|
|
||||||
|
#include "pos.h"
|
||||||
|
#include "component.h"
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace edge {
|
namespace edge {
|
||||||
/** \addtogroup edge */
|
/** \addtogroup edge */
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue