Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

gugr::line Struct Reference

#include <gugr_basics.h>

List of all members.

Public Methods

 line ()
 line (const line &other)
 ~line ()
 line (const point2< rational > &av, const rational &adx, const rational &ady)
GULAPI line (const point2< rational > &a, const point2< rational > &b)
line & operator= (const line &other)
point2< rational > & v () const
rational & dx () const
rational & dy () const
bool IsNULL (void) const
bool IsHorizontal (void) const
bool IsVertical (void) const

Public Attributes

line_repm_rep


Constructor & Destructor Documentation

gugr::line::line   [inline]
 

Definition at line 226 of file gugr_basics.h.

Referenced by line(), and operator=().

00226 { m_rep = NULL; }

gugr::line::line const line &    other [inline, explicit]
 

Definition at line 228 of file gugr_basics.h.

References line().

00229   {
00230     if( other.m_rep ) other.m_rep->m_refcount++;
00231     m_rep = other.m_rep;
00232   }

gugr::line::~line   [inline]
 

Definition at line 234 of file gugr_basics.h.

00234 { if( (m_rep != NULL)&&(--m_rep->m_refcount == 0) ) delete m_rep; }

gugr::line::line const point2< rational > &    av,
const rational &    adx,
const rational &    ady
[inline, explicit]
 

Definition at line 237 of file gugr_basics.h.

References GULAPI.

00239   {
00240     m_rep = new line_rep( av, adx, ady );
00241   }

GULAPI gugr::line::line const point2< rational > &    a,
const point2< rational > &    b
[explicit]
 

Definition at line 34 of file gugr_basics.cpp.

References dx(), dy(), GULAPI, and m_rep.

00035 {
00036   rational dx,dy,adx,ady; // the constructor initializes these variables to 0
00037                           // (so adx becomes 0, when dx=0 and dy!=0 below)
00038   dx = b.x - a.x;
00039   dy = b.y - a.y;
00040   if( !dx.is_zero() ) ady = dy/dx; else ady = rational(ULong(1));
00041   if( !dy.is_zero() ) { 
00042     if( !dx.is_zero() ) 
00043       adx = rational(ULong(1))/ady;
00044   }
00045   else 
00046     adx = rational(ULong(1));
00047   m_rep = new line_rep( a, adx, ady );
00048 }


Member Function Documentation

rational& gugr::line::dx   const [inline]
 

Definition at line 253 of file gugr_basics.h.

Referenced by line().

00253 { return(m_rep->dx); }

rational& gugr::line::dy   const [inline]
 

Definition at line 254 of file gugr_basics.h.

Referenced by line().

00254 { return(m_rep->dy); }

bool gugr::line::IsHorizontal void    const [inline]
 

Definition at line 256 of file gugr_basics.h.

00256 { return m_rep->dy.is_zero(); }

bool gugr::line::IsNULL void    const [inline]
 

Definition at line 255 of file gugr_basics.h.

00255 { return(m_rep == NULL); }

bool gugr::line::IsVertical void    const [inline]
 

Definition at line 257 of file gugr_basics.h.

00257 { return m_rep->dx.is_zero(); }

line& gugr::line::operator= const line &    other [inline]
 

Definition at line 244 of file gugr_basics.h.

References line(), and gust::PoolFree().

00244                                        {
00245     if( other.m_rep ) other.m_rep->m_refcount++;
00246     if( (m_rep != NULL) && (--m_rep->m_refcount == 0) ) {
00247       m_rep->~line_rep();
00248       PoolFree( m_rep, sizeof(line_rep) );      
00249     }
00250     m_rep = other.m_rep;
00251     return( *this ); }

point2<rational>& gugr::line::v   const [inline]
 

Definition at line 252 of file gugr_basics.h.

00252 { return(m_rep->v); }


Member Data Documentation

line_rep* gugr::line::m_rep
 

Definition at line 224 of file gugr_basics.h.

Referenced by line().


The documentation for this struct was generated from the following files:
Generated on Mon Jan 21 04:17:55 2002 for GUL 0.6 - Geometry Utility Library by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001