proj home

Files   Classes   Functions   Hierarchy  

planepointsurface Class Reference

Plane point surface. More...

#include <planepointsurface.h>

Collaboration diagram for planepointsurface:

List of all members.

Public Member Functions

 planepointsurface (plane &_pln)
 Need a plane to display.
void scaleSet (doublec s)
 Globaly scale the two axeses together.
void operator() (bool &accept, double &x, double &y, double &z, doublec u, doublec v)
 Generate a point of the surface with u and v in unit square.

Public Attributes

planepln
 The plane this surface represents.
double uoffset
 u is shifted before being scaled.
double voffset
 v is shifted before being scaled.
double uscale
 u axis is scaled.
double vscale
 v axis is scaled.


Detailed Description

Plane point surface.

This class is designed to be used with the pointsurface class. Essentially this class is a function which is a plane surface.

The client can set the scale and offset for the u and v variables. So when the operator () is called where on the plane the rectangular patch is generated can be controlled.

Example
  plane P1(nml,d); 
  ...
  planepointsurface f1(P1);
  // Say how many surface points to generate.
  pointsurface<> ps1(4000);
  // Color the points. 
  ps1.pre.push(new gobjglColor3ub(184,134,11) );
  ps1.addsurface2D(f1);
  gobjpush(&ps1);

Definition at line 31 of file planepointsurface.h.


Constructor & Destructor Documentation

planepointsurface::planepointsurface ( plane _pln  )  [inline]

Need a plane to display.

Definition at line 50 of file planepointsurface.h.

00051     : state(0), pln(_pln), uoffset(-0.5), voffset(-0.5), 
00052       uscale(20.0), vscale(20.0) {}


Member Function Documentation

void planepointsurface::operator() ( bool accept,
double &  x,
double &  y,
double &  z,
doublec  u,
doublec  v 
)

Generate a point of the surface with u and v in unit square.

Definition at line 6 of file planepointsurface.cpp.

References point3< T >::x, point3< T >::y, and point3< T >::z.

00014 {
00015   ++state;
00016   state %=3;
00017 
00018   doublec u2 = (uoffset + u)*uscale;
00019   doublec v2 = (voffset + v)*vscale;
00020 
00021   point3<double> & nml(pln.nml);
00022 
00023   accept=false;
00024    
00025   switch (state)
00026   {
00027     case 0:
00028       if (nml.z*nml.z<zero<double>::val)
00029         return;
00030 
00031       x = u2;
00032       y = v2;
00033       z = (pln.d0-u2*nml.x-v2*nml.y)/nml.z;
00034       accept=true;
00035       break;
00036 
00037     case 1:
00038       if (nml.x*nml.x<zero<double>::val)
00039         return;
00040 
00041       y = u2;
00042       z = v2;
00043       x = (pln.d0-u2*nml.y-v2*nml.z)/nml.x;
00044       accept=true;
00045       break;
00046 
00047     case 2:
00048       if (nml.y*nml.y<zero<double>::val)
00049         return;
00050 
00051       x = u2;
00052       z = v2;
00053       y = (pln.d0-u2*nml.x-v2*nml.z)/nml.y;
00054       accept=true;
00055       break;
00056   }
00057 }

void planepointsurface::scaleSet ( doublec  s  )  [inline]

Globaly scale the two axeses together.

Definition at line 55 of file planepointsurface.h.

References uscale, and vscale.

Referenced by planeinttest::test01().

00056     { uscale=s; vscale=s; }


Member Data Documentation

The plane this surface represents.

Definition at line 38 of file planepointsurface.h.

u is shifted before being scaled.

Definition at line 41 of file planepointsurface.h.

u axis is scaled.

Definition at line 45 of file planepointsurface.h.

Referenced by scaleSet().

v is shifted before being scaled.

Definition at line 43 of file planepointsurface.h.

v axis is scaled.

Definition at line 47 of file planepointsurface.h.

Referenced by scaleSet().


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

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