partial cleanup of issue #595

This commit is contained in:
Andreas Fabri 2016-01-08 17:55:08 +01:00
parent 32a3972c33
commit c32b00acce
10 changed files with 0 additions and 796 deletions

View File

@ -1,47 +0,0 @@
// Copyright (c) 2003,2004 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Menelaos Karavelas <mkaravel@iacm.forth.gr>
#ifndef CGAL_QT_WIDGET_APOLLONIUS_SITE_2_H
#define CGAL_QT_WIDGET_APOLLONIUS_SITE_2_H
#include <CGAL/Apollonius_site_2.h>
#include <CGAL/IO/Qt_widget.h>
namespace CGAL {
template <class K>
Qt_widget&
operator<<(Qt_widget &qt_w, const Apollonius_site_2<K>& wp)
{
typedef typename K::Circle_2 Circle_2;
typedef typename K::Point_2 Point_2;
Point_2 p(wp.point());
Circle_2 c(p, CGAL::square(wp.weight()));
return qt_w << p << c;
}
} //namespace CGAL
#include <CGAL/IO/Qt_widget_Hyperbola_2.h>
#endif // CGAL_QT_WIDGET_APOLLONIUS_SITE_2_H

View File

@ -1,48 +0,0 @@
// Copyright (c) 2003,2004 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Menelaos Karavelas <mkaravel@iacm.forth.gr>
#ifndef CGAL_QT_WIDGET_HYPERBOLA_2_H
#define CGAL_QT_WIDGET_HYPERBOLA_2_H
#include <CGAL/Hyperbola_2.h>
#include <CGAL/Hyperbola_ray_2.h>
#include <CGAL/IO/Qt_widget.h>
namespace CGAL {
template< class Gt >
inline
Qt_widget& operator<<(Qt_widget& s, const Hyperbola_2< Gt > &H)
{
H.draw_qt(s);
return s;
}
template< class Gt >
inline
Qt_widget& operator<<(Qt_widget &s, Hyperbola_ray_2<Gt> &H)
{
H.draw_qt(s);
return s;
}
} //namespace CGAL
#endif // CGAL_QT_WIDGET_HYPERBOLA_2_H

View File

@ -1,134 +0,0 @@
// Copyright (c) 2010,2011 Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Pavel Emeliyanenko <asm@mpi-sb.mpg.de>
//
// ============================================================================
/*!\file CGAL/IO/Qt_widget_Curve_renderer_2.h
* \brief
* provides \c CGAL::Qt_widget interface for the curve renderer
*/
#ifndef CGAL_QT_WIDGET_CURVE_RENDERER_2_H
#define CGAL_QT_WIDGET_CURVE_RENDERER_2_H
#include <qpainter.h>
#include <CGAL/IO/Qt_widget.h>
#include <CGAL/Curved_kernel_via_analysis_2/Curve_renderer_facade.h>
namespace CGAL {
#define CGAL_REND_PT_RADIUS 6
/*! \brief
* outputs a curve arc to \c Qt_widget
*/
template <class CKvA_2>
Qt_widget& operator << (Qt_widget& ws, const internal::Arc_2< CKvA_2 >& arc) {
typedef Curve_renderer_facade<CKvA_2> Facade;
typedef std::pair< int, int > Coord_2;
typedef std::vector< Coord_2 > Coord_vec_2;
boost::optional < Coord_2 > p1, p2;
std::list<Coord_vec_2> points;
//Facade::setup(CGAL::Bbox_2(-100, -100, 10, -10),
// 330, 270);
Facade::setup(CGAL::Bbox_2(ws.x_min(), ws.y_min(), ws.x_max(), ws.y_max()),
ws.width(), ws.height());
Facade::instance().draw(arc, points, &p1, &p2);
if(points.empty())
return ws;
QPainter *ppnt = &ws.get_painter();
int height = ws.height();
// std::cerr << ws.width() << " and " << ws.height() << "\n";
typename std::list<Coord_vec_2>::const_iterator lit = points.begin();
//ppnt->moveTo((*p1).first, height - (*p1).second);
while(lit != points.end()) {
const Coord_vec_2& vec = *lit;
typename Coord_vec_2::const_iterator vit = vec.begin();
//std::cerr << "(" << vit->first << "; " << vit->second << ")\n";
// if(lit == points.begin() &&*/ vit != vec.end()) {
// ppnt->lineTo(vit->first, height - vit->second);
// vit++;
// }
if(vit != vec.end())
ppnt->moveTo(vit->first, height - vit->second);
while(vit != vec.end()) {
ppnt->lineTo(vit->first, height - vit->second);
vit++;
//std::cerr << "(" << vit->e0 << "; " << vit->e1 << "\n";
}
lit++;
}
//ppnt->lineTo((*p2).first, height - (*p2).second);
QPen old_pen = ppnt->pen();
ppnt->setPen(QPen(Qt::NoPen)); // avoid drawing outlines
// draw with the current brush attributes
//std::cerr << "endpts1: (" << (*p1).first << "; " << (*p1).second << "\n";
//std::cerr << "endpts2: (" << (*p2).first << "; " << (*p2).second << "\n";
unsigned sz = CGAL_REND_PT_RADIUS;
ppnt->drawEllipse((*p1).first - sz, height-(*p1).second - sz, sz*2, sz*2);
ppnt->drawEllipse((*p2).first - sz, height-(*p2).second - sz, sz*2, sz*2);
ppnt->setPen(old_pen);
return ws;
}
/*! \brief
* outputs a curve point to \c Qt_widget
*/
template <class CKvA_2>
Qt_widget& operator << (Qt_widget& ws, const internal::Point_2< CKvA_2 >& pt) {
typedef Curve_renderer_facade<CKvA_2> Facade;
std::pair< int, int > coord;
Facade::setup(CGAL::Bbox_2(ws.x_min(), ws.y_min(), ws.x_max(), ws.y_max()),
ws.width(), ws.height());
if(!Facade::instance().draw(pt, coord)) {
return ws;
}
QPainter *ppnt = &ws.get_painter();
QPen old_pen = ppnt->pen();
ppnt->setPen(QPen(Qt::NoPen));
unsigned sz = CGAL_REND_PT_RADIUS;
ppnt->drawEllipse(coord.first - sz, ws.height() - coord.second - sz,
sz*2, sz*2);
ppnt->setPen(old_pen);
return ws;
}
} //namespace CGAL
#endif // CGAL_QT_WIDGET_CURVE_RENDERER_2_H

View File

@ -1,112 +0,0 @@
// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_QT_WIDGET_CONIC_ARC_2_H
#define CGAL_QT_WIDGET_CONIC_ARC_2_H
#include <CGAL/IO/Qt_widget.h>
#include <CGAL/Arr_conic_traits_2.h>
#include <list>
namespace CGAL {
/*!
* Draw an x-monotone conic arc.
*/
template <class ConicArc>
Qt_widget& operator<< (Qt_widget& ws,
const _Conic_x_monotone_arc_2<ConicArc>& cv)
{
// Get the co-ordinates of the curve's source and target.
const double sx = CGAL::to_double(cv.source().x());
const double sy = CGAL::to_double(cv.source().y());
const double tx = CGAL::to_double(cv.target().x());
const double ty = CGAL::to_double(cv.target().y());
if (cv.orientation() == COLLINEAR)
{
// The curve is a segment - simply draw it.
ws.get_painter().drawLine(ws.x_pixel(sx), ws.y_pixel(sy),
ws.x_pixel(tx), ws.y_pixel(ty));
return (ws);
}
// Draw a curves conic arc: As the arc is x-monotone, its source and its
// target has the extreme x-coordinates.
const bool is_source_left = (sx < tx);
const int x_min = is_source_left ? ws.x_pixel(sx) : ws.x_pixel(tx);
const int x_max = is_source_left ? ws.x_pixel(tx) : ws.x_pixel(sx);
const int n = x_max - x_min + 1;
if (n <= 0)
return (ws);
typedef std::pair<double, double> App_point_2;
int i;
App_point_2 *pts = new App_point_2 [n + 1];
cv.polyline_approximation (n, pts);
ws.get_painter().moveTo (ws.x_pixel(pts[0].first),
ws.y_pixel(pts[0].second));
for (i = 1; i <= n; i++)
{
ws.get_painter().lineTo (ws.x_pixel(pts[i].first),
ws.y_pixel(pts[i].second));
}
delete[] pts;
return (ws);
}
/*!
* Draw a conic arc.
*/
template <class Rat_kernel, class Alg_kernel, class Nt_traits>
Qt_widget& operator<<
(Qt_widget& ws,
const typename Arr_conic_traits_2<Rat_kernel,
Alg_kernel,
Nt_traits>::Curve_2& cv)
{
typedef Arr_conic_traits_2<Rat_kernel,
Alg_kernel,
Nt_traits> Conic_traits_2;
typedef typename Conic_traits_2::X_monotone_curve_2 X_monotone_conic_arc_2;
// Break the arc into x-monotone sub-curves and draw each one separately.
Conic_traits_2 traits;
std::list<X_monotone_conic_arc_2> x_arcs;
typename std::list<X_monotone_conic_arc_2>::const_iterator x_iter;
traits.curve_make_x_monotone (cv,
std::back_inserter (x_arcs));
for (x_iter = x_arcs.begin(); x_iter != x_arcs.end(); ++x_iter)
ws << *x_iter;
return (ws);
}
} //namespace CGAL
#endif

View File

@ -1,55 +0,0 @@
// Copyright (c) 2006,2007,2009,2010,2011 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Date$
//
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_QT_WIDGET_LINEAR_OBJECT_2_H
#define CGAL_QT_WIDGET_LINEAR_OBJECT_2_H
#include <CGAL/IO/Qt_widget.h>
#include <CGAL/Arr_linear_traits_2.h>
namespace CGAL {
/*!
* Export a polyline to a window stream
*/
template <class K>
Qt_widget & operator<<(Qt_widget & ws, const Arr_linear_object_2<K> & o)
{
if(o.is_segment())
{
ws << o.segment();
return ws;
}
if(o.is_ray())
{
ws << o.ray();
return ws;
}
CGAL_assertion(o.is_line());
ws << o.line();
return ws;
}
} //namespace CGAL
#endif

View File

@ -1,43 +0,0 @@
// Copyright (c) 2005,2006,2007,2009,2010,2011 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// $Date$
//
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
#ifndef CGAL_QT_WIDGET_POLYLINE_2_H
#define CGAL_QT_WIDGET_POLYLINE_2_H
#include <CGAL/IO/Qt_widget.h>
#include <CGAL/Arr_traits_2/Polyline_2.h>
namespace CGAL {
/*!
* Export a polyline to a window stream
*/
template <class T_SegmentTraits>
Qt_widget & operator<<(Qt_widget & ws, const _Polyline_2<T_SegmentTraits> & cv)
{
for (unsigned int i = 0; i < cv.size(); ++i) ws << cv[i];
return ws;
}
} //namespace CGAL
#endif

View File

@ -1,73 +0,0 @@
// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Monique Teillaud, Sylvain Pion, Radu Ursu
// Partially supported by the IST Programme of the EU as a Shared-cost
// RTD (FET Open) Project under Contract No IST-2000-26473
// (ECG - Effective Computational Geometry for Curves and Surfaces)
// and a STREP (FET Open) Project under Contract No IST-006413
// (ACS -- Algorithms for Complex Shapes)
#ifndef CGAL_IO_QT_WIDGET_CIRCULAR_ARC_2_H
#define CGAL_IO_QT_WIDGET_CIRCULAR_ARC_2_H
#include <CGAL/IO/Qt_widget.h>
#include <CGAL/Circular_arc_2.h>
#include <cmath>
namespace CGAL {
template < typename CK >
CGAL::Qt_widget &
operator<<(CGAL::Qt_widget & widget, const CGAL::Circular_arc_2<CK> &arc)
{
const typename CK::Circle_2 & circ = arc.supporting_circle();
//typename CK::Circle_2 circ = arc.supporting_circle();
const typename CK::Point_2 & center = circ.center();
const typename CK::Circular_arc_point_2 & source = arc.source();
const typename CK::Circular_arc_point_2 & target = arc.target();
double rad = std::sqrt(CGAL::to_double(circ.squared_radius()));
int x_screen = widget.x_pixel(CGAL::to_double(center.x()));
int y_screen = widget.y_pixel(CGAL::to_double(center.y()));
int x_screen_b = widget.x_pixel(CGAL::to_double(center.x()) + rad);
int radius = x_screen_b - x_screen;
double a = std::atan2( to_double(source.y() - center.y()),
to_double(source.x() - center.x()));
double a2p = std::atan2( to_double(target.y() - center.y()),
to_double(target.x() - center.x()));
if (a2p <= a)
a2p += 2 * CGAL_PI;
double alen2 = a2p - a;
double diff = 180/CGAL_PI*16;
widget.get_painter().drawArc(x_screen - radius,
y_screen - radius,
2 * radius, 2 * radius,
(int)(a * diff),
(int)(alen2 * diff));
return widget;
}
} // namespace CGAL
#endif // CGAL_IO_QT_WIDGET_CIRCULAR_ARC_2_H

View File

@ -1,44 +0,0 @@
// Copyright (c) 2003-2008 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Monique Teillaud, Sylvain Pion
// Partially supported by the IST Programme of the EU as a Shared-cost
// RTD (FET Open) Project under Contract No IST-2000-26473
// (ECG - Effective Computational Geometry for Curves and Surfaces)
// and a STREP (FET Open) Project under Contract No IST-006413
// (ACS -- Algorithms for Complex Shapes)
#ifndef CGAL_IO_QT_WIDGET_CIRCULAR_ARC_ENDPOINT_2_H
#define CGAL_IO_QT_WIDGET_CIRCULAR_ARC_ENDPOINT_2_H
#include <CGAL/IO/Qt_widget.h>
#include <CGAL/Circular_arc_point_2.h>
namespace CGAL {
template < typename CK >
CGAL::Qt_widget &
operator<<(CGAL::Qt_widget & widget, const CGAL::Circular_arc_point_2<CK> &p)
{
typedef typename CK::Point_2 Point_2;
return widget << Point_2(to_double(p.x()), to_double(p.y()));
}
} // namespace CGAL
#endif // CGAL_IO_QT_WIDGET_CIRCULAR_ARC_ENDPOINT_2_H

View File

@ -1,233 +0,0 @@
// Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Michael Seel <seel@mpi-sb.mpg.de>
// Miguel Granados <granados@mpi-sb.mpg.de>
// Susan Hert <hert@mpi-sb.mpg.de>
// Lutz Kettner <kettner@mpi-sb.mpg.de>
#ifndef CGAL_SNC_RAY_SHOOTER_H
#define CGAL_SNC_RAY_SHOOTER_H
#include <CGAL/basic.h>
#include <CGAL/functional.h>
#include <CGAL/function_objects.h>
#include <CGAL/Nef_3/Pluecker_line_3.h>
#include <CGAL/Nef_3/SNC_decorator.h>
#include <CGAL/Nef_3/SNC_SM_overlayer.h>
#include <CGAL/Nef_S2/SM_point_locator.h>
#include <CGAL/Nef_3/SNC_FM_decorator.h>
#include <CGAL/Nef_3/SNC_intersection.h>
#ifdef SM_VISUALIZOR
#include <CGAL/Nef_3/SNC_SM_visualizor.h>
#endif // SM_VISUALIZOR
#include <map>
#include <list>
#undef CGAL_NEF_DEBUG
#define CGAL_NEF_DEBUG 37
#include <CGAL/Nef_2/debug.h>
#ifndef CGAL_I_DO_WANT_TO_USE_GENINFO
#include <boost/any.hpp>
#endif
namespace CGAL {
// ----------------------------------------------------------------------------
// SNC_ray_shooting
// ----------------------------------------------------------------------------
/*{\Manpage{SNC_ray_shooting}{SNC}{ray shoot functionality}{O}}*/
template <typename SNC_decorator>
class SNC_ray_shooter : public SNC_decorator
{
protected:
typedef typename SNC_decorator::SNC_structure SNC_structure;
typedef SNC_ray_shooter<SNC_decorator> Self;
typedef SNC_decorator Base;
public:
typedef typename SNC_decorator::Decorator_traits Decorator_traits;
typedef typename Decorator_traits::SM_decorator SM_decorator;
typedef SM_point_locator<SM_decorator> SM_point_locator;
typedef SNC_intersection<SNC_structure> SNC_intersection;
typedef typename Decorator_traits::Vertex_handle Vertex_handle;
typedef typename Decorator_traits::Halfedge_handle Halfedge_handle;
typedef typename Decorator_traits::Halffacet_handle Halffacet_handle;
typedef typename Decorator_traits::Volume_handle Volume_handle;
typedef typename Decorator_traits::SVertex_handle SVertex_handle;
typedef typename Decorator_traits::SHalfedge_handle SHalfedge_handle;
typedef typename Decorator_traits::SFace_handle SFace_handle;
typedef typename Decorator_traits::SHalfloop_handle SHalfloop_handle;
typedef typename SNC_structure::Object_handle Object_handle;
typedef typename SNC_structure::Kernel Kernel;
typedef typename SNC_structure::Point_3 Point_3;
typedef typename SNC_structure::Vector_3 Vector_3;
typedef typename SNC_structure::Segment_3 Segment_3;
typedef typename SNC_structure::Ray_3 Ray_3;
typedef typename SNC_structure::Line_3 Line_3;
typedef typename SNC_structure::Plane_3 Plane_3;
typedef typename SNC_structure::Mark Mark;
#ifdef CGAL_I_DO_WANT_TO_USE_GENINFO
typedef void* GenPtr;
#else
typedef boost::any GenPtr;
#endif
SNC_ray_shooter() {}
void initialize(SNC_structure* W) { *this = SNC_ray_shooter(*W);}
SNC_ray_shooter(SNC_structure& W) : Base(W) {}
/*{\Mcreate makes |\Mvar| a ray shooter on |W|.}*/
private:
Volume_handle determine_volume(const Ray_3& ray) const {
CGAL_precondition( !ray.is_degenerate());
Object_handle o = shoot(ray);
Vertex_handle v;
Halfedge_handle e;
Halffacet_handle f, f_below;
if( CGAL::assign(v, o)) {
CGAL_NEF_TRACEN("facet below from from vertex...");
f_below = get_visible_facet(v, ray);
if(f_below != Halffacet_handle())
return f_below->incident_volume();
SM_decorator SD(&*v);
CGAL_assertion( SD.number_of_sfaces() == 1);
return SD.sfaces_begin()->volume();
}
else if( CGAL::assign(e, o)) {
CGAL_NEF_TRACEN("facet below from from edge...");
f_below = get_visible_facet(e, ray);
if(f_below != Halffacet_handle())
return f_below->incident_volume();
SM_decorator SD(&*e->source());
CGAL_assertion(SD.is_isolated(e));
return e->incident_sface()->volume();
}
else if( CGAL::assign(f, o)) {
CGAL_NEF_TRACEN("facet below from from facet...");
f_below = get_visible_facet(f, ray);
CGAL_assertion( f_below != Halffacet_handle());
return f_below->incident_volume();
}
return Base(*this).volumes_begin();
}
public:
Object_handle shoot(const Ray_3& ray) const
/*{\Mop returns the nearest object hit by a ray |ray|. }*/ {
CGAL_precondition( !ray.is_degenerate());
bool hit = false;
Point_3 end_of_seg;
SNC_intersection is(*this->sncp());
CGAL_NEF_TRACEN( "Shooting ray " << ray);
Object_handle o;
Vertex_handle v;
CGAL_forall_vertices( v, *this->sncp()) {
if ( ray.source() != v->point() && ray.has_on(v->point())) {
if(hit && !Segment_3(ray.source(), end_of_seg).has_on(v->point()))
continue;
CGAL_NEF_TRACEN("ray hit vertex case "<<v->point());
end_of_seg = v->point();
hit = true;
o = Object_handle(v);
}
}
Halfedge_handle e;
CGAL_forall_edges( e, *this->sncp()) {
Point_3 q;
if( is.does_intersect_internally( ray, segment(e), q)) {
if (!hit ||
has_smaller_distance_to_point(ray.source(),q, end_of_seg)) {
CGAL_NEF_TRACEN("ray hit edge case " << segment(e) << " in " << q);
end_of_seg = q;
hit = true;
o = Object_handle(e);
}
}
}
Halffacet_handle f;
CGAL_forall_halffacets( f, *this->sncp()) {
Point_3 q;
if( is.does_intersect_internally( ray, f, q) ) {
if(!hit ||
has_smaller_distance_to_point(ray.source(), q, end_of_seg)) {
CGAL_NEF_TRACEN("ray hit facet "<< f->plane()<<" on "<<q);
end_of_seg = q;
hit = true;
o = Object_handle(f);
}
}
}
return o;
}
Object_handle locate( const Point_3& p) const
/*{\Mop returns the lowest dimension object on an SNC structure
which contais |p| in its interior. }*/ {
SNC_intersection is(*this->sncp());
CGAL_NEF_TRACEN( "Point locator for " << p);
Vertex_handle v;
CGAL_forall_vertices( v, *this->sncp()) {
CGAL_NEF_TRACEN("test vertex " << v->point());
if ( p == v->point()) {
CGAL_NEF_TRACEN("on vertex.");
return Object_handle(v);
}
}
Halfedge_handle e;
CGAL_forall_edges( e, *this->sncp()) {
if ( is.does_contain_internally( segment(e), p) ) {
CGAL_NEF_TRACEN("on edge.");
return Object_handle(e);
}
}
Halffacet_handle f;
CGAL_forall_halffacets( f, *this->sncp()) {
if ( is.does_contain_internally( f, p) ) {
CGAL_NEF_TRACEN("on facet.");
return Object_handle(f);
}
}
CGAL_warning("altered code in SNC_ray_shooter");
Ray_3 r( p, Vector_3( 0, 0, 1));
return Object_handle(determine_volume(r));
}
}; // SNC_ray_shooter
} //namespace CGAL
#endif //CGAL_SNC_RAY_SHOOTER_H

View File

@ -48,9 +48,6 @@
#include <CGAL/Modifier_base.h>
#include <CGAL/Nef_3/Mark_bounded_volumes.h>
#ifdef CGAL_NEF3_POINT_LOCATOR_NAIVE
#include <CGAL/Nef_3/SNC_ray_shooter.h>
#endif
#ifdef CGAL_NEF3_CGAL_NEF3_SM_VISUALIZOR
#include <CGAL/Nef_3/SNC_SM_visualizor.h>
@ -115,11 +112,7 @@ class Nef_polyhedron_3_rep
typedef CGAL::SNC_external_structure<I, SNC_structure> SNC_external_structure;
typedef CGAL::SNC_point_locator<SNC_decorator> SNC_point_locator;
typedef CGAL::SNC_simplify<I, SNC_structure> SNC_simplify;
#ifdef CGAL_NEF3_POINT_LOCATOR_NAIVE
typedef CGAL::SNC_point_locator_naive<SNC_decorator> SNC_point_locator_default;
#else
typedef CGAL::SNC_point_locator_by_spatial_subdivision<SNC_decorator> SNC_point_locator_default;
#endif
typedef typename SNC_structure::Sphere_map Sphere_map;
typedef CGAL::SM_decorator<Sphere_map> SM_decorator;