proj home

Files   Classes   Functions   Hierarchy  

spring1< F > Class Template Reference

#include <spring1.h>

Collaboration diagram for spring1< F >:

List of all members.

Public Member Functions

 spring1 ()
void init (uintc sample_, doublec h, doublec t0, doublec x00, doublec x10, doublec kval=0.1, doublec len=1.0, doublec radius=0.2)
void idle ()
void draw ()

Public Attributes

DEsys< double, 2, 1 > de
RK< double, F > fi
gspring spr
bool drawenabled
uint sample
double lennatural


Detailed Description

template<typename F>
class spring1< F >

Definition at line 69 of file spring1.h.


Constructor & Destructor Documentation

template<typename F >
spring1< F >::spring1 (  )  [inline]

Definition at line 84 of file spring1.h.

00084 {}


Member Function Documentation

template<typename F >
void spring1< F >::draw (  )  [inline]

Definition at line 111 of file spring1.h.

References spring1< F >::drawenabled, and spring1< F >::spr.

00112 {
00113   if (drawenabled)
00114   {
00115     glPushMatrix();
00116 
00117     spr.draw();
00118     
00119     glPopMatrix();
00120   }
00121 }

template<typename F >
void spring1< F >::idle (  )  [inline]

Definition at line 124 of file spring1.h.

References spring1< F >::de, spring1< F >::lennatural, spring1< F >::sample, and spring1< F >::spr.

00125 {
00126   de();
00127 
00128   static uint counter;
00129 
00130   ++counter;
00131   if ((counter % sample)==0)
00132   {
00133     spr.h.len = lennatural+de.y[0][0];
00134 
00135     glutPostRedisplay();
00136     counter=0;
00137   }
00138 }

template<typename F >
void spring1< F >::init ( uintc  sample_,
doublec  h,
doublec  t0,
doublec  x00,
doublec  x10,
doublec  kval = 0.1,
doublec  len = 1.0,
doublec  radius = 0.2 
) [inline]

Definition at line 143 of file spring1.h.

00153 {
00154   de.h[0]=h;
00155 
00156   de.xval = t0;
00157   de.yi[0] = x00;
00158   de.yi[1] = x10;
00159 
00160   fi.Dy.kval = kval;
00161   fi.Dy.x = & (de.y[0][0]);
00162 
00163   de.fi[0] = & fi;
00164 
00165   lennatural = len;
00166 
00167   spr = gspring
00168   ( 
00169     helix(len+x00,10,0.2,200, 0.2,0.8,0.17),
00170     mysphere
00171     (
00172       radius, 
00173       0.1,0.6,0.77,
00174       0.0,0.0,0.0
00175     )
00176   );
00177 
00178   sample=sample_;
00179 
00180   drawenabled=true;
00181 }


Member Data Documentation

template<typename F >
DEsys< double, 2, 1 > spring1< F >::de

Definition at line 73 of file spring1.h.

Referenced by spring1< F >::idle().

template<typename F >
bool spring1< F >::drawenabled

Definition at line 78 of file spring1.h.

Referenced by spring1< F >::draw().

template<typename F >
RK< double, F > spring1< F >::fi

Definition at line 74 of file spring1.h.

template<typename F >
double spring1< F >::lennatural

Definition at line 82 of file spring1.h.

Referenced by spring1< F >::idle().

template<typename F >
uint spring1< F >::sample

Definition at line 80 of file spring1.h.

Referenced by spring1< F >::idle().

template<typename F >
gspring spring1< F >::spr

Definition at line 76 of file spring1.h.

Referenced by spring1< F >::draw(), and spring1< F >::idle().


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

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