View.cpp

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.3 $
00022 // $Date: 2003/02/14 23:01:58 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/renderer/View.cpp,v $
00024                                                                         
00025                                                                         
00026 #include "View.h"
00027 #include "db.H"
00028 
00029 View theView;
00030 
00031 View::View()
00032 {
00033 
00034 }
00035 
00036 View::~View()
00037 {
00038 
00039 }
00040 
00041 int
00042 View::update(void)
00043 {
00044   // first determine coords for Viewing system
00045   VECTOR u, v, n;
00046 //  float scalar;
00047   int i;
00048 
00049 
00050   for (i=0; i<3; i++) {
00051     n[i] = vpn[i];
00052     v[i] = vuv[i];
00053   }
00054    
00055   if (n.Normalize() != 0) {
00056     opserr << "View::update() - VPN cannot have zero length\n";
00057     return -1;
00058   }
00059 
00060   u = v % n;
00061   if (u.Normalize() != 0) {
00062     opserr << "View::update() - VUV X VPN cannot have zero length\n";
00063     return -1;
00064   }
00065 
00066    v = n % u;
00067    v.Normalize();
00068 
00069    TMat.Set(       u[0],   v[0],   n[0], 0,
00070                    u[1],   v[1],   n[1], 0,
00071                    u[2],   v[2],   n[2], 0,
00072                   -vrp.Dot(u), -vrp.Dot(v), -vrp.Dot(n), 1.0);
00073 
00074    return 0;
00075 }
00076 
00077 
00078 FACE &
00079 View::transform(FACE &input)
00080 {
00081   // transform all the points by the transformation matrix
00082   // remember that in previos pipeline all points were marked
00083   MYPOINT *point;
00084   FOR_EACH(point, input.pointList) {
00085     point->Transform(&TMat);
00086   };
00087 
00088   return input;
00089 }
00090 
00091 
00092 MYPOINT *
00093 View::transformP(MYPOINT *input)
00094 {
00095     if (input != 0)
00096         input->Transform(&TMat);
00097 
00098     return input;
00099 }
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 

Generated on Mon Oct 23 15:05:27 2006 for OpenSees by doxygen 1.5.0