mirror of https://github.com/CGAL/cgal
Merge remote-tracking branch 'cgal/releases/CGAL-5.0-branch'
This commit is contained in:
commit
84ec799ca1
|
|
@ -73,17 +73,13 @@ public:
|
|||
}
|
||||
|
||||
void extend(const Point_3& p) {
|
||||
FT q[3];
|
||||
q[0] = p.x();
|
||||
q[1] = p.y();
|
||||
q[2] = p.z();
|
||||
FT q[3] = { p.x(), p.y(), p.z() };
|
||||
|
||||
if(initialized)
|
||||
Base::extend(q);
|
||||
else {
|
||||
initialized = true;
|
||||
std::copy( q, q + 3, Base::lo );
|
||||
std::copy( q, q + 3, Base::hi );
|
||||
*this = Bounding_box_3(q);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -229,9 +229,10 @@ public:
|
|||
Vertex_handle v = this->sncp()->new_vertex(p , boundary);
|
||||
CGAL_NEF_TRACEN( v->point());
|
||||
SM_decorator SD(&*v);
|
||||
Sphere_point sp[] = { Sphere_point(NT(-x), 0, 0),
|
||||
Sphere_point(0, NT(-y), 0),
|
||||
Sphere_point(0, 0, NT(-z)) };
|
||||
const NT zero(0);
|
||||
Sphere_point sp[] = { Sphere_point(NT(-x), zero, zero),
|
||||
Sphere_point(zero, NT(-y), zero),
|
||||
Sphere_point(zero, zero, NT(-z)) };
|
||||
|
||||
/* create box vertices */
|
||||
SVertex_handle sv[3];
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ namespace Nef_3_internal{
|
|||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_Exact_kernel,Exact_kernel,false)
|
||||
|
||||
template <class R,bool has_exact_kernel=Has_nested_Exact_kernel<R>::value, class FT = typename R::RT, class Kernel_tag=typename R::Kernel_tag>
|
||||
template <class R,bool has_exact_kernel=Has_nested_Exact_kernel<R>::value &&
|
||||
!std::is_floating_point<typename R::RT>::value, class FT = typename R::RT, class Kernel_tag=typename R::Kernel_tag>
|
||||
struct Type_converter{
|
||||
typedef const CGAL::Point_3<R>& Point_3;
|
||||
typedef const CGAL::Vector_3<R>& Vector_3;
|
||||
|
|
@ -670,8 +671,9 @@ template<typename Tag, typename Kernel> class Geometry_io;
|
|||
template<typename Kernel>
|
||||
class Geometry_io<Cartesian_tag, Kernel> {
|
||||
public:
|
||||
template <typename EK, typename K> static
|
||||
typename EK::Point_3 read_point(std::istream& in) {
|
||||
|
||||
template <typename EK, typename K, typename Compose_> static
|
||||
typename EK::Point_3 read_point_impl(std::istream& in, Compose_) {
|
||||
typedef Fraction_traits<typename K::FT> FracTraits;
|
||||
typename FracTraits::Type hx, hy, hz, hw;
|
||||
typename FracTraits::Numerator_type num;
|
||||
|
|
@ -688,8 +690,8 @@ class Geometry_io<Cartesian_tag, Kernel> {
|
|||
return typename EK::Point_3(hx,hy,hz,hw);
|
||||
}
|
||||
|
||||
template <typename EK, typename K> static
|
||||
typename EK::Plane_3 read_plane(std::istream& in) {
|
||||
template <typename EK, typename K, typename Compose_> static
|
||||
typename EK::Plane_3 read_plane_impl(std::istream& in, Compose_) {
|
||||
typedef Fraction_traits<typename K::FT> FracTraits;
|
||||
typename FracTraits::Type a, b, c, d;
|
||||
typename FracTraits::Numerator_type num;
|
||||
|
|
@ -706,8 +708,32 @@ class Geometry_io<Cartesian_tag, Kernel> {
|
|||
return typename EK::Plane_3(a,b,c,d);
|
||||
}
|
||||
|
||||
template <typename R> static
|
||||
void print_point_impl(std::ostream& out, const CGAL::Point_3<R> p) {
|
||||
template <typename EK, typename K> static
|
||||
typename EK::Point_3 read_point_impl(std::istream& in, Null_functor) {
|
||||
typename K::FT hx, hy, hz, hw;
|
||||
in >> hx >> hy >> hz >> hw;
|
||||
return typename EK::Point_3(hx,hy,hz,hw);
|
||||
}
|
||||
|
||||
template <typename EK, typename K> static
|
||||
typename EK::Plane_3 read_plane_impl(std::istream& in, Null_functor) {
|
||||
typename K::FT a, b, c, d;
|
||||
in >> a >> b >> c >> d;
|
||||
return typename EK::Plane_3(a,b,c,d);
|
||||
}
|
||||
|
||||
template <typename EK, typename K> static
|
||||
typename EK::Point_3 read_point(std::istream& in) {
|
||||
return read_point_impl<EK,K>(in, typename Fraction_traits<typename K::FT>::Compose());
|
||||
}
|
||||
|
||||
template <typename EK, typename K> static
|
||||
typename EK::Plane_3 read_plane(std::istream& in) {
|
||||
return read_plane_impl<EK,K>(in, typename Fraction_traits<typename K::FT>::Compose());
|
||||
}
|
||||
|
||||
template <typename R, typename Decompose_> static
|
||||
void print_point_impl(std::ostream& out, const CGAL::Point_3<R> p, Decompose_) {
|
||||
typedef Fraction_traits<typename R::FT> FracTraits;
|
||||
typedef std::vector<typename FracTraits::Numerator_type> NV;
|
||||
|
||||
|
|
@ -737,8 +763,8 @@ class Geometry_io<Cartesian_tag, Kernel> {
|
|||
<< vec[2] << " " << vec[3];
|
||||
}
|
||||
|
||||
template <typename R> static
|
||||
void print_vector_impl(std::ostream& out, const CGAL::Vector_3<R> p) {
|
||||
template <typename R, typename Decompose_> static
|
||||
void print_vector_impl(std::ostream& out, const CGAL::Vector_3<R> p, Decompose_) {
|
||||
typedef Fraction_traits<typename R::FT> FracTraits;
|
||||
typedef typename FracTraits::Numerator_type NumType;
|
||||
typedef std::vector<NumType> NV;
|
||||
|
|
@ -766,8 +792,8 @@ class Geometry_io<Cartesian_tag, Kernel> {
|
|||
<< vec[2] << " " << NumType(1);
|
||||
}
|
||||
|
||||
template <typename R> static
|
||||
void print_plane_impl(std::ostream& out, const CGAL::Plane_3<R> p) {
|
||||
template <typename R, typename Decompose_> static
|
||||
void print_plane_impl(std::ostream& out, const CGAL::Plane_3<R> p, Decompose_) {
|
||||
typedef Fraction_traits<typename R::FT> FracTraits;
|
||||
typedef std::vector<typename FracTraits::Numerator_type> NV;
|
||||
|
||||
|
|
@ -803,19 +829,37 @@ class Geometry_io<Cartesian_tag, Kernel> {
|
|||
<< vec[2] << " " << vec[3];
|
||||
}
|
||||
|
||||
template <typename R> static
|
||||
void print_point_impl(std::ostream& out, const CGAL::Point_3<R> p, Null_functor)
|
||||
{
|
||||
out << p.x() << " " << p.y() << " " << p.z() << " " << 1;
|
||||
}
|
||||
|
||||
template <typename R> static
|
||||
void print_vector_impl(std::ostream& out, const CGAL::Vector_3<R> v, Null_functor)
|
||||
{
|
||||
out << v.x() << " " << v.y() << " " << v.z() << " " << 1;
|
||||
}
|
||||
|
||||
template <typename R> static
|
||||
void print_plane_impl(std::ostream& out, const CGAL::Plane_3<R> p, Null_functor)
|
||||
{
|
||||
out << p.a() << " " << p.b() << " " << p.c() << " " << p.d();
|
||||
}
|
||||
|
||||
template <class R> static
|
||||
void print_point(std::ostream& out, const CGAL::Point_3<R>& p) {
|
||||
print_point_impl(out, Nef_3_internal::get_point(p) );
|
||||
print_point_impl(out, Nef_3_internal::get_point(p), typename Fraction_traits<typename R::FT>::Decompose() );
|
||||
}
|
||||
|
||||
template <class R> static
|
||||
void print_vector(std::ostream& out, const CGAL::Vector_3<R>& v) {
|
||||
print_vector_impl(out, Nef_3_internal::get_vector(v) );
|
||||
print_vector_impl(out, Nef_3_internal::get_vector(v), typename Fraction_traits<typename R::FT>::Decompose() );
|
||||
}
|
||||
|
||||
template <class R> static
|
||||
void print_plane(std::ostream& out, const CGAL::Plane_3<R>& p) {
|
||||
print_plane_impl(out, Nef_3_internal::get_plane(p) );
|
||||
print_plane_impl(out, Nef_3_internal::get_plane(p), typename Fraction_traits<typename R::FT>::Decompose() );
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -563,7 +563,7 @@ public:
|
|||
Partial_facet pf;
|
||||
#endif
|
||||
bool hit = false;
|
||||
Point_3 eor; // 'end of ray', the latest ray's hit point
|
||||
Point_3 eor = CGAL::ORIGIN; // 'end of ray', the latest ray's hit point
|
||||
Objects_along_ray objects = candidate_provider->objects_along_ray(ray);
|
||||
Objects_along_ray_iterator objects_iterator = objects.begin();
|
||||
while( !hit && objects_iterator != objects.end()) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ if ( CGAL_FOUND )
|
|||
execution___of__test_nef_3_io_Cartesian
|
||||
execution___of__test_nef_3_io_Cartesian_Lazy
|
||||
execution___of__test_nef_3_io_EPEC
|
||||
execution___of__test_nef_3_io_EPIC
|
||||
execution___of__test_nef_3_io_Homogeneous
|
||||
execution___of__test_nef_3_io_Homogenoeus_Lazy
|
||||
execution___of__test_with_extended_homogeneous
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/Nef_polyhedron_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel EPEC;
|
||||
|
||||
template <class Kernel>
|
||||
void test_write_read()
|
||||
{
|
||||
typedef CGAL::Nef_polyhedron_3< Kernel > Nef_polyhedron;
|
||||
typedef CGAL::Polyhedron_3< Kernel > Polyhedron;
|
||||
typedef typename Kernel::Point_3 Point;
|
||||
|
||||
typename Kernel::RT n, d;
|
||||
std::istringstream str_n("5");
|
||||
str_n >> n;
|
||||
std::istringstream str_d("1");
|
||||
str_d >> d;
|
||||
|
||||
Point p(n, 0, 0, d);
|
||||
Point q(0, n, 0, d);
|
||||
Point r(0, 0, n, d);
|
||||
Point s(0, 0, 0, 1);
|
||||
|
||||
std::cout << " build...\n";
|
||||
Polyhedron P;
|
||||
P.make_tetrahedron( p, q, r, s);
|
||||
Nef_polyhedron nef_1( P );
|
||||
|
||||
std::cout << " write...\n";
|
||||
std::ofstream out ("temp.nef");
|
||||
out << std::setprecision(17) << nef_1;
|
||||
out.close();
|
||||
|
||||
std::cout << " read...\n";
|
||||
std::ifstream in ("temp.nef");
|
||||
Nef_polyhedron nef_2;
|
||||
in >> nef_2;
|
||||
in.close();
|
||||
|
||||
std::cout << " check...\n";
|
||||
assert( nef_1 == nef_2);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Testing Exact_predicates_inexact_constructions_kernel\n";
|
||||
test_write_read<EPEC>();
|
||||
std::cout << "Testing Simple_cartesian<double>\n";
|
||||
test_write_read<CGAL::Simple_cartesian<double>>();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue