mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'cgal/master' into CGAL_data-moving_files
This commit is contained in:
commit
1857a25d28
|
|
@ -1,9 +1,9 @@
|
|||
name: CMake all CGAL
|
||||
name: CMake Testsuite
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
cmake-testsuite:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
|
@ -12,4 +12,21 @@ jobs:
|
|||
- name: install dependencies
|
||||
run: sudo apt-get install -y libboost-dev libboost-program-options-dev libmpfr-dev libeigen3-dev
|
||||
- name: configure all
|
||||
run: mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON ..
|
||||
run: |
|
||||
set -e
|
||||
mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DBUILD_TESTING=ON ..
|
||||
ctest -L CGAL_cmake_testsuite
|
||||
|
||||
cmake-testsuite-with-qt5:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.0.0
|
||||
- name: install dependencies
|
||||
run: sudo bash -e .github/install.sh
|
||||
- name: configure all
|
||||
run: |
|
||||
set -e
|
||||
mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DBUILD_TESTING=ON ..
|
||||
ctest -L CGAL_cmake_testsuite
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ jobs:
|
|||
if [ -n "$(diff -q ./index.html ./tmp.html)" ]; then
|
||||
mv tmp.html index.html
|
||||
fi
|
||||
if [ -d ${PR_NUMBER} ]; then
|
||||
git rm -r ${PR_NUMBER}
|
||||
if [ -d ${PR_NUMBER} ]; then
|
||||
git rm -r ${PR_NUMBER}
|
||||
fi
|
||||
#git diff exits with 1 if there is no diff
|
||||
if git diff --quiet; then
|
||||
# `git diff --quiet` exits with 1 if there is a diff
|
||||
if ! git diff --quiet; then
|
||||
git commit -a --amend -m"base commit" && git push -f -u origin master
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,19 @@
|
|||
\ingroup PkgAABBTreeConcepts
|
||||
\cgalConcept
|
||||
|
||||
The concept `AABBGeomTraits` defines the requirements for the first template parameter of the class `CGAL::AABB_traits<AABBGeomTraits, AABBPrimitive>`. It provides predicates and constructors to detect and compute intersections between query objects and the primitives stored in the AABB tree. In addition, it contains predicates and constructors to compute distances between a point query and the primitives stored in the AABB tree.
|
||||
The concept `AABBGeomTraits` defines the requirements for the first template parameter of the class
|
||||
`CGAL::AABB_traits<AABBGeomTraits, AABBPrimitive>`. It provides predicates and constructors to detect
|
||||
and compute intersections between query objects and the primitives stored in the AABB tree.
|
||||
In addition, it contains predicates and constructors to compute distances between a point query
|
||||
and the primitives stored in the AABB tree.
|
||||
|
||||
\cgalRefines `SearchGeomTraits_3`
|
||||
|
||||
\cgalHasModel Any 3D Kernel is a model of this traits concept.
|
||||
\cgalHasModel All models of the concept `Kernel`
|
||||
|
||||
\sa `CGAL::AABB_traits<AABBGeomTraits,AABBPrimitive>`
|
||||
\sa `CGAL::AABB_tree<AABBTraits>`
|
||||
\sa `AABBPrimitive`
|
||||
|
||||
*/
|
||||
|
||||
|
|
@ -19,118 +25,123 @@ public:
|
|||
/// \name Types
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
A number type model of `Field`.
|
||||
*/
|
||||
typedef unspecified_type FT;
|
||||
|
||||
/*!
|
||||
Sphere type, that should be consistent with the distance function chosen for the distance queries, namely the `Squared_distance_3` functor.
|
||||
*/
|
||||
typedef unspecified_type Sphere_3;
|
||||
|
||||
/*!
|
||||
Point type.
|
||||
*/
|
||||
typedef unspecified_type Point_3;
|
||||
|
||||
/*!
|
||||
A functor object to detect intersections between two geometric objects.
|
||||
Provides the operators:
|
||||
`bool operator()(const Type_1& type_1, const Type_2& type_2);`
|
||||
where `Type_1` and `Type_2` are relevant types
|
||||
among `Ray_3`, `Segment_3`, `Line_3`, `Triangle_3`, `Plane_3` and `Bbox_3`. Relevant herein means that a line primitive (ray, segment, line) is tested against a planar or solid primitive (plane, triangle, box), and a solid primitive is tested against another solid primitive (box against box). The operator returns `true` iff `type_1` and `type_2` have a non empty intersection.
|
||||
Provides the following operators:
|
||||
|
||||
`bool operator()(Query, Bbox_3)`,
|
||||
|
||||
`bool operator()(Query, Primitive::Datum)`,
|
||||
|
||||
`bool operator()(Sphere_3, Bbox_3)`.
|
||||
|
||||
The operator returns `true` iff there exists a non-empty intersection.
|
||||
*/
|
||||
typedef unspecified_type Do_intersect_3;
|
||||
|
||||
/*!
|
||||
A functor object to construct the intersection between two geometric objects.
|
||||
|
||||
Provides the operators:
|
||||
`decltype(auto) operator()(const A& a, const B& b);`
|
||||
where `A` and `B` are any relevant types among `Ray_3`, `Segment_3`, `Line_3`,
|
||||
`Triangle_3`, `Plane_3` and `Bbox_3`.
|
||||
Relevant herein means that a line primitive (ray, segment, line) is tested
|
||||
against a planar or solid primitive (plane, triangle, box).
|
||||
A model of `Kernel::Intersect_3` fulfills those requirements.
|
||||
Provides the operator:
|
||||
|
||||
`return_type operator()(const Query& q, const Primitive::Datum& d)`,
|
||||
|
||||
which computes the intersection between `q` and `d`. The type of the returned object
|
||||
must be a `boost::optional` of a `boost::variant` of the possible intersection types.
|
||||
*/
|
||||
typedef unspecified_type Intersect_3;
|
||||
|
||||
/*!
|
||||
A functor object to construct the sphere centered at one point and passing through another one. Provides the operator:
|
||||
- `Sphere_3 operator()(const Point_3& p, const FT & sr)` which returns the sphere centered at `p` with `sr` as squared radius.
|
||||
A functor object to construct the sphere centered at one point and passing through another one.
|
||||
Provides the operator:
|
||||
|
||||
`Sphere_3 operator()(const Point_3& p, const FT & sr)`,
|
||||
|
||||
which returns the sphere centered at `p` with `sr` as squared radius.
|
||||
*/
|
||||
typedef unspecified_type Construct_sphere_3;
|
||||
|
||||
/*!
|
||||
A functor object to compute the point on a geometric primitive which is closest from a query. Provides the operator:
|
||||
`Point_3 operator()(const Type_2& type_2, const Point_3& p);` where `Type_2` can be any of the following types : `Segment_3`, `Ray_3`, or `Triangle_3`.
|
||||
The operator returns the point on `type_2` which is closest to `p`.
|
||||
A functor object to compute the point on a geometric primitive which is closest from a query.
|
||||
Provides the operator:
|
||||
|
||||
`Point_3 operator()(const Primitive::Datum& d, const Point_3& p)`,
|
||||
|
||||
which returns the point on `d` that is closest to `p`.
|
||||
*/
|
||||
typedef unspecified_type Construct_projected_point_3;
|
||||
|
||||
/*!
|
||||
A functor object to compare the distance of two points wrt a third one.
|
||||
Provides the operator:
|
||||
`CGAL::Comparision_result operator()(const Point_3& p1, const Point_3& p2, const Point_3& p3)`. The operator compare the distance between `p1 and `p2`, and between `p2` and `p3`.
|
||||
A functor object to compare the distance of two points wrt a third one. Provides the operator:
|
||||
|
||||
`CGAL::Comparision_result operator()(const Point_3& p1, const Point_3& p2, const Point_3& p3)`,
|
||||
|
||||
which compares the distance between `p1 and `p2`, and between `p2` and `p3`.
|
||||
*/
|
||||
typedef unspecified_type Compare_distance_3;
|
||||
|
||||
/*!
|
||||
A functor object to detect if a point lies inside a sphere or not.
|
||||
A functor object to compute the squared radius of a sphere.
|
||||
Provides the operator:
|
||||
`bool operator()(const Sphere_3& s, const Point_3& p);` which returns `true` iff the closed volume bounded by `s` contains `p`.
|
||||
*/
|
||||
typedef unspecified_type Has_on_bounded_side_3;
|
||||
|
||||
/*!
|
||||
A functor object to compute the squared radius of a sphere. Provides the operator:
|
||||
`FT operator()(const Sphere_3& s);` which returns the squared radius of `s`.
|
||||
`FT operator()(const Sphere_3& s),`
|
||||
|
||||
which returns the squared radius of `s`.
|
||||
*/
|
||||
typedef unspecified_type Compute_squared_radius_3;
|
||||
|
||||
/*!
|
||||
A functor object to compute the squared distance between two points. Provides the operator:
|
||||
`FT operator()(const Point_3& p, const Point_3& q);}` which returns the squared distance between `p` and `q`.
|
||||
|
||||
`FT operator()(const Point_3& p, const Point_3& q),`
|
||||
|
||||
which returns the squared distance between `p` and `q`.
|
||||
*/
|
||||
typedef unspecified_type Compute_squared_distance_3;
|
||||
|
||||
/*!
|
||||
A functor object to compare the x-coordinates of two points. Provides the operator:
|
||||
`bool operator()(const Point_3& p, const Point_3& q);}` which returns `true` if the x-coordinate of `p` is smaller
|
||||
than the x-coordinate of `q`.
|
||||
|
||||
`bool operator()(const Point_3& p, const Point_3& q)`,
|
||||
|
||||
which returns `true` iff the x-coordinate of `p` is smaller than the x-coordinate of `q`.
|
||||
*/
|
||||
typedef unspecified_type Less_x_3;
|
||||
|
||||
/*!
|
||||
A functor object to compare the y-coordinates of two points. Provides the operator:
|
||||
`bool operator()(const Point_3& p, const Point_3& q);}` which returns `true` if the y-coordinate of `p` is smaller
|
||||
than the y-coordinate of `q`.
|
||||
|
||||
`bool operator()(const Point_3& p, const Point_3& q)`,
|
||||
|
||||
which returns `true` iff the y-coordinate of `p` is smaller than the y-coordinate of `q`.
|
||||
*/
|
||||
typedef unspecified_type Less_y_3;
|
||||
|
||||
/*!
|
||||
A functor object to compare the z-coordinates of two points. Provides the operator:
|
||||
`bool operator()(const Point_3& p, const Point_3& q);}` which returns `true` if the z-coordinate of `p` is smaller
|
||||
than the z-coordinate of `q`.
|
||||
|
||||
`bool operator()(const Point_3& p, const Point_3& q)`,
|
||||
|
||||
which returns `true` iff the z-coordinate of `p` is smaller than the z-coordinate of `q`.
|
||||
*/
|
||||
typedef unspecified_type Less_z_3;
|
||||
|
||||
/*!
|
||||
A functor object to compare two points. Provides the operator:
|
||||
`bool operator()(const Point_3& p, const Point_3& q);}` which returns `true` if `p` is equal to `q`.
|
||||
|
||||
`bool operator()(const Point_3& p, const Point_3& q)`,
|
||||
|
||||
which returns `true` iff `p` is equal to `q`.
|
||||
*/
|
||||
typedef unspecified_type Equal_3;
|
||||
|
||||
|
||||
|
||||
/// @}
|
||||
|
||||
/// \name Operations
|
||||
/// @{
|
||||
|
||||
/*!
|
||||
returns the intersection detection functor.
|
||||
returns the intersection detection predicate.
|
||||
*/
|
||||
Do_intersect_3 do_intersect_3_object();
|
||||
|
||||
|
|
@ -150,15 +161,10 @@ returns the closest point constructor.
|
|||
Construct_projected_point_3 construct_projected_point_3_object();
|
||||
|
||||
/*!
|
||||
returns the compare distance constructor.
|
||||
returns the compare distance predicate.
|
||||
*/
|
||||
Compare_distance_3 compare_distance_3_object();
|
||||
|
||||
/*!
|
||||
returns the closest point constructor.
|
||||
*/
|
||||
Has_on_bounded_side_3 has_on_bounded_side_3_object();
|
||||
|
||||
/*!
|
||||
returns the squared radius functor.
|
||||
*/
|
||||
|
|
@ -170,22 +176,22 @@ returns the squared distance functor.
|
|||
Compute_squared_distance_3 compute_squared_distance_3_object();
|
||||
|
||||
/*!
|
||||
returns the `Less_x_3` functor.
|
||||
returns the `Less_x_3` predicate.
|
||||
*/
|
||||
Less_x_3 less_x_3_object();
|
||||
|
||||
/*!
|
||||
returns the `Less_y_3` functor.
|
||||
returns the `Less_y_3` predicate.
|
||||
*/
|
||||
Less_y_3 less_y_3_object();
|
||||
|
||||
/*!
|
||||
returns the `Less_z_3` functor.
|
||||
returns the `Less_z_3` predicate.
|
||||
*/
|
||||
Less_z_3 less_z_3_object();
|
||||
|
||||
/*!
|
||||
returns the equal functor.
|
||||
returns the equal predicate.
|
||||
*/
|
||||
Equal_3 equal_3_object();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ concept `AABBGeomTraits`. In addition to the types required by
|
|||
define the Intersection_distance functor.
|
||||
|
||||
\cgalRefines `AABBGeomTraits`
|
||||
\cgalHasModel Any 3D Kernel is a model of this concept.
|
||||
|
||||
\cgalHasModel All models of the concept `Kernel`
|
||||
|
||||
\sa `CGAL::AABB_traits<AABBGeomTraits,AABBPrimitive>`
|
||||
\sa `CGAL::AABB_tree<AABBTraits>`
|
||||
|
|
@ -17,11 +18,6 @@ define the Intersection_distance functor.
|
|||
*/
|
||||
class AABBRayIntersectionGeomTraits {
|
||||
public:
|
||||
/*!
|
||||
Type of a 3D point.
|
||||
*/
|
||||
typedef unspecified_type Point_3;
|
||||
|
||||
/*!
|
||||
Type of a 3D ray.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ distance of an intersection along a ray.
|
|||
|
||||
\cgalHasModel `CGAL::AABB_traits<AABBGeomTraits,AABBPrimitive>`
|
||||
|
||||
\sa `CGAL::AABB_traits<AABBGeomTraits,AABBPrimitive>`
|
||||
\sa `CGAL::AABB_tree<AABBTraits>`
|
||||
\sa `AABBPrimitive`
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@
|
|||
\cgalCRPSection{Concepts}
|
||||
- `AABBPrimitive`
|
||||
- `AABBPrimitiveWithSharedData`
|
||||
- `AABBTraits`
|
||||
- `AABBGeomTraits`
|
||||
- `AABBTraits`
|
||||
- `AABBRayIntersectionGeomTraits`
|
||||
- `AABBRayIntersectionTraits`
|
||||
|
||||
\cgalCRPSection{Classes}
|
||||
- `CGAL::AABB_traits<GeomTraits,Primitive>`
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ class AABB_tree;
|
|||
/// \tparam BboxMap must be a model of `ReadablePropertyMap` that has as key type a primitive id,
|
||||
/// and as value type a `Bounding_box`.
|
||||
/// If the type is `Default` the `Datum` must have the
|
||||
/// member function `bbox()` that returns the bounding box of the primitive.
|
||||
/// member function `bbox()` that returns the bounding box of the primitive.
|
||||
///
|
||||
/// If the argument `GeomTraits` is a model of the concept \ref
|
||||
/// AABBRayIntersectionGeomTraits, this class is also a model of \ref
|
||||
|
|
@ -366,7 +366,7 @@ public:
|
|||
template<typename Query>
|
||||
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
|
||||
operator()(const Query& query, const typename AT::Primitive& primitive) const {
|
||||
auto inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
|
||||
auto inter_res = GeomTraits().intersect_3_object()(query, internal::Primitive_helper<AT>::get_datum(primitive,m_traits));
|
||||
if (!inter_res)
|
||||
return boost::none;
|
||||
return boost::make_optional( std::make_pair(*inter_res, primitive.id()) );
|
||||
|
|
@ -391,9 +391,9 @@ public:
|
|||
GeomTraits geom_traits;
|
||||
Point closest_point = geom_traits.construct_projected_point_3_object()(
|
||||
internal::Primitive_helper<AT>::get_datum(pr,m_traits), p);
|
||||
return
|
||||
geom_traits.compare_distance_3_object()(p, closest_point, bound)==LARGER ?
|
||||
bound : closest_point;
|
||||
|
||||
return (geom_traits.compare_distance_3_object()(p, closest_point, bound) == LARGER) ?
|
||||
bound : closest_point;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -406,15 +406,6 @@ public:
|
|||
typedef typename AT::FT FT;
|
||||
typedef typename AT::Primitive Primitive;
|
||||
public:
|
||||
template <class Solid>
|
||||
CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const Point& bound) const
|
||||
{
|
||||
return GeomTraits().do_intersect_3_object()
|
||||
(GeomTraits().construct_sphere_3_object()
|
||||
(p, GeomTraits().compute_squared_distance_3_object()(p, bound)), pr)?
|
||||
CGAL::SMALLER : CGAL::LARGER;
|
||||
}
|
||||
|
||||
CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_true) const
|
||||
{
|
||||
return GeomTraits().do_intersect_3_object()
|
||||
|
|
@ -436,6 +427,16 @@ public:
|
|||
return (*this)(p, bb, bound, Boolean_tag<internal::Has_static_filters<GeomTraits>::value>());
|
||||
}
|
||||
|
||||
// The following functions seem unused...?
|
||||
template <class Solid>
|
||||
CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const Point& bound) const
|
||||
{
|
||||
return GeomTraits().do_intersect_3_object()
|
||||
(GeomTraits().construct_sphere_3_object()
|
||||
(p, GeomTraits().compute_squared_distance_3_object()(p, bound)), pr)?
|
||||
CGAL::SMALLER : CGAL::LARGER;
|
||||
}
|
||||
|
||||
template <class Solid>
|
||||
CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const FT& sq_distance) const
|
||||
{
|
||||
|
|
@ -445,7 +446,6 @@ public:
|
|||
CGAL::SMALLER :
|
||||
CGAL::LARGER;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Closest_point closest_point_object() const {return Closest_point(*this);}
|
||||
|
|
|
|||
|
|
@ -12,14 +12,12 @@ struct AABBGeomTraits {
|
|||
typedef nope Intersect_3;
|
||||
typedef nope Construct_sphere_3;
|
||||
typedef nope Compute_closest_point_3;
|
||||
typedef nope Has_on_bounded_side_3;
|
||||
typedef nope Compute_squared_radius_3;
|
||||
typedef nope Compute_squared_distance_3;
|
||||
Do_intersect_3 do_intersect_3_object();
|
||||
Intersect_3 intersect_3_object();
|
||||
Construct_sphere_3 construct_sphere_3_object();
|
||||
Compute_closest_point_3 compute_closest_point_3_object();
|
||||
Has_on_bounded_side_3 has_on_bounded_side_3_object();
|
||||
Compute_squared_radius_3 compute_squared_radius_3_object();
|
||||
Compute_squared_distance_3 compute_squared_distance_3_object();
|
||||
}; /* end AABBGeomTraits */
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <atomic>
|
||||
#include <array>
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Arr_enums.h>
|
||||
|
|
@ -885,11 +886,11 @@ public:
|
|||
|
||||
/*! Clean all operation counters */
|
||||
void clear_counters()
|
||||
{ memset(m_counters, 0, sizeof(m_counters)); }
|
||||
{ m_counters = {}; }
|
||||
|
||||
private:
|
||||
/*! The operation counters */
|
||||
mutable size_t m_counters[NUMBER_OF_OPERATIONS];
|
||||
mutable std::array<size_t, NUMBER_OF_OPERATIONS> m_counters;
|
||||
};
|
||||
|
||||
template <typename Out_stream, class Base_traits>
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ public:
|
|||
Comparison_result res =
|
||||
ker.compare_x_2_object()(this->_source, this->_target);
|
||||
|
||||
this->_info = (Conic_arc_2::IS_VALID | DEGREE_1);
|
||||
this->_info = (static_cast<int>(Conic_arc_2::IS_VALID) | static_cast<int>(DEGREE_1));
|
||||
if (res == EQUAL) {
|
||||
// Mark that the segment is vertical.
|
||||
this->_info = (this->_info | IS_VERTICAL_SEGMENT);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <cstdio>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -750,14 +751,17 @@ public:
|
|||
return;
|
||||
|
||||
// Prepare a string desribing the color.
|
||||
char color_desc [10];
|
||||
|
||||
sprintf ("#%02x%02x%02x", r, g, b);
|
||||
std::stringstream out;
|
||||
out << "0x" << std::hex
|
||||
<< std::setfill('0') << std::setw(2) << r
|
||||
<< std::setfill('0') << std::setw(2) << g
|
||||
<< std::setfill('0') << std::setw(2) << b;
|
||||
|
||||
// Write the color to the FIG file.
|
||||
_ofile << "0 " // Desginates a color pseudo-object.
|
||||
<< static_cast<int>(color) << ' '
|
||||
<< color_desc << std::endl;
|
||||
<< out.str() << std::endl;
|
||||
|
||||
// Mark that the color is now defined.
|
||||
colors[static_cast<int>(color)] = true;
|
||||
|
|
@ -1700,7 +1704,6 @@ protected:
|
|||
_ofile << ' ' << ix << ' ' << iy << ' ';
|
||||
|
||||
// Write the text.
|
||||
char oct[10];
|
||||
int i;
|
||||
|
||||
for (i = 0; i < len_text; i++)
|
||||
|
|
@ -1712,9 +1715,11 @@ protected:
|
|||
}
|
||||
else
|
||||
{
|
||||
// Convert the current character to an octal string and write it.
|
||||
sprintf (oct, "\\%03o", text[i]);
|
||||
_ofile << oct;
|
||||
// Convert the current character to an octal string and write
|
||||
// it.
|
||||
std::stringstream out;
|
||||
out << "\\" << std::setfill('0') << std::setw(3) << std::oct << text[i];
|
||||
_ofile << out.str();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ bool read_PLY_BGL(std::istream& is,
|
|||
|
||||
The data is expected to represent a 2-manifold (possibly with borders).
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\tparam Graph a model of `MutableFaceGraph`
|
||||
\tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
|
|
@ -266,7 +266,9 @@ bool read_PLY(const std::string& fname, Graph& g,
|
|||
|
||||
\brief writes the graph in an output stream, using the \ref IOStreamPLY.
|
||||
|
||||
\attention When writing a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation
|
||||
of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink
|
||||
of the stream must be set to `BINARY`.
|
||||
|
||||
\tparam Graph a model of `FaceListGraph`
|
||||
\tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public:
|
|||
|
||||
\attention The graph `g` is not cleared, and the data from the stream are appended.
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\tparam Graph a model of `MutableFaceGraph`
|
||||
\tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
|
|
@ -208,7 +208,9 @@ bool read_STL(const std::string& fname, Graph& g) { return read_STL(fname, g, pa
|
|||
|
||||
\brief writes the graph `g` in the output stream `os`, using the \ref IOStreamSTL.
|
||||
|
||||
\attention When writing a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation
|
||||
of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink of the stream
|
||||
must be set to `BINARY`.
|
||||
|
||||
\tparam Graph a model of `FaceListGraph` and `HalfedgeListGraph`
|
||||
\tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ private:
|
|||
|
||||
public:
|
||||
Halfedge_around_source_iterator()
|
||||
: anchor(), pos(), g(0)
|
||||
: anchor(), pos(), g(nullptr), winding(0)
|
||||
{}
|
||||
|
||||
Halfedge_around_source_iterator(halfedge_descriptor hd, const Graph& g, int n=0)
|
||||
|
|
@ -305,7 +305,7 @@ private:
|
|||
|
||||
public:
|
||||
Halfedge_around_target_iterator()
|
||||
: anchor(), pos(), g(0)
|
||||
: anchor(), pos(), g(nullptr), winding(0)
|
||||
{}
|
||||
|
||||
Halfedge_around_target_iterator(halfedge_descriptor hd, const Graph& g, int n=0)
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ void duplicate_terminal_vertices(Graph& graph,
|
|||
{
|
||||
typename boost::graph_traits<OrigGraph>::vertex_descriptor orig_v = graph[v];
|
||||
typename boost::graph_traits<Graph>::degree_size_type deg = degree(v, graph);
|
||||
if ((deg != 0 && is_terminal(orig_v, orig)) || deg > 2)
|
||||
if (deg != 2 || is_terminal(orig_v, orig))
|
||||
{
|
||||
out_edge_iterator b, e;
|
||||
boost::tie(b, e) = out_edges(v, graph);
|
||||
|
|
@ -170,7 +170,6 @@ void duplicate_terminal_vertices(Graph& graph,
|
|||
const std::pair<edge_descriptor, bool> pair = add_edge(vc, w, graph);
|
||||
graph[pair.first] = orig_e;
|
||||
}
|
||||
CGAL_assertion(degree(v, graph) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ namespace CGAL {
|
|||
// Barycentric coordinates namespace.
|
||||
namespace Barycentric_coordinates {
|
||||
|
||||
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
|
||||
|
||||
// Examples: see the User Manual here - https://doc.cgal.org/latest/Manual/index.html.
|
||||
// [1] Reference: "M. S. Floater, K. Hormann, and G. Kos. A general construction of barycentric coordinates over convex polygons. Advances in Computational Mathematics, 24(1-4):311-331, 2006.".
|
||||
|
||||
|
|
@ -430,6 +432,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
} // namespace Barycentric_coordinates
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ namespace CGAL {
|
|||
// Barycentric coordinates namespace.
|
||||
namespace Barycentric_coordinates {
|
||||
|
||||
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
|
||||
|
||||
// Examples: see the User Manual here - https://doc.cgal.org/latest/Manual/index.html.
|
||||
|
||||
/*!
|
||||
|
|
@ -585,6 +587,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
} // namespace Barycentric_coordinates
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ namespace CGAL {
|
|||
// Barycentric coordinates namespace.
|
||||
namespace Barycentric_coordinates {
|
||||
|
||||
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Try to find a square root object in the provided `Traits` class. If not, then use the default square root from CGAL.
|
||||
|
||||
|
|
@ -498,6 +500,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
} // namespace Barycentric_coordinates
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ namespace CGAL {
|
|||
// Barycentric coordinates namespace.
|
||||
namespace Barycentric_coordinates {
|
||||
|
||||
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
|
||||
|
||||
// Examples: see the User Manual here - https://doc.cgal.org/latest/Manual/index.html.
|
||||
// [1] Reference: "M. S. Floater, K. Hormann, and G. Kos. A general construction of barycentric coordinates over convex polygons. Advances in Computational Mathematics, 24(1-4):311-331, 2006.".
|
||||
|
||||
|
|
@ -413,6 +415,8 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
} // namespace Barycentric_coordinates
|
||||
|
||||
} // namespace CGAL
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ enum class Computation_policy_2 {
|
|||
namespace CGAL {
|
||||
namespace Barycentric_coordinates {
|
||||
|
||||
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
|
||||
|
||||
/// \name Locations of a Query Point
|
||||
/// @{
|
||||
|
||||
|
|
@ -142,6 +144,8 @@ enum Type_of_polygon {
|
|||
|
||||
/// \endcond
|
||||
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
} // namespace Barycentric_coordinates
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -172,6 +172,8 @@ namespace Barycentric_coordinates {
|
|||
namespace CGAL {
|
||||
namespace Barycentric_coordinates {
|
||||
|
||||
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
|
||||
|
||||
/*!
|
||||
\ingroup PkgBarycentricCoordinates2RefDeprecated
|
||||
* The class `Segment_coordinates_2` implements barycentric coordinates with respect to an arbitrary non-degenerate segment along an arbitrary line in the plane.
|
||||
|
|
@ -376,6 +378,8 @@ namespace Barycentric_coordinates {
|
|||
return CGAL::make_array(b_first, FT(1) - b_first);
|
||||
}
|
||||
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
} // namespace Barycentric_coordinates
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -182,6 +182,8 @@ namespace Barycentric_coordinates {
|
|||
namespace CGAL {
|
||||
namespace Barycentric_coordinates {
|
||||
|
||||
#if !defined(CGAL_NO_DEPRECATED_CODE) || defined(DOXYGEN_RUNNING)
|
||||
|
||||
/*!
|
||||
* \ingroup PkgBarycentricCoordinates2RefDeprecated
|
||||
* The class `Triangle_coordinates_2` implements barycentric coordinates ( <a href="https://mathworld.wolfram.com/BarycentricCoordinates.html" target=blanc>[1]</a>,
|
||||
|
|
@ -413,6 +415,8 @@ namespace Barycentric_coordinates {
|
|||
return CGAL::make_array(b_first, b_second, FT(1) - b_first - b_second);
|
||||
}
|
||||
|
||||
#endif // CGAL_NO_DEPRECATED_CODE
|
||||
|
||||
} // namespace Barycentric_coordinates
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#include <cmath>
|
||||
#include <cassert>
|
||||
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/triangle_coordinates_2.h>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
// #define HMC_SparseLU
|
||||
// #define HMC_SimplicialLLT
|
||||
// #define HMC_SimplicialLDLT // default
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/Delaunay_domain_2.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
// #define HMC_SparseLU
|
||||
// #define HMC_SimplicialLLT
|
||||
// #define HMC_SimplicialLDLT // default
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/Delaunay_domain_2.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,3 @@
|
|||
// #define HMC_SparseLU
|
||||
// #define HMC_SimplicialLLT
|
||||
// #define HMC_SimplicialLDLT // default
|
||||
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/Delaunay_domain_2.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/Harmonic_coordinates_2.h>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#include <cmath>
|
||||
#include <cassert>
|
||||
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/triangle_coordinates_2.h>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#include <cmath>
|
||||
#include <cassert>
|
||||
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/segment_coordinates_2.h>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#include <cmath>
|
||||
#include <cassert>
|
||||
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/triangle_coordinates_2.h>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
#include <cmath>
|
||||
#include <cassert>
|
||||
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Barycentric_coordinates_2/Wachspress_2.h>
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <string>
|
||||
#include <ctype.h>
|
||||
#include <CGAL/CORE/BigFloat.h>
|
||||
#include <CGAL/CORE/Expr.h>
|
||||
|
|
@ -1057,8 +1058,8 @@ void BigFloatRep :: fromString(const char *str, extLong prec ) {
|
|||
CGAL_INLINE_FUNCTION
|
||||
std::istream& BigFloatRep :: operator >>(std::istream& i) {
|
||||
int size = 20;
|
||||
char *str = new char[size];
|
||||
char *p = str;
|
||||
std::string str;
|
||||
str.reserve(size);
|
||||
char c;
|
||||
int d = 0, e = 0, s = 0;
|
||||
// d=1 means dot is found
|
||||
|
|
@ -1078,14 +1079,13 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
|
|||
// Chen Li, "if (c == EOF)" is unsafe since c is of char type and
|
||||
// EOF is of int tyep with a negative value -1
|
||||
if (i.eof()) {
|
||||
delete [] str;
|
||||
i.clear(std::ios::eofbit | std::ios::failbit);
|
||||
return i;
|
||||
}
|
||||
|
||||
// the current content in "c" should be the first non-whitespace char
|
||||
if (c == '-' || c == '+') {
|
||||
*p++ = c;
|
||||
str += c;
|
||||
i.get(c);
|
||||
}
|
||||
|
||||
|
|
@ -1097,19 +1097,8 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
|
|||
// xxxx.xxxe+xxx.xxx:
|
||||
if (e && (c == '.'))
|
||||
break;
|
||||
if (p - str == size) {
|
||||
char *t = str;
|
||||
str = new char[size*2];
|
||||
memcpy(str, t, size);
|
||||
delete [] t;
|
||||
p = str + size;
|
||||
size *= 2;
|
||||
}
|
||||
#ifdef CGAL_CORE_DEBUG
|
||||
CGAL_assertion((p-str) < size);
|
||||
#endif
|
||||
|
||||
*p++ = c;
|
||||
str += c;
|
||||
if (c == '.')
|
||||
d = 1;
|
||||
// Chen Li: fix a bug -- the sign of exponent can not happen before
|
||||
|
|
@ -1121,24 +1110,8 @@ std::istream& BigFloatRep :: operator >>(std::istream& i) {
|
|||
e = 1;
|
||||
}
|
||||
|
||||
// chenli: make sure that the p is still in the range
|
||||
if (p - str >= size) {
|
||||
std::size_t len = p - str;
|
||||
char *t = str;
|
||||
str = new char[len + 1];
|
||||
memcpy(str, t, len);
|
||||
delete [] t;
|
||||
p = str + len;
|
||||
}
|
||||
|
||||
#ifdef CGAL_CORE_DEBUG
|
||||
CGAL_assertion(p - str < size);
|
||||
#endif
|
||||
|
||||
*p = '\0';
|
||||
i.putback(c);
|
||||
fromString(str);
|
||||
delete [] str;
|
||||
fromString(str.c_str());
|
||||
return i;
|
||||
}//operator >>
|
||||
|
||||
|
|
|
|||
|
|
@ -139,27 +139,6 @@ long gcd(long m, long n) {
|
|||
return p;
|
||||
}
|
||||
|
||||
// char* core_itoa(int n, char* buffer, int buffer_size)
|
||||
// returns a pointer to the null-terminated string in buffer
|
||||
// NOTES:
|
||||
// 0. Buffer size should be 17 bytes (resp., 33 bytes, 65 bytes) on 16-bit
|
||||
// (resp., 32-bit, 64-bit) machines. Formula: 1+sizeof(int)*8 bytes.
|
||||
// 1. itoa(...) is available on some stdlib.h, but it is
|
||||
// not defined by ANSI-C and so not all compilers support it.
|
||||
// 2. Our use of sprintf(...) to do the job is known to
|
||||
// be inefficient, but this is hardly critical for our usage.
|
||||
// 3. A more general program should take a 3rd argument (the radix of
|
||||
// output number). We assume radix 10.
|
||||
CGAL_INLINE_FUNCTION
|
||||
char * core_itoa(int n, char* buffer, int buffer_size) {
|
||||
#if defined(_MSC_VER)
|
||||
sprintf_s(buffer, buffer_size, "%d", n);
|
||||
#else
|
||||
CGAL_USE(buffer_size);
|
||||
std::sprintf(buffer, "%d", n);
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/// implements the "integer mantissa" function
|
||||
// (See CORE_PATH/progs/ieee/frexp.cpp for details)
|
||||
|
|
@ -197,11 +176,8 @@ void core_error(std::string msg, std::string file, int lineno, bool err) {
|
|||
<< msg << std::endl;
|
||||
outFile.close();
|
||||
if (err) {
|
||||
char buf[65];
|
||||
// perror((std::string("CORE ERROR") + " (file " + file + ", line "
|
||||
// + core_itoa(lineno,buf, 65) +"):" + msg + "\n").c_str());
|
||||
std::cerr << (std::string("CORE ERROR") + " (file " + file + ", line "
|
||||
+ core_itoa(lineno,buf, 65) +"):" + msg + "\n").c_str();
|
||||
+ std::to_string(lineno) +"):" + msg + "\n").c_str();
|
||||
std::exit(1); //Note: do not call abort()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <string>
|
||||
#include <ctype.h>
|
||||
#include <CGAL/CORE/Real.h>
|
||||
#include <CGAL/tss.h>
|
||||
|
|
@ -189,8 +190,9 @@ void Real::constructFromString(const char *str, const extLong& prec )
|
|||
CGAL_INLINE_FUNCTION
|
||||
std::istream& operator >>(std::istream& i, Real& x) {
|
||||
int size = 20;
|
||||
char *str = new char[size];
|
||||
char *p = str;
|
||||
std::string str;
|
||||
str.reserve(size);
|
||||
|
||||
char c;
|
||||
int d = 0, e = 0, s = 0;
|
||||
// int done = 0;
|
||||
|
|
@ -211,13 +213,12 @@ std::istream& operator >>(std::istream& i, Real& x) {
|
|||
|
||||
if (i.eof()) {
|
||||
i.clear(std::ios::eofbit | std::ios::failbit);
|
||||
delete [] str;
|
||||
return i;
|
||||
}
|
||||
|
||||
// the current content in "c" should be the first non-whitespace char
|
||||
if (c == '-' || c == '+') {
|
||||
*p++ = c;
|
||||
str += c;
|
||||
i.get(c);
|
||||
}
|
||||
|
||||
|
|
@ -230,19 +231,9 @@ std::istream& operator >>(std::istream& i, Real& x) {
|
|||
// xxxx.xxxe+xxx.xxx:
|
||||
if (e && (c == '.'))
|
||||
break;
|
||||
if (p - str == size) {
|
||||
char *t = str;
|
||||
str = new char[size*2];
|
||||
std::memcpy(str, t, size);
|
||||
delete [] t;
|
||||
p = str + size;
|
||||
size *= 2;
|
||||
}
|
||||
#ifdef CORE_DEBUG
|
||||
CGAL_assertion((p-str) < size);
|
||||
#endif
|
||||
|
||||
*p++ = c;
|
||||
str += c;
|
||||
|
||||
if (c == '.')
|
||||
d = 1;
|
||||
// Chen Li: fix a bug -- the sign of exponent can not happen before
|
||||
|
|
@ -255,29 +246,13 @@ std::istream& operator >>(std::istream& i, Real& x) {
|
|||
}
|
||||
|
||||
if (!i && !i.eof()) {
|
||||
delete [] str;
|
||||
return i;
|
||||
}
|
||||
// chenli: make sure that the p is still in the range
|
||||
if (p - str >= size) {
|
||||
std::ptrdiff_t len = p - str;
|
||||
char *t = str;
|
||||
str = new char[len + 1];
|
||||
std::memcpy(str, t, len);
|
||||
delete [] t;
|
||||
p = str + len;
|
||||
}
|
||||
|
||||
#ifdef CORE_DEBUG
|
||||
CGAL_assertion(p - str < size);
|
||||
#endif
|
||||
|
||||
*p = '\0';
|
||||
i.putback(c);
|
||||
i.clear();
|
||||
// old: x = Real(str, i.precision()); // use precision of input stream.
|
||||
x = Real(str); // default precision = get_static_defInputDigits()
|
||||
delete [] str;
|
||||
x = Real(str.c_str()); // default precision = get_static_defInputDigits()
|
||||
return i;
|
||||
}//operator >> (std::istream&, Real&)
|
||||
|
||||
|
|
|
|||
|
|
@ -3341,8 +3341,17 @@ namespace CartesianKernelFunctors {
|
|||
typedef typename K::Segment_3 Segment_3;
|
||||
typedef typename K::Ray_3 Ray_3;
|
||||
typedef typename K::FT FT;
|
||||
|
||||
public:
|
||||
typedef Point_3 result_type;
|
||||
template<typename>
|
||||
struct result {
|
||||
typedef const Point_3 type;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct result<F(Point_3, Point_3)> {
|
||||
typedef const Point_3& type;
|
||||
};
|
||||
|
||||
Point_3
|
||||
operator()( const Line_3& l, const Point_3& p ) const
|
||||
|
|
@ -3369,15 +3378,19 @@ namespace CartesianKernelFunctors {
|
|||
|
||||
Point_3
|
||||
operator()( const Triangle_3& t, const Point_3& p ) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,t,K()); }
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(t,p,K()); }
|
||||
|
||||
Point_3
|
||||
operator()( const Segment_3& s, const Point_3& p ) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,s,K()); }
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(s,p,K()); }
|
||||
|
||||
Point_3
|
||||
operator()( const Ray_3& r, const Point_3& p ) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,r,K()); }
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(r,p,K()); }
|
||||
|
||||
const Point_3&
|
||||
operator()( const Point_3& p, const Point_3& q) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,q,K()); }
|
||||
};
|
||||
|
||||
template <class K>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <CGAL/license/Cone_spanners_2.h>
|
||||
|
||||
|
||||
#include <array>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
@ -134,9 +134,8 @@ public:
|
|||
_Leaf (const key_compare& less, const value_compare& vless, tree_type *const t,
|
||||
_leaf_type *const prev = nullptr,
|
||||
_leaf_type *const next = nullptr)
|
||||
: _node_type (less, vless, t), prev (prev), next (next) {
|
||||
std::memset (values, 0, 2*sizeof(value_type*));
|
||||
}
|
||||
: _node_type (less, vless, t), values({nullptr,nullptr}), prev (prev), next (next)
|
||||
{}
|
||||
|
||||
/* Destructor.
|
||||
* Frees memory used for storing key-value pair, thus invalidating any
|
||||
|
|
@ -242,7 +241,7 @@ protected:
|
|||
|
||||
private:
|
||||
/* Key-value pairs */
|
||||
value_type* values[2];
|
||||
std::array<value_type*,2> values;
|
||||
|
||||
/* Linked list structure of the B+ tree */
|
||||
_leaf_type* prev;
|
||||
|
|
@ -268,11 +267,8 @@ public:
|
|||
typedef typename _node_type::tree_type tree_type;
|
||||
|
||||
_Internal (const Comp& less, const VComp& vless, tree_type *const t)
|
||||
: _node_type(less, vless, t) {
|
||||
std::memset (keys, 0, 2*sizeof(key_type*));
|
||||
std::memset (children, 0, 3*sizeof(_node_type*));
|
||||
std::memset (vMin, 0, 3*sizeof(mapped_type*));
|
||||
}
|
||||
: _node_type(less, vless, t), keys({nullptr, nullptr}), children({nullptr, nullptr, nullptr}), vMin({nullptr, nullptr, nullptr})
|
||||
{}
|
||||
|
||||
virtual ~_Internal() {
|
||||
keys[0] = nullptr;
|
||||
|
|
@ -492,9 +488,9 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
const key_type* keys[2];
|
||||
_node_type* children[3];
|
||||
const mapped_type* vMin[3];
|
||||
std::array<const key_type*, 2> keys;
|
||||
std::array< _node_type*, 3> children;
|
||||
std::array<const mapped_type*, 3> vMin;
|
||||
};
|
||||
|
||||
template <typename Key, typename T, typename Comp, typename VComp >
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ template<typename Nef_, typename FTComparison, typename Container>
|
|||
SNC_point_locator* pl;
|
||||
|
||||
public:
|
||||
Edge_sorter(Container& cin) : c(cin) {}
|
||||
Edge_sorter(Container& cin) : c(cin), sncp(nullptr), pl(nullptr) {}
|
||||
|
||||
void operator()(SNC_and_PL& sncpl) {
|
||||
sncp = sncpl.sncp;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ class Ray_hit_generator2 : public Modifier_base<typename Nef_::SNC_and_PL> {
|
|||
bool vertex_added;
|
||||
|
||||
public:
|
||||
Ray_hit_generator2(Vector_3 d, Vertex_handle v) : dir(d), vs(v) {}
|
||||
Ray_hit_generator2(Vector_3 d, Vertex_handle v)
|
||||
: dir(d), vs(v), sncp(nullptr), pl(nullptr), edge_splitted(false), vertex_added(false) {}
|
||||
|
||||
Vertex_handle create_vertex_on_first_hit(const Ray_3& r) {
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class Single_wall_creator : public Modifier_base<typename Nef_::SNC_and_PL> {
|
|||
|
||||
public:
|
||||
Single_wall_creator(SVertex_handle e, Vector_3 d)
|
||||
: ein(e), dir(d)
|
||||
: ein(e), dir(d), sncp(nullptr), pl(nullptr)
|
||||
#ifndef CGAL_NEF_NO_INDEXED_ITEMS
|
||||
, index1(0), index2(0)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -160,11 +160,11 @@ public:
|
|||
&arrays[SMOOTH_NORMAL_COLORED_FACES])
|
||||
{
|
||||
// Define 'Control+Q' as the new exit shortcut (default was 'Escape')
|
||||
setShortcut(qglviewer::EXIT_VIEWER, ::Qt::CTRL+::Qt::Key_Q);
|
||||
setShortcut(qglviewer::EXIT_VIEWER, ::Qt::CTRL, ::Qt::Key_Q);
|
||||
|
||||
// Add custom key description (see keyPressEvent).
|
||||
setKeyDescription(::Qt::Key_C, "Switch clipping plane display mode");
|
||||
setKeyDescription(::Qt::Key_C+::Qt::AltModifier, "Toggle clipping plane rendering on/off");
|
||||
setKeyDescription(::Qt::AltModifier, ::Qt::Key_C, "Toggle clipping plane rendering on/off");
|
||||
setKeyDescription(::Qt::Key_E, "Toggles edges display");
|
||||
setKeyDescription(::Qt::Key_M, "Toggles mono color");
|
||||
setKeyDescription(::Qt::Key_N, "Inverse direction of normals");
|
||||
|
|
@ -175,8 +175,8 @@ public:
|
|||
setKeyDescription(::Qt::Key_W, "Toggles faces display");
|
||||
setKeyDescription(::Qt::Key_Plus, "Increase size of edges");
|
||||
setKeyDescription(::Qt::Key_Minus, "Decrease size of edges");
|
||||
setKeyDescription(::Qt::Key_Plus+::Qt::ControlModifier, "Increase size of vertices");
|
||||
setKeyDescription(::Qt::Key_Minus+::Qt::ControlModifier, "Decrease size of vertices");
|
||||
setKeyDescription(::Qt::ControlModifier, ::Qt::Key_Plus, "Increase size of vertices");
|
||||
setKeyDescription(::Qt::ControlModifier, ::Qt::Key_Minus, "Decrease size of vertices");
|
||||
setKeyDescription(::Qt::Key_PageDown, "Increase light (all colors, use shift/alt/ctrl for one rgb component)");
|
||||
setKeyDescription(::Qt::Key_PageUp, "Decrease light (all colors, use shift/alt/ctrl for one rgb component)");
|
||||
setKeyDescription(::Qt::Key_O, "Toggles 2D mode only");
|
||||
|
|
|
|||
|
|
@ -833,8 +833,26 @@ public:
|
|||
|
||||
public Q_SLOTS:
|
||||
void setShortcut(qglviewer::KeyboardAction action, unsigned int key);
|
||||
void setShortcut(qglviewer::KeyboardAction action, ::Qt::Modifier modifier, ::Qt::Key key)
|
||||
{
|
||||
setShortcut(action,
|
||||
static_cast<unsigned int>(modifier)+
|
||||
static_cast<unsigned int>(key));
|
||||
}
|
||||
|
||||
void setKeyDescription(unsigned int key, QString description);
|
||||
void setKeyDescription(::Qt::KeyboardModifier modifier, ::Qt::Key key, QString description)
|
||||
{
|
||||
setKeyDescription(static_cast<unsigned int>(modifier) +
|
||||
static_cast<unsigned int>(key),
|
||||
description);
|
||||
}
|
||||
void setKeyDescription(::Qt::Modifier modifier, ::Qt::Key key, QString description)
|
||||
{
|
||||
setKeyDescription(static_cast<unsigned int>(modifier) +
|
||||
static_cast<unsigned int>(key),
|
||||
description);
|
||||
}
|
||||
void clearShortcuts();
|
||||
|
||||
// Key Frames shortcut keys
|
||||
|
|
|
|||
|
|
@ -657,10 +657,10 @@ void CGAL::QGLViewer::setDefaultShortcuts() {
|
|||
setShortcut(qglviewer::DRAW_AXIS, ::Qt::Key_A);
|
||||
setShortcut(qglviewer::DRAW_GRID, ::Qt::Key_G);
|
||||
setShortcut(qglviewer::DISPLAY_FPS, ::Qt::Key_F);
|
||||
setShortcut(qglviewer::ENABLE_TEXT, ::Qt::SHIFT + ::Qt::Key_Question);
|
||||
setShortcut(qglviewer::ENABLE_TEXT, ::Qt::SHIFT, ::Qt::Key_Question);
|
||||
setShortcut(qglviewer::EXIT_VIEWER, ::Qt::Key_Escape);
|
||||
setShortcut(qglviewer::CAMERA_MODE, ::Qt::Key_Space);
|
||||
setShortcut(qglviewer::FULL_SCREEN, ::Qt::ALT + ::Qt::Key_Return);
|
||||
setShortcut(qglviewer::FULL_SCREEN, ::Qt::ALT, ::Qt::Key_Return);
|
||||
setShortcut(qglviewer::ANIMATION, ::Qt::Key_Return);
|
||||
setShortcut(qglviewer::HELP, ::Qt::Key_H);
|
||||
setShortcut(qglviewer::MOVE_CAMERA_LEFT, ::Qt::Key_Left);
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ public:
|
|||
/// Functor with operator: `FT operator()(const Point_3& p, const Point_3& q) const` which computes the squared distance between `p` and `q`.
|
||||
typedef unspecified_type Compute_squared_distance_3;
|
||||
|
||||
/// Functor with operator: `FT operator()(const Vector_3& v) const` which computes the squared length of `v`.
|
||||
typedef unspecified_type Compute_squared_length_3;
|
||||
|
||||
/// @}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <CGAL/Eigen_solver_traits.h>
|
||||
#endif
|
||||
|
||||
#include <CGAL/Weights/utils.h>
|
||||
#include <boost/range/has_range_iterator.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
|
@ -361,7 +362,6 @@ private:
|
|||
void
|
||||
compute_divergence()
|
||||
{
|
||||
typename Traits::Construct_cross_product_vector_3 cross_product = Traits().construct_cross_product_vector_3_object();
|
||||
typename Traits::Compute_scalar_product_3 scalar_product = Traits().compute_scalar_product_3_object();
|
||||
typename Traits::Construct_vector_3 construct_vector = Traits().construct_vector_3_object();
|
||||
Matrix indexD(dimension,1);
|
||||
|
|
@ -374,36 +374,30 @@ private:
|
|||
Index i = get(vertex_id_map, current);
|
||||
Index j = get(vertex_id_map, neighbor_one);
|
||||
Index k = get(vertex_id_map, neighbor_two);
|
||||
VertexPointMap_reference p_i = get(vpm,current);
|
||||
VertexPointMap_reference p_i = get(vpm, current);
|
||||
VertexPointMap_reference p_j = get(vpm, neighbor_one);
|
||||
VertexPointMap_reference p_k = get(vpm, neighbor_two);
|
||||
Index face_i = get(face_id_map, f);
|
||||
|
||||
Vector_3 v_ij = construct_vector(p_i,p_j);
|
||||
Vector_3 v_ik = construct_vector(p_i,p_k);
|
||||
Vector_3 cross = cross_product(v_ij, v_ik);
|
||||
double norm_cross = CGAL::sqrt(to_double(scalar_product(cross,cross)));
|
||||
double dot = to_double(scalar_product(v_ij, v_ik));
|
||||
double cotan_i = dot/norm_cross;
|
||||
const Vector_3 v_ij = construct_vector(p_i, p_j);
|
||||
const Vector_3 v_ik = construct_vector(p_i, p_k);
|
||||
const Vector_3 v_ji = construct_vector(p_j, p_i);
|
||||
const Vector_3 v_jk = construct_vector(p_j, p_k);
|
||||
const Vector_3 v_ki = construct_vector(p_k, p_i);
|
||||
const Vector_3 v_kj = construct_vector(p_k, p_j);
|
||||
|
||||
Vector_3 v_ji = construct_vector(p_j, p_i);
|
||||
Vector_3 v_jk = construct_vector(p_j, p_k);
|
||||
const Traits traits;
|
||||
const FT cotan_i = CGAL::Weights::cotangent(p_k, p_i, p_j, traits);
|
||||
const FT cotan_j = CGAL::Weights::cotangent(p_k, p_j, p_i, traits);
|
||||
const FT cotan_k = CGAL::Weights::cotangent(p_j, p_k, p_i, traits);
|
||||
|
||||
cross = cross_product(v_ji, v_jk);
|
||||
dot = to_double(scalar_product(v_ji, v_jk));
|
||||
double cotan_j = dot/norm_cross;
|
||||
|
||||
Vector_3 v_ki = construct_vector(p_k,p_i);
|
||||
Vector_3 v_kj = construct_vector(p_k,p_j);
|
||||
|
||||
cross = cross_product(v_ki, v_kj);
|
||||
dot = to_double(scalar_product(v_ki,v_kj));
|
||||
double cotan_k = dot/norm_cross;
|
||||
|
||||
const Vector_3& a = m_X[face_i];
|
||||
double i_entry = (to_double(scalar_product(a,v_ij)) * cotan_k) + (to_double(scalar_product(a,v_ik)) * cotan_j);
|
||||
double j_entry = (to_double(scalar_product(a,v_jk)) * cotan_i) + (to_double(scalar_product(a,v_ji)) * cotan_k);
|
||||
double k_entry = (to_double(scalar_product(a,v_ki)) * cotan_j) + (to_double(scalar_product(a,v_kj)) * cotan_i);
|
||||
const Vector_3& a = m_X[face_i];
|
||||
const double i_entry = (CGAL::to_double(scalar_product(a, v_ij) * cotan_k)) +
|
||||
(CGAL::to_double(scalar_product(a, v_ik) * cotan_j));
|
||||
const double j_entry = (CGAL::to_double(scalar_product(a, v_jk) * cotan_i)) +
|
||||
(CGAL::to_double(scalar_product(a, v_ji) * cotan_k));
|
||||
const double k_entry = (CGAL::to_double(scalar_product(a, v_ki) * cotan_j)) +
|
||||
(CGAL::to_double(scalar_product(a, v_kj) * cotan_i));
|
||||
|
||||
indexD.add_coef(i, 0, (1./2)*i_entry);
|
||||
indexD.add_coef(j, 0, (1./2)*j_entry);
|
||||
|
|
@ -549,47 +543,40 @@ private:
|
|||
Index k = get(vertex_id_map, neighbor_two);
|
||||
Point_3 pi, pj, pk;
|
||||
|
||||
VertexPointMap_reference p_i = get(vpm,current);
|
||||
const Traits traits;
|
||||
VertexPointMap_reference p_i = get(vpm, current);
|
||||
VertexPointMap_reference p_j = get(vpm, neighbor_one);
|
||||
VertexPointMap_reference p_k = get(vpm, neighbor_two);
|
||||
pi = p_i;
|
||||
pj = p_j;
|
||||
pk = p_k;
|
||||
|
||||
Vector_3 v_ij = construct_vector(p_i,p_j);
|
||||
Vector_3 v_ik = construct_vector(p_i,p_k);
|
||||
const double cotan_i = CGAL::to_double(
|
||||
CGAL::Weights::cotangent(pk, pi, pj, traits));
|
||||
m_cotan_matrix.add_coef(j, k, -(1./2) * cotan_i);
|
||||
m_cotan_matrix.add_coef(k, j, -(1./2) * cotan_i);
|
||||
m_cotan_matrix.add_coef(j, j, (1./2) * cotan_i);
|
||||
m_cotan_matrix.add_coef(k, k, (1./2) * cotan_i);
|
||||
|
||||
Vector_3 cross = cross_product(v_ij, v_ik);
|
||||
double dot = to_double(scalar_product(v_ij,v_ik));
|
||||
const double cotan_j = CGAL::to_double(
|
||||
CGAL::Weights::cotangent(pk, pj, pi, traits));
|
||||
m_cotan_matrix.add_coef(i, k, -(1./2) * cotan_j);
|
||||
m_cotan_matrix.add_coef(k, i, -(1./2) * cotan_j);
|
||||
m_cotan_matrix.add_coef(i, i, (1./2) * cotan_j);
|
||||
m_cotan_matrix.add_coef(k, k, (1./2) * cotan_j);
|
||||
|
||||
double norm_cross = (CGAL::sqrt(to_double(scalar_product(cross,cross))));
|
||||
const double cotan_k = CGAL::to_double(
|
||||
CGAL::Weights::cotangent(pj, pk, pi, traits));
|
||||
m_cotan_matrix.add_coef(i, j, -(1./2) * cotan_k);
|
||||
m_cotan_matrix.add_coef(j, i, -(1./2) * cotan_k);
|
||||
m_cotan_matrix.add_coef(i, i, (1./2) * cotan_k);
|
||||
m_cotan_matrix.add_coef(j, j, (1./2) * cotan_k);
|
||||
|
||||
double cotan_i = dot/norm_cross;
|
||||
m_cotan_matrix.add_coef(j,k ,-(1./2)*cotan_i);
|
||||
m_cotan_matrix.add_coef(k,j,-(1./2)* cotan_i);
|
||||
m_cotan_matrix.add_coef(j,j,(1./2)*cotan_i);
|
||||
m_cotan_matrix.add_coef(k,k,(1./2)* cotan_i);
|
||||
|
||||
Vector_3 v_ji = construct_vector(p_j,p_i);
|
||||
Vector_3 v_jk = construct_vector(p_j,p_k);
|
||||
|
||||
cross = cross_product(v_ji, v_jk);
|
||||
dot = to_double(scalar_product(v_ji, v_jk));
|
||||
double cotan_j = dot/norm_cross;
|
||||
m_cotan_matrix.add_coef(i,k ,-(1./2)*cotan_j);
|
||||
m_cotan_matrix.add_coef(k,i,-(1./2)* cotan_j);
|
||||
m_cotan_matrix.add_coef(i,i,(1./2)* cotan_j);
|
||||
m_cotan_matrix.add_coef(k,k,(1./2)* cotan_j);
|
||||
|
||||
Vector_3 v_ki = construct_vector(p_k,p_i);
|
||||
Vector_3 v_kj = construct_vector(p_k,p_j);
|
||||
cross = cross_product(v_ki, v_kj);
|
||||
dot = to_double(scalar_product(v_ki,v_kj));
|
||||
double cotan_k = dot/norm_cross;
|
||||
m_cotan_matrix.add_coef(i,j,-(1./2)*cotan_k);
|
||||
m_cotan_matrix.add_coef(j,i,-(1./2)* cotan_k);
|
||||
m_cotan_matrix.add_coef(i,i,(1./2)* cotan_k);
|
||||
m_cotan_matrix.add_coef(j,j,(1./2)* cotan_k);
|
||||
const Vector_3 v_ij = construct_vector(p_i, p_j);
|
||||
const Vector_3 v_ik = construct_vector(p_i, p_k);
|
||||
const Vector_3 cross = cross_product(v_ij, v_ik);
|
||||
const double norm_cross = CGAL::sqrt(
|
||||
CGAL::to_double(scalar_product(cross, cross)));
|
||||
|
||||
//double area_face = CGAL::Polygon_mesh_processing::face_area(f,tm);
|
||||
//cross is 2*area
|
||||
|
|
|
|||
|
|
@ -18,3 +18,4 @@ Random_numbers
|
|||
STL_Extension
|
||||
Solver_interface
|
||||
Stream_support
|
||||
Weights
|
||||
|
|
|
|||
|
|
@ -59,6 +59,11 @@ struct Heat_method_traits_3
|
|||
{ return 0;}
|
||||
};
|
||||
|
||||
struct Compute_squared_length_3 {
|
||||
|
||||
double operator()(const Vector_3&) const
|
||||
{ return 0;}
|
||||
};
|
||||
|
||||
Construct_vector_3 construct_vector_3_object() const
|
||||
{
|
||||
|
|
@ -79,6 +84,11 @@ struct Heat_method_traits_3
|
|||
return Compute_squared_distance_3();
|
||||
}
|
||||
|
||||
Compute_squared_length_3 compute_squared_length_3_object() const
|
||||
{
|
||||
return Compute_squared_length_3();
|
||||
}
|
||||
|
||||
Compute_scalar_product_3 compute_scalar_product_3_object() const
|
||||
{
|
||||
return Compute_scalar_product_3();
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ template <class R>
|
|||
CGAL_KERNEL_MEDIUM_INLINE
|
||||
Oriented_side
|
||||
SphereH3<R>::oriented_side(const typename SphereH3<R>::Point_3& p) const
|
||||
{ return Oriented_side(bounded_side(p) * orientation()); }
|
||||
{ return Oriented_side(static_cast<int>(bounded_side(p)) * static_cast<int>(orientation())); }
|
||||
|
||||
template <class R>
|
||||
CGAL_KERNEL_INLINE
|
||||
|
|
|
|||
|
|
@ -3398,8 +3398,17 @@ namespace HomogeneousKernelFunctors {
|
|||
typedef typename K::Triangle_3 Triangle_3;
|
||||
typedef typename K::Segment_3 Segment_3;
|
||||
typedef typename K::Ray_3 Ray_3;
|
||||
|
||||
public:
|
||||
typedef Point_3 result_type;
|
||||
template<typename>
|
||||
struct result {
|
||||
typedef const Point_3 type;
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct result<F(Point_3, Point_3)> {
|
||||
typedef const Point_3& type;
|
||||
};
|
||||
|
||||
Point_3
|
||||
operator()( const Line_3& l, const Point_3& p ) const
|
||||
|
|
@ -3429,15 +3438,19 @@ namespace HomogeneousKernelFunctors {
|
|||
|
||||
Point_3
|
||||
operator()( const Triangle_3& t, const Point_3& p ) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,t,K()); }
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(t,p,K()); }
|
||||
|
||||
Point_3
|
||||
operator()( const Segment_3& s, const Point_3& p ) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,s,K()); }
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(s,p,K()); }
|
||||
|
||||
Point_3
|
||||
operator()( const Ray_3& r, const Point_3& p ) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,r,K()); }
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(r,p,K()); }
|
||||
|
||||
const Point_3&
|
||||
operator()( const Point_3& p, const Point_3& q) const
|
||||
{ return CommonKernelFunctors::Construct_projected_point_3<K>()(p,q,K()); }
|
||||
};
|
||||
|
||||
template <class K>
|
||||
|
|
@ -4675,7 +4688,7 @@ namespace HomogeneousKernelFunctors {
|
|||
|
||||
result_type
|
||||
operator()( const Circle_2& c, const Point_2& p) const
|
||||
{ return Oriented_side(c.bounded_side(p) * c.orientation()); }
|
||||
{ return Oriented_side(static_cast<int>(c.bounded_side(p)) * static_cast<int>(c.orientation())); }
|
||||
|
||||
result_type
|
||||
operator()( const Line_2& l, const Point_2& p) const
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ Release date: December 2021
|
|||
### [2D and 3D Linear Geometry Kernel](https://doc.cgal.org/5.4/Manual/packages.html#PkgKernel23)
|
||||
|
||||
- Added `construct_centroid_2_object()` and `compute_determinant_2_object()` in `Projection_traits_xy_3`, `Projection_traits_xz_3`,
|
||||
and`Projection_traits_yz_3` classes.
|
||||
and `Projection_traits_yz_3` classes.
|
||||
|
||||
- Added documentation for the class `Projection_traits_3`, which enables the use of 2D algorithms on the projections of 3D data onto an arbitrary plane.
|
||||
|
||||
|
|
@ -62,6 +62,10 @@ Release date: December 2021
|
|||
|
||||
- Added an option to [`CGAL::Polygon_mesh_processing::self_intersections()`](https://doc.cgal.org/5.4/Polygon_mesh_processing/group__PMP__intersection__grp.html#gaf19c80ec12cbff7ebe9e69453f1d40b8) to report only a limited number of intersections (`maximum_number()`)
|
||||
|
||||
### [The Heat Method](https://doc.cgal.org/5.4/Manual/packages.html#PkgHeatMethod)
|
||||
|
||||
- **Breaking change**: Added the functor `Compute_squared_length_3` that has an operator `operator(const Vector_3& v)`, which computes the squared length of `v`, to the `HeatMethodTraits_3` concept.
|
||||
|
||||
### [Shape Regularization](https://doc.cgal.org/5.4/Manual/packages.html#PkgShapeRegularization) (new package)
|
||||
|
||||
- This package enables to regularize a set of segments and open or closed contours in 2D
|
||||
|
|
|
|||
|
|
@ -653,6 +653,10 @@ cache_get(CGAL_3RD_PARTY_LIBRARIES )
|
|||
cache_get(CGAL_3RD_PARTY_LIBRARIES_DIRS)
|
||||
|
||||
install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/Qt" COMPONENT CGAL_Qt5)
|
||||
if(CGAL_BRANCH_BUILD)
|
||||
install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/resources/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/resources" COMPONENT CGAL_Qt5)
|
||||
install(DIRECTORY "${CGAL_GRAPHICSVIEW_PACKAGE_DIR}/demo/icons/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/icons" COMPONENT CGAL_Qt5)
|
||||
endif()
|
||||
|
||||
#
|
||||
# Variables used when WITH_{demos|examples|tests} are TRUE
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ if(libpointmatcher_FOUND AND NOT TARGET CGAL::pointmatcher_support)
|
|||
add_library(CGAL::pointmatcher_support INTERFACE IMPORTED)
|
||||
target_compile_definitions(CGAL::pointmatcher_support INTERFACE "CGAL_LINKED_WITH_POINTMATCHER")
|
||||
target_include_directories(CGAL::pointmatcher_support INTERFACE "${libpointmatcher_INCLUDE_DIR}")
|
||||
target_link_libraries(CGAL::pointmatcher_support INTERFACE "${libpointmatcher_LIBRARIES}")
|
||||
target_link_libraries(CGAL::pointmatcher_support INTERFACE ${libpointmatcher_LIBRARIES})
|
||||
else()
|
||||
message(STATUS "NOTICE : the libpointmatcher library requires the following boost components: thread filesystem system program_options date_time chrono.")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -36,11 +36,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Line_2_Iso_rectangle_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Line_2_Iso_rectangle_2_pair(typename K::Line_2 const *line,
|
||||
typename K::Iso_rectangle_2 const *iso)
|
||||
: _known(false),
|
||||
_ref_point(line->point()),
|
||||
: _ref_point(line->point()),
|
||||
_dir(line->direction().to_vector()),
|
||||
_isomin((iso->min)()),
|
||||
_isomax((iso->max)()) {}
|
||||
|
|
@ -50,8 +49,7 @@ public:
|
|||
typename K::Point_2 intersection_point() const;
|
||||
typename K::Segment_2 intersection_segment() const;
|
||||
protected:
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::FT _min, _max;
|
||||
typename K::Point_2 _ref_point;
|
||||
typename K::Vector_2 _dir;
|
||||
|
|
@ -84,10 +82,9 @@ typename Line_2_Iso_rectangle_2_pair<K>::Intersection_results
|
|||
Line_2_Iso_rectangle_2_pair<K>::intersection_type() const
|
||||
{
|
||||
//typedef typename K::Line_2 line_t;
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::RT RT;
|
||||
bool all_values = true;
|
||||
|
|
@ -156,7 +153,7 @@ intersection_point() const
|
|||
typename K::Construct_translated_point_2 translated_point;
|
||||
typename K::Construct_scaled_vector_2 construct_scaled_vector;
|
||||
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return translated_point(_ref_point, construct_scaled_vector(_dir, _min));
|
||||
|
|
@ -170,7 +167,7 @@ intersection_segment() const
|
|||
typename K::Construct_segment_2 construct_segment_2;
|
||||
typename K::Construct_translated_point_2 translated_point;
|
||||
typename K::Construct_scaled_vector_2 construct_scaled_vector;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return construct_segment_2(translated_point(_ref_point, construct_scaled_vector(_dir,_min)),
|
||||
|
|
|
|||
|
|
@ -35,10 +35,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Ray_2_Iso_rectangle_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Ray_2_Iso_rectangle_2_pair(typename K::Ray_2 const *ray,
|
||||
typename K::Iso_rectangle_2 const *iso)
|
||||
: _known(false), _ref_point(ray->source()), _dir(ray->direction().to_vector()),
|
||||
: _ref_point(ray->source()), _dir(ray->direction().to_vector()),
|
||||
_isomin((iso->min)()), _isomax((iso->max)()), _min((typename K::FT)(0)) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
|
@ -46,8 +46,7 @@ public:
|
|||
typename K::Point_2 intersection_point() const;
|
||||
typename K::Segment_2 intersection_segment() const;
|
||||
protected:
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _ref_point;
|
||||
mutable typename K::Vector_2 _dir;
|
||||
mutable typename K::Point_2 _isomin;
|
||||
|
|
@ -109,9 +108,8 @@ Ray_2_Iso_rectangle_2_pair<K>::intersection_type() const
|
|||
{
|
||||
typedef typename K::RT RT;
|
||||
typedef typename K::FT FT;
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
_known = true;
|
||||
bool to_infinity = true;
|
||||
|
||||
typename K::Construct_cartesian_const_iterator_2 construct_cccit;
|
||||
|
|
@ -175,7 +173,7 @@ Ray_2_Iso_rectangle_2_pair<K>::intersection_segment() const
|
|||
typedef typename K::Segment_2 Segment_2;
|
||||
typename K::Construct_translated_point_2 translated_point;
|
||||
typename K::Construct_scaled_vector_2 construct_scaled_vector;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
typename K::Point_2 p1(translated_point(_ref_point, construct_scaled_vector(_dir,_min)));
|
||||
|
|
@ -190,7 +188,7 @@ Ray_2_Iso_rectangle_2_pair<K>::intersection_point() const
|
|||
typedef typename K::Point_2 Point_2;
|
||||
typename K::Construct_translated_point_2 translated_point;
|
||||
typename K::Construct_scaled_vector_2 construct_scaled_vector;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return Point_2(translated_point(_ref_point, construct_scaled_vector(_dir, _min)));
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace internal {
|
|||
template <class K>
|
||||
class Segment_2_Iso_rectangle_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Segment_2_Iso_rectangle_2_pair(typename K::Segment_2 const *seg,
|
||||
typename K::Iso_rectangle_2 const *rect) ;
|
||||
|
||||
|
|
@ -45,8 +45,7 @@ public:
|
|||
typename K::Point_2 intersection_point() const;
|
||||
typename K::Segment_2 intersection_segment() const;
|
||||
protected:
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _ref_point;
|
||||
mutable typename K::Vector_2 _dir;
|
||||
mutable typename K::Point_2 _isomin;
|
||||
|
|
@ -108,7 +107,6 @@ Segment_2_Iso_rectangle_2_pair(
|
|||
typename K::Segment_2 const *seg,
|
||||
typename K::Iso_rectangle_2 const *iso)
|
||||
{
|
||||
_known = false;
|
||||
_isomin = (iso->min)();
|
||||
_isomax = (iso->max)();
|
||||
_ref_point = seg->source();
|
||||
|
|
@ -130,9 +128,8 @@ Segment_2_Iso_rectangle_2_pair<K>::intersection_type() const
|
|||
{
|
||||
typedef typename K::RT RT;
|
||||
typedef typename K::FT FT;
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
_known = true;
|
||||
|
||||
typename K::Construct_cartesian_const_iterator_2 construct_cccit;
|
||||
typename K::Cartesian_const_iterator_2 ref_point_it = construct_cccit(_ref_point);
|
||||
|
|
@ -190,7 +187,7 @@ intersection_segment() const
|
|||
typedef typename K::Segment_2 Segment_2;
|
||||
typename K::Construct_translated_point_2 translated_point;
|
||||
typename K::Construct_scaled_vector_2 construct_scaled_vector;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
typename K::Point_2 p1(translated_point(_ref_point, construct_scaled_vector(_dir,_min)));
|
||||
|
|
@ -205,7 +202,7 @@ intersection_point() const
|
|||
{
|
||||
typename K::Construct_translated_point_2 translated_point;
|
||||
typename K::Construct_scaled_vector_2 construct_scaled_vector;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return translated_point(_ref_point, construct_scaled_vector(_dir,_min));
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Line_2_Line_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NOT_COMPUTED_YET, NO_INTERSECTION, POINT, LINE};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, LINE, UNKNOWN};
|
||||
Line_2_Line_2_pair(typename K::Line_2 const *line1,
|
||||
typename K::Line_2 const *line2)
|
||||
: _line1(line1), _line2(line2), _result(NOT_COMPUTED_YET) {}
|
||||
: _line1(line1), _line2(line2) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ public:
|
|||
protected:
|
||||
typename K::Line_2 const* _line1;
|
||||
typename K::Line_2 const * _line2;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point;
|
||||
};
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ typename Line_2_Line_2_pair<K>::Intersection_results
|
|||
Line_2_Line_2_pair<K>::intersection_type() const
|
||||
{
|
||||
typedef typename K::RT RT;
|
||||
if (_result != NOT_COMPUTED_YET)
|
||||
if (_result != UNKNOWN)
|
||||
return _result;
|
||||
RT nom1, nom2, denom;
|
||||
// The non const this pointer is used to cast away const.
|
||||
|
|
@ -178,7 +178,7 @@ template <class K>
|
|||
typename K::Point_2
|
||||
Line_2_Line_2_pair<K>::intersection_point() const
|
||||
{
|
||||
if (_result == NOT_COMPUTED_YET)
|
||||
if (_result == UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -188,7 +188,7 @@ template <class K>
|
|||
typename K::Line_2
|
||||
Line_2_Line_2_pair<K>::intersection_line() const
|
||||
{
|
||||
if (_result == NOT_COMPUTED_YET)
|
||||
if (_result == UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == LINE);
|
||||
return *_line1;
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ namespace internal {
|
|||
template <class K>
|
||||
class Ray_2_Line_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NOT_COMPUTED_YET, NO_INTERSECTION, POINT, RAY};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, RAY, UNKNOWN};
|
||||
typedef typename K::FT FT;
|
||||
Ray_2_Line_2_pair(typename K::Ray_2 const *ray,
|
||||
typename K::Line_2 const *line)
|
||||
: _ray(ray), _line(line), _result(NOT_COMPUTED_YET),
|
||||
: _ray(ray), _line(line),
|
||||
_intersection_point(K().construct_point_2_object()(ORIGIN))
|
||||
{}
|
||||
|
||||
|
|
@ -50,7 +50,7 @@ public:
|
|||
protected:
|
||||
typename K::Ray_2 const * _ray;
|
||||
typename K::Line_2 const * _line;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point;
|
||||
};
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ template <class K>
|
|||
typename Ray_2_Line_2_pair<K>::Intersection_results
|
||||
Ray_2_Line_2_pair<K>::intersection_type() const
|
||||
{
|
||||
if (_result != NOT_COMPUTED_YET)
|
||||
if (_result != UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
const typename K::Line_2 &l1 = _ray->supporting_line();
|
||||
|
|
@ -144,7 +144,7 @@ template <class K>
|
|||
typename K::Point_2
|
||||
Ray_2_Line_2_pair<K>::intersection_point() const
|
||||
{
|
||||
if (_result == NOT_COMPUTED_YET)
|
||||
if (_result == UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -154,7 +154,7 @@ template <class K>
|
|||
typename K::Ray_2
|
||||
Ray_2_Line_2_pair<K>::intersection_ray() const
|
||||
{
|
||||
if (_result == NOT_COMPUTED_YET)
|
||||
if (_result == UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == RAY);
|
||||
return *_ray;
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Segment_2_Line_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Segment_2_Line_2_pair(typename K::Segment_2 const *seg,
|
||||
typename K::Line_2 const *line)
|
||||
: _seg(seg), _line(line), _known(false) {}
|
||||
: _seg(seg), _line(line) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -46,8 +46,7 @@ public:
|
|||
protected:
|
||||
typename K::Segment_2 const*_seg;
|
||||
typename K::Line_2 const * _line;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point;
|
||||
};
|
||||
|
||||
|
|
@ -108,10 +107,9 @@ template <class K>
|
|||
typename Segment_2_Line_2_pair<K>::Intersection_results
|
||||
Segment_2_Line_2_pair<K>::intersection_type() const
|
||||
{
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
const typename K::Line_2 &l1 = _seg->supporting_line();
|
||||
Line_2_Line_2_pair<K> linepair(&l1, _line);
|
||||
switch ( linepair.intersection_type()) {
|
||||
|
|
@ -136,7 +134,7 @@ template <class K>
|
|||
typename K::Point_2
|
||||
Segment_2_Line_2_pair<K>::intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -146,7 +144,7 @@ template <class K>
|
|||
typename K::Segment_2
|
||||
Segment_2_Line_2_pair<K>::intersection_segment() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return *_seg;
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Line_2_Triangle_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Line_2_Triangle_2_pair(typename K::Line_2 const *line,
|
||||
typename K::Triangle_2 const *trian)
|
||||
: _line(line), _trian(trian), _known(false) {}
|
||||
: _line(line), _trian(trian) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -48,8 +48,7 @@ public:
|
|||
protected:
|
||||
typename K::Line_2 const*_line;
|
||||
typename K::Triangle_2 const * _trian;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point;
|
||||
mutable typename K::Point_2 _other_point;
|
||||
};
|
||||
|
|
@ -81,10 +80,9 @@ typename Line_2_Triangle_2_pair<K>::Intersection_results
|
|||
Line_2_Triangle_2_pair<K>::intersection_type() const
|
||||
{
|
||||
typedef typename K::Line_2 Line_2;
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
Straight_2_<K> straight(*_line);
|
||||
Line_2 l(_trian->vertex(0), _trian->vertex(1));
|
||||
if (l.oriented_side(_trian->vertex(2)) == ON_POSITIVE_SIDE) {
|
||||
|
|
@ -133,7 +131,7 @@ typename K::Point_2
|
|||
Line_2_Triangle_2_pair<K>::
|
||||
intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -145,7 +143,7 @@ Line_2_Triangle_2_pair<K>::
|
|||
intersection_segment() const
|
||||
{
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return Segment_2(_intersection_point, _other_point);
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Point_2_Triangle_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, UNKNOWN};
|
||||
Point_2_Triangle_2_pair(typename K::Point_2 const *pt,
|
||||
typename K::Triangle_2 const *trian)
|
||||
: _pt(pt), _trian(trian), _known(false) {}
|
||||
: _pt(pt), _trian(trian) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -44,8 +44,7 @@ public:
|
|||
protected:
|
||||
typename K::Point_2 const * _pt;
|
||||
typename K::Triangle_2 const * _trian;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point;
|
||||
mutable typename K::Point_2 _other_point;
|
||||
};
|
||||
|
|
@ -73,10 +72,9 @@ template <class K>
|
|||
typename Point_2_Triangle_2_pair<K>::Intersection_results
|
||||
Point_2_Triangle_2_pair<K>::intersection_type() const
|
||||
{
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
if (_trian->has_on_unbounded_side(*_pt)) {
|
||||
_result = NO_INTERSECTION;
|
||||
} else {
|
||||
|
|
@ -92,7 +90,7 @@ typename K::Point_2
|
|||
Point_2_Triangle_2_pair<K>::
|
||||
intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return *_pt;
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Ray_2_Ray_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, RAY};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, RAY, UNKNOWN};
|
||||
Ray_2_Ray_2_pair(typename K::Ray_2 const *ray1,
|
||||
typename K::Ray_2 const *ray2)
|
||||
: _ray1(ray1), _ray2(ray2), _known(false) {}
|
||||
: _ray1(ray1), _ray2(ray2) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -49,8 +49,7 @@ public:
|
|||
protected:
|
||||
typename K::Ray_2 const* _ray1;
|
||||
typename K::Ray_2 const * _ray2;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point, _other_point;
|
||||
};
|
||||
|
||||
|
|
@ -71,10 +70,9 @@ template <class K>
|
|||
typename Ray_2_Ray_2_pair<K>::Intersection_results
|
||||
Ray_2_Ray_2_pair<K>::intersection_type() const
|
||||
{
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
// if (!do_overlap(_ray1->bbox(), _ray2->bbox()))
|
||||
// return NO_INTERSECTION;
|
||||
const typename K::Line_2 &l1 = _ray1->supporting_line();
|
||||
|
|
@ -196,7 +194,7 @@ template <class K>
|
|||
typename K::Point_2
|
||||
Ray_2_Ray_2_pair<K>::intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -207,7 +205,7 @@ typename K::Segment_2
|
|||
Ray_2_Ray_2_pair<K>::intersection_segment() const
|
||||
{
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return Segment_2(_ray1->source(), _ray2->source());
|
||||
|
|
@ -218,7 +216,7 @@ typename K::Ray_2
|
|||
Ray_2_Ray_2_pair<K>::intersection_ray() const
|
||||
{
|
||||
typedef typename K::Ray_2 Ray_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == RAY);
|
||||
return Ray_2(_intersection_point, _ray1->direction());
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Ray_2_Segment_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Ray_2_Segment_2_pair(typename K::Ray_2 const *ray,
|
||||
typename K::Segment_2 const *seg)
|
||||
: _ray(ray), _seg(seg), _known(false) {}
|
||||
: _ray(ray), _seg(seg) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -49,8 +49,7 @@ public:
|
|||
protected:
|
||||
typename K::Ray_2 const * _ray;
|
||||
typename K::Segment_2 const * _seg;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point, _other_point;
|
||||
};
|
||||
|
||||
|
|
@ -76,10 +75,9 @@ template <class K>
|
|||
typename Ray_2_Segment_2_pair<K>::Intersection_results
|
||||
Ray_2_Segment_2_pair<K>::intersection_type() const
|
||||
{
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
// if (!do_overlap(_ray->bbox(), _seg->bbox()))
|
||||
// return NO_INTERSECTION;
|
||||
const typename K::Line_2 &l1 = _ray->supporting_line();
|
||||
|
|
@ -211,7 +209,7 @@ template <class K>
|
|||
typename K::Point_2
|
||||
Ray_2_Segment_2_pair<K>::intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -222,7 +220,7 @@ typename K::Segment_2
|
|||
Ray_2_Segment_2_pair<K>::intersection_segment() const
|
||||
{
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return Segment_2(_intersection_point, _other_point);
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Ray_2_Triangle_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Ray_2_Triangle_2_pair(typename K::Ray_2 const *ray,
|
||||
typename K::Triangle_2 const *trian)
|
||||
: _ray(ray), _trian(trian), _known(false) {}
|
||||
: _ray(ray), _trian(trian) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -46,8 +46,7 @@ public:
|
|||
protected:
|
||||
typename K::Ray_2 const* _ray;
|
||||
typename K::Triangle_2 const * _trian;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point;
|
||||
mutable typename K::Point_2 _other_point;
|
||||
};
|
||||
|
|
@ -59,10 +58,9 @@ typename Ray_2_Triangle_2_pair<K>::Intersection_results
|
|||
Ray_2_Triangle_2_pair<K>::intersection_type() const
|
||||
{
|
||||
typedef typename K::Line_2 Line_2;
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
Straight_2_<K> straight(*_ray);
|
||||
Line_2 l(_trian->vertex(0), _trian->vertex(1));
|
||||
if (l.oriented_side(_trian->vertex(2)) == ON_POSITIVE_SIDE) {
|
||||
|
|
@ -111,7 +109,7 @@ typename K::Point_2
|
|||
Ray_2_Triangle_2_pair<K>::
|
||||
intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -123,7 +121,7 @@ Ray_2_Triangle_2_pair<K>::
|
|||
intersection_segment() const
|
||||
{
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return Segment_2(_intersection_point, _other_point);
|
||||
|
|
|
|||
|
|
@ -274,10 +274,10 @@ do_intersect(const typename K::Segment_2 &seg1,
|
|||
template <class K>
|
||||
class Segment_2_Segment_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Segment_2_Segment_2_pair(typename K::Segment_2 const *seg1,
|
||||
typename K::Segment_2 const *seg2)
|
||||
: _seg1(seg1), _seg2(seg2), _known(false) {}
|
||||
: _seg1(seg1), _seg2(seg2) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -286,8 +286,7 @@ public:
|
|||
protected:
|
||||
typename K::Segment_2 const* _seg1;
|
||||
typename K::Segment_2 const * _seg2;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point, _other_point;
|
||||
};
|
||||
|
||||
|
|
@ -296,9 +295,8 @@ typename Segment_2_Segment_2_pair<K>::Intersection_results
|
|||
Segment_2_Segment_2_pair<K>::intersection_type() const
|
||||
{
|
||||
typename K::Construct_vector_2 construct_vector;
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
_known = true;
|
||||
if (!internal::do_intersect(*_seg1, *_seg2, K())) {
|
||||
_result = NO_INTERSECTION;
|
||||
return _result;
|
||||
|
|
@ -408,7 +406,7 @@ template <class K>
|
|||
typename K::Point_2
|
||||
Segment_2_Segment_2_pair<K>::intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -419,7 +417,7 @@ typename K::Segment_2
|
|||
Segment_2_Segment_2_pair<K>::intersection_segment() const
|
||||
{
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return Segment_2(_intersection_point, _other_point);
|
||||
|
|
|
|||
|
|
@ -34,10 +34,10 @@ namespace internal {
|
|||
template <class K>
|
||||
class Segment_2_Triangle_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, UNKNOWN};
|
||||
Segment_2_Triangle_2_pair(typename K::Segment_2 const *seg,
|
||||
typename K::Triangle_2 const *trian)
|
||||
: _seg(seg), _trian(trian), _known(false) {}
|
||||
: _seg(seg), _trian(trian) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -46,8 +46,7 @@ public:
|
|||
protected:
|
||||
typename K::Segment_2 const * _seg;
|
||||
typename K::Triangle_2 const * _trian;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable typename K::Point_2 _intersection_point;
|
||||
mutable typename K::Point_2 _other_point;
|
||||
};
|
||||
|
|
@ -71,10 +70,9 @@ template <class K>
|
|||
typename Segment_2_Triangle_2_pair<K>::Intersection_results
|
||||
Segment_2_Triangle_2_pair<K>::intersection_type() const
|
||||
{
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
Straight_2_<K> straight(*_seg);
|
||||
typedef typename K::Line_2 Line_2;
|
||||
|
||||
|
|
@ -124,7 +122,7 @@ typename K::Point_2
|
|||
Segment_2_Triangle_2_pair<K>::
|
||||
intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _intersection_point;
|
||||
|
|
@ -136,7 +134,7 @@ Segment_2_Triangle_2_pair<K>::
|
|||
intersection_segment() const
|
||||
{
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return Segment_2(_intersection_point, _other_point);
|
||||
|
|
|
|||
|
|
@ -154,10 +154,10 @@ void _cut_off(Pointlist_2_<K> &list,
|
|||
template <class K>
|
||||
class Triangle_2_Triangle_2_pair {
|
||||
public:
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, TRIANGLE, POLYGON};
|
||||
enum Intersection_results {NO_INTERSECTION, POINT, SEGMENT, TRIANGLE, POLYGON, UNKNOWN};
|
||||
Triangle_2_Triangle_2_pair(typename K::Triangle_2 const *trian1,
|
||||
typename K::Triangle_2 const *trian2)
|
||||
: _trian1(trian1), _trian2(trian2), _known(false) {}
|
||||
: _trian1(trian1), _trian2(trian2) {}
|
||||
|
||||
Intersection_results intersection_type() const;
|
||||
|
||||
|
|
@ -170,8 +170,7 @@ public:
|
|||
protected:
|
||||
typename K::Triangle_2 const* _trian1;
|
||||
typename K::Triangle_2 const * _trian2;
|
||||
mutable bool _known;
|
||||
mutable Intersection_results _result;
|
||||
mutable Intersection_results _result = UNKNOWN;
|
||||
mutable Pointlist_2_<K> _pointlist;
|
||||
};
|
||||
|
||||
|
|
@ -180,10 +179,9 @@ typename Triangle_2_Triangle_2_pair<K>::Intersection_results
|
|||
Triangle_2_Triangle_2_pair<K>::intersection_type() const
|
||||
{
|
||||
typedef typename K::Line_2 Line_2;
|
||||
if (_known)
|
||||
if (_result!=UNKNOWN)
|
||||
return _result;
|
||||
// The non const this pointer is used to cast away const.
|
||||
_known = true;
|
||||
if (!do_overlap(_trian1->bbox(), _trian2->bbox())) {
|
||||
_result = NO_INTERSECTION;
|
||||
return _result;
|
||||
|
|
@ -235,7 +233,7 @@ bool
|
|||
Triangle_2_Triangle_2_pair<K>::intersection(
|
||||
/* Polygon_2<R> &result */) const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
if (_result != TRIANGLE && _result != POLYGON)
|
||||
return false;
|
||||
|
|
@ -255,7 +253,7 @@ template <class K>
|
|||
int
|
||||
Triangle_2_Triangle_2_pair<K>::vertex_count() const
|
||||
{
|
||||
CGAL_kernel_assertion(_known);
|
||||
CGAL_kernel_assertion(_result!=UNKNOWN);
|
||||
return _pointlist.size;
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +261,7 @@ template <class K>
|
|||
typename K::Point_2
|
||||
Triangle_2_Triangle_2_pair<K>::vertex(int n) const
|
||||
{
|
||||
CGAL_kernel_assertion(_known);
|
||||
CGAL_kernel_assertion(_result!=UNKNOWN);
|
||||
CGAL_kernel_assertion(n >= 0 && n < _pointlist.size);
|
||||
Pointlist_2_rec_<K> *cur;
|
||||
int k;
|
||||
|
|
@ -279,7 +277,7 @@ typename K::Triangle_2
|
|||
Triangle_2_Triangle_2_pair<K>::intersection_triangle() const
|
||||
{
|
||||
typedef typename K::Triangle_2 Triangle_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == TRIANGLE);
|
||||
if(CGAL::left_turn(_pointlist.first->point,
|
||||
|
|
@ -302,7 +300,7 @@ typename K::Segment_2
|
|||
Triangle_2_Triangle_2_pair<K>::intersection_segment() const
|
||||
{
|
||||
typedef typename K::Segment_2 Segment_2;
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == SEGMENT);
|
||||
return Segment_2(_pointlist.first->point,
|
||||
|
|
@ -313,7 +311,7 @@ template <class K>
|
|||
typename K::Point_2
|
||||
Triangle_2_Triangle_2_pair<K>::intersection_point() const
|
||||
{
|
||||
if (!_known)
|
||||
if (_result==UNKNOWN)
|
||||
intersection_type();
|
||||
CGAL_kernel_assertion(_result == POINT);
|
||||
return _pointlist.first->point;
|
||||
|
|
|
|||
|
|
@ -2850,8 +2850,8 @@ namespace CommonKernelFunctors {
|
|||
|
||||
public:
|
||||
typename K::Point_3
|
||||
operator()(const typename K::Point_3& origin,
|
||||
const typename K::Triangle_3& triangle,
|
||||
operator()(const typename K::Triangle_3& triangle,
|
||||
const typename K::Point_3& origin,
|
||||
const K& k)
|
||||
{
|
||||
typedef typename K::Point_3 Point_3;
|
||||
|
|
@ -2890,18 +2890,18 @@ namespace CommonKernelFunctors {
|
|||
if(linf_ab > linf_ac) {
|
||||
if(linf_ab > linf_bc) {
|
||||
// ab is the maximal segment
|
||||
return this->operator()(origin, seg(a, b), k);
|
||||
return this->operator()(seg(a, b), origin, k);
|
||||
} else {
|
||||
// ab > ac, bc >= ab, use bc
|
||||
return this->operator()(origin, seg(b, c), k);
|
||||
return this->operator()(seg(b, c), origin, k);
|
||||
}
|
||||
} else { // ab <= ac
|
||||
if(linf_ac > linf_bc) {
|
||||
// ac is the maximal segment
|
||||
return this->operator()(origin, seg(a, c), k);
|
||||
return this->operator()(seg(a, c), origin, k);
|
||||
} else {
|
||||
// ab <= ac, ac <= bc, use bc
|
||||
return this->operator()(origin, seg(b, c), k);
|
||||
return this->operator()(seg(b, c), origin, k);
|
||||
}
|
||||
}
|
||||
} // degenerate plane
|
||||
|
|
@ -2923,8 +2923,8 @@ namespace CommonKernelFunctors {
|
|||
}
|
||||
|
||||
typename K::Point_3
|
||||
operator()(const typename K::Point_3& query,
|
||||
const typename K::Segment_3& segment,
|
||||
operator()(const typename K::Segment_3& segment,
|
||||
const typename K::Point_3& query,
|
||||
const K& k)
|
||||
{
|
||||
|
||||
|
|
@ -2945,8 +2945,8 @@ namespace CommonKernelFunctors {
|
|||
}
|
||||
|
||||
typename K::Point_3
|
||||
operator()(const typename K::Point_3& query,
|
||||
const typename K::Ray_3& ray,
|
||||
operator()(const typename K::Ray_3& ray,
|
||||
const typename K::Point_3& query,
|
||||
const K& k)
|
||||
{
|
||||
if ( ray.to_vector() * (query-ray.source()) <= 0)
|
||||
|
|
@ -2957,6 +2957,14 @@ namespace CommonKernelFunctors {
|
|||
}
|
||||
}
|
||||
|
||||
const typename K::Point_3&
|
||||
operator()(const typename K::Point_3& point,
|
||||
const typename K::Point_3&,
|
||||
const K&)
|
||||
{
|
||||
return point;
|
||||
}
|
||||
|
||||
// code for operator for plane and point is defined in
|
||||
// CGAL/Cartesian/function_objects.h and CGAL/Homogeneous/function_objects.h
|
||||
};
|
||||
|
|
@ -3005,7 +3013,6 @@ namespace CommonKernelFunctors {
|
|||
public:
|
||||
typedef typename K::Boolean result_type;
|
||||
|
||||
// There are 36 combinaisons, so I use a template.
|
||||
template <class T1, class T2>
|
||||
result_type
|
||||
operator()(const T1& t1, const T2& t2) const
|
||||
|
|
@ -3018,7 +3025,6 @@ namespace CommonKernelFunctors {
|
|||
public:
|
||||
typedef typename K::Boolean result_type;
|
||||
|
||||
// There are x combinaisons, so I use a template.
|
||||
template <class T1, class T2>
|
||||
result_type
|
||||
operator()(const T1& t1, const T2& t2) const
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ _test_fct_constructions_3(const R& r)
|
|||
assert( r.construct_projected_point_3_object()(ray, Point(-1,0,0)) == Point(0,0,0));
|
||||
assert( r.construct_projected_point_3_object()(s, Point(-1,0,0)) == Point(0,0,0));
|
||||
assert( r.construct_projected_point_3_object()(s, Point(2,0,0)) == Point(1,1,0));
|
||||
assert( r.construct_projected_point_3_object()(Point(0,0,0), Point(2,0,0)) == Point(0,0,0));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include <CGAL/Kernel_d/Pair_d.h>
|
||||
#include <CGAL/Kernel_d/Point_d.h>
|
||||
#include <CGAL/Kernel_d/Segment_d.h>
|
||||
#include <CGAL/Kernel_d/Line_d.h>
|
||||
#include <CGAL/Kernel_d/Ray_d.h>
|
||||
#include <CGAL/Kernel_d/Aff_transformation_d.h>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@
|
|||
<select id='newlist'></select>
|
||||
|
||||
<button type="button" id='button'>Compare</button><br>
|
||||
<p>
|
||||
Note that the diff should be done from left to right, as red or yellow squares in the left testsuite that become green in the right testsuite will be ignored.
|
||||
</p>
|
||||
I = Master<br>
|
||||
Ic = integration
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -30,22 +30,23 @@ function diff_testsuites(baseTest, newTest){
|
|||
var init = false;
|
||||
for(s = 0; s < suffixes.length; s++) {
|
||||
var new_column = new Array();
|
||||
xhr.open('GET', URL_testsuite+baseTest+'/'+suffixes[s], false);
|
||||
var suffixe=suffixes[s].replace("\r", "");
|
||||
xhr.open('GET', URL_testsuite+baseTest+'/'+suffixe, false);
|
||||
xhr.send(null);
|
||||
var base_exists = (xhr.status === 200);
|
||||
var base=xhr.responseText;
|
||||
xhr.open('GET', URL_testsuite+newTest+'/'+suffixes[s], false);
|
||||
var base=xhr.responseText.replace("\r", "");
|
||||
xhr.open('GET', URL_testsuite+newTest+'/'+suffixe, false);
|
||||
xhr.send(null);
|
||||
var new_exists = (xhr.status === 200)
|
||||
|
||||
if(base_exists && !new_exists)
|
||||
{
|
||||
diffArray.push("-"+suffixes[s]);
|
||||
diffArray.push("-"+suffixe);
|
||||
continue;
|
||||
}
|
||||
if(!base_exists && new_exists)
|
||||
{
|
||||
diffArray.push("+"+suffixes[s]);
|
||||
diffArray.push("+"+suffixe);
|
||||
continue;
|
||||
}
|
||||
if(!base_exists && !new_exists)
|
||||
|
|
@ -53,11 +54,17 @@ function diff_testsuites(baseTest, newTest){
|
|||
continue;
|
||||
}
|
||||
|
||||
var newtext=xhr.responseText;
|
||||
var newtext=xhr.responseText.replace("\r", "");
|
||||
var sp_base=base.split("\n");
|
||||
sp_base.sort();
|
||||
for(i=0; i< sp_base.length; i++){
|
||||
sp_base[i]=sp_base[i].replace("\r", "");
|
||||
}
|
||||
var sp_newtext=newtext.split("\n");
|
||||
sp_newtext.sort();
|
||||
for(i=0; i< sp_newtext.length; i++){
|
||||
sp_newtext[i]=sp_newtext[i].replace("\r", "");
|
||||
}
|
||||
addMissingLines(sp_base, sp_newtext);
|
||||
if(!init)
|
||||
{
|
||||
|
|
@ -73,7 +80,7 @@ function diff_testsuites(baseTest, newTest){
|
|||
myArray.push(first_column);
|
||||
init = true;
|
||||
}
|
||||
var fragments = suffixes[s].split("_");
|
||||
var fragments = suffixe.split("_");
|
||||
fragments.shift();
|
||||
var name = fragments.join("_");
|
||||
name = name.replace('.txt', '');
|
||||
|
|
@ -82,29 +89,29 @@ function diff_testsuites(baseTest, newTest){
|
|||
for(i=0; i< sp_base.length; i++){
|
||||
var broken = false;
|
||||
var res = print_diff(sp_base[i], sp_newtext[i]);
|
||||
var compensator=0;
|
||||
if(sp_base[i] !== ""){
|
||||
while(sp_base[i].substr(0, sp_base[i].length-2) !== first_column[i+compensator]){
|
||||
if(compensator >10){
|
||||
broken=true;
|
||||
break;
|
||||
}
|
||||
compensator++;
|
||||
}
|
||||
var compensator=0;
|
||||
if(sp_base[i] !== ""){
|
||||
while(sp_base[i].substr(0, sp_base[i].length-2) !== first_column[i+compensator]){
|
||||
if(compensator >10){
|
||||
broken=true;
|
||||
break;
|
||||
}
|
||||
compensator++;
|
||||
}
|
||||
else{
|
||||
while(sp_newtext[i].substr(0, sp_newtext[i].length-2) !== first_column[i+compensator]){
|
||||
if(compensator >10){
|
||||
broken=true;
|
||||
break;
|
||||
}
|
||||
compensator++;
|
||||
}
|
||||
}
|
||||
if(broken)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else{
|
||||
while(sp_newtext[i].substr(0, sp_newtext[i].length-2) !== first_column[i+compensator]){
|
||||
if(compensator >10){
|
||||
broken=true;
|
||||
break;
|
||||
}
|
||||
compensator++;
|
||||
}
|
||||
}
|
||||
if(broken)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var new_line=first_column[i+compensator]+"||"+"<td style='width: 25px; text-align: right;";
|
||||
var result="";
|
||||
if(res[0]===""){
|
||||
|
|
@ -130,8 +137,9 @@ function diff_testsuites(baseTest, newTest){
|
|||
new_line+=" background-color: rgb(65%,65%,100%)'> "+result;
|
||||
} else if(res[1]=== "n"){
|
||||
new_line+=" background-color: rgb(100%,50%,50%)'> "+result;
|
||||
}
|
||||
else if(res[1]==="" && res[0]!==""){
|
||||
} else if(res[1]== "t"){
|
||||
new_line+=" background-color: rgb(75%,100%,50%)'> "+result;
|
||||
} else if(res[1]==="" && res[0]!==""){
|
||||
new_line+=" background-color: rgb(50%,25%,75%)'>"+result;
|
||||
}
|
||||
else{
|
||||
|
|
@ -146,3 +154,4 @@ function diff_testsuites(baseTest, newTest){
|
|||
|
||||
return [myArray, diffArray];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#include <CGAL/Mesher_level_visitors.h>
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
#include <CGAL/point_generators_3.h>
|
||||
#include <CGAL/assertions.h>
|
||||
|
||||
#ifdef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE
|
||||
#include <CGAL/Surface_mesher/Surface_mesher_visitor.h>
|
||||
|
|
@ -765,6 +766,18 @@ initialize()
|
|||
facets_mesher_.scan_triangulation();
|
||||
refinement_stage = REFINE_FACETS;
|
||||
}
|
||||
|
||||
if (r_c3t3_.number_of_facets() == 0)
|
||||
{
|
||||
CGAL::warning_fail("r_c3t3_.number_of_facets() == 0",
|
||||
__FILE__,
|
||||
__LINE__,
|
||||
"Warning : The mesh refinement process can't start.\n"
|
||||
"When calling refine_mesh_3(), the input `c3t3` should have been initialized and have "
|
||||
"at least one facet in the complex. Try to solve this issue using :\n"
|
||||
"\t- The automatic initialization provided by make_mesh_3()\n"
|
||||
"\t- Adding more and better chosen points on the input surface\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ public:
|
|||
Segment_3 segment;
|
||||
bool initialized;
|
||||
public:
|
||||
Objects_around_segment() : initialized(false) {}
|
||||
Objects_around_segment() : root_node(nullptr), initialized(false) {}
|
||||
Objects_around_segment( const K3_tree& k, const Segment_3& s) :
|
||||
root_node(k.root), segment(s), initialized(true) {
|
||||
CGAL_NEF_TRACEN("Objects_around_segment: input segment: "<<segment);
|
||||
|
|
@ -322,7 +322,8 @@ public:
|
|||
CGAL_assertion_code( Segment_3 prev_segment;)
|
||||
CGAL_assertion_code( bool first_segment;)
|
||||
public:
|
||||
Iterator() : node() {}
|
||||
Iterator() : node()
|
||||
{ CGAL_assertion_code( first_segment = false); }
|
||||
Iterator( const Node_handle root, const Segment_3& s) {
|
||||
CGAL_assertion_code( first_segment = true);
|
||||
S.push_front( Candidate( root, s));
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <qgl.h>
|
||||
#include <CGAL/glu.h>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
#define CGAL_NEF3_MARKED_VERTEX_COLOR 183,232,92
|
||||
#define CGAL_NEF3_MARKED_EDGE_COLOR 171,216,86
|
||||
|
|
@ -226,7 +227,7 @@ namespace OGL {
|
|||
inline void CGAL_GLU_TESS_CALLBACK errorCallback(GLenum errorCode)
|
||||
{ const GLubyte *estring;
|
||||
estring = gluErrorString(errorCode);
|
||||
fprintf(stderr, "Tessellation Error: %s\n", estring);
|
||||
std::cerr << "Tessellation Error: " << estring << std::endl;
|
||||
std::exit (0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1088,7 +1088,10 @@ public:
|
|||
|
||||
template <typename EW>
|
||||
SNC_io_parser<EW>::SNC_io_parser(std::istream& is, SNC_structure& W) :
|
||||
Base(W), in(is), out(std::cout) {
|
||||
Base(W), in(is), out(std::cout),
|
||||
reduce(false), sorted(false), addInfiBox(false),
|
||||
i(0), vn(0), en(0), fn(0), cn(0), sen(0), sln(0), sfn(0)
|
||||
{
|
||||
W.clear();
|
||||
CGAL_assertion(W.is_empty());
|
||||
verbose = false;
|
||||
|
|
@ -1099,11 +1102,13 @@ template <typename EW>
|
|||
SNC_io_parser<EW>::SNC_io_parser(std::ostream& os, SNC_structure& W,
|
||||
bool sort, bool reduce_) :
|
||||
Base(W), in(std::cin), out(os),
|
||||
addInfiBox(false),
|
||||
FI(W.halffacets_begin(),W.halffacets_end(),'F'),
|
||||
CI(W.volumes_begin(),W.volumes_end(),'C'),
|
||||
SEI(W.shalfedges_begin(),W.shalfedges_end(),'e'),
|
||||
SLI(W.shalfloops_begin(),W.shalfloops_end(),'l'),
|
||||
SFI(W.sfaces_begin(),W.sfaces_end(),'f'),
|
||||
i(0),
|
||||
vn(W.number_of_vertices()),
|
||||
en(W.number_of_halfedges()),
|
||||
fn(W.number_of_halffacets()),
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/number_type_basic.h>
|
||||
#include <CGAL/CORE/BigFloat.h>
|
||||
#include <CGAL/CORE_coercion_traits.h>
|
||||
#include <CGAL/Interval_traits.h>
|
||||
#include <CGAL/Bigfloat_interval_traits.h>
|
||||
|
|
@ -513,7 +512,6 @@ template <> class Real_embeddable_traits< CORE::BigFloat >
|
|||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/CORE_BigInt.h>
|
||||
#include <CGAL/CORE_BigRat.h>
|
||||
#include <CGAL/CORE_BigFloat.h>
|
||||
#include <CGAL/CORE_arithmetic_kernel.h>
|
||||
|
||||
namespace Eigen {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <CGAL/config.h>
|
||||
#include <CGAL/number_type_basic.h>
|
||||
#include <CGAL/CORE/BigInt.h>
|
||||
#include <CGAL/CORE/Expr.h>
|
||||
#include <CGAL/CORE_coercion_traits.h>
|
||||
|
||||
|
|
@ -189,7 +188,6 @@ public:
|
|||
|
||||
//since types are included by CORE_coercion_traits.h:
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/CORE_BigInt.h>
|
||||
#include <CGAL/CORE_BigRat.h>
|
||||
#include <CGAL/CORE_BigFloat.h>
|
||||
#include <CGAL/CORE_arithmetic_kernel.h>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <CGAL/config.h>
|
||||
#include <CGAL/number_type_basic.h>
|
||||
#include <CGAL/CORE/BigRat.h>
|
||||
#include <CGAL/CORE_coercion_traits.h>
|
||||
#include <CGAL/CORE_Expr.h> // used for To_interval-functor
|
||||
|
||||
|
|
@ -226,7 +225,6 @@ public:
|
|||
//since types are included by CORE_coercion_traits.h:
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/CORE_BigInt.h>
|
||||
#include <CGAL/CORE_BigRat.h>
|
||||
#include <CGAL/CORE_BigFloat.h>
|
||||
#include <CGAL/CORE_arithmetic_kernel.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
#include <CGAL/number_type_basic.h>
|
||||
#include <CGAL/CORE_coercion_traits.h>
|
||||
#include <CGAL/CORE/Expr.h>
|
||||
#include <utility>
|
||||
|
||||
|
||||
|
|
@ -177,7 +176,6 @@ template <> class Real_embeddable_traits< CORE::Expr >
|
|||
} //namespace CGAL
|
||||
|
||||
//since types are included by CORE_coercion_traits.h:
|
||||
#include <CGAL/CORE_Expr.h>
|
||||
#include <CGAL/CORE_BigInt.h>
|
||||
#include <CGAL/CORE_BigRat.h>
|
||||
#include <CGAL/CORE_BigFloat.h>
|
||||
|
|
|
|||
|
|
@ -248,6 +248,8 @@ inline __m128d IA_opacify128(__m128d x)
|
|||
# ifdef _MSC_VER
|
||||
// With VS, __m128d is a union, where volatile doesn't disappear automatically
|
||||
// However, this version generates wrong code with clang, check before enabling it for more compilers.
|
||||
// The usage here is safe as we write from a __m128d to a __m128d
|
||||
// and we know that this type has 16 bytes
|
||||
std::memcpy(&x, (void*)&e, 16);
|
||||
return x;
|
||||
# else
|
||||
|
|
|
|||
|
|
@ -209,7 +209,6 @@ namespace Eigen {
|
|||
|
||||
//since types are included by Gmp_coercion_traits.h:
|
||||
#include <CGAL/Gmpz.h>
|
||||
#include <CGAL/Gmpq.h>
|
||||
#include <CGAL/Gmpzf.h>
|
||||
#include <CGAL/GMP_arithmetic_kernel.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,6 @@ namespace Eigen {
|
|||
|
||||
|
||||
//since types are included by Gmp_coercion_traits.h:
|
||||
#include <CGAL/Gmpz.h>
|
||||
#include <CGAL/Gmpq.h>
|
||||
#include <CGAL/Gmpzf.h>
|
||||
#include <CGAL/GMP_arithmetic_kernel.h>
|
||||
|
|
|
|||
|
|
@ -171,7 +171,6 @@ public:
|
|||
//since types are included by Gmp_coercion_traits.h:
|
||||
#include <CGAL/Gmpz.h>
|
||||
#include <CGAL/Gmpq.h>
|
||||
#include <CGAL/Gmpzf.h>
|
||||
|
||||
#endif // CGAL_GMPZF_H
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Point_set_3;
|
|||
normal vectors, the normal map is added to the point set. For PLY
|
||||
input, all point properties found in the header are added.
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\param is input stream
|
||||
\param ps point set
|
||||
|
|
@ -167,7 +167,9 @@ bool read_point_set(const std::string& fname, CGAL::Point_set_3<Point, Vector>&
|
|||
|
||||
All properties are inserted in their instantiation order.
|
||||
|
||||
\attention When writing a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation
|
||||
of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink
|
||||
of the stream must be set to `BINARY`.
|
||||
|
||||
\param os the output stream
|
||||
\param ps the point set
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ void check_if_property_is_used(PointSet& point_set,
|
|||
|
||||
\brief reads the content of an intput stream in the \ref IOStreamLAS into a point set.
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\param is the input stream
|
||||
\param point_set the point set
|
||||
|
|
@ -194,7 +194,7 @@ namespace IO {
|
|||
|
||||
\brief writes the content of a point set into an output stream in the \ref IOStreamLAS.
|
||||
|
||||
\attention When writing a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`.
|
||||
|
||||
\tparam Point the point type of the `Point_set_3`
|
||||
\tparam Vector the vector type of the `Point_set_3`
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ public:
|
|||
header. Each line starting by "comment " in the header is
|
||||
appended to the `comments` string (without the "comment " word).
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\param is the input stream
|
||||
\param point_set the point set
|
||||
|
|
@ -443,7 +443,9 @@ namespace IO {
|
|||
the header of the PLY stream (each line will be precedeed by
|
||||
"comment ").
|
||||
|
||||
\attention When writing a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation
|
||||
of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink
|
||||
of the stream must be set to `BINARY`.
|
||||
|
||||
\tparam Point the point type of the `Point_set_3`
|
||||
\tparam Vector the vector type of the `Point_set_3`
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ void process_properties (const LASpoint& reader, OutputValueType& new_element,
|
|||
- `LAS_property::B` with type `unsigned short`
|
||||
- `LAS_property::I` with type `unsigned short`
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`.
|
||||
It must be a model of `DefaultConstructible` and defaults to `value_type_traits<PointOutputIterator>::%type`.
|
||||
|
|
@ -430,7 +430,7 @@ bool read_LAS_with_properties(std::istream& is,
|
|||
|
||||
Potential additional properties are ignored.
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`.
|
||||
It must be a model of `DefaultConstructible` and defaults to `value_type_traits<PointOutputIterator>::%type`.
|
||||
|
|
|
|||
|
|
@ -190,12 +190,15 @@ bool read_OFF(std::istream& is,
|
|||
put(normal_map, pwn, normal); // normal_map[&pwn] = normal
|
||||
*output++ = pwn;
|
||||
pointsRead++;
|
||||
|
||||
}
|
||||
// ...or skip comment line
|
||||
}
|
||||
// Skip remaining lines
|
||||
}
|
||||
|
||||
if(is.eof()) {
|
||||
is.clear(is.rdstate() & ~std::ios_base::failbit); // set by getline
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ make_ply_normal_reader(VectorMap normal_map);
|
|||
second element of the tuple should be a functor that constructs
|
||||
the value type of `PropertyMap` from N objects of types `T`.
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`.
|
||||
It must be a model of `DefaultConstructible` and defaults to `value_type_traits<PointOutputIterator>::%type`.
|
||||
|
|
@ -207,7 +207,7 @@ bool read_PLY_with_properties(std::istream& is,
|
|||
|
||||
Potential additional point properties and faces are ignored.
|
||||
|
||||
\attention When reading a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ifstream`.
|
||||
\attention To read a binary file, the flag `std::ios::binary` must be set during the creation of the `ifstream`.
|
||||
|
||||
\tparam OutputIteratorValueType type of objects that can be put in `PointOutputIterator`.
|
||||
It must be a model of `DefaultConstructible` and defaults to `value_type_traits<PointOutputIterator>::%type`.
|
||||
|
|
|
|||
|
|
@ -179,6 +179,9 @@ bool read_XYZ(std::istream& is,
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if(is.eof()) {
|
||||
is.clear(is.rdstate() & ~std::ios_base::failbit); // set by getline
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,10 +176,10 @@ namespace LAS {
|
|||
See documentation of `read_LAS_with_properties()` for the
|
||||
list of available `LAS_property::Tag` classes.
|
||||
|
||||
\attention When writing a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`.
|
||||
|
||||
\tparam PointRange is a model of `ConstRange`. The value type of
|
||||
its iterator is the key type of the named parameter `point_map`.
|
||||
its iterator is the key type of the named parameter `point_map`.
|
||||
\tparam PointMap is a model of `ReadablePropertyMap` with a value_type = `CGAL::Point_3`.
|
||||
\tparam PropertyHandler handlers to recover properties.
|
||||
|
||||
|
|
@ -254,10 +254,10 @@ bool write_LAS_with_properties(std::ostream& os, ///< output stream.
|
|||
|
||||
\brief writes the range of `points` (positions only), using the \ref IOStreamLAS.
|
||||
|
||||
\attention When writing a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation of the `ofstream`.
|
||||
|
||||
\tparam PointRange is a model of `ConstRange`. The value type of
|
||||
its iterator is the key type of the named parameter `point_map`.
|
||||
its iterator is the key type of the named parameter `point_map`.
|
||||
\tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
|
||||
\param os output stream
|
||||
|
|
|
|||
|
|
@ -96,11 +96,13 @@ namespace IO {
|
|||
be provided for `PropertyMap::value_type` that handles both ASCII
|
||||
and binary output (see `CGAL::IO::get_mode()`).
|
||||
|
||||
\attention When writing to a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation
|
||||
of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink
|
||||
of the stream must be set to `BINARY`.
|
||||
|
||||
\tparam PointRange is a model of `ConstRange`. The value type of
|
||||
its iterator is the key type of the `PropertyMap` objects provided
|
||||
within the `PropertyHandler` parameter.
|
||||
its iterator is the key type of the `PropertyMap` objects provided
|
||||
within the `PropertyHandler` parameter.
|
||||
\tparam PropertyHandler handlers to recover properties.
|
||||
|
||||
\returns `true` if writing was successful, `false` otherwise.
|
||||
|
|
@ -145,10 +147,12 @@ template <typename PointRange,
|
|||
|
||||
\brief writes the range of `points` (positions + normals, if available) using \ref IOStreamPLY.
|
||||
|
||||
\attention When writing a binary file, the flag `std::ios::binary` flag must be set during the creation of the `ofstream`.
|
||||
\attention To write to a binary file, the flag `std::ios::binary` must be set during the creation
|
||||
of the `ofstream`, and the \link PkgStreamSupportEnumRef `IO::Mode` \endlink
|
||||
of the stream must be set to `BINARY`.
|
||||
|
||||
\tparam PointRange is a model of `ConstRange`. The value type of
|
||||
its iterator is the key type of the named parameter `point_map`.
|
||||
its iterator is the key type of the named parameter `point_map`.
|
||||
\tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
|
||||
\param os output stream
|
||||
|
|
@ -216,11 +220,11 @@ bool write_PLY(std::ostream& os,
|
|||
|
||||
set_stream_precision_from_NP(os, np);
|
||||
|
||||
if (has_normals)
|
||||
if(has_normals)
|
||||
return write_PLY_with_properties(os, points,
|
||||
make_ply_point_writer(point_map),
|
||||
make_ply_normal_writer(normal_map));
|
||||
// else
|
||||
|
||||
return write_PLY_with_properties(os, points, make_ply_point_writer(point_map));
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +245,7 @@ bool write_PLY(std::ostream& os, const PointRange& points,
|
|||
\brief writes the range of `points` (positions + normals, if available) using \ref IOStreamPLY.
|
||||
|
||||
\tparam PointRange is a model of `ConstRange`. The value type of
|
||||
its iterator is the key type of the named parameter `point_map`.
|
||||
its iterator is the key type of the named parameter `point_map`.
|
||||
\tparam NamedParameters a sequence of \ref bgl_namedparameters "Named Parameters"
|
||||
|
||||
\param filename the path to the output file
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ jet_estimate_normals(
|
|||
using parameters::choose_parameter;
|
||||
using parameters::get_parameter;
|
||||
|
||||
CGAL_TRACE("Calls jet_estimate_normals()\n");
|
||||
CGAL_TRACE_STREAM << "Calls jet_estimate_normals()\n";
|
||||
|
||||
// basic geometric types
|
||||
typedef typename PointRange::iterator iterator;
|
||||
|
|
@ -221,13 +221,15 @@ jet_estimate_normals(
|
|||
// precondition: at least 2 nearest neighbors
|
||||
CGAL_point_set_processing_precondition(k >= 2 || neighbor_radius > FT(0));
|
||||
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Creates KD-tree\n");
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Creates KD-tree\n";
|
||||
|
||||
Neighbor_query neighbor_query (points, point_map);
|
||||
|
||||
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Computes normals\n");
|
||||
memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Computes normals\n";
|
||||
|
||||
std::size_t nb_points = points.size();
|
||||
|
||||
|
|
@ -251,8 +253,9 @@ jet_estimate_normals(
|
|||
|
||||
callback_wrapper.join();
|
||||
|
||||
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE("End of jet_estimate_normals()\n");
|
||||
memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << "End of jet_estimate_normals()\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ mst_find_source(
|
|||
NormalMap normal_map, ///< property map: value_type of ForwardIterator -> Vector_3
|
||||
const Kernel& /*kernel*/) ///< geometric traits.
|
||||
{
|
||||
CGAL_TRACE(" mst_find_source()\n");
|
||||
CGAL_TRACE_STREAM << " mst_find_source()\n";
|
||||
|
||||
// Input points types
|
||||
typedef typename boost::property_traits<NormalMap>::value_type Vector;
|
||||
|
|
@ -270,8 +270,8 @@ mst_find_source(
|
|||
Vector_ref normal = get(normal_map,*top_point);
|
||||
const Vector Z(0, 0, 1);
|
||||
if (Z * normal < 0) {
|
||||
CGAL_TRACE(" Flip top point normal\n");
|
||||
put(normal_map,*top_point, -normal);
|
||||
CGAL_TRACE_STREAM << " Flip top point normal\n";
|
||||
put(normal_map,*top_point, -normal);
|
||||
}
|
||||
|
||||
return top_point;
|
||||
|
|
@ -329,13 +329,15 @@ create_riemannian_graph(
|
|||
// Number of input points
|
||||
const std::size_t num_input_points = points.size();
|
||||
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Creates KD-tree\n");
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Creates KD-tree\n";
|
||||
|
||||
Neighbor_query neighbor_query (points, point_map);
|
||||
|
||||
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Creates Riemannian Graph\n");
|
||||
memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Creates Riemannian Graph\n";
|
||||
|
||||
// Iterates over input points and creates Riemannian Graph:
|
||||
// - vertices are numbered like the input points index.
|
||||
|
|
@ -465,8 +467,9 @@ create_mst_graph(
|
|||
// Number of input points
|
||||
const std::size_t num_input_points = num_vertices(riemannian_graph) - 1;
|
||||
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Calls boost::prim_minimum_spanning_tree()\n");
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Calls boost::prim_minimum_spanning_tree()\n";
|
||||
|
||||
// Computes Minimum Spanning Tree.
|
||||
std::size_t source_point_index = num_input_points;
|
||||
|
|
@ -478,8 +481,9 @@ create_mst_graph(
|
|||
weight_map( riemannian_graph_weight_map )
|
||||
.root_vertex( vertex(source_point_index, riemannian_graph) ));
|
||||
|
||||
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Creates MST Graph\n");
|
||||
memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Creates MST Graph\n";
|
||||
|
||||
// Converts predecessor map to a MST graph:
|
||||
// - vertices are numbered like the input points index.
|
||||
|
|
@ -605,7 +609,7 @@ mst_orient_normals(
|
|||
using parameters::choose_parameter;
|
||||
using parameters::get_parameter;
|
||||
|
||||
CGAL_TRACE("Calls mst_orient_normals()\n");
|
||||
CGAL_TRACE_STREAM << "Calls mst_orient_normals()\n";
|
||||
|
||||
typedef typename CGAL::GetPointMap<PointRange, NamedParameters>::type PointMap;
|
||||
typedef typename Point_set_processing_3::GetNormalMap<PointRange, NamedParameters>::type NormalMap;
|
||||
|
|
@ -643,8 +647,9 @@ mst_orient_normals(
|
|||
// Precondition: at least 2 nearest neighbors
|
||||
CGAL_point_set_processing_precondition(k >= 2);
|
||||
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Create Index_property_map\n");
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Create Index_property_map\n";
|
||||
|
||||
// Create a property map Iterator -> index.
|
||||
// - if typename PointRange::iterator is a random access iterator (typically vector and deque),
|
||||
|
|
@ -686,8 +691,9 @@ mst_orient_normals(
|
|||
kernel,
|
||||
riemannian_graph);
|
||||
|
||||
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Calls boost::breadth_first_search()\n");
|
||||
memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Calls boost::breadth_first_search()\n";
|
||||
|
||||
const std::size_t num_input_points = distance(points.begin(), points.end());
|
||||
std::size_t source_point_index = num_input_points;
|
||||
|
|
@ -717,10 +723,11 @@ mst_orient_normals(
|
|||
std::copy(unoriented_points.begin(), unoriented_points.end(), first_unoriented_point);
|
||||
|
||||
// At this stage, we have typically 0 unoriented normals if k is large enough
|
||||
CGAL_TRACE(" => %u normals are unoriented\n", unoriented_points.size());
|
||||
CGAL_TRACE_STREAM << " => " << unoriented_points.size() << " normals are unoriented\n";
|
||||
|
||||
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE("End of mst_orient_normals()\n");
|
||||
memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << "End of mst_orient_normals()\n";
|
||||
|
||||
return first_unoriented_point;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ pca_estimate_normals(
|
|||
using parameters::choose_parameter;
|
||||
using parameters::get_parameter;
|
||||
|
||||
CGAL_TRACE("Calls pca_estimate_normals()\n");
|
||||
CGAL_TRACE_STREAM << "Calls pca_estimate_normals()\n";
|
||||
|
||||
// basic geometric types
|
||||
typedef typename CGAL::GetPointMap<PointRange, NamedParameters>::type PointMap;
|
||||
|
|
@ -192,13 +192,15 @@ pca_estimate_normals(
|
|||
// precondition: at least 2 nearest neighbors
|
||||
CGAL_point_set_processing_precondition(k >= 2);
|
||||
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Creates KD-tree\n");
|
||||
std::size_t memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Creates KD-tree\n";
|
||||
|
||||
Neighbor_query neighbor_query (points, point_map);
|
||||
|
||||
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE(" Computes normals\n");
|
||||
memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << " Computes normals\n";
|
||||
|
||||
std::size_t nb_points = points.size();
|
||||
|
||||
|
|
@ -223,8 +225,9 @@ pca_estimate_normals(
|
|||
|
||||
callback_wrapper.join();
|
||||
|
||||
memory = CGAL::Memory_sizer().virtual_size(); CGAL_TRACE(" %ld Mb allocated\n", memory>>20);
|
||||
CGAL_TRACE("End of pca_estimate_normals()\n");
|
||||
memory = CGAL::Memory_sizer().virtual_size();
|
||||
CGAL_TRACE_STREAM << (memory >> 20) << " Mb allocated\n";
|
||||
CGAL_TRACE_STREAM << "End of pca_estimate_normals()\n";
|
||||
}
|
||||
|
||||
/// \cond SKIP_IN_MANUAL
|
||||
|
|
|
|||
|
|
@ -77,116 +77,150 @@ points[1] = std::make_pair(Point_3(0,1,0), Color{0,255,0,255});
|
|||
points[2] = std::make_pair(Point_3(0,0,1), Color{0,0,255,255});
|
||||
|
||||
|
||||
std::ofstream os;
|
||||
std::ifstream is;
|
||||
bool ok;
|
||||
std::vector<Point_3> ps;
|
||||
ps.push_back(Point_3(1,0,0));
|
||||
ps.push_back(Point_3(0,1,0));
|
||||
ps.push_back(Point_3(0,0,1));
|
||||
|
||||
|
||||
//LAS
|
||||
#ifdef CGAL_LINKED_WITH_LASLIB
|
||||
os.open("tmp.las", std::ios::binary);
|
||||
ok = CGAL::write_las_points_with_properties(os, points,
|
||||
CGAL::make_las_point_writer(CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||
std::make_pair(GetRedMap(),CGAL::LAS_property::R()),
|
||||
std::make_pair(GetGreenMap(), CGAL::LAS_property::G()),
|
||||
std::make_pair(GetBlueMap(), CGAL::LAS_property::B()),
|
||||
std::make_pair(GetAlphaMap(), CGAL::LAS_property::I())
|
||||
);
|
||||
os.close();
|
||||
assert(ok);
|
||||
points.clear();
|
||||
is.open("tmp.las", std::ios::binary);
|
||||
ok = CGAL::read_las_points_with_properties(is, std::back_inserter (points),
|
||||
CGAL::make_las_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
|
||||
CGAL::Construct_array(),
|
||||
CGAL::LAS_property::R(),
|
||||
CGAL::LAS_property::G(),
|
||||
CGAL::LAS_property::B(),
|
||||
CGAL::LAS_property::I()));
|
||||
is.close();
|
||||
assert(ok);
|
||||
assert(points.size() == 3);
|
||||
assert(points[1].second[1] == 255);
|
||||
|
||||
os.open("tmp.las", std::ios_base::binary);
|
||||
CGAL::write_las_points(os, ps, CGAL::parameters::all_default());
|
||||
os.close();
|
||||
assert(ok);
|
||||
ps.clear();
|
||||
is.open("tmp.las", std::ios::binary);
|
||||
ok = CGAL::read_las_points(is, std::back_inserter (ps),CGAL::parameters::all_default());
|
||||
is.close();
|
||||
assert(ok);
|
||||
assert(ps.size() == 3);
|
||||
{
|
||||
std::ofstream os("tmp1.las", std::ios::binary);
|
||||
ok = CGAL::write_las_points_with_properties(os, points,
|
||||
CGAL::make_las_point_writer(CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||
std::make_pair(GetRedMap(),CGAL::LAS_property::R()),
|
||||
std::make_pair(GetGreenMap(), CGAL::LAS_property::G()),
|
||||
std::make_pair(GetBlueMap(), CGAL::LAS_property::B()),
|
||||
std::make_pair(GetAlphaMap(), CGAL::LAS_property::I())
|
||||
);
|
||||
assert(ok);
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
points.clear();
|
||||
std::ifstream is("tmp1.las", std::ios::binary);
|
||||
ok = CGAL::read_las_points_with_properties(is, std::back_inserter (points),
|
||||
CGAL::make_las_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
|
||||
CGAL::Construct_array(),
|
||||
CGAL::LAS_property::R(),
|
||||
CGAL::LAS_property::G(),
|
||||
CGAL::LAS_property::B(),
|
||||
CGAL::LAS_property::I()));
|
||||
assert(ok);
|
||||
assert(points.size() == 3);
|
||||
assert(points[1].second[1] == 255);
|
||||
}
|
||||
|
||||
{
|
||||
std::ofstream os("tmp2.las", std::ios_base::binary);
|
||||
CGAL::write_las_points(os, ps, CGAL::parameters::all_default());
|
||||
assert(ok);
|
||||
}
|
||||
|
||||
{
|
||||
ps.clear();
|
||||
std::ifstream is("tmp2.las", std::ios::binary);
|
||||
ok = CGAL::read_las_points(is, std::back_inserter (ps),CGAL::parameters::all_default());
|
||||
assert(ok);
|
||||
assert(ps.size() == 3);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//PLY
|
||||
os.open("tmp.ply");
|
||||
ok = CGAL::write_ply_points_with_properties(os, points,
|
||||
CGAL::make_ply_point_writer (CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||
std::make_pair(GetRedMap(),CGAL::PLY_property<unsigned short>("red")),
|
||||
std::make_pair(GetGreenMap(), CGAL::PLY_property<unsigned short>("green")),
|
||||
std::make_pair(GetBlueMap(), CGAL::PLY_property<unsigned short>("blue")),
|
||||
std::make_pair(GetAlphaMap(), CGAL::PLY_property<unsigned short>("alpha"))
|
||||
);
|
||||
os.close();
|
||||
assert(ok);
|
||||
{
|
||||
std::ofstream os("tmp1.ply");
|
||||
assert(os.good());
|
||||
ok = CGAL::write_ply_points_with_properties(os, points,
|
||||
CGAL::make_ply_point_writer (CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||
std::make_pair(GetRedMap(),CGAL::PLY_property<unsigned short>("red")),
|
||||
std::make_pair(GetGreenMap(), CGAL::PLY_property<unsigned short>("green")),
|
||||
std::make_pair(GetBlueMap(), CGAL::PLY_property<unsigned short>("blue")),
|
||||
std::make_pair(GetAlphaMap(), CGAL::PLY_property<unsigned short>("alpha"))
|
||||
);
|
||||
assert(! os.fail());
|
||||
assert(ok);
|
||||
}
|
||||
|
||||
is.open("tmp.ply");
|
||||
points.clear();
|
||||
ok = CGAL::read_ply_points_with_properties(is, std::back_inserter (points),
|
||||
CGAL::make_ply_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
|
||||
CGAL::Construct_array(),
|
||||
CGAL::PLY_property<unsigned short>("red"),
|
||||
CGAL::PLY_property<unsigned short>("green"),
|
||||
CGAL::PLY_property<unsigned short>("blue"),
|
||||
CGAL::PLY_property<unsigned short>("alpha")));
|
||||
is.close();
|
||||
assert(ok);
|
||||
assert(points.size() == 3);
|
||||
assert(points[1].second[1] == 255);
|
||||
{
|
||||
std::ifstream is("tmp1.ply");
|
||||
assert(is.good());
|
||||
points.clear();
|
||||
ok = CGAL::read_ply_points_with_properties(is, std::back_inserter (points),
|
||||
CGAL::make_ply_point_reader(CGAL::First_of_pair_property_map<PointWithColor>()),
|
||||
std::make_tuple(CGAL::Second_of_pair_property_map<PointWithColor>(),
|
||||
CGAL::Construct_array(),
|
||||
CGAL::PLY_property<unsigned short>("red"),
|
||||
CGAL::PLY_property<unsigned short>("green"),
|
||||
CGAL::PLY_property<unsigned short>("blue"),
|
||||
CGAL::PLY_property<unsigned short>("alpha")));
|
||||
assert(! is.fail());
|
||||
assert(ok);
|
||||
assert(points.size() == 3);
|
||||
assert(points[1].second[1] == 255);
|
||||
}
|
||||
|
||||
os.open("tmp.ply");
|
||||
ok = CGAL::write_ply_points(os, ps, CGAL::parameters::all_default());
|
||||
os.close();
|
||||
assert(ok);
|
||||
{
|
||||
std::ofstream os("tmp2.ply");
|
||||
assert(os.good());
|
||||
ok = CGAL::write_ply_points(os, ps, CGAL::parameters::all_default());
|
||||
assert(! os.fail());
|
||||
assert(ok);
|
||||
}
|
||||
|
||||
is.open("tmp.ply");
|
||||
ps.clear();
|
||||
ok = CGAL::read_ply_points(is, std::back_inserter (ps),
|
||||
CGAL::parameters::all_default());
|
||||
is.close();
|
||||
assert(ok);
|
||||
assert(ps.size() == 3);
|
||||
{
|
||||
std::ifstream is("tmp2.ply");
|
||||
assert(is.good());
|
||||
ps.clear();
|
||||
ok = CGAL::read_ply_points(is, std::back_inserter (ps),
|
||||
CGAL::parameters::all_default());
|
||||
assert(! is.fail());
|
||||
assert(ok);
|
||||
assert(ps.size() == 3);
|
||||
}
|
||||
|
||||
//OFF
|
||||
os.open("tmp.off");
|
||||
ok = CGAL::write_off_points(os, ps, CGAL::parameters::all_default());
|
||||
os.close();
|
||||
assert(ok);
|
||||
{
|
||||
std::ofstream os("tmp.off");
|
||||
assert(os.good());
|
||||
ok = CGAL::write_off_points(os, ps, CGAL::parameters::all_default());
|
||||
assert(! os.fail());
|
||||
assert(ok);
|
||||
}
|
||||
|
||||
is.open("tmp.off");
|
||||
ps.clear();
|
||||
ok = CGAL::read_off_points(is, std::back_inserter (ps),
|
||||
CGAL::parameters::all_default());
|
||||
is.close();
|
||||
assert(ok);
|
||||
assert(ps.size() == 3);
|
||||
{
|
||||
std::ifstream is("tmp.off");
|
||||
assert(is.good());
|
||||
ps.clear();
|
||||
ok = CGAL::read_off_points(is, std::back_inserter (ps),
|
||||
CGAL::parameters::all_default());
|
||||
assert(! is.fail());
|
||||
assert(ok);
|
||||
assert(ps.size() == 3);
|
||||
}
|
||||
|
||||
//XYZ
|
||||
os.open("tmp.xyz");
|
||||
ok = CGAL::write_xyz_points(os, ps, CGAL::parameters::all_default());
|
||||
os.close();
|
||||
assert(ok);
|
||||
{
|
||||
std::ofstream os("tmp.xyz");
|
||||
assert(os.good());
|
||||
ok = CGAL::write_xyz_points(os, ps, CGAL::parameters::all_default());
|
||||
assert(! os.fail());
|
||||
assert(ok);
|
||||
}
|
||||
|
||||
is.open("tmp.xyz");
|
||||
ps.clear();
|
||||
ok = CGAL::read_xyz_points(is, std::back_inserter (ps),
|
||||
CGAL::parameters::all_default());
|
||||
is.close();
|
||||
assert(ok);
|
||||
assert(ps.size() == 3);
|
||||
{
|
||||
std::ifstream is("tmp.xyz");
|
||||
assert(is.good());
|
||||
ps.clear();
|
||||
ok = CGAL::read_xyz_points(is, std::back_inserter (ps),
|
||||
CGAL::parameters::all_default());
|
||||
assert(! is.fail());
|
||||
assert(ok);
|
||||
assert(ps.size() == 3);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ private:
|
|||
SparseLinearAlgebraTraits_d solver, ///< sparse linear solver
|
||||
double lambda)
|
||||
{
|
||||
CGAL_TRACE("Calls solve_poisson()\n");
|
||||
CGAL_TRACE_STREAM << "Calls solve_poisson()\n";
|
||||
|
||||
double time_init = clock();
|
||||
|
||||
|
|
@ -786,7 +786,7 @@ private:
|
|||
m_tr->index_unconstrained_vertices();
|
||||
unsigned int nb_variables = static_cast<unsigned int>(m_tr->number_of_vertices()-1);
|
||||
|
||||
CGAL_TRACE(" Number of variables: %ld\n", (long)(nb_variables));
|
||||
CGAL_TRACE_STREAM << " Number of variables: " << nb_variables << std::endl;
|
||||
|
||||
// Assemble linear system A*X=B
|
||||
typename SparseLinearAlgebraTraits_d::Matrix A(nb_variables); // matrix is symmetric definite positive
|
||||
|
|
@ -815,9 +815,9 @@ private:
|
|||
clear_duals();
|
||||
clear_normals();
|
||||
duration_assembly = (clock() - time_init)/CLOCKS_PER_SEC;
|
||||
CGAL_TRACE(" Creates matrix: done (%.2lf s)\n", duration_assembly);
|
||||
CGAL_TRACE_STREAM << " Creates matrix: done (" << duration_assembly << "sec.)\n";
|
||||
|
||||
CGAL_TRACE(" Solve sparse linear system...\n");
|
||||
CGAL_TRACE_STREAM << " Solve sparse linear system...\n";
|
||||
|
||||
// Solve "A*X = B". On success, solution is (1/D) * X.
|
||||
time_init = clock();
|
||||
|
|
@ -827,7 +827,7 @@ private:
|
|||
CGAL_surface_reconstruction_points_assertion(D == 1.0);
|
||||
duration_solve = (clock() - time_init)/CLOCKS_PER_SEC;
|
||||
|
||||
CGAL_TRACE(" Solve sparse linear system: done (%.2lf s)\n", duration_solve);
|
||||
CGAL_TRACE_STREAM << " Solve sparse linear system: done (" << duration_solve << "sec.)\n";
|
||||
|
||||
// copy function's values to vertices
|
||||
unsigned int index = 0;
|
||||
|
|
@ -835,7 +835,7 @@ private:
|
|||
if(!m_tr->is_constrained(v))
|
||||
v->f() = X[index++];
|
||||
|
||||
CGAL_TRACE("End of solve_poisson()\n");
|
||||
CGAL_TRACE_STREAM << "End of solve_poisson()\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,917 +0,0 @@
|
|||
// Copyright (c) 2015 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) : Yin Xu, Andreas Fabri and Ilker O. Yaz
|
||||
|
||||
#ifndef CGAL_PMP_WEIGHTS_H
|
||||
#define CGAL_PMP_WEIGHTS_H
|
||||
|
||||
#include <CGAL/license/Polygon_mesh_processing/core.h>
|
||||
|
||||
/// @cond CGAL_DOCUMENT_INTERNAL
|
||||
|
||||
#include <CGAL/boost/graph/helpers.h>
|
||||
#include <CGAL/Kernel/global_functions_3.h>
|
||||
#include <CGAL/property_map.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace internal {
|
||||
|
||||
// Returns the cotangent value of half angle v0 v1 v2
|
||||
// using formula in -[Meyer02] Discrete Differential-Geometry Operators for- page 19
|
||||
// The potential problem with previous one (Cotangent_value) is that it does not produce symmetric results
|
||||
// (i.e. for v0, v1, v2 and v2, v1, v0 returned cot weights can be slightly different)
|
||||
// This one provides stable results.
|
||||
template<class PolygonMesh>
|
||||
struct Cotangent_value_Meyer_impl
|
||||
{
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
template <class VertexPointMap>
|
||||
double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2, const VertexPointMap& ppmap)
|
||||
{
|
||||
typedef typename Kernel_traits<
|
||||
typename boost::property_traits<VertexPointMap>::value_type >::Kernel::Vector_3 Vector;
|
||||
|
||||
Vector a = get(ppmap, v0) - get(ppmap, v1);
|
||||
Vector b = get(ppmap, v2) - get(ppmap, v1);
|
||||
|
||||
double dot_ab = to_double(a*b);
|
||||
// rewritten for safer fp arithmetic
|
||||
//double dot_aa = a.squared_length();
|
||||
//double dot_bb = b.squared_length();
|
||||
//double divider = CGAL::sqrt( dot_aa * dot_bb - dot_ab * dot_ab );
|
||||
|
||||
Vector cross_ab = CGAL::cross_product(a, b);
|
||||
double divider = to_double(CGAL::approximate_sqrt(cross_ab*cross_ab));
|
||||
|
||||
if(divider == 0 /*|| divider != divider*/)
|
||||
{
|
||||
CGAL::collinear(get(ppmap, v0), get(ppmap, v1), get(ppmap, v2)) ?
|
||||
CGAL_warning_msg(false, "Infinite Cotangent value with degenerate triangle!") :
|
||||
CGAL_warning_msg(false, "Infinite Cotangent value due to floating point arithmetic!");
|
||||
|
||||
|
||||
return dot_ab > 0 ? (std::numeric_limits<double>::max)() :
|
||||
-(std::numeric_limits<double>::max)();
|
||||
}
|
||||
|
||||
return dot_ab / divider;
|
||||
}
|
||||
};
|
||||
|
||||
// Same as above but with a different API
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
|
||||
class Cotangent_value_Meyer
|
||||
{
|
||||
protected:
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
typedef VertexPointMap Point_property_map;
|
||||
typedef typename boost::property_traits<Point_property_map>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel::Vector_3 Vector;
|
||||
|
||||
PolygonMesh& pmesh_;
|
||||
Point_property_map ppmap_;
|
||||
|
||||
public:
|
||||
|
||||
Cotangent_value_Meyer(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: pmesh_(pmesh_)
|
||||
, ppmap_(vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return pmesh_;
|
||||
}
|
||||
|
||||
Point_property_map& ppmap()
|
||||
{
|
||||
return ppmap_;
|
||||
}
|
||||
|
||||
double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
|
||||
{
|
||||
return Cotangent_value_Meyer_impl<PolygonMesh>()(v0, v1, v2, ppmap());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// imported from skeletonization
|
||||
template<class PolygonMesh,
|
||||
class VertexPointMap =
|
||||
typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
|
||||
class Cotangent_value_Meyer_secure
|
||||
{
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
typedef VertexPointMap Point_property_map;
|
||||
typedef typename boost::property_traits<Point_property_map>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel::Vector_3 Vector;
|
||||
|
||||
PolygonMesh& pmesh_;
|
||||
Point_property_map ppmap_;
|
||||
|
||||
public:
|
||||
|
||||
Cotangent_value_Meyer_secure(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: pmesh_(pmesh_)
|
||||
, ppmap_(vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return pmesh_;
|
||||
}
|
||||
|
||||
Point_property_map& ppmap()
|
||||
{
|
||||
return ppmap_;
|
||||
}
|
||||
|
||||
double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
|
||||
{
|
||||
Vector a = get(ppmap(), v0) - get(ppmap(), v1);
|
||||
Vector b = get(ppmap(), v2) - get(ppmap(), v1);
|
||||
|
||||
double dot_ab = CGAL::to_double(a * b);
|
||||
double dot_aa = CGAL::to_double(a.squared_length());
|
||||
double dot_bb = CGAL::to_double(b.squared_length());
|
||||
double lb = -0.999, ub = 0.999;
|
||||
double cosine = dot_ab / CGAL::sqrt(dot_aa) / CGAL::sqrt(dot_bb);
|
||||
cosine = (cosine < lb) ? lb : cosine;
|
||||
cosine = (cosine > ub) ? ub : cosine;
|
||||
double sine = std::sqrt(1.0 - cosine * cosine);
|
||||
return cosine / sine;
|
||||
}
|
||||
};
|
||||
|
||||
// Returns the cotangent value of half angle v0 v1 v2 by clamping between [1, 89] degrees
|
||||
// as suggested by -[Friedel] Unconstrained Spherical Parameterization-
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
|
||||
, class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
|
||||
class Cotangent_value_clamped : CotangentValue
|
||||
{
|
||||
Cotangent_value_clamped()
|
||||
{}
|
||||
public:
|
||||
|
||||
Cotangent_value_clamped(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: CotangentValue(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return CotangentValue::pmesh();
|
||||
}
|
||||
|
||||
VertexPointMap& ppmap()
|
||||
{
|
||||
return CotangentValue::ppmap();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
|
||||
{
|
||||
const double cot_1 = 57.289962;
|
||||
const double cot_89 = 0.017455;
|
||||
double value = CotangentValue::operator()(v0, v1, v2);
|
||||
return (std::max)(cot_89, (std::min)(value, cot_1));
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
|
||||
, class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
|
||||
class Cotangent_value_clamped_2 : CotangentValue
|
||||
{
|
||||
Cotangent_value_clamped_2()
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
Cotangent_value_clamped_2(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: CotangentValue(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return CotangentValue::pmesh();
|
||||
}
|
||||
|
||||
VertexPointMap& ppmap()
|
||||
{
|
||||
return CotangentValue::ppmap();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
|
||||
{
|
||||
const double cot_5 = 5.671282;
|
||||
const double cot_175 = -cot_5;
|
||||
double value = CotangentValue::operator()(v0, v1, v2);
|
||||
return (std::max)(cot_175, (std::min)(value, cot_5));
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
|
||||
, class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
|
||||
class Cotangent_value_minimum_zero : CotangentValue
|
||||
{
|
||||
Cotangent_value_minimum_zero()
|
||||
{}
|
||||
public:
|
||||
Cotangent_value_minimum_zero(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: CotangentValue(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return CotangentValue::pmesh();
|
||||
}
|
||||
|
||||
VertexPointMap& ppmap()
|
||||
{
|
||||
return CotangentValue::ppmap();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
|
||||
{
|
||||
double value = CotangentValue::operator()(v0, v1, v2);
|
||||
return (std::max)(0.0, value);
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolygonMesh,
|
||||
class CotangentValue = Cotangent_value_Meyer_impl<PolygonMesh> >
|
||||
struct Cotangent_value_minimum_zero_impl : CotangentValue
|
||||
{
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
template <class VertexPointMap>
|
||||
double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2, const VertexPointMap ppmap)
|
||||
{
|
||||
double value = CotangentValue::operator()(v0, v1, v2, ppmap);
|
||||
return (std::max)(0.0, value);
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
|
||||
, class CotangentValue
|
||||
= Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
|
||||
class Voronoi_area : CotangentValue
|
||||
{
|
||||
public:
|
||||
Voronoi_area(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: CotangentValue(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return CotangentValue::pmesh();
|
||||
}
|
||||
|
||||
VertexPointMap& ppmap()
|
||||
{
|
||||
return CotangentValue::ppmap();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::in_edge_iterator in_edge_iterator;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
typedef VertexPointMap Point_property_map;
|
||||
typedef typename boost::property_traits<Point_property_map>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel::Vector_3 Vector;
|
||||
|
||||
double operator()(vertex_descriptor v0) {
|
||||
|
||||
//return 1.0;
|
||||
double voronoi_area = 0.0;
|
||||
for(halfedge_descriptor he :
|
||||
halfedges_around_target( halfedge(v0,pmesh()), pmesh()) )
|
||||
{
|
||||
if( is_border(he,pmesh()) ) { continue; }
|
||||
|
||||
CGAL_expensive_assertion(CGAL::is_valid_polygon_mesh(pmesh()));
|
||||
CGAL_expensive_assertion(CGAL::is_triangle_mesh(pmesh()));
|
||||
CGAL_assertion( v0 == target(he, pmesh()) );
|
||||
vertex_descriptor v1 = source(he, pmesh());
|
||||
vertex_descriptor v_op = target(next(he, pmesh()), pmesh());
|
||||
|
||||
const Point& v0_p = get(ppmap(), v0);
|
||||
const Point& v1_p = get(ppmap(), v1);
|
||||
const Point& v_op_p = get(ppmap(), v_op);
|
||||
|
||||
// (?) check if there is a better way to predicate triangle is obtuse or not
|
||||
CGAL::Angle angle0 = CGAL::angle(v1_p, v0_p, v_op_p);
|
||||
CGAL::Angle angle1 = CGAL::angle(v_op_p, v1_p, v0_p);
|
||||
CGAL::Angle angle_op = CGAL::angle(v0_p, v_op_p, v1_p);
|
||||
|
||||
bool obtuse = (angle0 == CGAL::OBTUSE) || (angle1 == CGAL::OBTUSE) || (angle_op == CGAL::OBTUSE);
|
||||
|
||||
if(!obtuse) {
|
||||
double cot_v1 = CotangentValue::operator()(v_op, v1, v0);
|
||||
double cot_v_op = CotangentValue::operator()(v0, v_op, v1);
|
||||
|
||||
double term1 = cot_v1 * to_double((v_op_p - v0_p).squared_length());
|
||||
double term2 = cot_v_op * to_double((v1_p - v0_p).squared_length());
|
||||
voronoi_area += (1.0 / 8.0) * (term1 + term2);
|
||||
}
|
||||
else {
|
||||
double area_t = to_double(CGAL::approximate_sqrt(squared_area(v0_p, v1_p, v_op_p)));
|
||||
if(angle0 == CGAL::OBTUSE) {
|
||||
voronoi_area += area_t / 2.0;
|
||||
}
|
||||
else {
|
||||
voronoi_area += area_t / 4.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
CGAL_warning_msg(voronoi_area != 0, "Zero voronoi area!");
|
||||
return voronoi_area;
|
||||
}
|
||||
};
|
||||
// Returns the cotangent value of half angle v0 v1 v2 by dividing the triangle area
|
||||
// as suggested by -[Mullen08] Spectral Conformal Parameterization-
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
|
||||
, class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
|
||||
class Cotangent_value_area_weighted : CotangentValue
|
||||
{
|
||||
Cotangent_value_area_weighted()
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
Cotangent_value_area_weighted(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: CotangentValue(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return CotangentValue::pmesh();
|
||||
}
|
||||
|
||||
VertexPointMap& ppmap()
|
||||
{
|
||||
return CotangentValue::ppmap();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
double operator()(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
|
||||
{
|
||||
return CotangentValue::operator()(v0, v1, v2) /
|
||||
CGAL::sqrt(squared_area(get(this->ppmap(), v0),
|
||||
get(this->ppmap(), v1),
|
||||
get(this->ppmap(), v2)));
|
||||
}
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////// Edge Weight Calculators ///////////////////////////////////
|
||||
// Cotangent weight calculator
|
||||
// Cotangent_value: as suggested by -[Sorkine07] ARAP Surface Modeling-
|
||||
// Cotangent_value_area_weighted: as suggested by -[Mullen08] Spectral Conformal Parameterization-
|
||||
template< class PolygonMesh,
|
||||
class CotangentValue = Cotangent_value_minimum_zero_impl<PolygonMesh> >
|
||||
struct Cotangent_weight_impl : CotangentValue
|
||||
{
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
// Returns the cotangent weight of specified halfedge_descriptor
|
||||
// Edge orientation is trivial
|
||||
template<class VertexPointMap>
|
||||
double operator()(halfedge_descriptor he, PolygonMesh& pmesh, const VertexPointMap& ppmap)
|
||||
{
|
||||
vertex_descriptor v0 = target(he, pmesh);
|
||||
vertex_descriptor v1 = source(he, pmesh);
|
||||
// Only one triangle for border edges
|
||||
if (is_border_edge(he, pmesh))
|
||||
{
|
||||
|
||||
halfedge_descriptor he_cw = opposite( next(he, pmesh) , pmesh );
|
||||
vertex_descriptor v2 = source(he_cw, pmesh);
|
||||
if (is_border_edge(he_cw, pmesh) )
|
||||
{
|
||||
halfedge_descriptor he_ccw = prev( opposite(he, pmesh) , pmesh );
|
||||
v2 = source(he_ccw, pmesh);
|
||||
}
|
||||
return ( CotangentValue::operator()(v0, v2, v1, ppmap)/2.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
halfedge_descriptor he_cw = opposite( next(he, pmesh) , pmesh );
|
||||
vertex_descriptor v2 = source(he_cw, pmesh);
|
||||
halfedge_descriptor he_ccw = prev( opposite(he, pmesh) , pmesh );
|
||||
vertex_descriptor v3 = source(he_ccw, pmesh);
|
||||
|
||||
return ( CotangentValue::operator()(v0, v2, v1, ppmap)/2.0 +
|
||||
CotangentValue::operator()(v0, v3, v1, ppmap)/2.0 );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, vertex_point_t>::type
|
||||
, class CotangentValue
|
||||
= Cotangent_value_minimum_zero<PolygonMesh, VertexPointMap> >
|
||||
class Cotangent_weight : CotangentValue
|
||||
{
|
||||
Cotangent_weight()
|
||||
{}
|
||||
|
||||
public:
|
||||
Cotangent_weight(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: CotangentValue(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
Cotangent_weight(PolygonMesh& pmesh_)
|
||||
: CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_))
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return CotangentValue::pmesh();
|
||||
}
|
||||
|
||||
VertexPointMap& ppmap()
|
||||
{
|
||||
return CotangentValue::ppmap();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
|
||||
typedef typename boost::property_traits<Point_property_map>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel::Vector_3 Vector;
|
||||
|
||||
// Returns the cotangent weight of specified halfedge_descriptor
|
||||
// Edge orientation is trivial
|
||||
double operator()(halfedge_descriptor he)
|
||||
{
|
||||
vertex_descriptor v0 = target(he, pmesh());
|
||||
vertex_descriptor v1 = source(he, pmesh());
|
||||
// Only one triangle for border edges
|
||||
if (is_border_edge(he, pmesh()))
|
||||
{
|
||||
|
||||
halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v2 = source(he_cw, pmesh());
|
||||
if (is_border_edge(he_cw, pmesh()) )
|
||||
{
|
||||
halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
|
||||
v2 = source(he_ccw, pmesh());
|
||||
}
|
||||
return ( CotangentValue::operator()(v0, v2, v1)/2.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v2 = source(he_cw, pmesh());
|
||||
halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v3 = source(he_ccw, pmesh());
|
||||
|
||||
return ( CotangentValue::operator()(v0, v2, v1)/2.0 + CotangentValue::operator()(v0, v3, v1)/2.0 );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Single cotangent from -[Chao10] Simple Geometric Model for Elastic Deformation
|
||||
template<class PolygonMesh,
|
||||
class CotangentValue = Cotangent_value_Meyer_impl<PolygonMesh> >
|
||||
struct Single_cotangent_weight_impl : CotangentValue
|
||||
{
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
// Returns the cotangent of the opposite angle of the edge
|
||||
// 0 for border edges (which does not have an opposite angle)
|
||||
template <class VertexPointMap>
|
||||
double operator()(halfedge_descriptor he, PolygonMesh& pmesh, const VertexPointMap& ppmap)
|
||||
{
|
||||
if(is_border(he, pmesh)) { return 0.0;}
|
||||
|
||||
vertex_descriptor v0 = target(he, pmesh);
|
||||
vertex_descriptor v1 = source(he, pmesh);
|
||||
|
||||
vertex_descriptor v_op = target(next(he, pmesh), pmesh);
|
||||
return CotangentValue::operator()(v0, v_op, v1, ppmap);
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type
|
||||
, class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
|
||||
class Single_cotangent_weight : CotangentValue
|
||||
{
|
||||
Single_cotangent_weight()
|
||||
{}
|
||||
public:
|
||||
Single_cotangent_weight(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: CotangentValue(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return CotangentValue::pmesh();
|
||||
}
|
||||
|
||||
VertexPointMap& ppmap()
|
||||
{
|
||||
return CotangentValue::ppmap();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
|
||||
typedef typename boost::property_traits<Point_property_map>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel::Vector_3 Vector;
|
||||
|
||||
// Returns the cotangent of the opposite angle of the edge
|
||||
// 0 for border edges (which does not have an opposite angle)
|
||||
double operator()(halfedge_descriptor he)
|
||||
{
|
||||
if(is_border(he, pmesh())) { return 0.0;}
|
||||
|
||||
vertex_descriptor v0 = target(he, pmesh());
|
||||
vertex_descriptor v1 = source(he, pmesh());
|
||||
|
||||
vertex_descriptor v_op = target(next(he, pmesh()), pmesh());
|
||||
return CotangentValue::operator()(v0, v_op, v1);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, vertex_point_t>::type
|
||||
, class CotangentValue = Cotangent_value_Meyer<PolygonMesh, VertexPointMap>
|
||||
>
|
||||
class Cotangent_weight_with_triangle_area : CotangentValue
|
||||
{
|
||||
typedef PolygonMesh PM;
|
||||
typedef VertexPointMap VPMap;
|
||||
typedef typename boost::property_traits<VPMap>::value_type Point;
|
||||
|
||||
typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
Cotangent_weight_with_triangle_area()
|
||||
{}
|
||||
public:
|
||||
Cotangent_weight_with_triangle_area(PolygonMesh& pmesh_, VertexPointMap vpmap_)
|
||||
: CotangentValue(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return CotangentValue::pmesh();
|
||||
}
|
||||
|
||||
VertexPointMap& ppmap()
|
||||
{
|
||||
return CotangentValue::ppmap();
|
||||
}
|
||||
|
||||
double operator()(halfedge_descriptor he)
|
||||
{
|
||||
vertex_descriptor v0 = target(he, pmesh());
|
||||
vertex_descriptor v1 = source(he, pmesh());
|
||||
|
||||
// Only one triangle for border edges
|
||||
if (is_border_edge(he, pmesh()))
|
||||
{
|
||||
halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v2 = source(he_cw, pmesh());
|
||||
if (is_border_edge(he_cw, pmesh()) )
|
||||
{
|
||||
halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
|
||||
v2 = source(he_ccw, pmesh());
|
||||
}
|
||||
|
||||
const Point& v0_p = get(ppmap(), v0);
|
||||
const Point& v1_p = get(ppmap(), v1);
|
||||
const Point& v2_p = get(ppmap(), v2);
|
||||
double area_t = to_double(CGAL::sqrt(squared_area(v0_p, v1_p, v2_p)));
|
||||
|
||||
return ( CotangentValue::operator()(v0, v2, v1) / area_t );
|
||||
}
|
||||
else
|
||||
{
|
||||
halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v2 = source(he_cw, pmesh());
|
||||
halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v3 = source(he_ccw, pmesh());
|
||||
|
||||
const Point& v0_p = get(ppmap(), v0);
|
||||
const Point& v1_p = get(ppmap(), v1);
|
||||
const Point& v2_p = get(ppmap(), v2);
|
||||
const Point& v3_p = get(ppmap(), v3);
|
||||
double area_t1 = to_double(CGAL::sqrt(squared_area(v0_p, v1_p, v2_p)));
|
||||
double area_t2 = to_double(CGAL::sqrt(squared_area(v0_p, v1_p, v3_p)));
|
||||
|
||||
return ( CotangentValue::operator()(v0, v2, v1) / area_t1
|
||||
+ CotangentValue::operator()(v0, v3, v1) / area_t2);
|
||||
}
|
||||
|
||||
return 0.;
|
||||
}
|
||||
};
|
||||
|
||||
// Mean value calculator described in -[Floater04] Mean Value Coordinates-
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, CGAL::vertex_point_t>::type>
|
||||
class Mean_value_weight
|
||||
{
|
||||
//Mean_value_weight()
|
||||
//{}
|
||||
|
||||
PolygonMesh& pmesh_;
|
||||
VertexPointMap vpmap_;
|
||||
|
||||
public:
|
||||
Mean_value_weight(PolygonMesh& pmesh_, VertexPointMap vpmap)
|
||||
: pmesh_(pmesh_), vpmap_(vpmap)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return pmesh_;
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
typedef VertexPointMap Point_property_map;
|
||||
typedef typename boost::property_traits<Point_property_map>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel::Vector_3 Vector;
|
||||
|
||||
// Returns the mean-value coordinate of specified halfedge_descriptor
|
||||
// Returns different value for different edge orientation (which is a normal behaivour according to formula)
|
||||
double operator()(halfedge_descriptor he)
|
||||
{
|
||||
vertex_descriptor v0 = target(he, pmesh());
|
||||
vertex_descriptor v1 = source(he, pmesh());
|
||||
Vector vec = get(vpmap_, v0) - get(vpmap_, v1);
|
||||
double norm = CGAL::sqrt( vec.squared_length() );
|
||||
|
||||
// Only one triangle for border edges
|
||||
if ( is_border_edge(he, pmesh()) )
|
||||
{
|
||||
halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v2 = source(he_cw, pmesh());
|
||||
if ( is_border_edge(he_cw, pmesh()) )
|
||||
{
|
||||
halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
|
||||
v2 = source(he_ccw, pmesh());
|
||||
}
|
||||
|
||||
return ( half_tan_value_2(v1, v0, v2)/norm);
|
||||
}
|
||||
else
|
||||
{
|
||||
halfedge_descriptor he_cw = opposite( next(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v2 = source(he_cw, pmesh());
|
||||
halfedge_descriptor he_ccw = prev( opposite(he, pmesh()) , pmesh() );
|
||||
vertex_descriptor v3 = source(he_ccw, pmesh());
|
||||
|
||||
return ( half_tan_value_2(v1, v0, v2)/norm + half_tan_value_2(v1, v0, v3)/norm);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// Returns the tangent value of half angle v0_v1_v2/2
|
||||
double half_tan_value(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
|
||||
{
|
||||
Vector vec0 = get(vpmap_, v1) - get(vpmap_, v2);
|
||||
Vector vec1 = get(vpmap_, v2) - get(vpmap_, v0);
|
||||
Vector vec2 = get(vpmap_, v0) - get(vpmap_, v1);
|
||||
double e0_square = vec0.squared_length();
|
||||
double e1_square = vec1.squared_length();
|
||||
double e2_square = vec2.squared_length();
|
||||
double e0 = CGAL::sqrt(e0_square);
|
||||
double e2 = CGAL::sqrt(e2_square);
|
||||
double cos_angle = ( e0_square + e2_square - e1_square ) / 2.0 / e0 / e2;
|
||||
cos_angle = (std::max)(-1.0, (std::min)(1.0, cos_angle)); // clamp into [-1, 1]
|
||||
double angle = acos(cos_angle);
|
||||
|
||||
return ( tan(angle/2.0) );
|
||||
}
|
||||
|
||||
// My deviation built on Meyer_02
|
||||
double half_tan_value_2(vertex_descriptor v0, vertex_descriptor v1, vertex_descriptor v2)
|
||||
{
|
||||
Vector a = get(vpmap_, v0) - get(vpmap_, v1);
|
||||
Vector b = get(vpmap_, v2) - get(vpmap_, v1);
|
||||
double dot_ab = a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
|
||||
double dot_aa = a.squared_length();
|
||||
double dot_bb = b.squared_length();
|
||||
double dot_aa_bb = dot_aa * dot_bb;
|
||||
|
||||
double cos_rep = dot_ab;
|
||||
double sin_rep = CGAL::sqrt(dot_aa_bb - dot_ab * dot_ab);
|
||||
double normalizer = CGAL::sqrt(dot_aa_bb); // |a|*|b|
|
||||
|
||||
return (normalizer - cos_rep) / sin_rep; // formula from [Floater04] page 4
|
||||
// tan(Q/2) = (1 - cos(Q)) / sin(Q)
|
||||
}
|
||||
};
|
||||
|
||||
template< class PolygonMesh,
|
||||
class PrimaryWeight = Cotangent_weight<PolygonMesh>,
|
||||
class SecondaryWeight = Mean_value_weight<PolygonMesh> >
|
||||
class Hybrid_weight : public PrimaryWeight, SecondaryWeight
|
||||
{
|
||||
PrimaryWeight primary;
|
||||
SecondaryWeight secondary;
|
||||
|
||||
Hybrid_weight()
|
||||
{}
|
||||
|
||||
public:
|
||||
Hybrid_weight(PolygonMesh& pmesh_)
|
||||
: primary(pmesh_), secondary(pmesh_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return primary.pmesh();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
double operator()(halfedge_descriptor he)
|
||||
{
|
||||
double weight = primary(he);
|
||||
//if(weight < 0) { std::cout << "Negative weight" << std::endl; }
|
||||
return (weight >= 0) ? weight : secondary(he);
|
||||
}
|
||||
};
|
||||
|
||||
// Trivial uniform weights (created for test purposes)
|
||||
template<class PolygonMesh>
|
||||
class Uniform_weight
|
||||
{
|
||||
public:
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
double operator()(halfedge_descriptor /*e*/)
|
||||
{ return 1.0; }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// FAIRING //
|
||||
template<class PolygonMesh>
|
||||
class Scale_dependent_weight_fairing
|
||||
{
|
||||
PolygonMesh& pmesh_;
|
||||
public:
|
||||
Scale_dependent_weight_fairing(PolygonMesh& pmesh_)
|
||||
: pmesh_(pmesh_)
|
||||
{}
|
||||
|
||||
PolygonMesh& pmesh()
|
||||
{
|
||||
return pmesh_;
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
typedef typename boost::property_map<PolygonMesh,vertex_point_t>::type Point_property_map;
|
||||
typedef typename boost::property_traits<Point_property_map>::value_type Point;
|
||||
typedef typename Kernel_traits<Point>::Kernel::Vector_3 Vector;
|
||||
|
||||
double w_i(vertex_descriptor /*v_i*/) { return 1.0; }
|
||||
|
||||
double w_ij(halfedge_descriptor he)
|
||||
{
|
||||
Vector v = target(he, pmesh())->point() - source(he, pmesh())->point();
|
||||
double divider = CGAL::sqrt(v.squared_length());
|
||||
if(divider == 0.0) {
|
||||
CGAL_warning_msg(false, "Scale dependent weight - zero length edge.");
|
||||
return (std::numeric_limits<double>::max)();
|
||||
}
|
||||
return 1.0 / divider;
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolygonMesh
|
||||
, class VertexPointMap = typename boost::property_map<PolygonMesh, vertex_point_t>::type
|
||||
>
|
||||
class Cotangent_weight_with_voronoi_area_fairing
|
||||
{
|
||||
typedef PolygonMesh PM;
|
||||
typedef VertexPointMap VPMap;
|
||||
Voronoi_area<PM, VPMap> voronoi_functor;
|
||||
Cotangent_weight<PM, VPMap, Cotangent_value_Meyer<PM, VPMap> > cotangent_functor;
|
||||
|
||||
public:
|
||||
Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_)
|
||||
: voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_))
|
||||
, cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_))
|
||||
{}
|
||||
|
||||
Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_, VPMap vpmap_)
|
||||
: voronoi_functor(pmesh_, vpmap_)
|
||||
, cotangent_functor(pmesh_, vpmap_)
|
||||
{}
|
||||
|
||||
PM& pmesh()
|
||||
{
|
||||
return voronoi_functor.pmesh();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
double w_i(vertex_descriptor v_i)
|
||||
{
|
||||
return 0.5 / voronoi_functor(v_i);
|
||||
}
|
||||
|
||||
double w_ij(halfedge_descriptor he) {
|
||||
|
||||
return cotangent_functor(he) * 2.0;
|
||||
}
|
||||
};
|
||||
|
||||
// Cotangent_value_Meyer has been changed to the version:
|
||||
// Cotangent_value_Meyer_secure to avoid imprecisions from
|
||||
// the issue #4706 - https://github.com/CGAL/cgal/issues/4706.
|
||||
template<
|
||||
class PolygonMesh, class VertexPointMap = typename boost::property_map<PolygonMesh, vertex_point_t>::type>
|
||||
class Cotangent_weight_with_voronoi_area_fairing_secure {
|
||||
|
||||
typedef PolygonMesh PM;
|
||||
typedef VertexPointMap VPMap;
|
||||
Voronoi_area<PM, VPMap> voronoi_functor;
|
||||
Cotangent_weight<PM, VPMap, Cotangent_value_Meyer_secure<PM, VPMap> > cotangent_functor;
|
||||
|
||||
public:
|
||||
Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_) :
|
||||
voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)),
|
||||
cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_))
|
||||
{ }
|
||||
|
||||
Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_, VPMap vpmap_) :
|
||||
voronoi_functor(pmesh_, vpmap_),
|
||||
cotangent_functor(pmesh_, vpmap_)
|
||||
{ }
|
||||
|
||||
PM& pmesh() {
|
||||
return voronoi_functor.pmesh();
|
||||
}
|
||||
|
||||
typedef typename boost::graph_traits<PM>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PM>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
double w_i(vertex_descriptor v_i) {
|
||||
return 0.5 / voronoi_functor(v_i);
|
||||
}
|
||||
|
||||
double w_ij(halfedge_descriptor he) {
|
||||
return cotangent_functor(he) * 2.0;
|
||||
}
|
||||
};
|
||||
|
||||
template<class PolygonMesh>
|
||||
class Uniform_weight_fairing
|
||||
{
|
||||
public:
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::vertex_descriptor vertex_descriptor;
|
||||
|
||||
Uniform_weight_fairing(PolygonMesh&)
|
||||
{}
|
||||
|
||||
double w_ij(halfedge_descriptor /*e*/) { return 1.0; }
|
||||
|
||||
double w_i(vertex_descriptor /*v_i*/) { return 1.0; }
|
||||
};
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}//namespace internal
|
||||
|
||||
|
||||
}//namespace CGAL
|
||||
/// @endcond
|
||||
#endif //CGAL_PMP_WEIGHTS_H
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
#ifndef CGAL_POLYGON_MESH_PROCESSING_GET_BORDER_H
|
||||
#define CGAL_POLYGON_MESH_PROCESSING_GET_BORDER_H
|
||||
|
||||
#include <CGAL/license/Polygon_mesh_processing/miscellaneous.h>
|
||||
#include <CGAL/license/Polygon_mesh_processing/core.h>
|
||||
|
||||
#include <CGAL/algorithm.h>
|
||||
#include <CGAL/boost/graph/iterator.h>
|
||||
|
|
|
|||
|
|
@ -16,15 +16,13 @@
|
|||
|
||||
#include <CGAL/license/Polygon_mesh_processing/detect_features.h>
|
||||
|
||||
#include <CGAL/disable_warnings.h>
|
||||
|
||||
#include <CGAL/Kernel/global_functions_3.h>
|
||||
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
|
||||
#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
|
||||
#include <CGAL/boost/graph/properties.h>
|
||||
#include <CGAL/Polygon_mesh_processing/connected_components.h>
|
||||
#include <set>
|
||||
|
||||
#include <set>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Polygon_mesh_processing {
|
||||
|
|
@ -45,29 +43,44 @@ generate_patch_id(std::pair<Int, Int>, int i)
|
|||
return std::pair<Int, Int>(i, 0);
|
||||
}
|
||||
|
||||
template <typename PolygonMesh, typename GT>
|
||||
template <typename PolygonMesh, typename VPM, typename GT>
|
||||
bool
|
||||
is_sharp(PolygonMesh& polygonMesh,
|
||||
const typename boost::graph_traits<PolygonMesh>::halfedge_descriptor& he,
|
||||
const typename GT::FT& cos_angle)
|
||||
is_sharp(const typename boost::graph_traits<PolygonMesh>::halfedge_descriptor h,
|
||||
const PolygonMesh& pmesh,
|
||||
const VPM vpm,
|
||||
const GT gt,
|
||||
const typename GT::Sign cos_sign,
|
||||
const typename GT::FT sq_cos_angle)
|
||||
{
|
||||
typedef typename boost::graph_traits<PolygonMesh>::face_descriptor face_descriptor;
|
||||
if(is_border(edge(he,polygonMesh),polygonMesh)){
|
||||
typedef typename GT::FT FT;
|
||||
typedef typename GT::Vector_3 Vector_3;
|
||||
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
if(is_border_edge(h, pmesh))
|
||||
return false;
|
||||
}
|
||||
face_descriptor f1 = face(he,polygonMesh);
|
||||
face_descriptor f2 = face(opposite(he,polygonMesh),polygonMesh);
|
||||
|
||||
const typename GT::Vector_3& n1 = Polygon_mesh_processing::compute_face_normal(f1,polygonMesh);
|
||||
const typename GT::Vector_3& n2 = Polygon_mesh_processing::compute_face_normal(f2,polygonMesh);
|
||||
typename GT::Construct_vector_3 vector = gt.construct_vector_3_object();
|
||||
typename GT::Construct_cross_product_vector_3 cross = gt.construct_cross_product_vector_3_object();
|
||||
typename GT::Compute_squared_length_3 sq_length = gt.compute_squared_length_3_object();
|
||||
|
||||
if ( n1 * n2 <= cos_angle )
|
||||
return true;
|
||||
halfedge_descriptor opp_h = opposite(h, pmesh);
|
||||
|
||||
const Vector_3 vc = vector(get(vpm, source(h, pmesh)), get(vpm, target(h, pmesh)));
|
||||
const Vector_3 v1 = vector(get(vpm, source(h, pmesh)), get(vpm, target(next(h, pmesh), pmesh)));
|
||||
const Vector_3 v2 = vector(get(vpm, target(next(opp_h, pmesh), pmesh)), get(vpm, target(opp_h, pmesh)));
|
||||
|
||||
const Vector_3 n1 = cross(vc, v1);
|
||||
const Vector_3 n2 = cross(vc, v2);
|
||||
const FT sp = n1 * n2;
|
||||
|
||||
// n1.n2 <= cos() without computing the norms of the vectors
|
||||
if(cos_sign == NEGATIVE)
|
||||
return (is_negative(sp) && (square(sp) >= sq_cos_angle * sq_length(n1) * sq_length(n2)));
|
||||
else
|
||||
return false;
|
||||
return (is_negative(sp) || (square(sp) <= sq_cos_angle * sq_length(n1) * sq_length(n2)));
|
||||
}
|
||||
|
||||
|
||||
//wrapper for patchid map.
|
||||
template<typename PatchIdMap,
|
||||
typename ValueType = typename boost::property_traits<PatchIdMap>::value_type>
|
||||
|
|
@ -133,7 +146,7 @@ void put(PatchIdMapWrapper<PatchIdMap, std::pair<Int, Int> >& map, Handle_type h
|
|||
template <typename PolygonMesh, typename PatchIdMap,
|
||||
typename EdgeIsFeatureMap, typename NamedParameters>
|
||||
typename boost::graph_traits<PolygonMesh>::faces_size_type
|
||||
detect_surface_patches(PolygonMesh& p,
|
||||
detect_surface_patches(const PolygonMesh& p,
|
||||
PatchIdMap patch_id_map,
|
||||
EdgeIsFeatureMap eif,
|
||||
const NamedParameters& np)
|
||||
|
|
@ -152,7 +165,7 @@ detect_surface_patches(PolygonMesh& p,
|
|||
|
||||
template <typename PolygonMesh, typename EdgeIsFeatureMap, typename PatchIdMap>
|
||||
typename boost::graph_traits<PolygonMesh>::faces_size_type
|
||||
detect_surface_patches(PolygonMesh& p,
|
||||
detect_surface_patches(const PolygonMesh& p,
|
||||
PatchIdMap patch_id_map,
|
||||
EdgeIsFeatureMap eif)
|
||||
{
|
||||
|
|
@ -160,69 +173,64 @@ detect_surface_patches(PolygonMesh& p,
|
|||
}
|
||||
|
||||
|
||||
template<typename GT,
|
||||
typename FT,
|
||||
typename PolygonMesh,
|
||||
typename EIFMap,
|
||||
typename VNFEMap>
|
||||
void sharp_call(PolygonMesh& pmesh,
|
||||
FT angle_in_deg,
|
||||
EIFMap edge_is_feature_map,
|
||||
VNFEMap vnfe)
|
||||
template <typename FT, typename PolygonMesh, typename VPM, typename GT, typename EIFMap, typename VNFEMap>
|
||||
void sharp_call(const FT angle_in_deg,
|
||||
const PolygonMesh& pmesh,
|
||||
const VPM vpm,
|
||||
const GT gt,
|
||||
EIFMap edge_is_feature_map,
|
||||
VNFEMap vnfe)
|
||||
{
|
||||
// Initialize vertices
|
||||
for(typename boost::graph_traits<PolygonMesh>::vertex_descriptor vd :
|
||||
vertices(pmesh))
|
||||
{
|
||||
for(typename boost::graph_traits<PolygonMesh>::vertex_descriptor vd : vertices(pmesh))
|
||||
put(vnfe, vd, 0);
|
||||
}
|
||||
FT cos_angle ( std::cos(CGAL::to_double(angle_in_deg) * CGAL_PI / 180.) );
|
||||
|
||||
const FT cos_angle = std::cos(CGAL::to_double(angle_in_deg) * CGAL_PI / 180.);
|
||||
const FT sq_cos_angle = square(cos_angle);
|
||||
|
||||
// Detect sharp edges
|
||||
for(typename boost::graph_traits<PolygonMesh>::edge_descriptor ed : edges(pmesh))
|
||||
{
|
||||
typename boost::graph_traits<PolygonMesh>::halfedge_descriptor he = halfedge(ed,pmesh);
|
||||
if(is_border_edge(he,pmesh)
|
||||
|| angle_in_deg == FT()
|
||||
|| (angle_in_deg != FT(180) && internal::is_sharp<PolygonMesh, GT>(pmesh,he,cos_angle))
|
||||
)
|
||||
typename boost::graph_traits<PolygonMesh>::halfedge_descriptor he = halfedge(ed, pmesh);
|
||||
if(is_border_edge(he, pmesh) ||
|
||||
angle_in_deg == FT() ||
|
||||
(angle_in_deg != FT(180) && internal::is_sharp(he, pmesh, vpm, gt, CGAL::sign(cos_angle), sq_cos_angle)))
|
||||
{
|
||||
put(edge_is_feature_map, edge(he, pmesh), true);
|
||||
put(vnfe, target(he,pmesh), get(vnfe, target(he,pmesh))+1);
|
||||
put(vnfe, source(he,pmesh), get(vnfe, source(he,pmesh))+1);
|
||||
put(vnfe, target(he, pmesh), get(vnfe, target(he, pmesh))+1);
|
||||
put(vnfe, source(he, pmesh), get(vnfe, source(he, pmesh))+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename GT,
|
||||
typename FT,
|
||||
typename PolygonMesh,
|
||||
typename EIFMap>
|
||||
void sharp_call(PolygonMesh& pmesh,
|
||||
FT& angle_in_deg,
|
||||
EIFMap edge_is_feature_map,
|
||||
const internal_np::Param_not_found&)
|
||||
template <typename FT, typename PolygonMesh, typename VPM, typename GT, typename EIFMap>
|
||||
void sharp_call(const FT angle_in_deg,
|
||||
const PolygonMesh& pmesh,
|
||||
const VPM vpm,
|
||||
const GT gt,
|
||||
EIFMap edge_is_feature_map,
|
||||
const internal_np::Param_not_found&)
|
||||
{
|
||||
typedef typename boost::graph_traits<PolygonMesh>::edge_descriptor edge_descriptor;
|
||||
typedef typename boost::graph_traits<PolygonMesh>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
FT cos_angle ( std::cos(CGAL::to_double(angle_in_deg) * CGAL_PI / 180.) );
|
||||
const FT cos_angle = std::cos(CGAL::to_double(angle_in_deg) * CGAL_PI / 180.);
|
||||
const FT sq_cos_angle = square(cos_angle);
|
||||
|
||||
// Detect sharp edges
|
||||
for(edge_descriptor ed : edges(pmesh))
|
||||
{
|
||||
halfedge_descriptor he = halfedge(ed,pmesh);
|
||||
if(is_border_edge(he,pmesh)
|
||||
|| angle_in_deg == FT()
|
||||
|| (angle_in_deg != FT(180) && internal::is_sharp<PolygonMesh, GT>(pmesh,he,cos_angle))
|
||||
)
|
||||
halfedge_descriptor he = halfedge(ed, pmesh);
|
||||
if(is_border_edge(he, pmesh) ||
|
||||
angle_in_deg == FT() ||
|
||||
(angle_in_deg != FT(180) && internal::is_sharp(he, pmesh, vpm, gt, CGAL::sign(cos_angle), sq_cos_angle)))
|
||||
{
|
||||
put(edge_is_feature_map, edge(he, pmesh), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} //end internal
|
||||
|
||||
} // namespace internal
|
||||
|
||||
/*!
|
||||
* \ingroup PMP_detect_features_grp
|
||||
|
|
@ -270,24 +278,30 @@ template <typename PolygonMesh, typename FT,
|
|||
#else
|
||||
template <typename PolygonMesh, typename EdgeIsFeatureMap, typename NamedParameters>
|
||||
#endif
|
||||
void detect_sharp_edges(PolygonMesh& pmesh,
|
||||
void detect_sharp_edges(const PolygonMesh& pmesh,
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
FT angle_in_deg,
|
||||
FT angle_in_deg,
|
||||
#else
|
||||
typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT angle_in_deg,
|
||||
typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT angle_in_deg,
|
||||
#endif
|
||||
EdgeIsFeatureMap edge_is_feature_map,
|
||||
const NamedParameters& np)
|
||||
EdgeIsFeatureMap edge_is_feature_map,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
//extract types from NPs
|
||||
using parameters::choose_parameter;
|
||||
using parameters::get_parameter;
|
||||
|
||||
// extract types from NPs
|
||||
typedef typename GetGeomTraits<PolygonMesh, NamedParameters>::type GT;
|
||||
typedef typename GT::FT FT;
|
||||
GT gt = choose_parameter<GT>(get_parameter(np, internal_np::geom_traits));
|
||||
|
||||
internal::sharp_call<GT, FT>(pmesh, angle_in_deg, edge_is_feature_map,
|
||||
parameters::get_parameter(np, internal_np::vertex_feature_degree));
|
||||
typedef typename GetVertexPointMap<PolygonMesh, NamedParameters>::const_type VPM;
|
||||
VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point),
|
||||
get_const_property_map(boost::vertex_point, pmesh));
|
||||
|
||||
internal::sharp_call(angle_in_deg, pmesh, vpm, gt, edge_is_feature_map,
|
||||
get_parameter(np, internal_np::vertex_feature_degree));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* \ingroup PMP_detect_features_grp
|
||||
*
|
||||
|
|
@ -315,7 +329,7 @@ void detect_sharp_edges(PolygonMesh& pmesh,
|
|||
|
||||
template <typename PolygonMesh, typename PatchIdMap,
|
||||
typename VertexIncidentPatchesMap, typename EdgeIsFeatureMap>
|
||||
void detect_vertex_incident_patches(PolygonMesh& pmesh,
|
||||
void detect_vertex_incident_patches(const PolygonMesh& pmesh,
|
||||
const PatchIdMap patch_id_map,
|
||||
VertexIncidentPatchesMap vertex_incident_patches_map,
|
||||
const EdgeIsFeatureMap edge_is_feature_map)
|
||||
|
|
@ -326,19 +340,18 @@ void detect_vertex_incident_patches(PolygonMesh& pmesh,
|
|||
for(vertex_descriptor vit :vertices(pmesh))
|
||||
{
|
||||
// Look only at feature vertices
|
||||
if( ! get(edge_is_feature_map, edge(halfedge(vit, pmesh), pmesh) ))
|
||||
{ continue; }
|
||||
if(!get(edge_is_feature_map, edge(halfedge(vit, pmesh), pmesh)))
|
||||
continue;
|
||||
|
||||
// Loop on incident facets of vit
|
||||
typename VertexIncidentPatchesMap::value_type&
|
||||
id_set = vertex_incident_patches_map[vit];
|
||||
for(halfedge_descriptor he : halfedges_around_target(vit,pmesh))
|
||||
typename VertexIncidentPatchesMap::value_type& id_set = vertex_incident_patches_map[vit];
|
||||
for(halfedge_descriptor he : halfedges_around_target(vit, pmesh))
|
||||
{
|
||||
if( ! is_border(he,pmesh) )
|
||||
if(!is_border(he, pmesh))
|
||||
{
|
||||
id_set.insert(get(patch_id_map, face(he, pmesh)));
|
||||
}
|
||||
else if( ! is_border(opposite(he,pmesh),pmesh) )
|
||||
else if(!is_border(opposite(he, pmesh), pmesh))
|
||||
{
|
||||
id_set.insert(get(patch_id_map, face(opposite(he, pmesh), pmesh)));
|
||||
}
|
||||
|
|
@ -346,26 +359,22 @@ void detect_vertex_incident_patches(PolygonMesh& pmesh,
|
|||
}
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
|
||||
namespace internal
|
||||
template<typename PolygonMesh, typename PIDMap, typename VIPMap, typename EIFMap>
|
||||
void vip_call(const PolygonMesh& mesh, PIDMap pid, VIPMap vip, EIFMap eif)
|
||||
{
|
||||
template<typename PolygonMesh,
|
||||
typename PIDMap,
|
||||
typename VIPMap,
|
||||
typename EIFMap>
|
||||
void vip_call(PolygonMesh& mesh, PIDMap pid, VIPMap vip, EIFMap eif )
|
||||
{
|
||||
CGAL::Polygon_mesh_processing::detect_vertex_incident_patches(mesh, pid, vip, eif);
|
||||
}
|
||||
CGAL::Polygon_mesh_processing::detect_vertex_incident_patches(mesh, pid, vip, eif);
|
||||
}
|
||||
|
||||
template<typename PolygonMesh, typename PIDMap, typename EIFMap>
|
||||
void vip_call(const PolygonMesh&, PIDMap, const internal_np::Param_not_found&, EIFMap)
|
||||
{
|
||||
//do nothing when the parameter is not given
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
||||
template<typename PolygonMesh,
|
||||
typename PIDMap,
|
||||
typename EIFMap>
|
||||
void vip_call(PolygonMesh&, PIDMap, const internal_np::Param_not_found&, EIFMap)
|
||||
{
|
||||
//do nothing when the parameter is not given
|
||||
}
|
||||
}//end internal
|
||||
/*!
|
||||
* \ingroup PMP_detect_features_grp
|
||||
*
|
||||
|
|
@ -446,30 +455,30 @@ template <typename PolygonMesh,
|
|||
typename EdgeIsFeatureMap, typename PatchIdMap, typename NamedParameters>
|
||||
#endif
|
||||
typename boost::graph_traits<PolygonMesh>::faces_size_type
|
||||
sharp_edges_segmentation(PolygonMesh& pmesh,
|
||||
sharp_edges_segmentation(const PolygonMesh& pmesh,
|
||||
#ifdef DOXYGEN_RUNNING
|
||||
FT angle_in_deg,
|
||||
FT angle_in_deg,
|
||||
#else
|
||||
typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT angle_in_deg,
|
||||
typename GetGeomTraits<PolygonMesh, NamedParameters>::type::FT angle_in_deg,
|
||||
#endif
|
||||
EdgeIsFeatureMap edge_is_feature_map,
|
||||
PatchIdMap patch_id_map,
|
||||
const NamedParameters& np)
|
||||
EdgeIsFeatureMap edge_is_feature_map,
|
||||
PatchIdMap patch_id_map,
|
||||
const NamedParameters& np)
|
||||
{
|
||||
detect_sharp_edges(pmesh, angle_in_deg, edge_is_feature_map, np);
|
||||
detect_sharp_edges(pmesh, angle_in_deg, edge_is_feature_map, np);
|
||||
|
||||
typename boost::graph_traits<PolygonMesh>::faces_size_type result =
|
||||
internal::detect_surface_patches(pmesh, patch_id_map, edge_is_feature_map, np);
|
||||
typename boost::graph_traits<PolygonMesh>::faces_size_type result =
|
||||
internal::detect_surface_patches(pmesh, patch_id_map, edge_is_feature_map, np);
|
||||
|
||||
internal::vip_call(pmesh, patch_id_map,
|
||||
parameters::get_parameter(np, internal_np::vertex_incident_patches), edge_is_feature_map);
|
||||
internal::vip_call(pmesh, patch_id_map,
|
||||
parameters::get_parameter(np, internal_np::vertex_incident_patches), edge_is_feature_map);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
//Convenient overrides
|
||||
template <typename PolygonMesh, typename EdgeIsFeatureMap, typename FT>
|
||||
void detect_sharp_edges(PolygonMesh& p,
|
||||
void detect_sharp_edges(const PolygonMesh& p,
|
||||
FT angle_in_deg,
|
||||
EdgeIsFeatureMap edge_is_feature_map)
|
||||
{
|
||||
|
|
@ -480,18 +489,16 @@ void detect_sharp_edges(PolygonMesh& p,
|
|||
template <typename PolygonMesh, typename FT,
|
||||
typename EdgeIsFeatureMap, typename PatchIdMap>
|
||||
typename boost::graph_traits<PolygonMesh>::faces_size_type
|
||||
sharp_edges_segmentation(PolygonMesh& p,
|
||||
sharp_edges_segmentation(const PolygonMesh& p,
|
||||
FT angle_in_deg,
|
||||
EdgeIsFeatureMap edge_is_feature_map,
|
||||
PatchIdMap patch_id_map)
|
||||
{
|
||||
return sharp_edges_segmentation(p, angle_in_deg, edge_is_feature_map, patch_id_map,
|
||||
parameters::all_default());
|
||||
parameters::all_default());
|
||||
}
|
||||
|
||||
} // end namespace PMP
|
||||
} // end namespace CGAL
|
||||
|
||||
#include <CGAL/enable_warnings.h>
|
||||
|
||||
#endif // CGAL_POLYGON_MESH_PROCESSING_DETECT_FEATURES_IN_POLYGON_MESH_H
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include <CGAL/Polygon_mesh_processing/internal/fair_impl.h>
|
||||
#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
|
||||
#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
|
||||
#include <CGAL/Weights/cotangent_weights.h>
|
||||
|
||||
#if defined(CGAL_EIGEN3_ENABLED)
|
||||
#include <CGAL/Eigen_solver_traits.h> // for sparse linear system solver
|
||||
|
|
@ -162,15 +163,14 @@ namespace internal {
|
|||
// Cotangent_weight_with_voronoi_area_fairing has been changed to the version:
|
||||
// Cotangent_weight_with_voronoi_area_fairing_secure to avoid imprecisions from
|
||||
// the issue #4706 - https://github.com/CGAL/cgal/issues/4706.
|
||||
typedef CGAL::internal::Cotangent_weight_with_voronoi_area_fairing_secure<TriangleMesh, VPMap>
|
||||
Default_Weight_calculator;
|
||||
typedef CGAL::Weights::Secure_cotangent_weight_with_voronoi_area<TriangleMesh, VPMap> Default_weight_calculator;
|
||||
|
||||
VPMap vpmap_ = choose_parameter(get_parameter(np, internal_np::vertex_point),
|
||||
get_property_map(vertex_point, tmesh));
|
||||
|
||||
return internal::fair(tmesh, vertices,
|
||||
choose_parameter<Default_solver>(get_parameter(np, internal_np::sparse_linear_solver)),
|
||||
choose_parameter(get_parameter(np, internal_np::weight_calculator), Default_Weight_calculator(tmesh, vpmap_)),
|
||||
choose_parameter(get_parameter(np, internal_np::weight_calculator), Default_weight_calculator(tmesh, vpmap_)),
|
||||
choose_parameter(get_parameter(np, internal_np::fairing_continuity), 1),
|
||||
vpmap_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include <CGAL/Polygon_mesh_processing/compute_normal.h>
|
||||
#include <CGAL/Polygon_mesh_processing/border.h>
|
||||
#include <CGAL/Polygon_mesh_processing/repair.h>
|
||||
#include <CGAL/Polygon_mesh_processing/repair_degeneracies.h>
|
||||
#include <CGAL/Polygon_mesh_processing/measure.h>
|
||||
#include <CGAL/Polygon_mesh_processing/connected_components.h>
|
||||
#include <CGAL/Polygon_mesh_processing/shape_predicates.h>
|
||||
|
|
@ -1492,6 +1492,8 @@ private:
|
|||
|| GeomTraits().collinear_3_object()(t, p, q))
|
||||
continue;
|
||||
|
||||
typename GeomTraits::Construct_cross_product_vector_3 cross_product
|
||||
= GeomTraits().construct_cross_product_vector_3_object();
|
||||
#ifdef CGAL_PMP_REMESHING_DEBUG
|
||||
typename GeomTraits::Construct_normal_3 normal
|
||||
= GeomTraits().construct_normal_3_object();
|
||||
|
|
@ -1499,13 +1501,13 @@ private:
|
|||
Vector_3 normal_after_collapse = normal(t, p, q);
|
||||
|
||||
CGAL::Sign s1 = CGAL::sign(normal_before_collapse * normal_after_collapse);
|
||||
CGAL::Sign s2 = CGAL::sign(CGAL::cross_product(Vector_3(s, p), Vector_3(s, q))
|
||||
* CGAL::cross_product(Vector_3(t, p), Vector_3(t, q)));
|
||||
CGAL::Sign s2 = CGAL::sign(cross_product(Vector_3(s, p), Vector_3(s, q))
|
||||
* cross_product(Vector_3(t, p), Vector_3(t, q)));
|
||||
CGAL_assertion(s1 == s2);
|
||||
#endif
|
||||
|
||||
if(CGAL::sign(CGAL::cross_product(Vector_3(s, p), Vector_3(s, q))
|
||||
* CGAL::cross_product(Vector_3(t, p), Vector_3(t, q)))
|
||||
if(CGAL::sign(cross_product(Vector_3(s, p), Vector_3(s, q))
|
||||
* cross_product(Vector_3(t, p), Vector_3(t, q)))
|
||||
!= CGAL::POSITIVE)
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue