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:
|
||||
[push, pull_request]
|
||||
|
||||
jobs:
|
||||
ubuntu_build_tests:
|
||||
name: Build Samples (Ubuntu)
|
||||
runs-on: ubuntu-latest #in order to deploy, need to use oldest supported version
|
||||
name: Build Examples (Linux)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -14,5 +14,7 @@ jobs:
|
|||
uses: jurplel/install-qt-action@v2
|
||||
- name: Build Samples
|
||||
run: |
|
||||
qmake apps/sample/sample.pro
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DVCG_BUILD_EXAMPLES=ON ..
|
||||
make -j4
|
|
@ -1,11 +1,11 @@
|
|||
name: BuildSamplesMacOS
|
||||
name: BuildExamplesMacOS
|
||||
|
||||
on:
|
||||
[push, pull_request]
|
||||
|
||||
jobs:
|
||||
macos_build_tests:
|
||||
name: Build Samples (MacOS)
|
||||
name: Build Examples (MacOS)
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
|
@ -14,5 +14,7 @@ jobs:
|
|||
uses: jurplel/install-qt-action@v2
|
||||
- name: Build Samples
|
||||
run: |
|
||||
qmake apps/sample/sample.pro
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DVCG_BUILD_EXAMPLES=ON ..
|
||||
make -j4
|
|
@ -1,10 +1,10 @@
|
|||
name: BuildSamplesWindows
|
||||
name: BuildExamplesWindows
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
windows_build_tests:
|
||||
name: Build Samples (Windows)
|
||||
name: Build Examples (Windows)
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
|
@ -25,5 +25,7 @@ jobs:
|
|||
uses: jurplel/install-qt-action@v2
|
||||
- name: Build Samples
|
||||
run: |
|
||||
qmake apps/sample/sample.pro
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "NMake Makefiles" -DVCG_BUILD_EXAMPLES=ON ..
|
||||
jom -j4
|
|
@ -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 library, composed by more than 100k lines of code, is released under the GPL license, and it is the base of most of the software tools of the [Visual Computing Lab](http://vcg.isti.cnr.it) of the Italian National Research Council Institute ISTI, like MeshLab, metro and many others.
|
||||
|
||||
|
@ -28,17 +28,10 @@ A number of applications have been developed using the vcglib:
|
|||
- Metro, the tool for measuring differences between meshes
|
||||
- The first high quality out-of-core mesh simplifier that was used by the Stanford Digital Michelangelo project to process their huge 3D scanned models.
|
||||
|
||||
## Contributing
|
||||
In case of bugs please report them [here](https://github.com/cnr-isti-vclab/vcglib/issues).
|
||||
|
||||
Copyright of the library is fully owned by CNR. Contributing means signing an appropriate [license agreement](https://github.com/cnr-isti-vclab/vcglib/blob/master/docs/ContributorLicenseAgreement.pdf) .
|
||||
|
||||
Pull requests about trivial, small, questionable updates (e.g. small stylistic changes like int -> uint8_t) will be rejected without discussion.
|
||||
|
||||
|
||||
## Contacts
|
||||
|
||||
For any info about licensing (portion of) the library please contact us:
|
||||
Paolo Cignoni (p.cignoni@isti.cnr.it)
|
||||
Visual Computing Lab of the Italian National Research Council - ISTI
|
||||
|
||||
In case of bugs please report them [here](https://github.com/cnr-isti-vclab/vcglib/issues) .
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
|
||||
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
|
||||
include_directories(../)
|
||||
include_directories(../eigenlib)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
project(VCGApps)
|
||||
|
||||
add_subdirectory(sample)
|
||||
add_subdirectory(metro)
|
||||
add_subdirectory(tridecimator)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
|
@ -64,10 +64,10 @@ class CMesh : public vcg::tri::TriMesh< std::vector<CVertex>, std::vector<CFac
|
|||
|
||||
class GLArea:public QGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
GLArea (QWidget * parent = 0);
|
||||
/// we choosed a subset of the avaible drawing modes
|
||||
/// we chose a subset of the available drawing modes
|
||||
enum DrawMode{SMOOTH=0,POINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
|
||||
public slots:
|
||||
/// widget-based user interaction slots
|
||||
|
@ -89,7 +89,7 @@ protected:
|
|||
void mousePressEvent(QMouseEvent*e);
|
||||
void mouseMoveEvent(QMouseEvent*e);
|
||||
void mouseReleaseEvent(QMouseEvent*e);
|
||||
void wheelEvent(QWheelEvent*e);
|
||||
void wheelEvent(QWheelEvent*e);
|
||||
private:
|
||||
/// the active mesh instance
|
||||
CMesh mesh;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
|
@ -65,13 +65,13 @@ public:
|
|||
|
||||
class GLArea:public QGLWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
public:
|
||||
GLArea (SharedDataOpenGLContext* sharedcontext,MainWindow* parent);
|
||||
~GLArea();
|
||||
void resetTrackBall();
|
||||
//unsigned int getId() const {return areaid;}
|
||||
/// we choosed a subset of the avaible drawing modes
|
||||
/// we chose a subset of the available drawing modes
|
||||
|
||||
signals:
|
||||
/// signal for setting the statusbar message
|
||||
|
@ -88,7 +88,7 @@ protected:
|
|||
void mousePressEvent(QMouseEvent*e);
|
||||
void mouseMoveEvent(QMouseEvent*e);
|
||||
void mouseReleaseEvent(QMouseEvent*e);
|
||||
void wheelEvent(QWheelEvent*e);
|
||||
void wheelEvent(QWheelEvent*e);
|
||||
|
||||
private:
|
||||
MainWindow* parwin;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
|
@ -24,7 +24,7 @@
|
|||
/**
|
||||
* Minimal trimesh viewer made with AntTweakBar and freglut
|
||||
*
|
||||
* This sample shows how to use togheter:
|
||||
* This sample shows how to use togheter:
|
||||
* - the trimesh loading and initialization
|
||||
* - basic usage of the default manipulators (the "Trackball")
|
||||
*/
|
||||
|
@ -75,7 +75,7 @@ vcg::Trackball track;
|
|||
/// window size
|
||||
int width,height;
|
||||
|
||||
/// we choosed a subset of the avaible drawing modes
|
||||
/// we chose a subset of the available drawing modes
|
||||
enum DrawMode{SMOOTH=0,PERPOINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
|
||||
|
||||
/// the current drawmode
|
||||
|
@ -101,7 +101,7 @@ static vcg::Trackball::Button GLUT2VCG (int glut_button, int )
|
|||
return vcg::Trackball::Button (vcgbt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -124,29 +124,29 @@ void Display(){
|
|||
glPushMatrix();
|
||||
float d=1.0f/mesh.bbox.Diag();
|
||||
vcg::glScale(d);
|
||||
glTranslate(-glWrap.m->bbox.Center());
|
||||
glTranslate(-glWrap.m->bbox.Center());
|
||||
// the trimesh drawing calls
|
||||
switch(drawmode)
|
||||
{
|
||||
case SMOOTH:
|
||||
case SMOOTH:
|
||||
glWrap.Draw<vcg::GLW::DMSmooth, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
|
||||
break;
|
||||
case PERPOINTS:
|
||||
case PERPOINTS:
|
||||
glWrap.Draw<vcg::GLW::DMPoints, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
|
||||
break;
|
||||
case WIRE:
|
||||
case WIRE:
|
||||
glWrap.Draw<vcg::GLW::DMWire, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
|
||||
break;
|
||||
case FLATWIRE:
|
||||
case FLATWIRE:
|
||||
glWrap.Draw<vcg::GLW::DMFlatWire, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
|
||||
break;
|
||||
case HIDDEN:
|
||||
case HIDDEN:
|
||||
glWrap.Draw<vcg::GLW::DMHidden, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
|
||||
break;
|
||||
case FLAT:
|
||||
case FLAT:
|
||||
glWrap.Draw<vcg::GLW::DMFlat, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ void initMesh()
|
|||
}
|
||||
|
||||
void TW_CALL loadMesh(void *)
|
||||
{
|
||||
{
|
||||
if(filename==0) return;
|
||||
int err=vcg::tri::io::ImporterPLY<CMesh>::Open(mesh,(char*)filename);
|
||||
if(err!=0){
|
||||
|
@ -276,7 +276,7 @@ int main(int argc, char *argv[])
|
|||
// (note that AntTweakBar could also be intialized after GLUT, no matter)
|
||||
if( !TwInit(TW_OPENGL, NULL) )
|
||||
{
|
||||
// A fatal error occured
|
||||
// A fatal error occured
|
||||
fprintf(stderr, "AntTweakBar initialization failed: %s\n", TwGetLastError());
|
||||
return 1;
|
||||
}
|
||||
|
@ -311,12 +311,12 @@ int main(int argc, char *argv[])
|
|||
glutKeyboardFunc(keyPressEvent);
|
||||
glutKeyboardUpFunc(keyReleaseEvent);
|
||||
|
||||
|
||||
|
||||
glutMouseWheelFunc(wheelEvent);
|
||||
bar = TwNewBar("TweakBar");
|
||||
|
||||
TwCopyCDStringToClientFunc (CopyCDStringToClient);
|
||||
|
||||
|
||||
TwAddVarRW(bar,"Input",TW_TYPE_CDSTRING,&filename," label='Filepath' group=SetMesh help=` Name of the file to load` ");
|
||||
TwAddButton(bar,"Load from file",loadMesh,0, " label='Load Mesh' group=SetMesh help=`load the mesh` ");
|
||||
TwAddButton(bar,"Use tetrahedron",loadTetrahedron,0, " label='Make Tetrahedron' group=SetMesh help=`use tetrahedron.` ");
|
||||
|
|
|
@ -1,2 +1,17 @@
|
|||
cmake_minimum_required(VERSION 3.13)
|
||||
project (metro)
|
||||
add_executable(metro metro.cpp ../../wrap/ply/plylib.cpp)
|
||||
|
||||
if (VCG_HEADER_ONLY)
|
||||
set(SOURCES
|
||||
metro.cpp
|
||||
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
|
||||
endif()
|
||||
|
||||
add_executable(metro
|
||||
${SOURCES})
|
||||
|
||||
target_link_libraries(
|
||||
metro
|
||||
PUBLIC
|
||||
vcglib
|
||||
)
|
||||
|
|
|
@ -112,7 +112,7 @@ template<class TriMeshType>
|
|||
// ALNParser::ParseALN(rmaps, alnName);
|
||||
|
||||
// for(size_t i=0; i<rmaps.size(); i++)
|
||||
// AddSingleMesh(rmaps[i].filename.c_str(), rmaps[i].trasformation, rmaps[i].quality);
|
||||
// AddSingleMesh(rmaps[i].filename.c_str(), rmaps[i].transformation, rmaps[i].quality);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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_voronoiatlas \
|
||||
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)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
|
||||
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
|
||||
project (trimesh_base)
|
||||
add_executable(trimesh_base trimesh_base.cpp)
|
||||
include_directories(../../..)
|
||||
include_directories(../../../eigenlib)
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
project(trimesh_base)
|
||||
|
||||
if (VCG_HEADER_ONLY)
|
||||
set(SOURCES
|
||||
trimesh_base.cpp)
|
||||
endif()
|
||||
|
||||
add_executable(trimesh_base
|
||||
${SOURCES})
|
||||
|
||||
target_link_libraries(
|
||||
trimesh_base
|
||||
PUBLIC
|
||||
vcglib
|
||||
)
|
||||
|
|
|
@ -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)
|
||||
TARGET = trimesh_sampling
|
||||
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)
|
||||
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 typename MeshType::VertexType VertexType;
|
||||
typedef typename MeshType::VertexPointer VertexPointer;
|
||||
typedef typename MeshType::ConstVertexPointer ConstVertexPointer;
|
||||
typedef typename MeshType::VertexIterator VertexIterator;
|
||||
typedef typename MeshType::ConstVertexIterator ConstVertexIterator;
|
||||
typedef typename MeshType::EdgeIterator EdgeIterator;
|
||||
|
@ -931,30 +932,38 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* The number of polygonal faces is
|
||||
* FN - EN_f (each faux edge hides exactly one triangular face or in other words a polygon of n edges has n-3 faux edges.)
|
||||
* In the general case where a The number of polygonal faces is
|
||||
* FN - EN_f + VN_f
|
||||
* where:
|
||||
* EN_f is the number of faux edges.
|
||||
* VN_f is the number of faux vertices (e.g vertices completely surrounded by faux edges)
|
||||
* 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.
|
||||
*/
|
||||
static int CountBitLargePolygons(MeshType &m)
|
||||
* The number of polygonal faces is
|
||||
* FN - EN_f (each faux edge hides exactly one triangular face or in other words a polygon of n edges has n-3 faux edges.)
|
||||
* In the general case where a The number of polygonal faces is
|
||||
* FN - EN_f + VN_f
|
||||
* where:
|
||||
* EN_f is the number of faux edges.
|
||||
* VN_f is the number of faux vertices (e.g vertices completely surrounded by faux edges)
|
||||
* 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.
|
||||
*/
|
||||
static int CountBitLargePolygons(const MeshType &m)
|
||||
{
|
||||
tri::RequirePerFaceFlags(m);
|
||||
UpdateFlags<MeshType>::VertexSetV(m);
|
||||
//note - using unordered_map to set visited vertices because
|
||||
//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
|
||||
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())
|
||||
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
|
||||
// (e.g vertexes on the boundary of a polygon)
|
||||
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()) {
|
||||
for(int i=0;i<3;++i)
|
||||
{
|
||||
|
@ -962,16 +971,16 @@ public:
|
|||
countE++;
|
||||
else
|
||||
{
|
||||
fi->V0(i)->SetV();
|
||||
fi->V1(i)->SetV();
|
||||
vertVisited[fi->V0(i)] = true;
|
||||
vertVisited[fi->V1(i)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Third Loop, count the number of referenced vertexes that are completely surrounded by faux edges.
|
||||
|
||||
int countV = 0;
|
||||
for (VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
|
||||
if (!vi->IsD() && !vi->IsV()) countV++;
|
||||
for (ConstVertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
|
||||
if (!vi->IsD() && !(vertVisited[&(*vi)])) countV++;
|
||||
|
||||
return m.fn - countE/2 + countV ;
|
||||
}
|
||||
|
@ -1520,7 +1529,7 @@ public:
|
|||
std::vector< VertexPointer > minVertVec;
|
||||
std::vector< VertexPointer > maxVertVec;
|
||||
|
||||
// The set of directions to be choosen
|
||||
// The set of directions to be chosen
|
||||
std::vector< CoordType > dirVec;
|
||||
dirVec.push_back(CoordType(1,0,0));
|
||||
dirVec.push_back(CoordType(0,1,0));
|
||||
|
|
|
@ -235,19 +235,19 @@ public:
|
|||
ScalarT cotB = 0;
|
||||
|
||||
// Get the edge (a pair of vertices)
|
||||
VertexType * v0 = f.cV(edge);
|
||||
VertexType * v1 = f.cV((edge+1)%f.VN());
|
||||
const VertexType * v0 = f.cV(edge);
|
||||
const VertexType * v1 = f.cV((edge+1)%f.VN());
|
||||
|
||||
if (fp != NULL &&
|
||||
fp != &f)
|
||||
{
|
||||
// not a border edge
|
||||
VertexType * vb = fp->cV((f.cFFi(edge)+2)%fp->VN());
|
||||
const VertexType * vb = fp->cV((f.cFFi(edge)+2)%fp->VN());
|
||||
ScalarT angleB = ComputeAngle<ScalarT>(v0, vb, v1);
|
||||
cotB = vcg::math::Cos(angleB) / vcg::math::Sin(angleB);
|
||||
}
|
||||
|
||||
VertexType * va = f.cV((edge+2)%f.VN());
|
||||
const VertexType * va = f.cV((edge+2)%f.VN());
|
||||
ScalarT angleA = ComputeAngle<ScalarT>(v0, va, v1);
|
||||
cotA = vcg::math::Cos(angleA) / vcg::math::Sin(angleA);
|
||||
|
||||
|
|
|
@ -813,7 +813,7 @@ private:
|
|||
{
|
||||
if (faces[i]->IsFaceEdgeS(VtoE(vIdxes[i], (vIdxes[i]+1)%3)) && !vcg::tri::IsMarked(*params.m, faces[i]->cV1(vIdxes[i])))
|
||||
{
|
||||
vcg::tri::Mark(*params.m,faces[i]->cV1(vIdxes[i]));
|
||||
vcg::tri::Mark(*params.m,faces[i]->V1(vIdxes[i]));
|
||||
incidentFeatures++;
|
||||
CoordType movingEdgeVector0 = (faces[i]->cP1(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
|
||||
if (std::fabs(movingEdgeVector0 * dEdgeVector) < .9f || !p.IsEdgeS())
|
||||
|
@ -821,7 +821,7 @@ private:
|
|||
}
|
||||
if (faces[i]->IsFaceEdgeS(VtoE(vIdxes[i], (vIdxes[i]+2)%3)) && !vcg::tri::IsMarked(*params.m, faces[i]->cV2(vIdxes[i])))
|
||||
{
|
||||
vcg::tri::Mark(*params.m,faces[i]->cV2(vIdxes[i]));
|
||||
vcg::tri::Mark(*params.m,faces[i]->V2(vIdxes[i]));
|
||||
incidentFeatures++;
|
||||
CoordType movingEdgeVector1 = (faces[i]->cP2(vIdxes[i]) - faces[i]->cP(vIdxes[i])).Normalize();
|
||||
if (std::fabs(movingEdgeVector1 * dEdgeVector) < .9f || !p.IsEdgeS())
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#ifndef __VCGLIB_MESH_ASSERT
|
||||
#define __VCGLIB_MESH_ASSERT
|
||||
|
||||
#include <vcg/complex/exception.h>
|
||||
#include <vcg/simplex/edge/pos.h>
|
||||
#include <vcg/complex/algorithms/update/flag.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
/**
|
||||
|
|
|
@ -96,11 +96,10 @@ public:
|
|||
}
|
||||
|
||||
///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;
|
||||
VertexIterator vi;
|
||||
for (vi=m.vert.begin();vi!=m.vert.end();vi++)
|
||||
for (auto vi=m.vert.begin();vi!=m.vert.end();vi++)
|
||||
{
|
||||
if ((*vi).IsD()) continue;
|
||||
UVBox.Add((*vi).T().P());
|
||||
|
|
|
@ -35,6 +35,7 @@ sampling strategies (montecarlo, stratified etc).
|
|||
#ifndef __VCGLIB_POINT_SAMPLING
|
||||
#define __VCGLIB_POINT_SAMPLING
|
||||
|
||||
#include <random>
|
||||
|
||||
#include <vcg/math/random_generator.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);
|
||||
|
||||
unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||
std::random_shuffle(faceVec.begin(),faceVec.end(), p_myrandom);
|
||||
//unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||
std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
std::shuffle(faceVec.begin(),faceVec.end(), g);
|
||||
}
|
||||
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);
|
||||
|
||||
unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||
std::random_shuffle(vertVec.begin(),vertVec.end(), p_myrandom);
|
||||
//unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||
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.
|
||||
|
@ -1000,7 +1005,7 @@ static void AllEdge(MeshType & m, VertexSampler &ps)
|
|||
|
||||
// Regular Uniform Edge sampling
|
||||
// Each edge is subdivided in a number of pieces proprtional to its length
|
||||
// Sample are choosen without touching the vertices.
|
||||
// Samples are chosen without touching the vertices.
|
||||
|
||||
static void EdgeUniform(MeshType & m, VertexSampler &ps,int sampleNum, bool sampleFauxEdge=true)
|
||||
{
|
||||
|
@ -1928,8 +1933,10 @@ static void PoissonDiskPruning(VertexSampler &ps, MeshType &montecarloMesh,
|
|||
if(pp.adaptiveRadiusFlag)
|
||||
InitRadiusHandleFromQuality(montecarloMesh, rH, diskRadius, pp.radiusVariance, pp.invertQuality);
|
||||
|
||||
unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||
std::random_shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), p_myrandom);
|
||||
//unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||
std::random_device rd;
|
||||
std::mt19937 g(rd());
|
||||
std::shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), g);
|
||||
int t1 = clock();
|
||||
pp.pds.montecarloSampleNum = montecarloMesh.vn;
|
||||
pp.pds.sampleNum =0;
|
||||
|
@ -2062,13 +2069,15 @@ static void HierarchicalPoissonDisk(MeshType &origMesh, VertexSampler &ps, MeshT
|
|||
montecarloSHT.UpdateAllocatedCells();
|
||||
}
|
||||
// shuffle active cells
|
||||
unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||
std::random_shuffle(montecarloSHT.AllocatedCells.begin(),montecarloSHT.AllocatedCells.end(), p_myrandom);
|
||||
//unsigned int (*p_myrandom)(unsigned int) = RandomInt;
|
||||
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
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
int removedCnt=montecarloSHT.hash_table.size();
|
||||
int addedCnt=checkSHT.hash_table.size();
|
||||
int removedCnt=montecarloSHT.hash_table.size();
|
||||
int addedCnt=checkSHT.hash_table.size();
|
||||
for (int i = 0; i < montecarloSHT.AllocatedCells.size(); i++)
|
||||
{
|
||||
for(int j=0;j<4;j++)
|
||||
|
|
|
@ -141,7 +141,8 @@ namespace tri {
|
|||
{
|
||||
std::vector<typename TriMeshType::VertexPointer> vs;// vertices of the polygon
|
||||
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)
|
||||
if (vs.size()==0)continue;
|
||||
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 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.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
|
@ -45,13 +45,13 @@ namespace tri
|
|||
|
||||
|
||||
/* Base class for all Texture Optimizers*/
|
||||
template<class MESH_TYPE>
|
||||
template<class MESH_TYPE>
|
||||
class TextureOptimizer{
|
||||
protected:
|
||||
MESH_TYPE &m;
|
||||
SimpleTempData<typename MESH_TYPE::VertContainer, int > isFixed;
|
||||
public:
|
||||
|
||||
|
||||
/* Tpyes */
|
||||
typedef MESH_TYPE MeshType;
|
||||
typedef typename MESH_TYPE::VertexIterator VertexIterator;
|
||||
|
@ -59,26 +59,26 @@ public:
|
|||
typedef typename MESH_TYPE::VertexType VertexType;
|
||||
typedef typename MESH_TYPE::FaceType FaceType;
|
||||
typedef typename MESH_TYPE::ScalarType ScalarType;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Access functions */
|
||||
const MeshType & Mesh() const {return m;}
|
||||
MeshType & Mesh() {return m;}
|
||||
|
||||
|
||||
/* Constructior */
|
||||
TextureOptimizer(MeshType &_m):m(_m),isFixed(_m.vert){
|
||||
assert(m.HasPerVertexTexture());
|
||||
}
|
||||
|
||||
// initializes on current geometry
|
||||
|
||||
// initializes on current geometry
|
||||
virtual void TargetCurrentGeometry()=0;
|
||||
|
||||
// performs an interation. Returns largest movement.
|
||||
|
||||
// performs an iteration. Returns largest movement.
|
||||
virtual ScalarType Iterate()=0;
|
||||
|
||||
|
||||
// performs an iteration (faster, but it does not tell how close it is to stopping)
|
||||
virtual void IterateBlind()=0;
|
||||
|
||||
|
||||
// performs <steps> iteration
|
||||
virtual ScalarType IterateN(int step){
|
||||
for (int i=0; i<step-1; i++) {
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
}
|
||||
if (step>1) return this->Iterate(); else return 0;
|
||||
}
|
||||
|
||||
|
||||
// performs iterations until convergence.
|
||||
bool IterateUntilConvergence(ScalarType threshold=0.0001, int maxite=5000){
|
||||
int i;
|
||||
|
@ -95,34 +95,34 @@ public:
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// desctuctor: free temporary field
|
||||
~TextureOptimizer(){
|
||||
isFixed.Stop();
|
||||
};
|
||||
|
||||
|
||||
// set the current border as fixed (forced to stay in position during text optimization)
|
||||
void SetBorderAsFixed(){
|
||||
isFixed.Start();
|
||||
for (VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) {
|
||||
isFixed[v]=(v->IsB())?1:0;
|
||||
}
|
||||
isFixed[v]=(v->IsB())?1:0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// everything moves, no vertex must fixed during texture optimization)
|
||||
void SetNothingAsFixed(){
|
||||
isFixed.Start();
|
||||
for (VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) {
|
||||
isFixed[v]=0;
|
||||
}
|
||||
isFixed[v]=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// fix a given vertex
|
||||
void FixVertex(const VertexType *v, bool fix=true){
|
||||
isFixed[v]=(fix)?1:0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -130,12 +130,12 @@ public:
|
|||
/*
|
||||
AREA PRESERVING TEXTURE OPTIMIZATION
|
||||
|
||||
as in: Degener, P., Meseth, J., Klein, R.
|
||||
as in: Degener, P., Meseth, J., Klein, R.
|
||||
"An adaptable surface parameterization method."
|
||||
Proc. of the 12th International Meshing oundtable, 201–213 [2003].
|
||||
Proc. of the 12th International Meshing oundtable, 201-213 [2003].
|
||||
|
||||
Features:
|
||||
|
||||
|
||||
:) - Balances angle and area distortions (best results!).
|
||||
:) - Can choose how to balance area and angle preservation (see SetTheta)
|
||||
theta=0 -> pure conformal (use MIPS instead!)
|
||||
|
@ -144,12 +144,12 @@ Features:
|
|||
:( - Slowest method.
|
||||
:( - Requires a fixed boundary, else expands forever in texture space (unless theta=0).
|
||||
:( - Diverges in presence of flipped faces (unless theta=0).
|
||||
:( - Requires a speed parameter to be set.
|
||||
:( - Requires a speed parameter to be set.
|
||||
Speed too large => when close, bounces back and forth around minimum, w/o getting any closer.
|
||||
Lower speed => longer convercence times
|
||||
*/
|
||||
|
||||
template<class MESH_TYPE>
|
||||
template<class MESH_TYPE>
|
||||
class AreaPreservingTextureOptimizer:public TextureOptimizer<MESH_TYPE>{
|
||||
public:
|
||||
/* Types */
|
||||
|
@ -159,34 +159,34 @@ public:
|
|||
typedef typename MESH_TYPE::VertexType VertexType;
|
||||
typedef typename MESH_TYPE::FaceType FaceType;
|
||||
typedef typename MESH_TYPE::ScalarType ScalarType;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
typedef TextureOptimizer<MESH_TYPE> Super; // superclass (commodity)
|
||||
|
||||
|
||||
// extra data per face: [0..3] -> cotangents. [4] -> area*2
|
||||
SimpleTempData<typename MESH_TYPE::FaceContainer, Point4<ScalarType> > data;
|
||||
SimpleTempData<typename MESH_TYPE::VertContainer, Point2<ScalarType> > sum;
|
||||
|
||||
|
||||
ScalarType totArea;
|
||||
ScalarType speed;
|
||||
|
||||
|
||||
int theta;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// constructor and destructor
|
||||
AreaPreservingTextureOptimizer(MeshType &_m):Super(_m),data(_m.face),sum(_m.vert){
|
||||
speed=0.001;
|
||||
theta=3;
|
||||
}
|
||||
|
||||
|
||||
~AreaPreservingTextureOptimizer(){
|
||||
data.Stop();
|
||||
sum.Stop();
|
||||
Super::isFixed.Stop();
|
||||
}
|
||||
|
||||
|
||||
void SetSpeed(ScalarType _speed){
|
||||
speed=_speed;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ public:
|
|||
ScalarType GetSpeed(){
|
||||
return speed;
|
||||
}
|
||||
|
||||
|
||||
// sets the parameter theta:
|
||||
// good parameters are in 1..3
|
||||
// 0 = converge to pure conformal, ignore area preservation
|
||||
|
@ -207,16 +207,16 @@ public:
|
|||
int GetTheta(){
|
||||
return theta;
|
||||
}
|
||||
|
||||
|
||||
void IterateBlind(){
|
||||
/* todo: do as iterate, but without */
|
||||
/* todo: do as iterate, but without */
|
||||
Iterate();
|
||||
}
|
||||
|
||||
|
||||
ScalarType Iterate(){
|
||||
|
||||
|
||||
ScalarType max; // max displacement
|
||||
|
||||
|
||||
#define v0 (f->V0(i)->T().P())
|
||||
#define v1 (f->V1(i)->T().P())
|
||||
#define v2 (f->V2(i)->T().P())
|
||||
|
@ -236,15 +236,15 @@ public:
|
|||
for (FaceIterator f=Super::m.face.begin(); f!=Super::m.face.end(); f++) {
|
||||
int i=0; ScalarType area2 = ((v1-v0) ^ (v2-v0));
|
||||
for (i=0; i<3; i++){
|
||||
ScalarType
|
||||
ScalarType
|
||||
a = (v1-v0).Norm(),
|
||||
b = ((v1-v0) * (v2-v0))/a,
|
||||
c = area2 / a,
|
||||
|
||||
|
||||
m0= data[f][i] / area2,
|
||||
m1= data[f][(i+1)%3] / area2,
|
||||
m2= data[f][(i+2)%3] / area2,
|
||||
|
||||
|
||||
mx= (b-a)/area2,
|
||||
my= c/area2, // 1.0/a
|
||||
mA= data[f][3]/area2 * scale,
|
||||
|
@ -258,35 +258,35 @@ public:
|
|||
|
||||
/* linear weightings
|
||||
|
||||
dx= (OMEGA) * (my * M2) +
|
||||
dx= (OMEGA) * (my * M2) +
|
||||
(1-OMEGA) * ( px - 2.0*qx),
|
||||
dy= (OMEGA) * (-mx * M2) +
|
||||
dy= (OMEGA) * (-mx * M2) +
|
||||
(1-OMEGA) * ( py - 2.0*qy),*/
|
||||
|
||||
|
||||
// exponential weighting
|
||||
// 2d gradient
|
||||
|
||||
|
||||
dx=// M1
|
||||
//*M1 // ^ theta-1
|
||||
//*M1 // ^ theta-1
|
||||
pow(M1,theta-1)
|
||||
*(px*(M1+ theta*M2) - 2.0*qx*M1),
|
||||
*(px*(M1+ theta*M2) - 2.0*qx*M1),
|
||||
dy=// M1
|
||||
//*M1 // ^ theta-1
|
||||
//*M1 // ^ theta-1
|
||||
pow(M1,theta-1)
|
||||
*(py*(M1+ theta*M2) - 2.0*qy*M1),
|
||||
*(py*(M1+ theta*M2) - 2.0*qy*M1),
|
||||
|
||||
gy= dy/c,
|
||||
gx= (dx - gy*b) / a;
|
||||
|
||||
// 3d gradient
|
||||
|
||||
sum[f->V(i)]+= ( (v1-v0) * gx + (v2-v0) * gy ) * data[f][3];
|
||||
sum[f->V(i)]+= ( (v1-v0) * gx + (v2-v0) * gy ) * data[f][3];
|
||||
}
|
||||
}
|
||||
max=0; // max displacement
|
||||
max=0; // max displacement
|
||||
speed=0.001;
|
||||
for (VertexIterator v=Super::m.vert.begin(); v!=Super::m.vert.end(); v++)
|
||||
if ( !Super::isFixed[v] ) //if (!v->IsB())
|
||||
for (VertexIterator v=Super::m.vert.begin(); v!=Super::m.vert.end(); v++)
|
||||
if ( !Super::isFixed[v] ) //if (!v->IsB())
|
||||
{
|
||||
ScalarType n=sum[v].Norm();
|
||||
if ( n > 1 ) { sum[v]/=n; n=1.0;}
|
||||
|
@ -298,17 +298,17 @@ public:
|
|||
}
|
||||
return max;
|
||||
#undef v0
|
||||
#undef v1
|
||||
#undef v2
|
||||
#undef v1
|
||||
#undef v2
|
||||
//printf("rejected %d\n",rejected);
|
||||
}
|
||||
|
||||
|
||||
void TargetCurrentGeometry(){
|
||||
|
||||
|
||||
Super::isFixed.Start();
|
||||
data.Start();
|
||||
sum.Start();
|
||||
|
||||
|
||||
totArea=0;
|
||||
for (FaceIterator f=Super::m.face.begin(); f!=Super::m.face.end(); f++) {
|
||||
double area2 = ((f->V(1)->P() - f->V(0)->P() )^(f->V(2)->P() - f->V(0)->P() )).Norm();
|
||||
|
@ -322,7 +322,7 @@ public:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -333,12 +333,12 @@ public:
|
|||
// returns false if any fold is present (faster than MarkFolds)
|
||||
template<class MESH_TYPE>
|
||||
bool IsFoldFree(MESH_TYPE &m){
|
||||
|
||||
|
||||
assert(m.HasPerVertexTexture());
|
||||
|
||||
|
||||
typedef typename MESH_TYPE::VertexType::TextureType::PointType PointType;
|
||||
typedef typename MESH_TYPE::VertexType::TextureType::PointType::ScalarType ScalarType;
|
||||
|
||||
|
||||
ScalarType lastsign=0;
|
||||
for (typename MESH_TYPE::FaceIterator f=m.face.begin(); f!=m.face.end(); f++){
|
||||
ScalarType sign=((f->V(1)->T().P()-f->V(0)->T().P()) ^ (f->V(2)->T().P()-f->V(0)->T().P()));
|
||||
|
@ -354,16 +354,16 @@ bool IsFoldFree(MESH_TYPE &m){
|
|||
// returns number of folded faces
|
||||
template<class MESH_TYPE>
|
||||
int MarkFolds(MESH_TYPE &m){
|
||||
|
||||
|
||||
assert(m.HasPerVertexTexture());
|
||||
assert(m.HasPerFaceQuality());
|
||||
|
||||
|
||||
typedef typename MESH_TYPE::VertexType::TextureType::PointType PointType;
|
||||
typedef typename MESH_TYPE::VertexType::TextureType::PointType::ScalarType ScalarType;
|
||||
|
||||
|
||||
SimpleTempData<typename MESH_TYPE::FaceContainer, short> sign(m.face);
|
||||
sign.Start(0);
|
||||
|
||||
|
||||
// first pass, determine predominant sign
|
||||
int npos=0, nneg=0;
|
||||
ScalarType lastsign=0;
|
||||
|
@ -372,7 +372,7 @@ int MarkFolds(MESH_TYPE &m){
|
|||
if (fsign<0) { sign[f]=-1; nneg++; }
|
||||
if (fsign>0) { sign[f]=+1; npos++; }
|
||||
}
|
||||
|
||||
|
||||
// second pass, detect folded faces
|
||||
int res=0;
|
||||
short gsign= (nneg>npos)?-1:+1;
|
||||
|
@ -382,28 +382,28 @@ int MarkFolds(MESH_TYPE &m){
|
|||
f->Q()=0;
|
||||
} else f->Q()=1;
|
||||
}
|
||||
|
||||
|
||||
sign.Stop();
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// Smooths texture coords.
|
||||
// (can be useful to remove folds,
|
||||
// (can be useful to remove folds,
|
||||
// e.g. these created when obtaining tecture coordinates after projections)
|
||||
template<class MESH_TYPE>
|
||||
void SmoothTextureCoords(MESH_TYPE &m){
|
||||
|
||||
|
||||
assert(m.HasPerVertexTexture());
|
||||
|
||||
|
||||
typedef typename MESH_TYPE::VertexType::TextureType::PointType PointType;
|
||||
|
||||
|
||||
SimpleTempData<typename MESH_TYPE::VertContainer, int> div(m.vert);
|
||||
SimpleTempData<typename MESH_TYPE::VertContainer, PointType > sum(m.vert);
|
||||
|
||||
|
||||
div.Start();
|
||||
sum.Start();
|
||||
|
||||
|
||||
for (typename MESH_TYPE::VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) {
|
||||
sum[v].SetZero();
|
||||
div[v]=0;
|
||||
|
@ -415,13 +415,13 @@ void SmoothTextureCoords(MESH_TYPE &m){
|
|||
div[f->V(2)] +=2; sum[f->V(2)] += f->V(1)->T().P(); sum[f->V(2)] += f->V(0)->T().P();
|
||||
}
|
||||
|
||||
for (typename MESH_TYPE::VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) // if (!v->IsB())
|
||||
for (typename MESH_TYPE::VertexIterator v=m.vert.begin(); v!=m.vert.end(); v++) // if (!v->IsB())
|
||||
{
|
||||
if (v->div>0) {
|
||||
v->T().P() = sum[v]/div[v];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
div.Stop();
|
||||
sum.Stop();
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#ifndef __VCG_TRI_UPDATE_FLAGS
|
||||
#define __VCG_TRI_UPDATE_FLAGS
|
||||
|
||||
#include <vcg/simplex/face/pos.h>
|
||||
#include <vcg/simplex/tetrahedron/pos.h>
|
||||
#include <vcg/simplex/edge/pos.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
/// \ingroup trimesh
|
||||
|
|
|
@ -24,8 +24,13 @@
|
|||
#ifndef __VCG_TRI_UPDATE_NORMALS
|
||||
#define __VCG_TRI_UPDATE_NORMALS
|
||||
|
||||
#include <vcg/space/triangle3.h>
|
||||
#include <vcg/complex/base.h>
|
||||
|
||||
#include <vcg/complex/algorithms/polygon_support.h>
|
||||
|
||||
#include "flag.h"
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
|
||||
|
|
|
@ -23,6 +23,13 @@
|
|||
#ifndef __VCG_TRI_UPDATE_SELECTION
|
||||
#define __VCG_TRI_UPDATE_SELECTION
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include <vcg/complex/base.h>
|
||||
#include <vcg/simplex/face/topology.h>
|
||||
|
||||
#include "flag.h"
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
/// \ingroup trimesh
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
#ifndef __VCG_TRI_UPDATE_TOPOLOGY
|
||||
#define __VCG_TRI_UPDATE_TOPOLOGY
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include <vcg/complex/base.h>
|
||||
#include <vcg/simplex/face/topology.h>
|
||||
#include <vcg/simplex/edge/pos.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
/// \ingroup trimesh
|
||||
|
|
|
@ -23,9 +23,12 @@
|
|||
#ifndef __VCGLIB_TRIALLOCATOR
|
||||
#define __VCGLIB_TRIALLOCATOR
|
||||
|
||||
#ifndef __VCG_MESH
|
||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
||||
#endif
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include <vcg/container/simple_temporary_data.h>
|
||||
|
||||
#include "used_types.h"
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
|
@ -1423,8 +1426,9 @@ 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>
|
||||
static
|
||||
bool IsValidHandle( const MeshType & m, const typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE> & a){
|
||||
|
@ -1434,6 +1438,18 @@ public:
|
|||
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.
|
||||
|
||||
No attribute with that name must exists (even of different type)
|
||||
|
@ -1482,20 +1498,16 @@ public:
|
|||
}
|
||||
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.
|
||||
Otherwise, returns an invalid handle (check it using IsValidHandle).
|
||||
*/
|
||||
template <class ATTR_TYPE>
|
||||
static
|
||||
typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
||||
typename MeshType::template ConstPerVertexAttributeHandle<ATTR_TYPE>
|
||||
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 typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||
return FindPerVertexAttribute<ATTR_TYPE>(m,name);
|
||||
}
|
||||
|
||||
/*! \brief Try to retrieve an handle to an attribute with a given name and ATTR_TYPE
|
||||
|
@ -1524,39 +1536,42 @@ public:
|
|||
}
|
||||
return typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Same as the one above, but without modifying the attribute if it is found.
|
||||
* (A "find" function should never modify the container in which is looking for..)
|
||||
* Input mesh is const.
|
||||
* @brief Try to retrieve a const handle to an attribute with a given name
|
||||
* and ATTR_TYPE, from the given const mesh.
|
||||
* If not found, an invalid handle will be returned.
|
||||
* Check it with the function IsValidHandle
|
||||
*/
|
||||
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)
|
||||
{
|
||||
assert(!name.empty());
|
||||
PointerToAttribute h1; h1._name = name;
|
||||
typename std::set<PointerToAttribute > :: iterator i;
|
||||
if(!name.empty()){
|
||||
PointerToAttribute h1; h1._name = name;
|
||||
typename std::set<PointerToAttribute > :: iterator i;
|
||||
|
||||
i =m.vert_attr.find(h1);
|
||||
if(i!=m.vert_attr.end())
|
||||
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||
return typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
||||
i =m.vert_attr.find(h1);
|
||||
if(i!=m.vert_attr.end()){
|
||||
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||
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
|
||||
\returns the name of all attributes with a non-empy name.
|
||||
*/
|
||||
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();
|
||||
typename std::set<PointerToAttribute > ::const_iterator i;
|
||||
for(i = m.vert_attr.begin(); i != m.vert_attr.end(); ++i )
|
||||
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);
|
||||
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||
all.push_back((*i)._name);
|
||||
|
@ -1616,6 +1631,15 @@ public:
|
|||
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>
|
||||
static
|
||||
typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE>
|
||||
|
@ -1662,6 +1686,12 @@ public:
|
|||
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>
|
||||
static
|
||||
|
@ -1688,6 +1718,24 @@ public:
|
|||
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>
|
||||
static void GetAllPerEdgeAttribute(const MeshType & m, std::vector<std::string> &all){
|
||||
all.clear();
|
||||
|
@ -1695,7 +1743,7 @@ public:
|
|||
for(i = m.edge_attr.begin(); i != m.edge_attr.end(); ++i )
|
||||
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);
|
||||
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||
all.push_back((*i)._name);
|
||||
|
@ -1731,6 +1779,9 @@ public:
|
|||
}
|
||||
|
||||
/// Per Face Attributes
|
||||
/**
|
||||
* @brief Checks if a handle to a Per-Face attribute is valid
|
||||
*/
|
||||
template <class ATTR_TYPE>
|
||||
static
|
||||
bool IsValidHandle( const MeshType & m, const typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE> & a){
|
||||
|
@ -1740,6 +1791,18 @@ public:
|
|||
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>
|
||||
static
|
||||
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
||||
|
@ -1792,13 +1855,9 @@ public:
|
|||
*/
|
||||
template <class ATTR_TYPE>
|
||||
static
|
||||
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
||||
typename MeshType::template ConstPerFaceAttributeHandle<ATTR_TYPE>
|
||||
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 typename MeshType:: template PerFaceAttributeHandle<ATTR_TYPE>(nullptr,0);
|
||||
return FindPerFaceAttribute<ATTR_TYPE>(m,name);
|
||||
}
|
||||
|
||||
template <class ATTR_TYPE>
|
||||
|
@ -1812,7 +1871,7 @@ public:
|
|||
i =m.face_attr.find(h1);
|
||||
if(i!=m.face_attr.end())
|
||||
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||
if( (*i)._padding != 0 ){
|
||||
if( (*i)._padding != 0 ){
|
||||
PointerToAttribute attr = (*i); // copy the PointerToAttribute
|
||||
m.face_attr.erase(i); // remove it from the set
|
||||
FixPaddedPerFaceAttribute<ATTR_TYPE>(m,attr);
|
||||
|
@ -1826,34 +1885,37 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Same as the one above, but without modifying the attribute if it is found.
|
||||
* (A "find" function should never modify the container in which is looking for..)
|
||||
* Input mesh is const.
|
||||
* @brief Try to retrieve a const handle to an attribute with a given name
|
||||
* and ATTR_TYPE, from the given const mesh.
|
||||
* If not found, an invalid handle will be returned.
|
||||
* Check it with the function IsValidHandle
|
||||
*/
|
||||
template <class ATTR_TYPE>
|
||||
static
|
||||
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
||||
typename MeshType::template ConstPerFaceAttributeHandle<ATTR_TYPE>
|
||||
FindPerFaceAttribute( const MeshType & m, const std::string & name){
|
||||
assert(!name.empty());
|
||||
PointerToAttribute h1; h1._name = name;
|
||||
typename std::set<PointerToAttribute > ::iterator i;
|
||||
if(!name.empty()){
|
||||
PointerToAttribute h1; h1._name = name;
|
||||
typename std::set<PointerToAttribute > ::iterator i;
|
||||
|
||||
i =m.face_attr.find(h1);
|
||||
if(i!=m.face_attr.end())
|
||||
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||
return typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
||||
i =m.face_attr.find(h1);
|
||||
if(i!=m.face_attr.end()){
|
||||
if((*i)._sizeof == sizeof(ATTR_TYPE) ){
|
||||
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>
|
||||
static void GetAllPerFaceAttribute(MeshType & m, std::vector<std::string> &all){
|
||||
static void GetAllPerFaceAttribute(const MeshType & m, std::vector<std::string> &all){
|
||||
all.clear();
|
||||
typename std::set<PointerToAttribute > :: const_iterator i;
|
||||
for(i = m.face_attr.begin(); i != m.face_attr.end(); ++i )
|
||||
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);
|
||||
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||
all.push_back((*i)._name);
|
||||
|
@ -1898,6 +1960,17 @@ public:
|
|||
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>
|
||||
static typename MeshType::template PerTetraAttributeHandle<ATTR_TYPE> AddPerTetraAttribute(MeshType & m, std::string name)
|
||||
{
|
||||
|
@ -1943,6 +2016,12 @@ public:
|
|||
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>
|
||||
static typename MeshType::template PerTetraAttributeHandle<ATTR_TYPE> FindPerTetraAttribute(MeshType &m, const std::string &name)
|
||||
{
|
||||
|
@ -1970,14 +2049,33 @@ public:
|
|||
}
|
||||
|
||||
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();
|
||||
typename std::set<PointerToAttribute>::const_iterator i;
|
||||
for (i = m.tetra_attr.begin(); i != m.tetra_attr.end(); ++i)
|
||||
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);
|
||||
if (IsValidHandle<ATTR_TYPE>(m, hh))
|
||||
all.push_back((*i)._name);
|
||||
|
@ -2026,6 +2124,15 @@ public:
|
|||
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>
|
||||
static
|
||||
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
||||
|
@ -2064,6 +2171,13 @@ public:
|
|||
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>
|
||||
static
|
||||
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
||||
|
@ -2090,6 +2204,24 @@ public:
|
|||
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>
|
||||
static void GetAllPerMeshAttribute(const MeshType & m, std::vector<std::string> &all){
|
||||
typename std::set<PointerToAttribute > :: iterator i;
|
||||
|
@ -2207,7 +2339,7 @@ public:
|
|||
pa._padding = 0;
|
||||
}
|
||||
|
||||
template <class ATTR_TYPE>
|
||||
template <class ATTR_TYPE>
|
||||
static void FixPaddedPerTetraAttribute(MeshType &m, PointerToAttribute &pa)
|
||||
{
|
||||
|
||||
|
@ -2245,7 +2377,7 @@ public:
|
|||
|
||||
// copy the padded container in the new one
|
||||
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
|
||||
delete ( (Attribute<ATTR_TYPE> *) pa._handle);
|
||||
|
|
|
@ -23,9 +23,8 @@
|
|||
#ifndef __VCGLIB_APPEND
|
||||
#define __VCGLIB_APPEND
|
||||
|
||||
#ifndef __VCG_MESH
|
||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
||||
#endif
|
||||
#include <vcg/complex/allocate.h>
|
||||
#include <vcg/complex/algorithms/update/selection.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
|
@ -670,64 +669,76 @@ static void MeshAppendConst(
|
|||
// If the left mesh has attributes that are not in the right mesh, their values for the elements
|
||||
// of the right mesh will be uninitialized
|
||||
|
||||
unsigned int id_r;
|
||||
typename std::set< PointerToAttribute >::iterator al, ar;
|
||||
unsigned int id_r;
|
||||
typename std::set< PointerToAttribute >::iterator al, ar;
|
||||
|
||||
// per vertex attributes
|
||||
for(al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.vert_attr.find(*al);
|
||||
if(ar!= mr.vert_attr.end()){
|
||||
id_r = 0;
|
||||
for (auto v: mr.vert){
|
||||
if( !v.IsD() && (!selected || v.IsS()))
|
||||
(*al)._handle->CopyValue(remap.vert[Index(mr,v)], id_r, (*ar)._handle);
|
||||
++id_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
// per vertex attributes
|
||||
for (al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
|
||||
if(!(*al)._name.empty())
|
||||
{
|
||||
ar = mr.vert_attr.find(*al);
|
||||
if (ar != mr.vert_attr.end())
|
||||
{
|
||||
id_r = 0;
|
||||
for (const auto & v : mr.vert)
|
||||
{
|
||||
if( !v.IsD() && (!selected || v.IsS()))
|
||||
(*al)._handle->CopyValue(remap.vert[Index(mr,v)], id_r, (*ar)._handle);
|
||||
++id_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// per edge attributes
|
||||
for(al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.edge_attr.find(*al);
|
||||
if(ar!= mr.edge_attr.end()){
|
||||
id_r = 0;
|
||||
for (auto e: mr.edge){
|
||||
if( !e.IsD() && (!selected || e.IsS()))
|
||||
(*al)._handle->CopyValue(remap.edge[Index(mr,e)], id_r, (*ar)._handle);
|
||||
++id_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
// per edge attributes
|
||||
for (al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
|
||||
if (!(*al)._name.empty())
|
||||
{
|
||||
ar = mr.edge_attr.find(*al);
|
||||
if (ar!= mr.edge_attr.end())
|
||||
{
|
||||
id_r = 0;
|
||||
for (const auto & e : mr.edge)
|
||||
{
|
||||
if( !e.IsD() && (!selected || e.IsS()))
|
||||
(*al)._handle->CopyValue(remap.edge[Index(mr,e)], id_r, (*ar)._handle);
|
||||
++id_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// per face attributes
|
||||
for(al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.face_attr.find(*al);
|
||||
if(ar!= mr.face_attr.end()){
|
||||
id_r = 0;
|
||||
for (auto f: mr.face) {
|
||||
if( !f.IsD() && (!selected || f.IsS()))
|
||||
(*al)._handle->CopyValue(remap.face[Index(mr,f)], id_r, (*ar)._handle);
|
||||
++id_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
// per face attributes
|
||||
for (al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
|
||||
if (!(*al)._name.empty())
|
||||
{
|
||||
ar = mr.face_attr.find(*al);
|
||||
if (ar!= mr.face_attr.end())
|
||||
{
|
||||
id_r = 0;
|
||||
for (const auto & f : mr.face)
|
||||
{
|
||||
if( !f.IsD() && (!selected || f.IsS()))
|
||||
(*al)._handle->CopyValue(remap.face[Index(mr,f)], id_r, (*ar)._handle);
|
||||
++id_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// per tetra attributes
|
||||
for(al = ml.tetra_attr.begin(); al != ml.tetra_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.tetra_attr.find(*al);
|
||||
if(ar!= mr.tetra_attr.end()){
|
||||
id_r = 0;
|
||||
for (auto t: mr.tetra) {
|
||||
if( !t.IsD() && (!selected || t.IsS()))
|
||||
(*al)._handle->CopyValue(remap.tetra[Index(mr, t)], id_r, (*ar)._handle);
|
||||
++id_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
// per tetra attributes
|
||||
for (al = ml.tetra_attr.begin(); al != ml.tetra_attr.end(); ++al)
|
||||
if (!(*al)._name.empty())
|
||||
{
|
||||
ar = mr.tetra_attr.find(*al);
|
||||
if (ar!= mr.tetra_attr.end())
|
||||
{
|
||||
id_r = 0;
|
||||
for (const auto & t: mr.tetra)
|
||||
{
|
||||
if( !t.IsD() && (!selected || t.IsS()))
|
||||
(*al)._handle->CopyValue(remap.tetra[Index(mr, t)], id_r, (*ar)._handle);
|
||||
++id_r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// per mesh attributes
|
||||
// if both ml and mr have an attribute with the same name, no action is done
|
||||
|
|
|
@ -20,12 +20,17 @@
|
|||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef __VCG_MESH
|
||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VCG_COMPLEX_BASE
|
||||
#define __VCG_COMPLEX_BASE
|
||||
|
||||
#include <typeindex>
|
||||
#include <set>
|
||||
|
||||
#include <vcg/container/simple_temporary_data.h>
|
||||
|
||||
#include "used_types.h"
|
||||
|
||||
namespace vcg {
|
||||
|
||||
class PointerToAttribute
|
||||
|
@ -297,6 +302,25 @@ public:
|
|||
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>
|
||||
class PerVertexAttributeHandle: public AttributeHandle<ATTR_TYPE,VertContainer>{
|
||||
public:
|
||||
|
@ -304,6 +328,12 @@ public:
|
|||
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>
|
||||
class PerFaceAttributeHandle: public AttributeHandle<ATTR_TYPE,FaceContainer>{
|
||||
|
@ -312,6 +342,13 @@ public:
|
|||
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>
|
||||
class PerEdgeAttributeHandle: public AttributeHandle<ATTR_TYPE,EdgeContainer>{
|
||||
public:
|
||||
|
@ -319,6 +356,13 @@ public:
|
|||
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>
|
||||
class PerTetraAttributeHandle : public AttributeHandle<ATTR_TYPE, TetraContainer>
|
||||
{
|
||||
|
@ -327,6 +371,14 @@ public:
|
|||
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>
|
||||
class PerMeshAttributeHandle{
|
||||
public:
|
||||
|
@ -340,7 +392,18 @@ public:
|
|||
|
||||
Attribute<ATTR_TYPE> * _handle;
|
||||
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
|
||||
|
@ -538,7 +601,7 @@ template <class MeshType> inline bool IsMarked(const MeshType & m,typename MeshT
|
|||
@param m the mesh containing the element
|
||||
@param t tetra pointer */
|
||||
template <class MeshType>
|
||||
inline bool IsMarked(MeshType &m, typename MeshType::ConstTetraPointer t) { return t->cIMark() == m.imark; }
|
||||
inline bool IsMarked(const MeshType &m, typename MeshType::ConstTetraPointer t) { return t->cIMark() == m.imark; }
|
||||
|
||||
/** \brief Set the vertex incremental mark of the vertex to the one of the mesh.
|
||||
@param m the mesh containing the element
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#ifndef __VCG_EXCEPTION_H
|
||||
#define __VCG_EXCEPTION_H
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
|
||||
namespace vcg
|
||||
{
|
||||
class MissingComponentException : public std::runtime_error
|
||||
|
|
|
@ -24,9 +24,7 @@
|
|||
#ifndef VCG__FOREACH_H
|
||||
#define VCG__FOREACH_H
|
||||
|
||||
#ifndef __VCG_MESH
|
||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
||||
#endif
|
||||
#include <vcg/simplex/face/pos.h>
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#ifndef VCG_USED_TYPES_H
|
||||
#define VCG_USED_TYPES_H
|
||||
|
||||
#include <vcg/space/point3.h>
|
||||
#include <vcg/space/box3.h>
|
||||
#include <vcg/space/color4.h>
|
||||
#include <vcg/math/shot.h>
|
||||
|
|
|
@ -20,11 +20,18 @@
|
|||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <vcg/complex/complex.h>
|
||||
|
||||
#ifndef __VCG_HEDGE_
|
||||
#define __VCG_HEDGE_
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <vcg/complex/all_types.h>
|
||||
#include <vcg/container/derivation_chain.h>
|
||||
|
||||
#include "hedge_component.h"
|
||||
|
||||
namespace vcg {
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
|
|
@ -20,11 +20,14 @@
|
|||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#include <vcg/complex/complex.h>
|
||||
|
||||
#ifndef __VCG_HEDGE_COMPONENT
|
||||
#define __VCG_HEDGE_COMPONENT
|
||||
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace vcg {
|
||||
namespace hedge {
|
||||
/*
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
#ifndef __VCGLIB_SIMPLE__
|
||||
#define __VCGLIB_SIMPLE__
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
#include <cassert>
|
||||
|
||||
namespace vcg
|
||||
{
|
||||
|
||||
|
@ -36,45 +42,44 @@ public:
|
|||
virtual void Reorder(std::vector<size_t> &newVertIndex) = 0;
|
||||
virtual size_t SizeOf() const = 0;
|
||||
virtual void *DataBegin() = 0;
|
||||
virtual const void* DataBegin() const = 0;
|
||||
|
||||
virtual void *At(size_t i) = 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;
|
||||
};
|
||||
|
||||
template <class TYPE>
|
||||
class VectorNBW : public std::vector<TYPE>
|
||||
template <class TYPE, class ...p>
|
||||
class VectorNBW : public std::vector<TYPE, p...>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
class VectorNBW<bool>
|
||||
template <class ...p>
|
||||
class VectorNBW<bool, p...>
|
||||
{
|
||||
public:
|
||||
VectorNBW() : data(0), datasize(0), datareserve(0) {}
|
||||
VectorNBW() : booldata(nullptr), datasize(0), datareserve(0) {}
|
||||
|
||||
~VectorNBW()
|
||||
{
|
||||
if (data)
|
||||
delete[] data;
|
||||
if (booldata)
|
||||
delete[] booldata;
|
||||
}
|
||||
|
||||
bool *data;
|
||||
|
||||
void reserve(const int &sz)
|
||||
void reserve(size_t sz)
|
||||
{
|
||||
if (sz <= datareserve)
|
||||
return;
|
||||
bool *newdataLoc = new bool[sz];
|
||||
if (datasize != 0)
|
||||
memcpy(newdataLoc, data, sizeof(datasize));
|
||||
std::swap(data, newdataLoc);
|
||||
memcpy(newdataLoc, booldata, sizeof(bool) * sizeof(datasize));
|
||||
std::swap(booldata, newdataLoc);
|
||||
if (newdataLoc != 0)
|
||||
delete[] newdataLoc;
|
||||
datareserve = sz;
|
||||
}
|
||||
|
||||
void resize(const int &sz)
|
||||
void resize(size_t sz)
|
||||
{
|
||||
int oldDatasize = datasize;
|
||||
if (sz <= oldDatasize)
|
||||
|
@ -82,12 +87,12 @@ public:
|
|||
if (sz > datareserve)
|
||||
reserve(sz);
|
||||
datasize = sz;
|
||||
memset(&data[oldDatasize], 0, datasize - oldDatasize);
|
||||
memset(&booldata[oldDatasize], 0, datasize - oldDatasize);
|
||||
}
|
||||
void push_back(const bool &v)
|
||||
{
|
||||
resize(datasize + 1);
|
||||
data[datasize] = v;
|
||||
booldata[datasize] = v;
|
||||
}
|
||||
|
||||
void clear() { datasize = 0; }
|
||||
|
@ -96,14 +101,16 @@ public:
|
|||
|
||||
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]; }
|
||||
const bool &operator[](const int &i) const { return data[i]; }
|
||||
bool &operator[](size_t i) { return booldata[i]; }
|
||||
const bool &operator[](size_t i) const { return booldata[i]; }
|
||||
|
||||
private:
|
||||
int datasize;
|
||||
int datareserve;
|
||||
bool *booldata;
|
||||
size_t datasize;
|
||||
size_t datareserve;
|
||||
};
|
||||
|
||||
template <class STL_CONT, class ATTR_TYPE>
|
||||
|
@ -114,16 +121,16 @@ public:
|
|||
typedef SimpleTempData<STL_CONT, ATTR_TYPE> SimpTempDataType;
|
||||
typedef ATTR_TYPE AttrType;
|
||||
|
||||
STL_CONT &c;
|
||||
const STL_CONT &c;
|
||||
VectorNBW<ATTR_TYPE> data;
|
||||
int padding;
|
||||
|
||||
SimpleTempData(STL_CONT &_c) : c(_c), padding(0)
|
||||
SimpleTempData(const STL_CONT &_c) : c(_c), padding(0)
|
||||
{
|
||||
data.reserve(c.capacity());
|
||||
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.resize(c.size());
|
||||
|
@ -142,11 +149,13 @@ public:
|
|||
// 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::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[](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::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[](size_t i) const { return data[i]; }
|
||||
|
||||
|
@ -177,7 +186,7 @@ public:
|
|||
|
||||
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)())
|
||||
data[newVertIndex[i]] = data[i];
|
||||
|
@ -185,7 +194,8 @@ public:
|
|||
}
|
||||
|
||||
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>
|
||||
|
@ -193,11 +203,11 @@ class Attribute : public SimpleTempDataBase
|
|||
{
|
||||
public:
|
||||
typedef ATTR_TYPE AttrType;
|
||||
AttrType *attribute;
|
||||
Attribute() { attribute = new ATTR_TYPE(); }
|
||||
~Attribute() { delete attribute; }
|
||||
size_t SizeOf() const { return sizeof(ATTR_TYPE); }
|
||||
void *DataBegin() { return attribute; }
|
||||
const void* DataBegin() const {return attribute;}
|
||||
|
||||
void Resize(size_t) { assert(0); }
|
||||
void Reorder(std::vector<size_t> &) { assert(0); }
|
||||
|
@ -213,6 +223,8 @@ public:
|
|||
return (void *)0;
|
||||
}
|
||||
void CopyValue(const size_t, const size_t, const SimpleTempDataBase *) { assert(0); }
|
||||
private:
|
||||
AttrType *attribute;
|
||||
};
|
||||
|
||||
} // end namespace vcg
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace math {
|
|||
|
||||
/* Some <math.h> files do not define M_PI... */
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_PI 3.14159265358979323846264338327950288
|
||||
#endif
|
||||
|
||||
#ifndef SQRT_TWO
|
||||
|
|
|
@ -566,7 +566,7 @@ bool Decompose(Matrix44<T> &M, Point3<T> &ScaleV, Point3<T> &ShearV, Point3<T> &
|
|||
return false;
|
||||
if(math::Abs(M.Determinant())<1e-10) return false; // matrix should be at least invertible...
|
||||
|
||||
// First Step recover the traslation
|
||||
// First Step recover the translation
|
||||
TranV=M.GetColumn3(3);
|
||||
|
||||
// Second Step Recover Scale and Shearing interleaved
|
||||
|
|
|
@ -207,7 +207,7 @@ public:
|
|||
}
|
||||
|
||||
/* multiply the current reference frame for the matrix passed
|
||||
note: it is up to the caller to check the the matrix passed is a pure rototraslation
|
||||
note: it is up to the caller to check the the matrix passed is a pure rototranslation
|
||||
*/
|
||||
void MultMatrix( vcg::Matrix44<S> m44)
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
}
|
||||
|
||||
/* multiply the current reference frame for the similarity passed
|
||||
note: it is up to the caller to check the the matrix passed is a pure rototraslation
|
||||
note: it is up to the caller to check the the matrix passed is a pure rototranslation
|
||||
*/
|
||||
void MultSimilarity( const Similarity<S> & s){ MultMatrix(s.Matrix());}
|
||||
|
||||
|
|
|
@ -20,11 +20,19 @@
|
|||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef __VCG_MESH
|
||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VCG_EDGE_PLUS
|
||||
#define __VCG_EDGE_PLUS
|
||||
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <vcg/complex/all_types.h>
|
||||
#include <vcg/container/derivation_chain.h>
|
||||
|
||||
#include "component.h"
|
||||
|
||||
namespace vcg {
|
||||
/*------------------------------------------------------------------*/
|
||||
/*
|
||||
|
|
|
@ -20,12 +20,17 @@
|
|||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef __VCG_MESH
|
||||
#error "This file should not be included alone. It is automatically included by complex.h"
|
||||
#endif
|
||||
|
||||
#ifndef __VCG_EDGE_PLUS_COMPONENT
|
||||
#define __VCG_EDGE_PLUS_COMPONENT
|
||||
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <vcg/space/color4.h>
|
||||
|
||||
|
||||
namespace vcg {
|
||||
namespace edge {
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef __VCG_EDGE_POS
|
||||
#define __VCG_EDGE_POS
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace vcg {
|
||||
namespace edge {
|
||||
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
#ifndef _VCG_EDGE_TOPOLOGY
|
||||
#define _VCG_EDGE_TOPOLOGY
|
||||
|
||||
#include <vector>
|
||||
#include <vcg/complex/allocate.h>
|
||||
|
||||
#include "pos.h"
|
||||
#include "component.h"
|
||||
|
||||
namespace vcg {
|
||||
namespace edge {
|
||||
/** \addtogroup edge */
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue