mirror of https://github.com/CGAL/cgal
remove unused files
This commit is contained in:
parent
e2054ad648
commit
61eca278e6
|
|
@ -16,10 +16,7 @@
|
|||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_policies.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_policy_base.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_plane_quadrics.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_functions.h>
|
||||
#include <Eigen/Dense>
|
||||
#include <iostream>
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (c) 2019 GeometryFactory (France). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Baskin Burak Senbaslar,
|
||||
// Mael Rouxel-Labbé,
|
||||
// Julian Komaromy
|
||||
|
||||
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_INTERNAL_COMMON_H
|
||||
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_INTERNAL_COMMON_H
|
||||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
namespace internal {
|
||||
|
||||
namespace common {
|
||||
template<typename GeomTraits, typename VPM, typename TM>
|
||||
typename GeomTraits::Vector_3 construct_unit_normal_from_face(
|
||||
const VPM& point_map,
|
||||
const TM& tmesh,
|
||||
typename boost::graph_traits<TM>::face_descriptor f,
|
||||
const GeomTraits& gt)
|
||||
{
|
||||
// initialize all necessary kernel functions
|
||||
auto unit_normal = gt.construct_unit_normal_3_object();
|
||||
|
||||
// reference and descriptor types
|
||||
typedef typename boost::property_traits<VPM>::reference Point_reference;
|
||||
typedef typename boost::graph_traits<TM>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
const halfedge_descriptor h = halfedge(f, tmesh);
|
||||
|
||||
// get the three points of the face and calculate their unit normal
|
||||
const Point_reference p = get(point_map, source(h, tmesh));
|
||||
const Point_reference q = get(point_map, target(h, tmesh));
|
||||
const Point_reference r = get(point_map, target(next(h, tmesh), tmesh));
|
||||
|
||||
return unit_normal(p, q, r);
|
||||
}
|
||||
} //namespace common
|
||||
} //namespace internal
|
||||
} //namespace Surface_mesh_simplification
|
||||
} //namespace CGAL
|
||||
|
||||
#endif //CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_INTERNAL_COMMON_H
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
// Copyright (c) 2019 GeometryFactory (France). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Mael Rouxel-Labbé,
|
||||
// Julian Komaromy
|
||||
|
||||
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_OPTIMIZERS_H
|
||||
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_OPTIMIZERS_H
|
||||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
|
||||
#include <Eigen/Dense>
|
||||
#include <iostream>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
namespace internal {
|
||||
template<typename GeomTraits>
|
||||
class GarlandHeckbert_invertible_optimizer
|
||||
{
|
||||
typedef typename GeomTraits::FT FT;
|
||||
typedef typename Eigen::Matrix<FT, 4, 1> Col_4;
|
||||
typedef typename Eigen::Matrix<FT, 4, 4, Eigen::DontAlign> Mat_4;
|
||||
|
||||
public:
|
||||
|
||||
Col_4 construct_optimal_point(const Mat_4& aQuadric, const Col_4& p0, const Col_4& p1) const
|
||||
{
|
||||
Mat_4 X;
|
||||
X << aQuadric.block(0, 0, 3, 4), 0, 0, 0, 1;
|
||||
|
||||
Col_4 opt_pt;
|
||||
|
||||
opt_pt = X.inverse().col(3); // == X.inverse() * (0 0 0 1)
|
||||
|
||||
return opt_pt;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename GeomTraits>
|
||||
class GarlandHeckbert_singular_optimizer
|
||||
{
|
||||
typedef typename GeomTraits::FT FT;
|
||||
typedef typename Eigen::Matrix<FT, 4, 1> Col_4;
|
||||
typedef typename Eigen::Matrix<FT, 4, 4, Eigen::DontAlign> Mat_4;
|
||||
|
||||
public:
|
||||
Col_4 construct_optimal_point(const Mat_4& aQuadric, const Col_4& p0, const Col_4& p1) const
|
||||
{
|
||||
Mat_4 X;
|
||||
X << aQuadric.block(0, 0, 3, 4), 0, 0, 0, 1;
|
||||
|
||||
Col_4 opt_pt;
|
||||
|
||||
if(X.determinant() == 0)
|
||||
{
|
||||
// not invertible
|
||||
const Col_4 p1mp0 = std::move(p1 - p0);
|
||||
const FT a = (p1mp0.transpose() * aQuadric * p1mp0)(0, 0);
|
||||
const FT b = 2 * (p0.transpose() * aQuadric * p1mp0)(0, 0);
|
||||
|
||||
if(a == 0)
|
||||
{
|
||||
if(b < 0)
|
||||
opt_pt = p1;
|
||||
else if(b == 0)
|
||||
opt_pt = 0.5 * (p0 + p1);
|
||||
else
|
||||
opt_pt = p0;
|
||||
}
|
||||
else
|
||||
{
|
||||
FT ext_t = -b/(2*a);
|
||||
if(ext_t < 0 || ext_t > 1 || a < 0)
|
||||
{
|
||||
// one of endpoints
|
||||
FT p0_cost = (p0.transpose() * aQuadric * p0)(0, 0);
|
||||
FT p1_cost = (p1.transpose() * aQuadric * p1)(0, 0);
|
||||
if(p0_cost > p1_cost)
|
||||
opt_pt = p1;
|
||||
else
|
||||
opt_pt = p0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// extremum of the parabola
|
||||
opt_pt = p0 + ext_t * (p1 - p0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // invertible
|
||||
{
|
||||
opt_pt = X.inverse().col(3); // == X.inverse() * (0 0 0 1)
|
||||
}
|
||||
return opt_pt;
|
||||
}
|
||||
};
|
||||
|
||||
} //namespace internal
|
||||
} //namespace Surface_mesh_simplification
|
||||
} //namespace CGAL
|
||||
|
||||
#endif //CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_OPTIMIZERS_H
|
||||
|
|
@ -1,141 +0,0 @@
|
|||
// Copyright (c) 2019 GeometryFactory (France). All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org).
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Baskin Burak Senbaslar,
|
||||
// Mael Rouxel-Labbé,
|
||||
// Julian Komaromy
|
||||
|
||||
#ifndef CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_PLANE_QUADRICS_H
|
||||
#define CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_PLANE_QUADRICS_H
|
||||
|
||||
#include <CGAL/license/Surface_mesh_simplification.h>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/internal/Common.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_policy_base.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_common.h>
|
||||
|
||||
#include <Eigen/Dense>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Surface_mesh_simplification {
|
||||
namespace internal {
|
||||
|
||||
namespace plane_quadric_helpers {
|
||||
template<typename GeomTraits>
|
||||
typename Eigen::Matrix<typename GeomTraits::FT, 4, 4, Eigen::DontAlign> construct_quadric_from_normal(
|
||||
const typename GeomTraits::Vector_3& normal,
|
||||
const typename GeomTraits::Point_3& point,
|
||||
const GeomTraits& gt)
|
||||
{
|
||||
typedef typename GeomTraits::FT FT;
|
||||
|
||||
auto dot_product = gt.compute_scalar_product_3_object();
|
||||
auto construct_vector = gt.construct_vector_3_object();
|
||||
|
||||
// negative dot product between the normal and the position vector
|
||||
const FT d = - dot_product(normal, construct_vector(ORIGIN, point));
|
||||
|
||||
// row vector given by d appended to the normal
|
||||
const Eigen::Matrix<FT, 1, 4> row(normal.x(), normal.y(), normal.z(), d);
|
||||
|
||||
// outer product
|
||||
return row.transpose() * row;
|
||||
}
|
||||
}
|
||||
|
||||
// change the quadric construction for faces, but keep the standard plane quadric
|
||||
// method for (discontinous) edges
|
||||
//
|
||||
// this means we inherit from GarlandHeckbert_policies so we have the implementation
|
||||
// for discontinous edges and from the cost base class so that out implementation
|
||||
// of face quadrics will be used
|
||||
template<typename TriangleMesh, typename GeomTraits>
|
||||
class GarlandHeckbert_plane_faces
|
||||
{
|
||||
typedef typename GeomTraits::FT FT;
|
||||
typedef typename GeomTraits::Vector_3 Vector_3;
|
||||
typedef typename GeomTraits::Point_3 Point_3;
|
||||
|
||||
typedef typename Eigen::Matrix<FT, 4, 4, Eigen::DontAlign> Mat_4;
|
||||
|
||||
public:
|
||||
template<typename VPM, typename TM>
|
||||
Mat_4 construct_quadric_from_face(
|
||||
const VPM& point_map,
|
||||
const TM& tmesh,
|
||||
typename boost::graph_traits<TM>::face_descriptor f,
|
||||
const GeomTraits& gt) const
|
||||
{
|
||||
// this-> is used because we are calling a base class function
|
||||
const Vector_3 normal = common::construct_unit_normal_from_face<
|
||||
GeomTraits, VPM, TM>(point_map, tmesh, f, gt);
|
||||
|
||||
// get any point of the face
|
||||
const auto p = get(point_map, source(halfedge(f, tmesh), tmesh));
|
||||
|
||||
return plane_quadric_helpers::construct_quadric_from_normal(normal, p, gt);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TriangleMesh, typename GeomTraits>
|
||||
class GarlandHeckbert_plane_edges
|
||||
{
|
||||
typedef typename GeomTraits::FT FT;
|
||||
typedef typename GeomTraits::Vector_3 Vector_3;
|
||||
typedef typename Eigen::Matrix<FT, 4, 4, Eigen::DontAlign> Mat_4;
|
||||
|
||||
public:
|
||||
template<typename VPM, typename TM>
|
||||
Mat_4 construct_quadric_from_edge(
|
||||
const VPM& point_map,
|
||||
const TM& tmesh,
|
||||
typename boost::graph_traits<TM>::halfedge_descriptor he,
|
||||
const GeomTraits& gt) const
|
||||
{
|
||||
const Vector_3 normal = construct_edge_normal<VPM, TM>(point_map, tmesh, he, gt);
|
||||
|
||||
return plane_quadric_helpers::construct_quadric_from_normal(normal,
|
||||
get(point_map, source(he, tmesh)), gt);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template<typename VPM, typename TM>
|
||||
Vector_3 construct_edge_normal(
|
||||
const VPM& point_map,
|
||||
const TM& tmesh,
|
||||
typename boost::graph_traits<TM>::halfedge_descriptor he,
|
||||
const GeomTraits& gt) const
|
||||
{
|
||||
typedef typename GeomTraits::Vector_3 Vector_3;
|
||||
|
||||
typedef typename boost::graph_traits<TM>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
// TODO we do a potentially redundant calculation here, as we have
|
||||
// almost certainly already calculated this when constructing a quadric for the face
|
||||
const Vector_3 face_normal = common::construct_unit_normal_from_face<GeomTraits, VPM, TM>(
|
||||
point_map, tmesh, face(he, tmesh), gt);
|
||||
|
||||
const vertex_descriptor vs = source(he, tmesh);
|
||||
const vertex_descriptor vt = target(he, tmesh);
|
||||
|
||||
const Vector_3 edge_vector = Vector_3(get(point_map, vs), get(point_map, vt));
|
||||
const Vector_3 discontinuity_normal = cross_product(edge_vector, face_normal);
|
||||
|
||||
// normalize
|
||||
const Vector_3 normal = discontinuity_normal
|
||||
/ sqrt(discontinuity_normal.squared_length());
|
||||
|
||||
return normal;
|
||||
}
|
||||
};
|
||||
} //namespace internal
|
||||
} //namespace Surface_mesh_simplification
|
||||
} //namespace CGAL
|
||||
|
||||
#endif //CGAL_SURFACE_MESH_SIMPLIFICATION_POLICIES_GARLANDHECKBERT_PLANE_QUADRICS_H
|
||||
Loading…
Reference in New Issue