Classes | Typedefs | Functions

MeshLib Namespace Reference

Classes

class  CCircle
 CCircle class, circle on the plane. More...
class  CPoint
 CPoint class, three dimensional point. More...
class  CPoint2
 CPoint2 class, two dimensional point. More...
class  CQrot
 CQrot quaternion class. More...
class  CDenseMatrix
struct  _Entry
 Entry in the sparse matrix. More...
class  CSparseMatrix
 CSparseMatrix. More...
class  CBaseMesh
 CBaseMesh, base class for all types of mesh classes. More...
class  CLoop
 CLoop Boundary loop class. More...
class  CBoundary
 CBoundary Boundary class. More...
class  CDynamicMesh
 CDynamicMesh class : Dynamic mesh. More...
class  CEdge
 CEdge class, which is the base class of all kinds of edge classes. More...
class  CEdgeKey
 CEdgeKey class, which is used for sorting edges. More...
class  CFace
 CFace base class of all kinds of face classes. More...
class  CHalfEdge
 CHalfEdge Base class of all kinds of halfedges. More...
class  VertexOutHalfedgeIterator
 VertexOutHalfedgeIterator, transverse all the outgoing halfedges of a vertex ccwly. More...
class  VertexInHalfedgeIterator
 VertexInHalfedgeIterator, transverse all the incoming halfedges of a vertex ccwly. More...
class  VertexVertexIterator
 VertexVertexIterator, transverse all the neighboring vertices of a vertex ccwly. More...
class  VertexEdgeIterator
 VertexEdgeIterator, transverse all the neighboring edges of a vertex ccwly. More...
class  VertexFaceIterator
 VertexFaceIterator, transverse all the neighboring faces of a vertex ccwly. More...
class  FaceHalfedgeIterator
 FaceHalfedgeIterator, transverse all the halfedges of a face CCWly. More...
class  FaceEdgeIterator
 FaceEdgeIterator, transverse all the edges of a face CCWly. More...
class  FaceVertexIterator
 FaceVertexIterator, transverse all the vertices of a face CCWly. More...
class  MeshVertexIterator
 MeshVertexIterator, transverse all the vertices in the mesh. More...
class  MeshFaceIterator
 MeshFaceIterator, transverse all the faces in the mesh. More...
class  MeshEdgeIterator
 MeshEdgeIterator, transverse all the edges in the mesh. More...
class  MeshHalfEdgeIterator
 MeshHalfEdgeIterator, transverse all the halfedges in the mesh. More...
class  CVertex
 CVertex class, which is the base class of all kinds of vertex classes. More...
class  CMobius
 CMobius class, Mobius transformation. More...
class  CToken
 CToken class, key=(value), e.g. uv=(x y). More...
class  CParser
 CParser class. More...
class  CArcball
 CArcball Interface. More...
class  CViewerFace
 CViewerFace class. More...
class  CViewerVertex
 CViewerVertex class. More...
class  CViewerMesh
 CViewerMesh class. More...

Typedefs

typedef std::complex< double > Complex
typedef CViewerMesh
< CViewerVertex, CEdge,
CViewerFace, CHalfEdge
CVMesh

Functions

CCircle orthogonal (CCircle C[3])
int _circle_circle_intersection (CCircle C0, CCircle C1, CPoint2 &p0, CPoint2 &p1)
void operator>> (const std::string &str, CPoint &p)
CPoint2 operator+ (CPoint2 &uv0, CPoint2 &uv1)
CPoint2 operator- (CPoint2 &uv0, CPoint2 &uv1)
CPoint2 operator* (CPoint2 &uv0, const double s)
CPoint2 operator/ (CPoint2 &uv0, const double s)
CPoint2 operator+ (const CPoint2 &uv0, const CPoint2 &uv1)
CPoint2 operator- (const CPoint2 &uv0, const CPoint2 &uv1)
CPoint2 operator* (const CPoint2 &uv0, const double s)
CPoint2 operator/ (const CPoint2 &uv0, const double s)
double mag2 (CPoint2 &uv)
double mag (CPoint2 &uv)
double cross (CPoint2 uv1, CPoint2 uv2)
double operator* (CPoint2 a, CPoint2 b)
double operator^ (CPoint2 uv1, CPoint2 uv2)
void operator>> (const std::string &str, CPoint2 &c)
double _inner_product (double *v1, double *v2, int num)
void _scale (double *v, double s, int num)
double norm (double *v, int num)
void _normalize (double *v, int num)

Typedef Documentation

typedef std::complex<double> MeshLib::Complex

use complex number in STL

Definition at line 21 of file Mobius.h.

Definition at line 114 of file ViewerMesh.h.


Function Documentation

int MeshLib::_circle_circle_intersection ( CCircle  C0,
CCircle  C1,
CPoint2 &  p0,
CPoint2 &  p1 
) [inline]

Definition at line 113 of file Circle.h.

{

        double x0 = C0.c()[0];
        double y0 = C0.c()[1]; 
        double r0 = C0.r();
                                                                                
        double x1 = C1.c()[0];
        double y1 = C1.c()[1]; 
        double r1 = C1.r();
          
        double a, dx, dy, d, h, rx, ry;
        double x2, y2;

  /* dx and dy are the vertical and horizontal distances between
   * the circle centers.
   */
  dx = x1 - x0;
  dy = y1 - y0;

  /* Determine the straight-line distance between the centers. */
  d = sqrt((dy*dy) + (dx*dx));

  /* Check for solvability. */
  if (d > (r0 + r1))
  {
    /* no solution. circles do not intersect. */
    return 0;
  }
  if (d < abs(r0 - r1))
  {
    /* no solution. one circle is contained in the other */
    return 0;
  }

  /* 'point 2' is the point where the line through the circle
   * intersection points crosses the line between the circle
   * centers.  
   */

  /* Determine the distance from point 0 to point 2. */
  a = ((r0*r0) - (r1*r1) + (d*d)) / (2.0 * d) ;

  /* Determine the coordinates of point 2. */
  x2 = x0 + (dx * a/d);
  y2 = y0 + (dy * a/d);

  /* Determine the distance from point 2 to either of the
   * intersection points.
   */
  h = sqrt((r0*r0) - (a*a));

  /* Now determine the offsets of the intersection points from
   * point 2.
   */
  rx = -dy * (h/d);
  ry = dx * (h/d);

  /* Determine the absolute intersection points. */
  p0 = CPoint2( x2 + rx, y2+ry);
  p1 = CPoint2( x2 - rx, y2-ry);

  return 1;
};

Here is the call graph for this function:

double MeshLib::_inner_product ( double *  v1,
double *  v2,
int  num 
)

Definition at line 12 of file densematrix.h.

        {
                double sum = 0;
                for( int i = 0; i < num; i ++ )
                {
                        sum += v1[i] * v2[i];
                }
                return sum;
        };

Here is the caller graph for this function:

void MeshLib::_normalize ( double *  v,
int  num 
)

Definition at line 36 of file densematrix.h.

        {
                double mag = norm( v, num );
                                
                for( int i = 0; i < num; i ++ )
                {
                        v[i] /= mag;
                };
        };

Here is the call graph for this function:

Here is the caller graph for this function:

void MeshLib::_scale ( double *  v,
double  s,
int  num 
)

Definition at line 22 of file densematrix.h.

        {
                for( int i = 0; i < num; i ++ )
                {
                        v[i] *= s;
                }
        };

double MeshLib::cross ( CPoint2  uv1,
CPoint2  uv2 
) [inline]

cross product of two CPoint2

Parameters:
uv1 the first two diemenional point
uv2 the second two diemenional point
Returns:
the cross product of the two points

\[ \left| \begin{array}{cc} x_1 & y_1\\ x_2 & y_2 \\ \end{array} \right| \]

Definition at line 215 of file Point2.H.

{
        return (uv1[0] * uv2[1] - uv1[1] * uv2[0]);
};

double MeshLib::mag ( CPoint2 &  uv  )  [inline]

norm of the CPoint2 $ \sqrt{x^2+y^2}$

Parameters:
uv input two dimensional point
Returns:
norm of the point

Definition at line 195 of file Point2.H.

{
        return sqrt(uv[0] * uv[0] + uv[1] * uv[1]);
};

Here is the caller graph for this function:

double MeshLib::mag2 ( CPoint2 &  uv  )  [inline]

square of the norm of the CPoint2 $x^2+y^2$

Parameters:
uv input two dimensional point
Returns:
square of the norm of the point

Definition at line 185 of file Point2.H.

{
        return uv[0] * uv[0] + uv[1] * uv[1];
};

Here is the caller graph for this function:

double MeshLib::norm ( double *  v,
int  num 
)

Definition at line 30 of file densematrix.h.

        {
                double inner_product = _inner_product( v,v, num );
                return sqrt( inner_product );   
        };

Here is the call graph for this function:

Here is the caller graph for this function:

CPoint2 MeshLib::operator* ( const CPoint2 &  uv0,
const double  s 
) [inline]

multiply by a scalor

Parameters:
uv0 input two dimensional point
s scalor
Returns:
product of uv0 and s

Definition at line 162 of file Point2.H.

{
        CPoint2 uv( uv0[0] * s, uv0[1] * s );
        return uv;
};

CPoint2 MeshLib::operator* ( CPoint2 &  uv0,
const double  s 
) [inline]

multiply by a scalor

Parameters:
uv0 input two dimensional point
s scalor
Returns:
product of uv0 and s

Definition at line 113 of file Point2.H.

{
        CPoint2 uv( uv0[0] * s, uv0[1] * s );
        return uv;
};

double MeshLib::operator* ( CPoint2  a,
CPoint2  b 
) [inline]

inner product of two CPoint2

Parameters:
a the first two diemenional point
b the second two diemenional point
Returns:
the inner product of the two points

Definition at line 227 of file Point2.H.

{
    return a[0] * b[0] + a[1] * b[1];
}

CPoint2 MeshLib::operator+ ( const CPoint2 &  uv0,
const CPoint2 &  uv1 
) [inline]

summation of two two dimensional points

Parameters:
uv0 input two dimensional point
uv1 input two dimensional point
Returns:
summation of uv0 and uv1

Definition at line 138 of file Point2.H.

{
        CPoint2 uv( uv0[0]+uv1[0], uv0[1] + uv1[1] );
        return uv;
};

CPoint2 MeshLib::operator+ ( CPoint2 &  uv0,
CPoint2 &  uv1 
) [inline]

summation of two two dimensional points

Parameters:
uv0 input two dimensional point
uv1 input two dimensional point
Returns:
summation of uv0 and uv1

Definition at line 89 of file Point2.H.

{
        CPoint2 uv( uv0[0]+uv1[0], uv0[1] + uv1[1] );
        return uv;
};

CPoint2 MeshLib::operator- ( const CPoint2 &  uv0,
const CPoint2 &  uv1 
) [inline]

difference between two two dimensional points

Parameters:
uv0 input two dimensional point
uv1 input two dimensional point
Returns:
difference between uv0 and uv1

Definition at line 150 of file Point2.H.

{
        CPoint2 uv( uv0[0]-uv1[0], uv0[1] - uv1[1] );
        return uv;
};

CPoint2 MeshLib::operator- ( CPoint2 &  uv0,
CPoint2 &  uv1 
) [inline]

difference between two two dimensional points

Parameters:
uv0 input two dimensional point
uv1 input two dimensional point
Returns:
difference between uv0 and uv1

Definition at line 101 of file Point2.H.

{
        CPoint2 uv( uv0[0]-uv1[0], uv0[1] - uv1[1] );
        return uv;
};

CPoint2 MeshLib::operator/ ( const CPoint2 &  uv0,
const double  s 
) [inline]

divide by a scalor

