seg.h: revert to version just before commit f68ce306bd, and update a few outdated comments.

This commit is contained in:
jean-pierre charras 2017-04-14 14:42:57 +02:00
parent 11c42cdff7
commit cbb5708c36
1 changed files with 13 additions and 56 deletions

View File

@ -38,75 +38,41 @@ class SEG
{ {
private: private:
typedef VECTOR2I::extended_type ecoord; typedef VECTOR2I::extended_type ecoord;
VECTOR2I m_a;
VECTOR2I m_b;
public: public:
friend inline std::ostream& operator<<( std::ostream& aStream, const SEG& aSeg ); friend inline std::ostream& operator<<( std::ostream& aStream, const SEG& aSeg );
/* Start and the of the segment. Public, to make access simpler. These are references /* Start and the of the segment. Public, to make access simpler.
* to an object the segment belongs to (e.g. a line chain) or references to locally stored
* points (m_a, m_b).
*/ */
VECTOR2I& A; VECTOR2I A;
VECTOR2I& B; VECTOR2I B;
/** Default constructor /** Default constructor
* Creates an empty (0, 0) segment, locally-referenced * Creates an empty (0, 0) segment
*/ */
SEG() : SEG()
A( m_a ),
B( m_b )
{ {
m_index = -1; m_index = -1;
} }
/** /**
* Constructor * Constructor
* Creates a segment between (aX1, aY1) and (aX2, aY2), locally referenced * Creates a segment between (aX1, aY1) and (aX2, aY2)
*/ */
SEG( int aX1, int aY1, int aX2, int aY2 ) : SEG( int aX1, int aY1, int aX2, int aY2 ) :
A( m_a ), A ( VECTOR2I( aX1, aY1 ) ),
B( m_b ) B ( VECTOR2I( aX2, aY2 ) )
{
A = VECTOR2I( aX1, aY1 );
B = VECTOR2I( aX2, aY2 );
m_index = -1;
}
/**
* Constructor
* Creates a segment between (aA) and (aB), locally referenced
*/
SEG( const VECTOR2I& aA, const VECTOR2I& aB ) :
A( m_a ),
B( m_b )
{
A = aA;
B = aB;
m_index = -1;
}
/**
* Constructor
* Creates a segment between (aA) and (aB), referencing the passed points
*/
SEG( VECTOR2I& aA, VECTOR2I& aB ) :
A( aA ),
B( aB )
{ {
m_index = -1; m_index = -1;
} }
/** /**
* Constructor * Constructor
* Creates a segment between (aA) and (aB), referencing the passed points * Creates a segment between (aA) and (aB)
*/ */
SEG( VECTOR2I& aA, VECTOR2I& aB, int aIndex ) : SEG( const VECTOR2I& aA, const VECTOR2I& aB ) : A( aA ), B( aB )
A( aA ),
B( aB )
{ {
m_index = aIndex; m_index = -1;
} }
/** /**
@ -116,25 +82,16 @@ public:
* @param aB reference to the end point in the parent shape * @param aB reference to the end point in the parent shape
* @param aIndex index of the segment within the parent shape * @param aIndex index of the segment within the parent shape
*/ */
SEG( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : SEG( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : A( aA ), B( aB )
A( m_a ),
B( m_b )
{ {
A = aA;
B = aB;
m_index = aIndex; m_index = aIndex;
} }
/** /**
* Copy constructor * Copy constructor
*/ */
SEG( const SEG& aSeg ) : SEG( const SEG& aSeg ) : A( aSeg.A ), B( aSeg.B ), m_index( aSeg.m_index )
A( m_a ),
B( m_b ),
m_index( aSeg.m_index )
{ {
A = aSeg.A;
B = aSeg.B;
} }
SEG& operator=( const SEG& aSeg ) SEG& operator=( const SEG& aSeg )