Main Page | Class List | Directories | File List | Class Members | File Members

structures.h

00001 /*
00002  * Physically Based Simulation, SS 2005
00003  *
00004  * Markus Liechti (liechtim@student.ethz.ch)
00005  * Yoshimi Takano (yoshi@student.ethz.ch)
00006  * Stefan Wismer (swismer@student.ethz.ch)
00007  *
00008  * $Id: structures.h,v 1.22 2005/06/26 18:40:26 ytakano Exp $
00009  */
00010 
00011 #ifndef __structures_H__
00012 #define __structures_H__
00013 
00014 #include "vector2.h"
00015 
00019 struct vertex {
00021         enum vertexType {normal = 0, fixed = 1, fixedTrainStartOrEnd = 2};
00022         
00024         vertexType type;
00025         
00027         component mass;
00028         
00030         vector2 initialPosition;
00031         
00033         vector2 position;
00034         
00036         vector2 velocity;
00037         
00039         vector2 force;
00040         
00042         component forceCoach;
00043 
00045         vertex() {}
00046         
00052         vertex(component x, component y): initialPosition(x, y) {}
00053 
00060         bool operator==(const vertex &v) {
00061                 return v.initialPosition == initialPosition; // this not: && v.type == type
00062         }
00063 };
00064 
00068 struct edge  {
00070         int start;
00071         
00073         int end;
00074         
00076         bool isRoad;
00077         
00079         component initialLength;
00080         
00082         component length;
00083         
00085         bool isBroken;
00086         
00092         component deformation() {
00093                 return  length / initialLength - 1.0;
00094         }
00095         
00101         bool operator==(const edge &e) {
00102                 return e.start == start && e.end == end;
00103         }
00104 };
00105 
00106 #endif

Generated on Sun Jul 10 22:32:04 2005 for S12 by  doxygen 1.4.2