proj home

Files   Classes   Functions   Hierarchy  

d3circlepartition.cpp

Go to the documentation of this file.
00001 #include <d3circlepartition.h>
00002 
00003 #include <mathlib.h>
00004 
00005 
00006 bool const d3circlepartition::intersection
00007 (
00008   pt3 & x, 
00009   pt3c & w, 
00010   pt3c & b
00011 ) const
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 }
00039 
00040 bool const d3circlepartition::isOnBoundary
00041 (
00042   pt3c & w, 
00043   double const zero
00044 ) const
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 }
00058 
00059 

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