Visitor enhanced. Demo now uses visitor to draw progress real-time

This commit is contained in:
Fernando Cacciola 2006-07-18 15:58:01 +00:00
parent b304c5b206
commit a86d3fb9dc
12 changed files with 279 additions and 142 deletions

View File

@ -5,13 +5,20 @@
- Fixed a bug in the detection of events at time zero (which ought to be ignored)
5 July 2006 Fernando Cacciola
- Merginig of coincident nodes now disabled by default (but can be requested)
- Computation of the coordinates of skeleton nodes now filtered
- Split-events are now clustered into parallel priority-queues to reduce processing time (up to 3 times faster now)
- Bug fixes in the handling of degnerate and near degenerate events
- Split-events clustered to reduce processing time (by a factor of 3)
20 June 2006 Fernando Cacciola
- Bug fixes from user report (see pseudo_split_5.poly)
- Vertex-events replaced by Pseudo-split events
RELEASE 3.2
26 March 2006 Fernando Cacciola
- Even more fixes for VC8
- More uses of the straight skeleton added to the docs

View File

@ -15,6 +15,8 @@
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
//
#ifndef SSKEL_DEMO_SS_TYPES_H
#define SSKEL_DEMO_SS_TYPES_H
#include <CGAL/Straight_skeleton_builder_2.h>
#include <CGAL/Polygon_offset_builder_2.h>
@ -23,12 +25,7 @@
namespace demo
{
typedef CGAL::Straight_skeleton_2<K> SSkel;
typedef CGAL::Straight_skeleton_builder_traits_2<K> SSkelBuilderTraits;
typedef CGAL::Straight_skeleton_builder_2<SSkelBuilderTraits,SSkel> SSkelBuilder;
typedef CGAL::Polygon_offset_builder_traits_2<K> OffsetBuilderTraits;
typedef CGAL::Polygon_offset_builder_2<SSkel,OffsetBuilderTraits,Polygon> OffsetBuilder;
typedef CGAL::Straight_skeleton_2<K> SSkel;
typedef SSkel::Halfedge_iterator Halfedge_iterator;
typedef SSkel::Vertex_handle Vertex_handle;
@ -38,4 +35,161 @@ typedef SSkel::Vertex_const_handle Vertex_const_handle ;
typedef boost::shared_ptr<SSkel> SSkelPtr ;
extern void draw_vertex ( Point const& v, CGAL::Color c ) ;
extern void draw_bisector( Point const& s, Point const& t, CGAL::Color c ) ;
struct Visitor
{
void on_initialization_started( int size_of_vertices ) const
{
mTotalVertices = size_of_vertices ;
mVertexCount0 = 0 ;
mVertexCount1 = 0 ;
mReflexVertexCount = 0 ;
mDegenerateVertexCount = 0 ;
mFoundEdgeEventCount = 0 ;
mFoundSplitEventCount = 0 ;
mProcessedEdgeEventCount = 0 ;
mProcessedSplitEventCount = 0 ;
mProcessedPseudoSplitEventCount = 0 ;
mAnihiliationCount = 0 ;
mStage = 0 ;
}
void on_initial_events_collected( Vertex_const_handle const& v, bool is_reflex, bool is_degenerate ) const
{
++ mVertexCount0 ;
if ( is_reflex )
++ mReflexVertexCount ;
if ( is_degenerate )
++ mDegenerateVertexCount ;
draw_vertex(v->point(),CGAL::BLACK );
//printf("\rInitialization: %d/%d (%d%%)",mVertexCount0,mTotalVertices,(mVertexCount0*100/mTotalVertices));
}
void on_edge_event_created( Vertex_const_handle const& lnode
, Vertex_const_handle const& rnode
) const
{
++ mFoundEdgeEventCount ;
}
void on_split_event_created( Vertex_const_handle const& node ) const
{
++ mFoundSplitEventCount ;
}
void on_pseudo_split_event_created( Vertex_const_handle const& lnode
, Vertex_const_handle const& rnode
) const
{
}
void on_initialization_finished() const { printf("\n"); ++ mStage ; }
void on_propagation_started() const {}
void on_anihiliation_event_processed ( Vertex_const_handle const& node0
, Vertex_const_handle const& node1
) const
{
draw_bisector(node0->point(),node1->point(),CGAL::BLACK);
++ mAnihiliationCount ;
}
void on_edge_event_processed( Vertex_const_handle const& lseed
, Vertex_const_handle const& rseed
, Vertex_const_handle const& node
) const
{
draw_bisector(lseed->point(),node->point(), CGAL::BLACK );
draw_bisector(rseed->point(),node->point(), CGAL::BLACK );
++ mProcessedEdgeEventCount ;
}
void on_split_event_processed( Vertex_const_handle const& seed
, Vertex_const_handle const& node0
, Vertex_const_handle const& node1
) const
{
draw_bisector(seed->point(),node0->point(), CGAL::BLACK );
++ mProcessedSplitEventCount ;
}
void on_pseudo_split_event_processed( Vertex_const_handle const& lseed
, Vertex_const_handle const& rseed
, Vertex_const_handle const& node0
, Vertex_const_handle const& node1
) const
{
draw_bisector(lseed->point(),node0->point(), CGAL::BLACK );
draw_bisector(rseed->point(),node1->point(), CGAL::BLACK );
++ mProcessedPseudoSplitEventCount ;
}
void on_vertex_processed( Vertex_const_handle const& node ) const
{
if ( node->is_contour() )
{
++ mVertexCount1 ;
//printf("\rPropagation: %d/%d (%d%%)",mVertexCount1,mTotalVertices,(mVertexCount1*100/mTotalVertices));
}
}
void on_propagation_finished() const { printf("\n"); ++ mStage ; }
void on_cleanup_started( bool mergin_coincident_nodes ) const {}
void on_cleanup_finished() const {}
void on_error( char const* what ) const
{
std::cerr << what << std::endl ;
}
void on_algorithm_finished ( bool finished_ok ) const
{
}
mutable int mTotalVertices ;
mutable int mVertexCount0 ;
mutable int mVertexCount1 ;
mutable int mReflexVertexCount ;
mutable int mDegenerateVertexCount ;
mutable int mFoundEdgeEventCount ;
mutable int mFoundSplitEventCount ;
mutable int mProcessedEdgeEventCount ;
mutable int mProcessedSplitEventCount ;
mutable int mProcessedPseudoSplitEventCount ;
mutable int mAnihiliationCount ;
mutable int mStage ;
void print_stats()
{
std::cout << "VertexCount =" << mTotalVertices << std::endl
<< "ReflexVertexCount =" << mReflexVertexCount << std::endl
<< "DegenerateVertexCount =" << mDegenerateVertexCount << std::endl
<< "FoundEdgeEventCount =" << mFoundEdgeEventCount << std::endl
<< "FoundSplitEventCount =" << mFoundSplitEventCount << std::endl
<< "ProcessedEdgeEventCount =" << mProcessedEdgeEventCount << std::endl
<< "ProcessedSplitEventCount =" << mProcessedSplitEventCount << std::endl
<< "ProcessedPseudoSplitEventCount=" << mProcessedPseudoSplitEventCount << std::endl
<< "AnihiliationCount =" << mAnihiliationCount << std::endl ;
}
} ;
typedef CGAL::Straight_skeleton_builder_traits_2<K> SSkelBuilderTraits;
typedef CGAL::Straight_skeleton_builder_2<SSkelBuilderTraits,SSkel,Visitor> SSkelBuilder;
typedef CGAL::Polygon_offset_builder_traits_2<K> OffsetBuilderTraits;
typedef CGAL::Polygon_offset_builder_2<SSkel,OffsetBuilderTraits,Polygon> OffsetBuilder;
}
#endif // SSKEL_DEMO_SS_TYPES_H

