cgma
Cubit2DPoint Class Reference

#include <Cubit2DPoint.hpp>

List of all members.

Public Member Functions

 Cubit2DPoint ()
 Cubit2DPoint (const double x, const double y)
 Cubit2DPoint (const double xy[2])
 Cubit2DPoint (const Cubit2DPoint &copy_from)
 Cubit2DPoint (const Cubit2DPoint *copy_from)
void set (const double x, const double y)
void set (const double xy[2])
void set (const Cubit2DPoint &to_copy)
double x () const
double y () const
void get_xy (double &x, double &y)
void get_xy (double xy[3])
void x (const double x)
void y (const double y)
void print_me ()
void min_max (const Cubit2DPoint &pnt2, double &xmin, double &xmax, double &ymin, double &ymax) const
void update_min_max (Cubit2DPoint &min, Cubit2DPoint &max) const
CubitBoolean is_on_line_segment (const Cubit2DPoint &end1, const Cubit2DPoint &end2, double tol=1e-10) const
Cubit2DPointoperator= (const Cubit2DPoint &from)

Private Attributes

double xVal
double yVal

Detailed Description

Definition at line 16 of file Cubit2DPoint.hpp.


Constructor & Destructor Documentation

Definition at line 88 of file Cubit2DPoint.hpp.

    : xVal(0.0), yVal(0.0)
{}
Cubit2DPoint::Cubit2DPoint ( const double  x,
const double  y 
) [inline]

Definition at line 92 of file Cubit2DPoint.hpp.

    : xVal(x), yVal(y)
{}
Cubit2DPoint::Cubit2DPoint ( const double  xy[2])
Cubit2DPoint::Cubit2DPoint ( const Cubit2DPoint copy_from) [inline]

Definition at line 80 of file Cubit2DPoint.hpp.

    : xVal(copy_from.xVal), yVal(copy_from.yVal)
{}
Cubit2DPoint::Cubit2DPoint ( const Cubit2DPoint copy_from) [inline]

Definition at line 84 of file Cubit2DPoint.hpp.

    : xVal(copy_from->xVal), yVal(copy_from->yVal)
{}

Member Function Documentation

void Cubit2DPoint::get_xy ( double &  x,
double &  y 
)
void Cubit2DPoint::get_xy ( double  xy[3])
CubitBoolean Cubit2DPoint::is_on_line_segment ( const Cubit2DPoint end1,
const Cubit2DPoint end2,
double  tol = 1e-10 
) const

Definition at line 52 of file Cubit2DPoint.cpp.

{
   // Check bounding box
   double xmin, xmax, ymin, ymax;
   end1.min_max( end2, xmin, xmax, ymin, ymax );
   if( xVal < xmin-tol || yVal < ymin-tol ||
       xVal > xmax+tol || yVal > ymax+tol ) 
   {
      return CUBIT_FALSE;
   }

   // Check area of triangle (formula in if is twice the area)
   
    if( fabs( end1.x()*end2.y() + end1.y()*xVal +
          end2.x()*yVal - end2.y()*xVal -
          end1.x()*yVal - end1.y()*end2.x() ) < tol )
      return CUBIT_TRUE;
   
   return CUBIT_FALSE;
}
void Cubit2DPoint::min_max ( const Cubit2DPoint pnt2,
double &  xmin,
double &  xmax,
double &  ymin,
double &  ymax 
) const

Definition at line 13 of file Cubit2DPoint.cpp.

{
   if( xVal < pnt2.x() )
   {
      xmin = xVal;
      xmax = pnt2.x();
   }
   else
   {
      xmin = pnt2.x();
      xmax = xVal;
   }

   if( yVal < pnt2.y() )
   {
      ymin = yVal;
      ymax = pnt2.y();
   }
   else
   {
      ymin = pnt2.y();
      ymax = yVal;
   }
}
Cubit2DPoint & Cubit2DPoint::operator= ( const Cubit2DPoint from) [inline]

Definition at line 120 of file Cubit2DPoint.hpp.

{
  xVal = from.xVal; 
  yVal = from.yVal;
  return *this;
}
void Cubit2DPoint::set ( const double  x,
const double  y 
) [inline]

Definition at line 107 of file Cubit2DPoint.hpp.

{
  xVal = x;
  yVal = y;
}
void Cubit2DPoint::set ( const double  xy[2]) [inline]

Definition at line 114 of file Cubit2DPoint.hpp.

{
  xVal = xy[0];
  yVal = xy[1];
}
void Cubit2DPoint::set ( const Cubit2DPoint to_copy) [inline]

Definition at line 127 of file Cubit2DPoint.hpp.

{
  *this = to_copy;
}
void Cubit2DPoint::update_min_max ( Cubit2DPoint min,
Cubit2DPoint max 
) const

Definition at line 41 of file Cubit2DPoint.cpp.

{
   min.x( CUBIT_MIN( xVal, min.x() ) );
   min.y( CUBIT_MIN( yVal, min.y() ) );

   max.x( CUBIT_MAX( xVal, max.x() ) );
   max.y( CUBIT_MAX( yVal, max.y() ) );
}  
double Cubit2DPoint::x ( void  ) const [inline]

Definition at line 97 of file Cubit2DPoint.hpp.

{ return xVal; }
void Cubit2DPoint::x ( const double  x) [inline]

Definition at line 102 of file Cubit2DPoint.hpp.

{ xVal = x; }
double Cubit2DPoint::y ( void  ) const [inline]

Definition at line 99 of file Cubit2DPoint.hpp.

{ return yVal; }
void Cubit2DPoint::y ( const double  y) [inline]

Definition at line 104 of file Cubit2DPoint.hpp.

{ yVal = y; }

Member Data Documentation

double Cubit2DPoint::xVal [private]

Definition at line 76 of file Cubit2DPoint.hpp.

double Cubit2DPoint::yVal [private]

Definition at line 77 of file Cubit2DPoint.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines