Fix return type of point on plane constructions

You could legally have a kernel that uses a custom point type,
but PlaneC3 as its plane type.
This commit is contained in:
Mael Rouxel-Labbé 2025-03-25 22:59:55 +01:00
parent 6257109821
commit df6919026e
3 changed files with 10 additions and 53 deletions

View File

@ -169,7 +169,9 @@ inline
typename PlaneC3<R>::Point_3 typename PlaneC3<R>::Point_3
PlaneC3<R>::point() const PlaneC3<R>::point() const
{ {
return point_on_plane(*this); FT x, y, z;
point_on_planeC3(a(), b(), c(), d(), x, y, z);
return R().construct_point_3_object()(x, y, z);
} }
template < class R > template < class R >
@ -178,7 +180,13 @@ typename PlaneC3<R>::Point_3
PlaneC3<R>:: PlaneC3<R>::
projection(const typename PlaneC3<R>::Point_3 &p) const projection(const typename PlaneC3<R>::Point_3 &p) const
{ {
return projection_plane(p, *this); FT x, y, z;
projection_planeC3(a(), b(), c(), d(),
R().compute_x_3_object()(p),
R().compute_y_3_object()(p),
R().compute_z_3_object()(p),
x, y, z);
return R().construct_point_3_object()(x, y, z);
} }
template < class R > template < class R >

View File

@ -17,7 +17,6 @@
#ifndef CGAL_CARTESIAN_BASIC_CONSTRUCTIONS_3_H #ifndef CGAL_CARTESIAN_BASIC_CONSTRUCTIONS_3_H
#define CGAL_CARTESIAN_BASIC_CONSTRUCTIONS_3_H #define CGAL_CARTESIAN_BASIC_CONSTRUCTIONS_3_H
#include <CGAL/Cartesian/point_constructions_3.h>
#include <CGAL/Cartesian/plane_constructions_3.h> #include <CGAL/Cartesian/plane_constructions_3.h>
#include <CGAL/Cartesian/ft_constructions_3.h> #include <CGAL/Cartesian/ft_constructions_3.h>

View File

@ -1,50 +0,0 @@
// Copyright (c) 2000
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Herve Bronnimann
#ifndef CGAL_CARTESIAN_POINT_CONSTRUCTIONS_3_H
#define CGAL_CARTESIAN_POINT_CONSTRUCTIONS_3_H
#include <CGAL/Cartesian/Point_3.h>
#include <CGAL/constructions/kernel_ftC3.h>
namespace CGAL {
template <class K>
CGAL_KERNEL_LARGE_INLINE
PointC3<K>
point_on_plane(const PlaneC3<K> &p)
{
typename K::FT x, y, z;
point_on_planeC3(p.a(), p.b(), p.c(), p.d(), x, y, z);
return PointC3<K>(x, y, z);
}
template <class K>
CGAL_KERNEL_LARGE_INLINE
PointC3<K>
projection_plane(const PointC3<K> &p,
const PlaneC3<K> &h)
{
typename K::FT x, y, z;
projection_planeC3(h.a(), h.b(), h.c(), h.d(),
p.x(), p.y(), p.z(),
x, y, z);
return PointC3<K>(x, y, z);
}
} //namespace CGAL
#endif // CGAL_CARTESIAN_POINT_CONSTRUCTIONS_3_H