mirror of https://github.com/CGAL/cgal
Fix return type of point on plane constructions (#8803)
## Summary of Changes The main issue is that the functions `point_on_plane()` and `projection_plane()` return a `PointC3`, whereas you could have a kernel that uses a custom point type with `PlaneC3` as its plane type. The correct return type is thus the kernel's point. I moved the code into PlaneC3, but the really clean fix would be to have all of this into the function object `Construct_point_on_3`. However, a lot of required changes immediately get pulled: `Construct_point_on_3` does not have the Cartesian / Homogeneous split, other overloads do not have a nice implementation and instead use directly the members in the Rep, etc. ## Release Management * Affected package(s): `Cartesian_kernel` * Issue(s) solved (if any): - * Feature/Small Feature (if any): - * License and copyright ownership: no change
This commit is contained in:
commit
7b0c8bd405
|
|
@ -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 >
|
||||||
|
|
|
||||||
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
Loading…
Reference in New Issue