Stream_support: Fix for Epeck

This commit is contained in:
Andreas Fabri 2025-09-18 09:19:19 +01:00
parent fdef97e88e
commit 967aee62e9
3 changed files with 19 additions and 5 deletions

View File

@ -2650,7 +2650,7 @@ namespace CommonKernelFunctors {
{
CGAL_kernel_precondition(! K().collinear_3_object()(p,q,r) );
Vector_3 res = CGAL::cross_product(q-p, r-p);
res = res / CGAL::sqrt(res.squared_length());
res = res / CGAL::approximate_sqrt(res.squared_length());
return res;
}
};

View File

@ -319,10 +319,10 @@ bool write_STL(std::ostream& os,
const Vector_3 n = collinear(p,q,r) ? Vector_3(1,0,0) : unit_normal(p,q,r);
const float coords[12] = { static_cast<float>(n.x()), static_cast<float>(n.y()), static_cast<float>(n.z()),
static_cast<float>(p.x()), static_cast<float>(p.y()), static_cast<float>(p.z()),
static_cast<float>(q.x()), static_cast<float>(q.y()), static_cast<float>(q.z()),
static_cast<float>(r.x()), static_cast<float>(r.y()), static_cast<float>(r.z()) };
const float coords[12] = { static_cast<float>(to_double(n.x())), static_cast<float>(to_double(n.y())), static_cast<float>(to_double(n.z())),
static_cast<float>(to_double(p.x())), static_cast<float>(to_double(p.y())), static_cast<float>(to_double(p.z())),
static_cast<float>(to_double(q.x())), static_cast<float>(to_double(q.y())), static_cast<float>(to_double(q.z())),
static_cast<float>(to_double(r.x())), static_cast<float>(to_double(r.y())), static_cast<float>(to_double(r.z())) };
for(int i=0; i<12; ++i)
os.write(reinterpret_cast<const char *>(&coords[i]), sizeof(coords[i]));

View File

@ -0,0 +1,14 @@
#include <array>
#include <vector>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/IO/polygon_soup_io.h>
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
int main() {
std::vector<Kernel::Point_3> points;
std::vector<std::array<std::size_t, 3>> polygons;
CGAL::IO::write_polygon_soup("xxx.off", points, polygons, CGAL::parameters::stream_precision(17));
return 0;
}