Parameters:
uv0 input two dimensional point
s scalor
Returns:
quotient between uv0 and s

Definition at line 174 of file Point2.H.

{
        CPoint2 uv( uv0[0] / s, uv0[1] / s );
        return uv;
};

CPoint2 MeshLib::operator/ ( CPoint2 &  uv0,
const double  s 
) [inline]

divide by a scalor

Parameters:
uv0 input two dimensional point
s scalor
Returns:
quotient between uv0 and s

Definition at line 126 of file Point2.H.

{
        CPoint2 uv( uv0[0] / s, uv0[1] / s );
        return uv;
};

void MeshLib::operator>> ( const std::string &  str,
CPoint2 &  c 
) [inline]

read in a CPoint2 from a string

Parameters:
str input string
c the reference to a point
Returns:
the value of (x,y) read out from the string is assigned bo c

Definition at line 251 of file Point2.H.

{
        std::string t = str;
        t.erase(0, t.find_first_not_of("()") );
        t.erase(t.find_last_not_of("()") + 1);
        std::istringstream iss( t );

        iss >> c[0] >> c[1];
}

void MeshLib::operator>> ( const std::string &  str,
CPoint &  p 
) [inline]

Read a CPoint from a string

Parameters:
str string
p three dimenionsal point
Returns:
the (x,y,z) value is read from str and assigned to p.

Definition at line 189 of file Point.h.

{
        std::string t = str;
        t.erase(0, t.find_first_not_of("()") );
        t.erase(t.find_last_not_of("()") + 1);
        std::istringstream iss( t );

        iss >> p[0] >> p[1] >> p[2];
}

double MeshLib::operator^ ( CPoint2  uv1,
CPoint2  uv2 
) [inline]

cross product of two CPoint2

Parameters:
uv1 the first two diemenional point
uv2 the second two diemenional point
Returns:
the cross product of the two points

Definition at line 239 of file Point2.H.

{
        return (uv1[0] * uv2[1] - uv1[1] * uv2[0]);
};

CCircle MeshLib::orthogonal ( CCircle  C[3]  )  [inline]

Computing a circle orthogonal to three other circles

Definition at line 62 of file Circle.h.

{

        //The cricle C_i is : <p,p> - 2<p,c_i> = d_i
        double d[3];
        for( int i = 0; i < 3; i ++ )
        {
                d[i] = C[i].r()*C[i].r() - mag2( C[i].c());
        }
        
        //the common chord lines are <p,dc_k> = h_k
        CPoint2 dc[2];
        
        dc[0] = C[1].c() - C[0].c();
        dc[1] = C[2].c() - C[1].c();

        double  h[2];
        h[0] = ( d[0] - d[1] )/2.0;
        h[1] = ( d[1] - d[2] )/2.0;

        double m[2][2];

        for( int i = 0; i < 2; i ++ )
        for( int j = 0; j < 2; j ++ )
        {
                m[i][j] = dc[i]*dc[j];
        }
        
        double det = m[0][0] * m[1][1] - m[1][0] * m[0][1];
        double inv[2][2];

        inv[0][0] =  m[1][1]/det;
        inv[1][1] =  m[0][0]/det;
        inv[0][1] = -m[0][1]/det;
        inv[1][0] = -m[1][0]/det;

        double x[2];
        x[0] = inv[0][0] * h[0] + inv[0][1] * h[1];
        x[1] = inv[1][0] * h[0] + inv[1][1] * h[1];

        CPoint2 center = dc[0] * x[0] + dc[1] * x[1];

        double radius = sqrt( mag2(center-C[0].c()) - C[0].r()*C[0].r() );
        
        //printf("%f %f %f\n", radius, sqrt( mag2(center-C[1].c()) - C[1].r()*C[1].r() ), sqrt( mag2(center-C[2].c()) - C[2].r()*C[2].r() ) );
        
        return CCircle( center, radius );
};

Here is the call graph for this function:

 All Classes Namespaces Files Functions Variables Typedefs Enumerator Defines