View File

@ -35,6 +35,19 @@ enum Triedge_collinearity
, TRIEDGE_COLLINEARITY_ALL
} ;
static char const* triedge_collinearity_to_string( Triedge_collinearity c )
{
switch ( c )
{
case TRIEDGE_COLLINEARITY_NONE : return "<>" ;
case TRIEDGE_COLLINEARITY_01 : return "<0,1>" ;
case TRIEDGE_COLLINEARITY_12 : return "<1,2>" ;
case TRIEDGE_COLLINEARITY_02 : return "<0,2>" ;
case TRIEDGE_COLLINEARITY_ALL : return "<0,1,2>" ;
}
return "!!UNKNOWN COLLINEARITY!!" ;
}
namespace CGALi
{

View File

@ -57,8 +57,6 @@ Straight_skeleton_builder_2<Gt,SS,V>::Straight_skeleton_builder_2 ( Traits const
template<class Gt, class SS, class V>
void Straight_skeleton_builder_2<Gt,SS,V>::throw_error ( char const* what ) const
{
mVisitor.on_error(what);
throw straight_skeleton_exception(what);
}
@ -127,7 +125,6 @@ Straight_skeleton_builder_2<Gt,SS,V>::FindEdgeEvent( Vertex_handle aLNode, Verte
mVisitor.on_edge_event_created(aLNode, aRNode) ;
CGAL_STSKEL_DEBUG_CODE( SetEventTimeAndPoint(*rResult) );
CGAL_STSKEL_STATS_CODE(++sFoundEdgeEventCount);
}
}
}
@ -161,7 +158,11 @@ Straight_skeleton_builder_2<Gt,SS,V>::IsPseudoSplitEvent( EventPtr const& aEvent
bool lCoupleIsPrev = false ;
if ( !IsDegenerate(lOppPrevN) && ExistEvent(lPrevSTriedge) && AreEventsSimultaneous(lEventSTriedge,lPrevSTriedge) )
if ( !IsDegenerate(lOppPrevN)
&& ExistEvent(lPrevSTriedge)
&& CompareEvents(lEventSTriedge,lPrevSTriedge) == EQUAL
//&& AreEventsSimultaneous(lEventSTriedge,lPrevSTriedge)
)
{
lIsPseudoSplitEvent = true ;
lCoupleIsPrev = true ;
@ -169,7 +170,11 @@ Straight_skeleton_builder_2<Gt,SS,V>::IsPseudoSplitEvent( EventPtr const& aEvent
}
else
{
if ( !IsDegenerate(aOppN) && ExistEvent(lNextSTriedge) && AreEventsSimultaneous(lEventSTriedge,lNextSTriedge) )
if ( !IsDegenerate(aOppN)
&& ExistEvent(lNextSTriedge)
&& CompareEvents(lEventSTriedge,lNextSTriedge) == EQUAL
//&& AreEventsSimultaneous(lEventSTriedge,lNextSTriedge)
)
{
lIsPseudoSplitEvent = true ;
lCoupleIsPrev = false ;
@ -218,7 +223,7 @@ void Straight_skeleton_builder_2<Gt,SS,V>::CollectSplitEvent( Vertex_handle aN
{
Sorted_triedge_2 lSortedTriedge = CreateSortedTriedge(aReflexLBorder,aReflexRBorder,aOppositeBorder);
if ( ExistEvent(lSortedTriedge) )
if ( lSortedTriedge.collinearity() == TRIEDGE_COLLINEARITY_NONE && ExistEvent(lSortedTriedge) )
{
if ( ! ( aNode->is_skeleton() && IsNewEventInThePast(aReflexLBorder,aReflexRBorder,aOppositeBorder,lSortedTriedge,aNode) ) )
{
@ -227,7 +232,6 @@ void Straight_skeleton_builder_2<Gt,SS,V>::CollectSplitEvent( Vertex_handle aN
mVisitor.on_split_event_created(aNode) ;
CGAL_STSKEL_DEBUG_CODE( SetEventTimeAndPoint(*lEvent) ) ;
CGAL_STSKEL_STATS_CODE( ++sFoundSplitEventCount );
AddSplitEvent(aNode,lEvent);
}
@ -386,8 +390,6 @@ void Straight_skeleton_builder_2<Gt,SS,V>::HandleSimultaneousEdgeEvent( Vertex_h
{
CGAL_STSKEL_BUILDER_TRACE ( 2, "Handling simultaneous EdgeEvent between N" << aA ->id() << " and N" << aB ->id() ) ;
CGAL_STSKEL_STATS_CODE(++sAnihiliationCount);
mVisitor.on_anihiliation_event_processed(aA,aB) ;
Halfedge_handle lOA = aA->primary_bisector() ;
@ -506,7 +508,7 @@ void Straight_skeleton_builder_2<Gt,SS,V>::CreateInitialEvents()
for ( Vertex_iterator v = mSSkel->vertices_begin(); v != mSSkel->vertices_end(); ++ v )
{
UpdatePQ(v);
mVisitor.on_initial_events_collected(v) ;
mVisitor.on_initial_events_collected(v,IsReflex(v),IsDegenerate(v)) ;
}
}
@ -517,8 +519,6 @@ void Straight_skeleton_builder_2<Gt,SS,V>::CreateContourBisectors()
CGAL_STSKEL_BUILDER_TRACE(0, "Creating contour bisectors...");
for ( Vertex_iterator v = mSSkel->vertices_begin(); v != mSSkel->vertices_end(); ++ v )
{
CGAL_STSKEL_STATS_CODE(++sVertexCount);
mSLAV.push_back(static_cast<Vertex_handle>(v));
Vertex_handle lPrev = GetPrevInLAV(v) ;
Vertex_handle lNext = GetNextInLAV(v) ;
@ -528,14 +528,12 @@ void Straight_skeleton_builder_2<Gt,SS,V>::CreateContourBisectors()
{
SetIsDegenerate(v);
CGAL_STSKEL_BUILDER_TRACE(1, "COLLINEAR vertex: N" << v->id() );
CGAL_STSKEL_STATS_CODE(++sDegenerateVertexCount);
}
else if ( lOrientation == RIGHT_TURN )
{
mReflexVertices.push_back(v);
SetIsReflex(v);
CGAL_STSKEL_BUILDER_TRACE(1,"Reflex vertex: N" << v->id() );
CGAL_STSKEL_STATS_CODE(++sReflexVertexCount);
}
Halfedge lOB(mEdgeID++), lIB(mEdgeID++);
@ -561,8 +559,10 @@ void Straight_skeleton_builder_2<Gt,SS,V>::CreateContourBisectors()
template<class Gt, class SS, class V>
void Straight_skeleton_builder_2<Gt,SS,V>::InitPhase()
{
mVisitor.on_initialization_started(mSSkel->size_of_vertices());
CreateContourBisectors();
CreateInitialEvents();
mVisitor.on_initialization_finished();
}
template<class Gt, class SS, class V>
@ -855,8 +855,6 @@ bool Straight_skeleton_builder_2<Gt,SS,V>::IsProcessed( EventPtr aEvent )
template<class Gt, class SS, class V>
void Straight_skeleton_builder_2<Gt,SS,V>::HandleEdgeEvent( EventPtr aEvent )
{
CGAL_STSKEL_STATS_CODE(++sProcessedEdgeEventCount);
EdgeEvent& lEvent = dynamic_cast<EdgeEvent&>(*aEvent) ;
Vertex_handle lLSeed = lEvent.seed0() ;
@ -933,15 +931,13 @@ void Straight_skeleton_builder_2<Gt,SS,V>::HandleEdgeEvent( EventPtr aEvent )
);
}
mVisitor.on_edge_event_processed(lLSeed,lRSeed) ;
mVisitor.on_edge_event_processed(lLSeed,lRSeed,lNewNode) ;
}
template<class Gt, class SS, class V>
void Straight_skeleton_builder_2<Gt,SS,V>::HandleSplitEvent( EventPtr aEvent, Vertex_handle aOppR )
{
CGAL_STSKEL_STATS_CODE(++sProcessedSplitEventCount);
SplitEvent& lEvent = dynamic_cast<SplitEvent&>(*aEvent) ;
Halfedge_handle lOppBorder = lEvent.border_c() ;
@ -1033,7 +1029,7 @@ void Straight_skeleton_builder_2<Gt,SS,V>::HandleSplitEvent( EventPtr aEvent, Ve
UpdatePQ(lNewNode_L);
UpdatePQ(lNewNode_R);
mVisitor.on_split_event_processed(lSeed) ;
mVisitor.on_split_event_processed(lSeed,lNewNode_L,lNewNode_R) ;
}
template<class Gt, class SS, class V>
@ -1051,7 +1047,6 @@ void Straight_skeleton_builder_2<Gt,SS,V>::SetupPseudoSplitEventNode( Vertex_han
{
SetIsDegenerate(aNode);
CGAL_STSKEL_BUILDER_TRACE(1, "COLLINEAR *NEW* vertex: N" << aNode->id() );
CGAL_STSKEL_STATS_CODE(++sDegenerateVertexCount);
}
else if ( lOrientation == RIGHT_TURN )
{
@ -1064,7 +1059,6 @@ void Straight_skeleton_builder_2<Gt,SS,V>::SetupPseudoSplitEventNode( Vertex_han
template<class Gt, class SS, class V>
void Straight_skeleton_builder_2<Gt,SS,V>::HandlePseudoSplitEvent( EventPtr aEvent )
{
CGAL_STSKEL_STATS_CODE(++sProcessedPseudoSplitEventCount);
PseudoSplitEvent& lEvent = dynamic_cast<PseudoSplitEvent&>(*aEvent) ;
@ -1157,7 +1151,7 @@ void Straight_skeleton_builder_2<Gt,SS,V>::HandlePseudoSplitEvent( EventPtr aEve
UpdatePQ(lNewNode_L);
UpdatePQ(lNewNode_R);
mVisitor.on_pseudo_split_event_processed(lLSeed,lRSeed) ;
mVisitor.on_pseudo_split_event_processed(lLSeed,lRSeed,lNewNode_L,lNewNode_R) ;
}
template<class Gt, class SS, class V>
@ -1171,10 +1165,6 @@ void Straight_skeleton_builder_2<Gt,SS,V>::HandleSplitOrPseudoSplitEvent( EventP
HandlePseudoSplitEvent(lPseudoSplitEvent);
else HandleSplitEvent (aEvent,lOppR);
}
else
{
CGAL_STSKEL_STATS_CODE(++sOutOfReachSplitEventCount);
}
}
template<class Gt, class SS, class V>
@ -1204,6 +1194,7 @@ template<class Gt, class SS, class V>
void Straight_skeleton_builder_2<Gt,SS,V>::Propagate()
{
CGAL_STSKEL_BUILDER_TRACE(0,"Propagating events...");
mVisitor.on_propagation_started();
while ( !mPQ.empty() )
{
@ -1231,6 +1222,8 @@ void Straight_skeleton_builder_2<Gt,SS,V>::Propagate()
++ mStepID ;
}
}
mVisitor.on_propagation_finished();
}
template<class Gt, class SS, class V>
@ -1558,6 +1551,8 @@ bool Straight_skeleton_builder_2<Gt,SS,V>::FinishUp( bool aMergeCoincidentNodes
{
CGAL_STSKEL_BUILDER_TRACE(0, "\n\nFinishing up...");
mVisitor.on_cleanup_started(aMergeCoincidentNodes);
std::for_each( mSplitNodes.begin()
,mSplitNodes.end ()
,boost::bind(&Straight_skeleton_builder_2<Gt,SS,V>::MergeSplitNodes,this,_1)
@ -1575,6 +1570,8 @@ bool Straight_skeleton_builder_2<Gt,SS,V>::FinishUp( bool aMergeCoincidentNodes
MergeCoincidentNodes();
CGAL_expensive_postcondition( ok = mSSkel->is_valid() ) ;
}
mVisitor.on_cleanup_finished();
return ok ;
}
@ -1598,7 +1595,7 @@ typename Straight_skeleton_builder_2<Gt,SS,V>::SSkelPtr Straight_skeleton_builde
}
catch( std::exception const& e )
{
std::cerr << "Exception caught: " << e.what() << std::endl ;
mVisitor.on_error ( e.what() ) ;
CGAL_STSKEL_BUILDER_TRACE(0,"EXCEPTION THROWN (" << e.what() << ") during straight skeleton construction.");
}
@ -1608,26 +1605,7 @@ typename Straight_skeleton_builder_2<Gt,SS,V>::SSkelPtr Straight_skeleton_builde
mSSkel = SSkelPtr() ;
}
#ifdef CGAL_STRAIGHT_SKELETON_STATS
std::cerr << "sVertexCount =" << sVertexCount << std::endl
<< "sReflexVertexCount =" << sReflexVertexCount << std::endl
<< "sDegenerateVertexCount =" << sDegenerateVertexCount << std::endl
<< "sFoundEdgeEventCount =" << sFoundEdgeEventCount << std::endl
<< "sFoundSplitEventCount =" << sFoundSplitEventCount << std::endl
<< "sProcessedEdgeEventCount =" << sProcessedEdgeEventCount << std::endl
<< "sProcessedSplitEventCount =" << sProcessedSplitEventCount << std::endl
<< "sProcessedPseudoSplitEventCount=" << sProcessedPseudoSplitEventCount << std::endl
<< "sOutOfReachSplitEventCount =" << sOutOfReachSplitEventCount << std::endl
<< "sAnihiliationCount =" << sAnihiliationCount << std::endl
<< "sInFrameCount =" << sInFrameCount << std::endl
<< "sOutsideFrameCount =" << sOutsideFrameCount<< std::endl
<< "sInTimeRangeCount =" << sInTimeRangeCount << std::endl
<< "sOutsideTimeRangeCount =" << sOutsideTimeRangeCount << std::endl
<< "sSingularCount =" << sSingularCount << std::endl ;
#endif
mVisitor.on_algorithm_finished(ok);
return mSSkel ;
}

View File

@ -81,9 +81,8 @@ public:
{
ss << "[" ;
e.dump(ss);
ss << " p=(" << e.point().x() << "," << e.point().y() << ") t=" << e.time() << "]" ;
if ( e.sorted_triedge().collinear_count() > 0 )
ss << " {collinear count=" << e.sorted_triedge().collinear_count() << "}" ;
ss << " p=(" << e.point().x() << "," << e.point().y() << ") t=" << e.time() << "] "
<< triedge_collinearity_to_string(e.sorted_triedge().collinearity()) ;
return ss ;
}

View File

@ -356,20 +356,20 @@ class Sorted_triedge_2 : public Triedge_2<K>
typedef typename Base::Segment_2 Segment_2 ;
Sorted_triedge_2( Segment_2 const& aE0
, Segment_2 const& aE1
, Segment_2 const& aE2
, int aCollinearCount
Sorted_triedge_2( Segment_2 const& aE0
, Segment_2 const& aE1
, Segment_2 const& aE2
, Triedge_collinearity aCollinearity
)
: Base(aE0,aE1,aE2)
, mCCount(aCollinearCount)
, mCollinearity(aCollinearity)
{}
int collinear_count() const { return mCCount ; }
Triedge_collinearity collinearity() const { return mCollinearity ; }
private:
int mCCount ;
Triedge_collinearity mCollinearity ;
} ;
template<class K>
@ -442,7 +442,7 @@ struct SS_converter : Converter
Target_sorted_triedge_2 operator()( Source_sorted_triedge_2 const& t) const
{
return Target_sorted_triedge_2(cvts(t.e0()), cvts(t.e1()), cvts(t.e2()), t.collinear_count() ) ;
return Target_sorted_triedge_2(cvts(t.e0()), cvts(t.e1()), cvts(t.e2()), t.collinearity() ) ;
}
Target_time_and_point_2 operator() ( Source_time_and_point_2 const& v ) const

View File

@ -40,21 +40,6 @@
#ifdef CGAL_STRAIGHT_SKELETON_STATS
int sVertexCount ;
int sReflexVertexCount ;
int sDegenerateVertexCount ;
int sFoundEdgeEventCount ;
int sFoundSplitEventCount ;
int sProcessedEdgeEventCount ;
int sProcessedSplitEventCount ;
int sProcessedPseudoSplitEventCount ;
int sOutOfReachSplitEventCount ;
int sAnihiliationCount ;
int sInFrameCount ;
int sOutsideFrameCount ;
int sInTimeRangeCount ;
int sOutsideTimeRangeCount ;
int sSingularCount ;
#define CGAL_STSKEL_STATS_CODE(c) c
#else
@ -70,8 +55,10 @@ struct Dummy_straight_skeleton_builder_2_visitor
typedef typename SSkel::Vertex_const_handle Vertex_const_handle ;
void on_error( char const* ) const {}
void on_initialization_started( int size_of_vertices ) const {}
void on_initial_events_collected( Vertex_const_handle const& v, bool is_reflex, bool is_degenerate ) const {}
void on_edge_event_created( Vertex_const_handle const& lnode
, Vertex_const_handle const& rnode
) const {}
@ -81,24 +68,43 @@ struct Dummy_straight_skeleton_builder_2_visitor
void on_pseudo_split_event_created( Vertex_const_handle const& lnode
, Vertex_const_handle const& rnode
) const {}
void on_initialization_finished() const {}
void on_propagation_started() const {}
void on_anihiliation_event_processed ( Vertex_const_handle const& node0
, Vertex_const_handle const& node1
) const {}
void on_initial_events_collected( Vertex_const_handle const& v ) const {}
void on_edge_event_processed( Vertex_const_handle const& lnode
, Vertex_const_handle const& rnode
void on_edge_event_processed( Vertex_const_handle const& lseed
, Vertex_const_handle const& rseed
, Vertex_const_handle const& node
) const {}
void on_split_event_processed( Vertex_const_handle const& node ) const {}
void on_split_event_processed( Vertex_const_handle const& seed
, Vertex_const_handle const& node0
, Vertex_const_handle const& node1
) const {}
void on_pseudo_split_event_processed( Vertex_const_handle const& lnode
, Vertex_const_handle const& rnode
void on_pseudo_split_event_processed( Vertex_const_handle const& lseed
, Vertex_const_handle const& rseed
, Vertex_const_handle const& node0
, Vertex_const_handle const& node1
) const {}
void on_vertex_processed( Vertex_const_handle const& node ) const {}
void on_propagation_finished() const {}
void on_cleanup_started( bool mergin_coincident_nodes ) const {}
void on_cleanup_finished() const {}
void on_algorithm_finished ( bool finished_ok ) const {}
void on_error( char const* ) const {}
} ;
@ -733,10 +739,10 @@ private:
Visitor const& mVisitor ;
std::vector<VertexWrapper> mWrappedVertices ;
Vertex_handle_vector mReflexVertices ;
Halfedge_handle_vector mDanglingBisectors ;
Halfedge_handle_vector mContourHalfedges ;
std::vector<VertexWrapper> mWrappedVertices ;
Vertex_handle_vector mReflexVertices ;
Halfedge_handle_vector mDanglingBisectors ;
Halfedge_handle_vector mContourHalfedges ;
std::list<Vertex_handle> mSLAV ;

View File

@ -259,7 +259,7 @@ struct Construct_ss_event_time_and_point_2 : Functor_base_2<K>
FT t(0) ;
Point_2 i = ORIGIN ;
CGAL_assertion(triedge.collinear_count() < 3) ;
CGAL_assertion(triedge.collinearity() != TRIEDGE_COLLINEARITY_ALL) ;
optional< Rational<FT> > ot = compute_offset_lines_isec_timeC2(triedge);

View File

@ -36,8 +36,8 @@ inline Uncertain<bool> certified_quotient_is_positive(const Quotient<NT>& x)
template <class NT>
inline Uncertain<bool> certified_quotient_is_negative(const Quotient<NT>& x)
{
Uncertain<Sign> singnum = CGAL_NTS certified_sign(x.num) ;
Uncertain<Sign> singden = CGAL_NTS certified_sign(x.den) ;
Uncertain<Sign> signum = CGAL_NTS certified_sign(x.num) ;
Uncertain<Sign> sigden = CGAL_NTS certified_sign(x.den) ;
Uncertain<Sign> zero(ZERO);
return signum != zero & signum != sigden ;

View File

@ -153,8 +153,6 @@ optional< Line_2<K> > compute_normalized_line_ceoffC2( Segment_2<K> const& e )
template<class K>
Sorted_triedge_2<K> construct_sorted_triedge ( Triedge_2<K> const& triedge, Triedge_collinearity collinearity )
{
int lCollinearCount = -1 ;
int idx0=0, idx1=1, idx2=2 ;
switch ( collinearity )
@ -163,36 +161,34 @@ Sorted_triedge_2<K> construct_sorted_triedge ( Triedge_2<K> const& triedge, Trie
idx0 = 0 ;
idx1 = 1 ;
idx2 = 2 ;
lCollinearCount = 0 ;
break ;
case TRIEDGE_COLLINEARITY_01 :
idx0 = 0 ;
idx1 = 1 ;
idx2 = 2 ;
lCollinearCount = 2 ;
break ;
case TRIEDGE_COLLINEARITY_12 :
idx0 = 1 ;
idx1 = 2 ;
idx2 = 0 ;
lCollinearCount = 2 ;
break ;
case TRIEDGE_COLLINEARITY_02 :
idx0 = 0 ;
idx1 = 2 ;
idx2 = 1 ;
lCollinearCount = 2 ;
break ;
default :
lCollinearCount = 3 ;
case TRIEDGE_COLLINEARITY_ALL :
idx0 = 0 ;
idx1 = 1 ;
idx2 = 2 ;
break ;
}
return Sorted_triedge_2<K>(triedge.e(idx0),triedge.e(idx1),triedge.e(idx2),lCollinearCount);
return Sorted_triedge_2<K>(triedge.e(idx0),triedge.e(idx1),triedge.e(idx2),collinearity);
}
// Given 3 oriented straight line segments: e0, e1, e2 (passed in a SortedTriedge record)
@ -389,27 +385,19 @@ optional< Rational< typename K::FT> > compute_degenerate_offset_lines_isec_timeC
return cgal_make_optional(ok,Rational<FT>(num,den)) ;
}
//
// Calls the appropiate function depending on the collinearity of the edges.
//
template<class K>
optional< Rational< typename K::FT > > compute_offset_lines_isec_timeC2 ( Sorted_triedge_2<K> const& triedge, int ccount )
{
CGAL_precondition ( ccount < 3 ) ;
return ccount == 0 ? compute_normal_offset_lines_isec_timeC2 (triedge)
: compute_degenerate_offset_lines_isec_timeC2(triedge);
}
//
// Calls the appropiate function depending on the collinearity of the edges.
//
template<class K>
optional< Rational< typename K::FT > > compute_offset_lines_isec_timeC2 ( Sorted_triedge_2<K> const& triedge )
{
return compute_offset_lines_isec_timeC2(triedge, triedge.collinear_count() ) ;
CGAL_precondition ( triedge.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
return triedge.collinearity() == TRIEDGE_COLLINEARITY_NONE ? compute_normal_offset_lines_isec_timeC2 (triedge)
: compute_degenerate_offset_lines_isec_timeC2(triedge);
}
// Given 3 oriented line segments e0, e1 and e2 (passed in a SortedTriedge record)
// such that their offsets at a certian distance intersect in a single point,
// returns the coordinates (x,y) of such a point.
@ -529,25 +517,16 @@ optional< Point_2<K> > construct_degenerate_offset_lines_isecC2 ( Sorted_triedge
return cgal_make_optional(ok,K().construct_point_2_object()(x,y)) ;
}
//
// Calls the appropiate function depending on the collinearity of the edges.
//
template<class K>
optional< Point_2<K> > construct_offset_lines_isecC2 ( Sorted_triedge_2<K> const& triedge, int ccount )
{
CGAL_precondition ( ccount < 3 ) ;
return ccount == 0 ? construct_normal_offset_lines_isecC2 (triedge)
: construct_degenerate_offset_lines_isecC2(triedge) ;
}
//
// Calls the appropiate function depending on the collinearity of the edges.
//
template<class K>
optional< Point_2<K> > construct_offset_lines_isecC2 ( Sorted_triedge_2<K> const& triedge )
{
return construct_offset_lines_isecC2(triedge, triedge.collinear_count()) ;
CGAL_precondition ( triedge.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
return triedge.collinearity() == TRIEDGE_COLLINEARITY_NONE ? construct_normal_offset_lines_isecC2 (triedge)
: construct_degenerate_offset_lines_isecC2(triedge) ;
}
// Give a point (px,py) and 3 oriented straight line segments e0,e1 and e2.

View File

@ -161,9 +161,9 @@ Uncertain<bool> exist_offset_lines_isec2 ( Sorted_triedge_2<K> const& event )
Uncertain<bool> rResult = Uncertain<bool>::indeterminate();
if ( event.collinear_count() < 3 ) // If the 3 edges are collinear thre is no event.
if ( event.collinearity() != TRIEDGE_COLLINEARITY_ALL ) // If the 3 edges are collinear thre is no event.
{
CGAL_STSKEL_TRAITS_TRACE( ( event.collinear_count() == 0 ? " normal edges" : " collinear edges" ) ) ;
CGAL_STSKEL_TRAITS_TRACE( ( event.collinearity() == TRIEDGE_COLLINEAR_NONE ? " normal edges" : " collinear edges" ) ) ;
Optional_rational t = compute_offset_lines_isec_timeC2(event) ;
if ( t )
@ -215,8 +215,8 @@ Uncertain<Comparison_result> compare_offset_lines_isec_timesC2 ( Sorted_triedge_
Uncertain<Comparison_result> rResult = Uncertain<Comparison_result>::indeterminate();
CGAL_assertion ( m.collinear_count() < 3 ) ;
CGAL_assertion ( n.collinear_count() < 3 ) ;
CGAL_assertion ( m.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
CGAL_assertion ( n.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
Optional_rational mt_ = compute_offset_lines_isec_timeC2(m);
Optional_rational nt_ = compute_offset_lines_isec_timeC2(n);
@ -260,8 +260,8 @@ compare_offset_lines_isec_dist_to_pointC2 ( optional< Point_2<K> > const& p
if ( p )
{
CGAL_assertion ( m.collinear_count() < 3 ) ;
CGAL_assertion ( n.collinear_count() < 3 ) ;
CGAL_assertion ( m.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
CGAL_assertion ( n.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
optional<FT> dm = compute_offset_lines_isec_dist_to_pointC2(p,m);
optional<FT> dn = compute_offset_lines_isec_dist_to_pointC2(p,n);
@ -287,7 +287,7 @@ compare_offset_lines_isec_dist_to_pointC2 ( Sorted_triedge_2<K> const& s
{
Uncertain<Comparison_result> rResult = Uncertain<Comparison_result>::indeterminate();
CGAL_assertion ( s.collinear_count() < 3 ) ;
CGAL_assertion ( s.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
rResult = compare_offset_lines_isec_dist_to_pointC2(construct_offset_lines_isecC2(s),m,n);
@ -369,7 +369,7 @@ is_offset_lines_isec_inside_offset_zoneC2 ( Sorted_triedge_2<K> const& event, Tr
if ( !is_indeterminate(degenerate_zone) )
{
CGAL_assertion ( event.collinear_count() < 3 ) ;
CGAL_assertion ( event.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
if ( !degenerate_zone )
{
@ -580,8 +580,8 @@ Uncertain<bool> are_events_simultaneousC2 ( Sorted_triedge_2<K> const& l, Sorted
Uncertain<bool> rResult = Uncertain<bool>::indeterminate();
CGAL_assertion ( l.collinear_count() < 3 ) ;
CGAL_assertion ( r.collinear_count() < 3 ) ;
CGAL_assertion ( l.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
CGAL_assertion ( r.collinearity() != TRIEDGE_COLLINEARITY_ALL ) ;
Optional_rational lt_ = compute_offset_lines_isec_timeC2(l);
Optional_rational rt_ = compute_offset_lines_isec_timeC2(r);

View File

@ -21,6 +21,7 @@
#include <CGAL/basic.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polygon_2.h>
#include <CORE/Expr.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Straight_skeleton_builder_2.h>