proj home

Files   Classes   Functions   Hierarchy  

linechopped< PT, PD > Class Template Reference

Maintain a linked list of chopped line segments. More...

#include <linechopped.h>

Collaboration diagram for linechopped< PT, PD >:

List of all members.

Public Types

typedef list< point2< PD >
>::iterator 
listiter

Public Member Functions

 linechopped (line< PT, PD > const &ln_, point2< PD > const &seg)
 Pass in an initial line segment.
boolc split (listiter &posnew, listiter pos, line< PT, PD > const &L2)
 Split into two segments.

Public Attributes

line< PT, PD > ln
 The line.
list< point2< PD > > chain
 Chain segments.


Detailed Description

template<typename PT, typename PD>
class linechopped< PT, PD >

Maintain a linked list of chopped line segments.

Definition at line 17 of file linechopped.h.


Member Typedef Documentation

template<typename PT , typename PD >
typedef list< point2<PD> >::iterator linechopped< PT, PD >::listiter

Definition at line 36 of file linechopped.h.


Constructor & Destructor Documentation

template<typename PT , typename PD >
linechopped< PT, PD >::linechopped ( line< PT, PD > const &  ln_,
point2< PD > const &  seg 
) [inline]

Pass in an initial line segment.

Definition at line 29 of file linechopped.h.

References linechopped< PT, PD >::chain.

00033     : ln(ln_)
00034     { chain.push_back( seg ); }


Member Function Documentation

template<typename PT , typename PD >
boolc linechopped< PT, PD >::split ( listiter posnew,
listiter  pos,
line< PT, PD > const &  L2 
) [inline]

Split into two segments.

The order is maintained. If the new element is inserted posnew then points to it and is before pos.

Definition at line 132 of file linechopped.h.

References solver< T >::d2linearequ(), line< PT, PD >::nml, and line< PT, PD >::pos.

00137 {
00138   bool res;
00139   point2<PD> t;
00140   res = solver<PD>::d2linearequ
00141     (t,ln.nml,L2.nml*((PD)-1.0), L2.pos - ln.pos);
00142 
00143   if (res==false)
00144     return false;
00145 
00146   PD t0(t[0]);
00147 
00148   if (t0<(*pos)[0])
00149     return false;
00150 
00151   if (t0>(*pos)[1])
00152     return false;
00153 
00154   // The line is being split.
00155 
00156   PD k0((*pos)[0]);
00157   (*pos)[0] = t0;
00158   
00159   posnew = chain.insert(pos,point2<PD>(k0,t0));
00160 
00161   return true;
00162 }


Member Data Documentation

template<typename PT , typename PD >
list< point2<PD> > linechopped< PT, PD >::chain

Chain segments.

Definition at line 25 of file linechopped.h.

Referenced by linechopped< PT, PD >::linechopped().

template<typename PT , typename PD >
line<PT,PD> linechopped< PT, PD >::ln

The line.

Definition at line 22 of file linechopped.h.


The documentation for this class was generated from the following file:

Generated on Fri Mar 4 00:50:04 2011 for Chelton Evans Source by  doxygen 1.5.8