mirror of https://github.com/CGAL/cgal
Use CGAL_PI instead of hardcoding it
This commit is contained in:
parent
08ef100083
commit
3c7eb2c6b9
|
|
@ -2,6 +2,7 @@
|
||||||
// We test speed of discrete harmonic coordinates on a set of automatically generated
|
// We test speed of discrete harmonic coordinates on a set of automatically generated
|
||||||
// points inside a regular polygon with 100 vertices. We use inexact kernel.
|
// points inside a regular polygon with 100 vertices. We use inexact kernel.
|
||||||
|
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
#include <CGAL/Real_timer.h>
|
#include <CGAL/Real_timer.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h>
|
#include <CGAL/Barycentric_coordinates_2/Discrete_harmonic_2.h>
|
||||||
|
|
@ -28,12 +29,11 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon
|
||||||
{
|
{
|
||||||
const int n = number_of_vertices;
|
const int n = number_of_vertices;
|
||||||
const double r = polygon_radius;
|
const double r = polygon_radius;
|
||||||
const double number_pi = 3.14159;
|
|
||||||
|
|
||||||
vertices.resize(n);
|
vertices.resize(n);
|
||||||
|
|
||||||
for(int i = 0; i < n; ++i)
|
for(int i = 0; i < n; ++i)
|
||||||
vertices[i] = Point(Scalar(r*sin((number_pi / n) + ((i * 2.0 * number_pi) / n))), Scalar(-r*cos((number_pi / n) + ((i * 2.0 * number_pi) / n))));
|
vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// We test speed of mean value coordinates on a set of automatically generated
|
// We test speed of mean value coordinates on a set of automatically generated
|
||||||
// points inside a regular polygon with 100 vertices. We use inexact kernel.
|
// points inside a regular polygon with 100 vertices. We use inexact kernel.
|
||||||
|
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
#include <CGAL/Real_timer.h>
|
#include <CGAL/Real_timer.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Barycentric_coordinates_2/Mean_value_2.h>
|
#include <CGAL/Barycentric_coordinates_2/Mean_value_2.h>
|
||||||
|
|
@ -28,12 +29,11 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon
|
||||||
{
|
{
|
||||||
const int n = number_of_vertices;
|
const int n = number_of_vertices;
|
||||||
const double r = polygon_radius;
|
const double r = polygon_radius;
|
||||||
const double number_pi = 3.14159;
|
|
||||||
|
|
||||||
vertices.resize(n);
|
vertices.resize(n);
|
||||||
|
|
||||||
for(int i = 0; i < n; ++i)
|
for(int i = 0; i < n; ++i)
|
||||||
vertices[i] = Point(Scalar(r*sin((number_pi / n) + ((i * 2.0 * number_pi) / n))), Scalar(-r*cos((number_pi / n) + ((i * 2.0 * number_pi) / n))));
|
vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// We test speed of Wachspress coordinates on a set of automatically generated
|
// We test speed of Wachspress coordinates on a set of automatically generated
|
||||||
// points inside a regular polygon with 100 vertices. We use inexact kernel.
|
// points inside a regular polygon with 100 vertices. We use inexact kernel.
|
||||||
|
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
#include <CGAL/Real_timer.h>
|
#include <CGAL/Real_timer.h>
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
#include <CGAL/Barycentric_coordinates_2/Wachspress_2.h>
|
#include <CGAL/Barycentric_coordinates_2/Wachspress_2.h>
|
||||||
|
|
@ -28,12 +29,11 @@ void generate_regular_polygon(const int number_of_vertices, const double polygon
|
||||||
{
|
{
|
||||||
const int n = number_of_vertices;
|
const int n = number_of_vertices;
|
||||||
const double r = polygon_radius;
|
const double r = polygon_radius;
|
||||||
const double number_pi = 3.14159;
|
|
||||||
|
|
||||||
vertices.resize(n);
|
vertices.resize(n);
|
||||||
|
|
||||||
for(int i = 0; i < n; ++i)
|
for(int i = 0; i < n; ++i)
|
||||||
vertices[i] = Point(Scalar(r*sin((number_pi / n) + ((i * 2.0 * number_pi) / n))), Scalar(-r*cos((number_pi / n) + ((i * 2.0 * number_pi) / n))));
|
vertices[i] = Point(Scalar(r*sin((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))), Scalar(-r*cos((CGAL_PI / n) + ((i * 2.0 * CGAL_PI) / n))));
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
#include <CGAL/generators.h>
|
#include <CGAL/generators.h>
|
||||||
#include <CGAL/number_type_basic.h>
|
#include <CGAL/number_type_basic.h>
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
@ -56,11 +58,10 @@ generate_point() {
|
||||||
for(int i=0; i<dimension; ++i) {
|
for(int i=0; i<dimension; ++i) {
|
||||||
// normal distribution
|
// normal distribution
|
||||||
//( a product of normal distib is a normal distrib in higher dim)
|
//( a product of normal distib is a normal distrib in higher dim)
|
||||||
const double pi = 3.141592653589793238462643;
|
|
||||||
double a=this->_rnd.get_double();
|
double a=this->_rnd.get_double();
|
||||||
a = std::sqrt( -2* std::log(1-a) );
|
a = std::sqrt( -2* std::log(1-a) );
|
||||||
double b=this->_rnd.get_double();
|
double b=this->_rnd.get_double();
|
||||||
b = std::cos(2*pi*b);
|
b = std::cos(2*CGAL_PI*b);
|
||||||
coord[i]= a*b;
|
coord[i]= a*b;
|
||||||
norm += coord[i]*coord[i];
|
norm += coord[i]*coord[i];
|
||||||
}
|
}
|
||||||
|
|
@ -104,11 +105,10 @@ generate_point() {
|
||||||
|
|
||||||
for(int i=0; i<dimension; ++i) {
|
for(int i=0; i<dimension; ++i) {
|
||||||
// normal distribution
|
// normal distribution
|
||||||
const double pi = 3.141592653589793238462643;
|
|
||||||
double a=this->_rnd.get_double();
|
double a=this->_rnd.get_double();
|
||||||
a = std::sqrt( -2* std::log(1-a) );
|
a = std::sqrt( -2* std::log(1-a) );
|
||||||
double b=this->_rnd.get_double();
|
double b=this->_rnd.get_double();
|
||||||
b = std::cos(2*pi*b);
|
b = std::cos(2*CGAL_PI*b);
|
||||||
coord[i]= a*b;
|
coord[i]= a*b;
|
||||||
norm += coord[i]*coord[i];
|
norm += coord[i]*coord[i];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,11 @@
|
||||||
#define cimg_display 0 // To avoid X11 or Windows-GDI dependency
|
#define cimg_display 0 // To avoid X11 or Windows-GDI dependency
|
||||||
#include <CImg.h>
|
#include <CImg.h>
|
||||||
#endif
|
#endif
|
||||||
#include <CGAL/Random.h>
|
|
||||||
#include <utility> // std::pair
|
#include <utility> // std::pair
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
|
#include <CGAL/Random.h>
|
||||||
#include <CGAL/property_map.h>
|
#include <CGAL/property_map.h>
|
||||||
#include <CGAL/value_type_traits.h>
|
#include <CGAL/value_type_traits.h>
|
||||||
#include <CGAL/compute_average_spacing.h>
|
#include <CGAL/compute_average_spacing.h>
|
||||||
|
|
@ -953,7 +955,7 @@ public:
|
||||||
|
|
||||||
void append_star(const int nb_branches, const int density) {
|
void append_star(const int nb_branches, const int density) {
|
||||||
std::cerr << "append star...";
|
std::cerr << "append star...";
|
||||||
const double deg_in_rad = 3.1415926535897932384626 / 180.0;
|
const double deg_in_rad = CGAL_PI / 180.0;
|
||||||
const double incr = 180.0 / nb_branches;
|
const double incr = 180.0 / nb_branches;
|
||||||
double angle = 0.0;
|
double angle = 0.0;
|
||||||
const Point center(0.5, 0.5);
|
const Point center(0.5, 0.5);
|
||||||
|
|
@ -970,7 +972,7 @@ public:
|
||||||
|
|
||||||
void append_predefined_increasingly_sharp_angles(const int density,
|
void append_predefined_increasingly_sharp_angles(const int density,
|
||||||
const double min_angle) {
|
const double min_angle) {
|
||||||
const double deg_in_rad = 3.1415926535897932384626 / 180.0;
|
const double deg_in_rad = CGAL_PI / 180.0;
|
||||||
double prev_angle = 0.0;
|
double prev_angle = 0.0;
|
||||||
double curr_angle = min_angle;
|
double curr_angle = min_angle;
|
||||||
double incr = min_angle;
|
double incr = min_angle;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include <CGAL/disable_warnings.h>
|
#include <CGAL/disable_warnings.h>
|
||||||
|
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
#include <CGAL/Search_traits_3.h>
|
#include <CGAL/Search_traits_3.h>
|
||||||
#include <CGAL/Orthogonal_k_neighbor_search.h>
|
#include <CGAL/Orthogonal_k_neighbor_search.h>
|
||||||
#include <CGAL/Point_set_processing_3/internal/neighbor_query.h>
|
#include <CGAL/Point_set_processing_3/internal/neighbor_query.h>
|
||||||
|
|
@ -143,7 +144,7 @@ compute_denoise_projection(
|
||||||
FT project_weight_sum = FT(0.0);
|
FT project_weight_sum = FT(0.0);
|
||||||
Vector normal_sum = CGAL::NULL_VECTOR;
|
Vector normal_sum = CGAL::NULL_VECTOR;
|
||||||
|
|
||||||
FT cos_sigma = cos(sharpness_angle / 180.0 * 3.1415926);
|
FT cos_sigma = cos(sharpness_angle * CGAL_PI / 180.0);
|
||||||
FT sharpness_bandwidth = std::pow((CGAL::max)(1e-8, 1 - cos_sigma), 2);
|
FT sharpness_bandwidth = std::pow((CGAL::max)(1e-8, 1 - cos_sigma), 2);
|
||||||
|
|
||||||
typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::const_iterator
|
typename std::vector<Pwn,CGAL_PSP3_DEFAULT_ALLOCATOR<Pwn> >::const_iterator
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,17 @@
|
||||||
|
|
||||||
#include <CGAL/license/Ridges_3.h>
|
#include <CGAL/license/Ridges_3.h>
|
||||||
|
|
||||||
|
#include <CGAL/basic.h>
|
||||||
|
#include <CGAL/boost/graph/helpers.h>
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
|
#include <CGAL/PolyhedralSurf_neighbors.h>
|
||||||
|
#include <CGAL/Kernel/global_functions_3.h>
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <CGAL/basic.h>
|
|
||||||
#include <CGAL/boost/graph/helpers.h>
|
|
||||||
#include <CGAL/PolyhedralSurf_neighbors.h>
|
|
||||||
#include <CGAL/Kernel/global_functions_3.h>
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
|
|
@ -230,7 +232,6 @@ compute_type(Umbilic& umb)
|
||||||
{
|
{
|
||||||
Vector_3 dir, dirnext, normal;
|
Vector_3 dir, dirnext, normal;
|
||||||
double cosinus, angle=0, angleSum=0;
|
double cosinus, angle=0, angleSum=0;
|
||||||
const double pi=3.141592653589793;
|
|
||||||
vertex_descriptor v;
|
vertex_descriptor v;
|
||||||
typename std::list<halfedge_descriptor>::const_iterator itb = umb.contour_list().begin(),
|
typename std::list<halfedge_descriptor>::const_iterator itb = umb.contour_list().begin(),
|
||||||
itlast = --umb.contour_list().end();
|
itlast = --umb.contour_list().end();
|
||||||
|
|
@ -266,9 +267,9 @@ compute_type(Umbilic& umb)
|
||||||
else angle = -acos(cosinus);
|
else angle = -acos(cosinus);
|
||||||
angleSum += angle;
|
angleSum += angle;
|
||||||
|
|
||||||
if ((angleSum > (pi/2)) && (angleSum < (3*pi/2))) umb.umbilic_type() = HYPERBOLIC_UMBILIC ;
|
if ((angleSum > (CGAL_PI/2)) && (angleSum < (3*CGAL_PI/2))) umb.umbilic_type() = HYPERBOLIC_UMBILIC ;
|
||||||
else if ((angleSum < (-pi/2)) && (angleSum > (-3*pi/2))) umb.umbilic_type() = ELLIPTIC_UMBILIC;
|
else if ((angleSum < (-CGAL_PI/2)) && (angleSum > (-3*CGAL_PI/2))) umb.umbilic_type() = ELLIPTIC_UMBILIC;
|
||||||
else if ((angleSum <= (pi/2)) && (angleSum >= (-pi/2))) return 0;//is not considered as an umbilic
|
else if ((angleSum <= (CGAL_PI/2)) && (angleSum >= (-CGAL_PI/2))) return 0;//is not considered as an umbilic
|
||||||
else umb.umbilic_type() = NON_GENERIC_UMBILIC;
|
else umb.umbilic_type() = NON_GENERIC_UMBILIC;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include <CGAL/utility.h>
|
#include <CGAL/utility.h>
|
||||||
#include <CGAL/assertions.h>
|
#include <CGAL/assertions.h>
|
||||||
#include <CGAL/Dimension.h>
|
#include <CGAL/Dimension.h>
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
|
|
||||||
#include <boost/type_traits/is_pointer.hpp>
|
#include <boost/type_traits/is_pointer.hpp>
|
||||||
|
|
||||||
|
|
@ -394,7 +395,7 @@ public:
|
||||||
Multiple_kd_tree(const Point_saved_pair_list & inp_points_list,
|
Multiple_kd_tree(const Point_saved_pair_list & inp_points_list,
|
||||||
int inp_number_of_trees,
|
int inp_number_of_trees,
|
||||||
const Segment_list & seg_list) :
|
const Segment_list & seg_list) :
|
||||||
pi(3.1415), half_pi(1.57075),
|
pi(CGAL_PI), half_pi(0.5 * CGAL_PI),
|
||||||
number_of_trees(inp_number_of_trees), input_points_list(inp_points_list)
|
number_of_trees(inp_number_of_trees), input_points_list(inp_points_list)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,10 @@
|
||||||
#include <boost/type_traits/detail/ice_not.hpp>
|
#include <boost/type_traits/detail/ice_not.hpp>
|
||||||
#endif
|
#endif
|
||||||
#include <boost/graph/adjacency_matrix.hpp>
|
#include <boost/graph/adjacency_matrix.hpp>
|
||||||
#include <CGAL/Unique_hash_map.h>
|
|
||||||
|
|
||||||
|
#include <CGAL/number_type_config.h>
|
||||||
#include <CGAL/Real_timer.h>
|
#include <CGAL/Real_timer.h>
|
||||||
|
#include <CGAL/Unique_hash_map.h>
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
#if defined(BOOST_MSVC)
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
|
|
@ -1421,8 +1422,8 @@ double angle_wrt_X ( Point const& a, Point const& b )
|
||||||
double dx = to_double(b.x() - a.x() ) ;
|
double dx = to_double(b.x() - a.x() ) ;
|
||||||
double dy = to_double(b.y() - a.y() ) ;
|
double dy = to_double(b.y() - a.y() ) ;
|
||||||
double atan = std::atan2(dy,dx);
|
double atan = std::atan2(dy,dx);
|
||||||
double rad = atan >= 0.0 ? atan : 2.0 * 3.141592653589793238462643 + atan ;
|
double rad = atan >= 0.0 ? atan : 2.0 * CGAL_PI + atan ;
|
||||||
double deg = rad * 180.0 / 3.141592653589793238462643;
|
double deg = rad * 180.0 / CGAL_PI;
|
||||||
return deg ;
|
return deg ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue