Changed ray-shooting strategy when landmark is not supported

This commit is contained in:
Efi Fogel 2020-04-23 22:54:46 +03:00
parent 5d37a1bbf8
commit ea6f94a490
1 changed files with 77 additions and 0 deletions

View File

@ -127,7 +127,11 @@ protected:
void highlightPointLocation( QGraphicsSceneMouseEvent *event );
Face_const_handle getFace( const CGAL::Object& o );
CGAL::Object rayShootUp( const Kernel_point_2& point );
CGAL::Object rayShootUp( const Kernel_point_2& point, CGAL::Tag_true );
CGAL::Object rayShootUp( const Kernel_point_2& point, CGAL::Tag_false );
CGAL::Object rayShootDown( const Kernel_point_2& point );
CGAL::Object rayShootDown( const Kernel_point_2& point, CGAL::Tag_true );
CGAL::Object rayShootDown( const Kernel_point_2& point, CGAL::Tag_false );
using Superclass::scene;
using Superclass::shootingUp;
@ -304,6 +308,14 @@ VerticalRayShootCallback< Arr_ >::getFace( const CGAL::Object& obj )
template < typename Arr_ >
CGAL::Object
VerticalRayShootCallback< Arr_ >::rayShootUp( const Kernel_point_2& pt )
{
typename Supports_landmarks< Arrangement >::Tag supportsLandmarks;
return this->rayShootUp( pt, supportsLandmarks );
}
template < typename Arr_ >
CGAL::Object VerticalRayShootCallback< Arr_ >::rayShootUp( const Kernel_point_2& pt,
CGAL::Tag_true )
{
CGAL::Object pointLocationResult;
Walk_pl_strategy* walkStrategy;
@ -334,9 +346,48 @@ VerticalRayShootCallback< Arr_ >::rayShootUp( const Kernel_point_2& pt )
return pointLocationResult;
}
template < typename Arr_ >
CGAL::Object VerticalRayShootCallback< Arr_ >::rayShootUp( const Kernel_point_2& pt,
CGAL::Tag_false )
{
CGAL::Object pointLocationResult;
Walk_pl_strategy* walkStrategy;
TrapezoidPointLocationStrategy* trapezoidStrategy;
SimplePointLocationStrategy* simpleStrategy;
Point_2 point = this->toArrPoint( pt );
if ( CGAL::assign( walkStrategy, this->pointLocationStrategy ) )
{
pointLocationResult = walkStrategy->ray_shoot_up( point );
}
else if ( CGAL::assign( trapezoidStrategy, this->pointLocationStrategy ) )
{
pointLocationResult = trapezoidStrategy->ray_shoot_up( point );
}
else if ( CGAL::assign( simpleStrategy, this->pointLocationStrategy ) )
{
pointLocationResult = simpleStrategy->ray_shoot_up( point );
}
else
{
std::cout<<"Didn't find the right strategy\n";
}
return pointLocationResult;
}
template < typename Arr_ >
CGAL::Object
VerticalRayShootCallback< Arr_ >::rayShootDown( const Kernel_point_2& pt )
{
typename Supports_landmarks< Arrangement >::Tag supportsLandmarks;
return this->rayShootDown( pt, supportsLandmarks );
}
template < typename Arr_ >
CGAL::Object
VerticalRayShootCallback< Arr_ >::rayShootDown( const Kernel_point_2& pt, CGAL::Tag_true )
{
CGAL::Object pointLocationResult;
Walk_pl_strategy* walkStrategy;
@ -367,4 +418,30 @@ VerticalRayShootCallback< Arr_ >::rayShootDown( const Kernel_point_2& pt )
return pointLocationResult;
}
template < typename Arr_ >
CGAL::Object
VerticalRayShootCallback< Arr_ >::rayShootDown( const Kernel_point_2& pt, CGAL::Tag_false )
{
CGAL::Object pointLocationResult;
Walk_pl_strategy* walkStrategy;
TrapezoidPointLocationStrategy* trapezoidStrategy;
SimplePointLocationStrategy* simpleStrategy;
Point_2 point = this->toArrPoint( pt );
if ( CGAL::assign( walkStrategy, this->pointLocationStrategy ) )
{
pointLocationResult = walkStrategy->ray_shoot_down( point );
}
else if ( CGAL::assign( trapezoidStrategy, this->pointLocationStrategy ) )
{
pointLocationResult = trapezoidStrategy->ray_shoot_down( point );
}
else if ( CGAL::assign( simpleStrategy, this->pointLocationStrategy ) )
{
pointLocationResult = simpleStrategy->ray_shoot_down( point );
}
return pointLocationResult;
}
#endif // VERTICAL_RAY_SHOOT_CALLBACK_H