proj home

Files   Classes   Functions   Hierarchy  

d3circlepartition Class Reference

#include <d3circlepartition.h>

Inheritance diagram for d3circlepartition:
Collaboration diagram for d3circlepartition:

List of all members.

Public Member Functions

 d3circlepartition ()
 d3circlepartition (pt2c _x0, double const _radius)
bool const isInside (pt3c &x) const
bool const intersection (pt3 &x, pt3c &w, pt3c &b) const
bool const isOnBoundary (pt3c &w, double const zero) const

Public Attributes

pt2 x0
double radius


Detailed Description

Definition at line 12 of file d3circlepartition.h.


Constructor & Destructor Documentation

d3circlepartition::d3circlepartition (  )  [inline]

Definition at line 19 of file d3circlepartition.h.

00020     : radius(1.0) {}

d3circlepartition::d3circlepartition ( pt2c  _x0,
double const   _radius 
) [inline]

Definition at line 22 of file d3circlepartition.h.

00023     : x0(_x0), radius(_radius) {}


Member Function Documentation

bool const d3circlepartition::intersection ( pt3 x,
pt3c w,
pt3c b 
) const

Definition at line 7 of file d3circlepartition.cpp.

References point2< T >::dot(), solvequadratic(), point3< T >::x, and point3< T >::y.

00012 {
00013   pt2c w2(w.x-x0.x,w.y-x0.y);
00014   pt2c b2(b.x-x0.x,b.y-x0.y);
00015 
00016   pt2c b3(b2-w2);
00017   double const q0 = b3.dot();
00018   double const q1 = w2.dot(b3)*2.0;
00019   double const q2 = w2.dot()-radius*radius;
00020 
00021   double t0;
00022   double t1;
00023   bool res = solvequadratic(t0,t1,q0,q1,q2);
00024   if (res==false)
00025     return false;
00026 
00027   double t = -1;
00028   if ((t0>=0.0) && (t0<=1.0))
00029     t = t0;
00030   if ((t1>=0.0) && (t1<=1.0))
00031     t = t1; 
00032   x = w + (b-w)*t;
00033 
00034   if (t==-1)
00035     return false;
00036  
00037   return true; 
00038 }

bool const d3circlepartition::isInside ( pt3c x  )  const [inline]

Definition at line 25 of file d3circlepartition.h.

References point2< T >::dot(), radius, point3< T >::x, x0, and point3< T >::y.

00026   {
00027     pt2 z(x.x,x.y);
00028     z -= x0;
00029     return z.dot() < radius*radius;
00030   }

bool const d3circlepartition::isOnBoundary ( pt3c w,
double const   zero 
) const

Definition at line 41 of file d3circlepartition.cpp.

References point2< T >::dot(), point3< T >::x, and point3< T >::y.

00045 {
00046   pt2c z(w.x-x0.x,w.y-x0.y);
00047   double const d = z.dot() - radius*radius;
00048 
00049   if (0 < (d + zero))
00050   {
00051     //if ( zero + d < zero + zero )
00052     if ( d < zero )
00053       return true;
00054   }
00055 
00056   return false;
00057 }


Member Data Documentation

Definition at line 17 of file d3circlepartition.h.

Referenced by d3circlepartitiondraw::draw(), and isInside().


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

Generated on Fri Mar 4 00:49:53 2011 for Chelton Evans Source by  doxygen 1.5.8