cleaning types

This commit is contained in:
Sven Oesau 2024-03-21 14:29:38 +01:00
parent 86fe47c7f7
commit 00a77dc2a7
7 changed files with 22 additions and 48 deletions

View File

@ -22,12 +22,12 @@ define the Intersection_distance functor.
class AABBRayIntersectionGeomTraits_2 { class AABBRayIntersectionGeomTraits_2 {
public: public:
/*! /*!
Type of a 3D ray. Type of a 2D ray.
*/ */
typedef unspecified_type Ray_2; typedef unspecified_type Ray_2;
/*! /*!
Type of a 3D vector. Type of a 2D vector.
*/ */
typedef unspecified_type Vector_2; typedef unspecified_type Vector_2;
@ -42,12 +42,12 @@ public:
Construct_source_2 construct_source_2_object(); Construct_source_2 construct_source_2_object();
/*! /*!
A model of `CartesianConstIterator3`. A model of `CartesianConstIterator2`.
*/ */
typedef unspecified_type Cartesian_const_iterator_2; typedef unspecified_type Cartesian_const_iterator_2;
/*! /*!
A model of `ConstructCartesianConstIterator3`. A model of `ConstructCartesianConstIterator2`.
*/ */
typedef unspecified_type Construct_cartesian_const_iterator_2; typedef unspecified_type Construct_cartesian_const_iterator_2;

View File

@ -28,7 +28,7 @@ Value type of the `Squared_distance` functor.
typedef unspecified_type FT; typedef unspecified_type FT;
/*! /*!
Type of a 3D point. Type of a point.
*/ */
typedef unspecified_type Point; typedef unspecified_type Point;

View File

@ -46,11 +46,8 @@ struct AABB_traits_intersection_base_2<GeomTraits,false>{};
template <typename GeomTraits> template <typename GeomTraits>
struct AABB_traits_intersection_base_2<GeomTraits,true>{ struct AABB_traits_intersection_base_2<GeomTraits,true>{
typedef typename GeomTraits::Ray_2 Ray_2;
typedef typename GeomTraits::Ray_2 Ray; typedef typename GeomTraits::Ray_2 Ray;
typedef typename GeomTraits::Point_2 Point_2;
typedef typename GeomTraits::Point_2 Point; typedef typename GeomTraits::Point_2 Point;
typedef typename GeomTraits::Vector_2 Vector_2;
typedef typename GeomTraits::Vector_2 Vector; typedef typename GeomTraits::Vector_2 Vector;
typedef typename GeomTraits::FT FT; typedef typename GeomTraits::FT FT;
typedef typename GeomTraits::Cartesian_const_iterator_2 Cartesian_const_iterator_2; typedef typename GeomTraits::Cartesian_const_iterator_2 Cartesian_const_iterator_2;
@ -65,7 +62,7 @@ struct AABB_traits_intersection_base_2<GeomTraits,true>{
typedef typename CGAL::Bbox_2 Bounding_box; typedef typename CGAL::Bbox_2 Bounding_box;
struct Intersection_distance { struct Intersection_distance {
std::optional<FT> operator()(const Ray_2& ray, const Bounding_box& bbox) const { std::optional<FT> operator()(const Ray& ray, const Bounding_box& bbox) const {
FT t_near = -DBL_MAX; // std::numeric_limits<FT>::lowest(); C++1903 FT t_near = -DBL_MAX; // std::numeric_limits<FT>::lowest(); C++1903
FT t_far = DBL_MAX; FT t_far = DBL_MAX;
@ -73,8 +70,8 @@ struct AABB_traits_intersection_base_2<GeomTraits,true>{
= GeomTraits().construct_cartesian_const_iterator_2_object(); = GeomTraits().construct_cartesian_const_iterator_2_object();
const Construct_source_2 construct_source_2 = GeomTraits().construct_source_2_object(); const Construct_source_2 construct_source_2 = GeomTraits().construct_source_2_object();
const Construct_vector_2 construct_vector_2 = GeomTraits().construct_vector_2_object(); const Construct_vector_2 construct_vector_2 = GeomTraits().construct_vector_2_object();
const Point_2 source = construct_source_2(ray); const Point source = construct_source_2(ray);
const Vector_2 direction = construct_vector_2(ray); const Vector direction = construct_vector_2(ray);
Cartesian_const_iterator_2 source_iter = construct_cartesian_const_iterator_2(source); Cartesian_const_iterator_2 source_iter = construct_cartesian_const_iterator_2(source);
Cartesian_const_iterator_2 direction_iter = construct_cartesian_const_iterator_2(direction); Cartesian_const_iterator_2 direction_iter = construct_cartesian_const_iterator_2(direction);
@ -90,13 +87,6 @@ struct AABB_traits_intersection_base_2<GeomTraits,true>{
t_near = (std::max)(t_near, (std::min)(t1, t2)); t_near = (std::max)(t_near, (std::min)(t1, t2));
t_far = (std::min)(t_far, (std::max)(t1, t2)); t_far = (std::min)(t_far, (std::max)(t1, t2));
// if(t1 > t2)
// std::swap(t1, t2);
// if(t1 > t_near)
// t_near = t1;
// if(t2 < t_far)
// t_far = t2;
if(t_near > t_far || t_far < FT(0.)) if(t_near > t_far || t_far < FT(0.))
return std::nullopt; return std::nullopt;
} }
@ -190,13 +180,10 @@ public:
/// \name Types /// \name Types
/// @{ /// @{
/// Point query type.
typedef typename GeomTraits::Point_2 Point_2;
/// <summary> /// <summary>
/// point type /// point type
/// </summary> /// </summary>
typedef Point_2 Point; typedef typename GeomTraits::Point_2 Point;
/// additional types for the search tree, required by the RangeSearchTraits concept /// additional types for the search tree, required by the RangeSearchTraits concept
/// \bug This is not documented for now in the AABBTraits concept. /// \bug This is not documented for now in the AABBTraits concept.
@ -360,7 +347,7 @@ public:
// This should go down to the GeomTraits, i.e. the kernel // This should go down to the GeomTraits, i.e. the kernel
class Closest_point { class Closest_point {
typedef typename AT::Point_2 Point; typedef typename AT::Point Point;
typedef typename AT::Primitive Primitive; typedef typename AT::Primitive Primitive;
const AABB_traits_2<GeomTraits,AABBPrimitive, BboxMap>& m_traits; const AABB_traits_2<GeomTraits,AABBPrimitive, BboxMap>& m_traits;
public: public:
@ -384,7 +371,7 @@ public:
// do_intersect to something like does_contain (this is what we compute, // do_intersect to something like does_contain (this is what we compute,
// this is not the same do_intersect as the spherical kernel) // this is not the same do_intersect as the spherical kernel)
class Compare_distance { class Compare_distance {
typedef typename AT::Point_2 Point; typedef typename AT::Point Point;
typedef typename AT::FT FT; typedef typename AT::FT FT;
typedef typename AT::Primitive Primitive; typedef typename AT::Primitive Primitive;
public: public:

View File

@ -69,11 +69,8 @@ struct AABB_traits_intersection_base<GeomTraits,false>{};
template <typename GeomTraits> template <typename GeomTraits>
struct AABB_traits_intersection_base<GeomTraits,true>{ struct AABB_traits_intersection_base<GeomTraits,true>{
typedef typename GeomTraits::Ray_3 Ray_3;
typedef typename GeomTraits::Ray_3 Ray; typedef typename GeomTraits::Ray_3 Ray;
typedef typename GeomTraits::Point_3 Point_3;
typedef typename GeomTraits::Point_3 Point; typedef typename GeomTraits::Point_3 Point;
typedef typename GeomTraits::Vector_3 Vector_3;
typedef typename GeomTraits::Vector_3 Vector; typedef typename GeomTraits::Vector_3 Vector;
typedef typename GeomTraits::FT FT; typedef typename GeomTraits::FT FT;
typedef typename GeomTraits::Cartesian_const_iterator_3 Cartesian_const_iterator_3; typedef typename GeomTraits::Cartesian_const_iterator_3 Cartesian_const_iterator_3;
@ -88,7 +85,7 @@ struct AABB_traits_intersection_base<GeomTraits,true>{
typedef typename CGAL::Bbox_3 Bounding_box; typedef typename CGAL::Bbox_3 Bounding_box;
struct Intersection_distance { struct Intersection_distance {
std::optional<FT> operator()(const Ray_3& ray, const Bounding_box& bbox) const { std::optional<FT> operator()(const Ray& ray, const Bounding_box& bbox) const {
FT t_near = -DBL_MAX; // std::numeric_limits<FT>::lowest(); C++1903 FT t_near = -DBL_MAX; // std::numeric_limits<FT>::lowest(); C++1903
FT t_far = DBL_MAX; FT t_far = DBL_MAX;
@ -113,13 +110,6 @@ struct AABB_traits_intersection_base<GeomTraits,true>{
t_near = (std::max)(t_near, (std::min)(t1, t2)); t_near = (std::max)(t_near, (std::min)(t1, t2));
t_far = (std::min)(t_far, (std::max)(t1, t2)); t_far = (std::min)(t_far, (std::max)(t1, t2));
// if(t1 > t2)
// std::swap(t1, t2);
// if(t1 > t_near)
// t_near = t1;
// if(t2 < t_far)
// t_far = t2;
if(t_near > t_far || t_far < FT(0.)) if(t_near > t_far || t_far < FT(0.))
return std::nullopt; return std::nullopt;
} }
@ -213,11 +203,8 @@ public:
/// \name Types /// \name Types
/// @{ /// @{
/// Point query type. /// Point type
typedef typename GeomTraits::Point_3 Point_3; typedef typename GeomTraits::Point_3 Point; // because the AABB_tree is dimension agnostic
/// Poin type
typedef Point_3 Point; // because the AABB_tree is dimension agnostic
/// additional types for the search tree, required by the RangeSearchTraits concept /// additional types for the search tree, required by the RangeSearchTraits concept
/// \bug This is not documented for now in the AABBTraits concept. /// \bug This is not documented for now in the AABBTraits concept.
@ -384,7 +371,7 @@ public:
// This should go down to the GeomTraits, i.e. the kernel // This should go down to the GeomTraits, i.e. the kernel
class Closest_point { class Closest_point {
typedef typename AT::Point_3 Point; typedef typename AT::Point Point;
typedef typename AT::Primitive Primitive; typedef typename AT::Primitive Primitive;
const AABB_traits_3<GeomTraits,AABBPrimitive, BboxMap>& m_traits; const AABB_traits_3<GeomTraits,AABBPrimitive, BboxMap>& m_traits;
public: public:
@ -408,7 +395,7 @@ public:
// do_intersect to something like does_contain (this is what we compute, // do_intersect to something like does_contain (this is what we compute,
// this is not the same do_intersect as the spherical kernel) // this is not the same do_intersect as the spherical kernel)
class Compare_distance { class Compare_distance {
typedef typename AT::Point_3 Point; typedef typename AT::Point Point;
typedef typename AT::FT FT; typedef typename AT::FT FT;
typedef typename AT::Primitive Primitive; typedef typename AT::Primitive Primitive;
public: public:

View File

@ -204,7 +204,7 @@ std::optional< typename AABB_tree<AABBTraits>::template Intersection_and_primiti
AABB_tree<AABBTraits>::first_intersection(const Ray& query, AABB_tree<AABBTraits>::first_intersection(const Ray& query,
const SkipFunctor& skip) const { const SkipFunctor& skip) const {
static_assert(std::is_same<Ray, typename AABBTraits::Ray>::value, static_assert(std::is_same<Ray, typename AABBTraits::Ray>::value,
"Ray and Ray_3 must be the same type"); "Ray and AABBTraits::Ray must be the same type");
switch(size()) // copy-paste from AABB_tree::traversal switch(size()) // copy-paste from AABB_tree::traversal
{ {

View File

@ -59,7 +59,7 @@ template<typename AABBTraits, typename Query>
class First_intersection_traits class First_intersection_traits
{ {
typedef typename AABBTraits::FT FT; typedef typename AABBTraits::FT FT;
typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Point Point;
typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Primitive Primitive;
typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Bounding_box Bounding_box;
typedef typename AABBTraits::Primitive::Id Primitive_id; typedef typename AABBTraits::Primitive::Id Primitive_id;
@ -108,7 +108,7 @@ template<typename AABBTraits, typename Query, typename Output_iterator>
class Listing_intersection_traits class Listing_intersection_traits
{ {
typedef typename AABBTraits::FT FT; typedef typename AABBTraits::FT FT;
typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Point Point;
typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Primitive Primitive;
typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Bounding_box Bounding_box;
typedef typename AABBTraits::Primitive::Id Primitive_id; typedef typename AABBTraits::Primitive::Id Primitive_id;
@ -191,7 +191,7 @@ template<typename AABBTraits, typename Query>
class First_primitive_traits class First_primitive_traits
{ {
typedef typename AABBTraits::FT FT; typedef typename AABBTraits::FT FT;
typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Point Point;
typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Primitive Primitive;
typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Bounding_box Bounding_box;
typedef typename AABBTraits::Primitive::Id Primitive_id; typedef typename AABBTraits::Primitive::Id Primitive_id;
@ -237,7 +237,7 @@ template<typename AABBTraits, typename Query>
class Do_intersect_traits class Do_intersect_traits
{ {
typedef typename AABBTraits::FT FT; typedef typename AABBTraits::FT FT;
typedef typename AABBTraits::Point_3 Point; typedef typename AABBTraits::Point Point;
typedef typename AABBTraits::Primitive Primitive; typedef typename AABBTraits::Primitive Primitive;
typedef typename AABBTraits::Bounding_box Bounding_box; typedef typename AABBTraits::Bounding_box Bounding_box;
typedef typename AABBTraits::Primitive::Id Primitive_id; typedef typename AABBTraits::Primitive::Id Primitive_id;

View File

@ -322,7 +322,7 @@ class Naive_implementations
typedef typename Traits::Object_and_primitive_id Object_and_primitive_id; typedef typename Traits::Object_and_primitive_id Object_and_primitive_id;
typedef typename Pr::Id Primitive_id; typedef typename Pr::Id Primitive_id;
typedef typename Traits::FT FT; typedef typename Traits::FT FT;
typedef typename Traits::Point_3 Point; typedef typename Traits::Point Point;
typedef typename Traits::Point_and_primitive_id Point_and_primitive_id; typedef typename Traits::Point_and_primitive_id Point_and_primitive_id;
typedef std::optional<Object_and_primitive_id> Intersection_result; typedef std::optional<Object_and_primitive_id> Intersection_result;