proj home

Files   Classes   Functions   Hierarchy  

meshrect Class Reference

Surface as a rectangular bezier patches. More...

#include <meshrect.h>

Collaboration diagram for meshrect:

List of all members.

Public Member Functions

pt3pij (uintc i, uintc j)
 i is the x-axis, j is the y-axis.
pt3 const & pij (uintc i, uintc j) const
 i is the x-axis, j is the y-axis.
 meshrect (uintc M_, uintc N_)
 Create a surface of points with uniform x and y values between and includeing [0.0,1.0].
 ~meshrect ()
 Cleanup.
template<typename F >
void func (F &f)
 Apply a function over the surface to calculate the z value.
void print () const
 Print the mesh as a 2D array.

Public Attributes

uintc M
 M partitions of X-axis.
uintc N
 N partitions of Y-axis.
pt3mat
 The points in the 2D matrix.


Detailed Description

Surface as a rectangular bezier patches.

(x,y) defines the surface with height z.

Definition at line 14 of file meshrect.h.


Constructor & Destructor Documentation

meshrect::meshrect ( uintc  M_,
uintc  N_ 
)

Create a surface of points with uniform x and y values between and includeing [0.0,1.0].

Definition at line 7 of file meshrect.cpp.

References M, mat, N, and pij().

00008   : M(M_), N(N_)
00009 {
00010   mat = new pt3[M*N];
00011   assert(mat!=0);
00012 
00013   double const dx = 1.0/((double)M-1.0);
00014   double const dy = 1.0/((double)N-1.0);
00015 
00016   for (uint j=0; j<N; ++j)
00017   {
00018     for (uint i=0; i<M; ++i)
00019       pij(i,j) = pt3(dx*i,dy*(N-1-j),0.0);
00020   }
00021 }

meshrect::~meshrect (  ) 

Cleanup.

Definition at line 23 of file meshrect.cpp.

References mat.

00024 {
00025   delete[] mat;
00026 }


Member Function Documentation

template<typename F >
void meshrect::func ( F &  f  )  [inline]

Apply a function over the surface to calculate the z value.

Definition at line 43 of file meshrect.h.

References M, mat, and N.

00044   {
00045     for (uint i=0; i<M*N; ++i)
00046       f(mat[i].z,mat[i].x,mat[i].y);
00047   }

pt3 const& meshrect::pij ( uintc  i,
uintc  j 
) const [inline]

i is the x-axis, j is the y-axis.

Definition at line 31 of file meshrect.h.

References mat, and N.

00032     { return mat[i+j*N]; }

pt3& meshrect::pij ( uintc  i,
uintc  j 
) [inline]

i is the x-axis, j is the y-axis.

Definition at line 28 of file meshrect.h.

References mat, and N.

Referenced by meshrect(), and print().

00029     { return mat[i+j*N]; }

void meshrect::print (  )  const

Print the mesh as a 2D array.

Definition at line 28 of file meshrect.cpp.

References M, N, and pij().

00029 {
00030   uint i;
00031   uint j=N;
00032   do
00033   {
00034     --j;
00035     for (i=0; i<M; ++i)
00036       cout << setw(10) << pij(i,j); 
00037     cout << endl;
00038   } while (j!=0);
00039 }


Member Data Documentation

M partitions of X-axis.

Definition at line 19 of file meshrect.h.

Referenced by func(), meshrect(), and print().

The points in the 2D matrix.

Definition at line 25 of file meshrect.h.

Referenced by func(), meshrect(), pij(), and ~meshrect().

N partitions of Y-axis.

Definition at line 22 of file meshrect.h.

Referenced by func(), meshrect(), pij(), and print().


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

Generated on Fri Mar 4 00:50:06 2011 for Chelton Evans Source by  doxygen 1.5.8