Files Classes Functions Hierarchy
#include <pointgrid3D.h>
Public Member Functions | |
| point3< double > const & | pij (uintc i, uintc j) const |
| Access the i'th column and j'th row. | |
| pointgrid3D (uintc M_, uintc N_) | |
| Construct evenly sampled points in x and y axes including 0.0 and 1.0. | |
| pointgrid3D (uintc M_, uintc N_, doublec x0, doublec x1, doublec y0, doublec y1) | |
| Construct evenly sampled points in x and y axes along [x0,x1] and [y0,y1]. | |
| pointgrid3D (uintc M_, uintc N_, doublec x0, doublec x1, doublec z0, doublec z1, bool const xzsurface) | |
| Construct evenly sampled points in x and z axes along [x0,x1] and [z0,z1]. | |
| void | createIndexedTriangles (vector< point3< double > > &points, vector< point3< uint > > &vi) const |
| Write out the grid as indexed triangles. | |
| template<typename T > | |
| void | createIndexedTrianglesT (T &x) const |
| ~pointgrid3D () | |
| Memory cleanup. | |
Public Attributes | |
| uintc | M |
| The number of rows. | |
| uintc | N |
| The number of columns. | |
| point3< double > * | pt |
| Sequence interpreted as a matrix from the bottom up. | |
A vector of points uniformily covers the square from the bottom up. x is the axis with the columns. The second axis has the rows.
At construction time the second axis for the surface is choosen. A range can be given which does away with the unit square. The range bounds do include the end points.
When constructed the surface x-y values or surface x-z are calculated.
The height or surface value is not calculated. Here is an example where a functional object was used.
#include <mathlib.h> #include <func2dovervec3d.h> ... pointgrid3D g(5,4,-1.0,3.0,-1.0,3.0,true); tempsin2 f2; // Apply the function with the surface as input. func2Dovervec3D< point3<double> >(g.pt,g.M*g.N).evalY(f2);
Definition at line 37 of file pointgrid3D.h.
Construct evenly sampled points in x and y axes including 0.0 and 1.0.
Definition at line 7 of file pointgrid3D.cpp.
References M, N, pt, point3< T >::x, and point3< T >::y.
00008 : M(M_), N(N_), pt(new point3<double>[M*N]) 00009 { 00010 doublec dx = 1.0/((double)N-1.0); 00011 doublec dy = 1.0/((double)M-1.0); 00012 00013 double x(0.0); 00014 double y(0.0); 00015 00016 uint index(0); 00017 uint i,k; 00018 for (i=0; i<M; ++i) 00019 { 00020 x = 0.0; 00021 for (k=0; k<N; ++k) 00022 { 00023 pt[index].x = x; 00024 pt[index].y = y; 00025 ++index; 00026 x += dx; 00027 } 00028 y += dy; 00029 } 00030 }
Construct evenly sampled points in x and y axes along [x0,x1] and [y0,y1].
Definition at line 33 of file pointgrid3D.cpp.
00041 : M(M_), N(N_), pt(new point3<double>[M*N]) 00042 { 00043 assert(x0<x1); 00044 assert(y0<y1); 00045 00046 doublec dx = (x1-x0)/((double)N-1.0); 00047 doublec dy = (y1-y0)/((double)M-1.0); 00048 00049 double x(x0); 00050 double y(y0); 00051 00052 uint index(0); 00053 uint i,k; 00054 for (i=0; i<M; ++i) 00055 { 00056 x = x0; 00057 for (k=0; k<N; ++k) 00058 { 00059 pt[index].x = x; 00060 pt[index].y = y; 00061 ++index; 00062 x += dx; 00063 } 00064 y += dy; 00065 } 00066 }
| pointgrid3D::pointgrid3D | ( | uintc | M_, | |
| uintc | N_, | |||
| doublec | x0, | |||
| doublec | x1, | |||
| doublec | z0, | |||
| doublec | z1, | |||
| bool const | xzsurface | |||
| ) |
Construct evenly sampled points in x and z axes along [x0,x1] and [z0,z1].
Definition at line 69 of file pointgrid3D.cpp.
00078 : M(M_), N(N_), pt(new point3<double>[M*N]) 00079 { 00080 assert(xzsurface==true); // Dummy argument. 00081 assert(x0<x1); 00082 assert(z0<z1); 00083 00084 doublec dx = (x1-x0)/((double)N-1.0); 00085 doublec dz = (z1-z0)/((double)M-1.0); 00086 00087 double x(x0); 00088 double z(z0); 00089 00090 uint index(0); 00091 uint i,k; 00092 for (i=0; i<M; ++i) 00093 { 00094 x = x0; 00095 for (k=0; k<N; ++k) 00096 { 00097 pt[index].x = x; 00098 pt[index].z = z; 00099 ++index; 00100 x += dx; 00101 } 00102 z += dz; 00103 } 00104 }
| pointgrid3D::~pointgrid3D | ( | ) |
Memory cleanup.
Definition at line 106 of file pointgrid3D.cpp.
References pt.
00107 { 00108 delete[] pt; 00109 }
| void pointgrid3D::createIndexedTriangles | ( | vector< point3< double > > & | points, | |
| vector< point3< uint > > & | vi | |||
| ) | const |
Write out the grid as indexed triangles.
Copies the points from pts to points.
Definition at line 112 of file pointgrid3D.cpp.
References r.
Referenced by createIndexedTrianglesT(), and meshpatchtest::test04().
00116 { 00117 uintc p0 = points.size(); 00118 00119 for (uint i=0; i<M*N; ++i) 00120 points.push_back(pt[i]); 00121 00122 for (uint r=1; r<M; ++r) 00123 { 00124 for (uint k=1; k<N; ++k) 00125 { 00126 vi.push_back 00127 ( 00128 point3<uint>(p0+r*N+k-1,p0+(r-1)*N+k-1,p0+(r-1)*N+k ) 00129 ); 00130 vi.push_back 00131 ( 00132 point3<uint>(p0+r*N+k-1,p0+(r-1)*N+k,p0+r*N+k ) 00133 ); 00134 } 00135 } 00136 }
| void pointgrid3D::createIndexedTrianglesT | ( | T & | x | ) | const [inline] |
Definition at line 91 of file pointgrid3D.h.
References createIndexedTriangles().
00092 { createIndexedTriangles(x.points,x.vi); }
Access the i'th column and j'th row.
Definition at line 50 of file pointgrid3D.h.
Referenced by pointgrid3Ddraw::update().
The number of rows.
Definition at line 42 of file pointgrid3D.h.
Referenced by pointgrid3Dbilineardraw::operator()(), pointgrid3D(), meshpatchtest::test02(), meshpatchtest::test04(), pointgrid3Ddraw::update(), and pointgrid3Dbilineardraw::update().
The number of columns.
Definition at line 44 of file pointgrid3D.h.
Referenced by pointgrid3Dbilineardraw::operator()(), pij(), pointgrid3D(), meshpatchtest::test02(), meshpatchtest::test04(), pointgrid3Ddraw::update(), and pointgrid3Dbilineardraw::update().
| point3<double>* pointgrid3D::pt |
Sequence interpreted as a matrix from the bottom up.
Definition at line 47 of file pointgrid3D.h.
Referenced by pointgrid3Dbilineardraw::operator()(), pij(), pointgrid3D(), meshpatchtest::test02(), meshpatchtest::test04(), pointgrid3Ddraw::update(), and ~pointgrid3D().
1.5.8