visualvector.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // This file is part of libgvectors.
00004 // libgvectors is a C++ library intended for visualizing mathematical vectors.
00005 // Copyright (C) 2007  Rafael Ostertag
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // This program is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with this program; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
00020 // USA.
00021 //
00022 // $Id: visualvector_8h-source.html,v 1.1 2007-09-08 19:02:37 rafi Exp $
00023 //
00024 // File:   visualvector.h
00025 // Author: Rafael Ostertag
00026 //
00027 // Created on March 14, 2007, 10:56 AM
00028 //
00029 
00039 #ifndef _VISUALVECTOR_H
00040 #define _VISUALVECTOR_H
00041 
00042 #include <string>
00043 
00044 #include <gvenums.h>
00045 #include <coordinates.h>
00046 #include <rotation.h>
00047 #include <segment.h>
00048 #include <gvector.h>
00049 #include <drawer.h>
00050 #include <matrix4x4.h>
00051 
00052 namespace GVectors {
00063     class VisualVector : public GVector {
00064     private:
00070         Rotation rotation;
00076         Segment segment;
00082         double scale;
00088         double arrow_length;
00095         double arrow_angle;
00104         std::string tag;
00105         
00111         Matrix4x4 m_rot_x;
00117         Matrix4x4 m_rot_y;
00123         Matrix4x4 m_rot_z;
00129         Matrix4x4 m_rot_ix;
00135         Matrix4x4 m_rot_iy;
00141         Matrix4x4 m_rot_iz;
00147         Matrix4x4 m_scale;
00153         Matrix4x4 m_otrans;
00159         Matrix4x4 m_iotrans;
00160         
00162         void init_matrices();
00163         
00164     protected:
00166         void transform_vector_2d();
00167         
00168     public:
00170         VisualVector();
00172         VisualVector(double x, double y, double z);
00174         VisualVector(const std::string& t, double x, double y, double z);
00176         VisualVector(const GVector &v);
00178         VisualVector(const std::string& t, const GVector &v);
00180         VisualVector(double x, double y, double z, const Coordinates& origin);
00182         VisualVector(const std::string& t, double x, double y, double z, const Coordinates& origin);
00184         VisualVector(const GVector& v, const Coordinates& origin);
00186         VisualVector(const std::string& t, const GVector& v, const Coordinates& origin);
00188         virtual ~VisualVector();
00190         VisualVector(const VisualVector &vv);
00191         
00193         void set_scale(double s);
00195         void set_origin(const Coordinates &c);
00203         inline void set_arrow_length(double len) { arrow_length = len; }
00205         void set_arrow_angle(double ang, Angle_Type at=ANG_RAD);
00207         void set_rotation(const Rotation& rot);
00216         inline void set_tag(const std::string& t) { tag = t; }
00226         inline void set_color(const Color& c) { segment.set_color(c); }
00227                 
00235         inline double get_scale() const { return scale; }
00246         inline Coordinates get_origin() const { return segment.get_from(); }
00255         inline Coordinates get_end() const { return segment.get_to(); }
00263         inline double get_arrow_length() const { return arrow_length; }
00265         double get_arrow_angle(Angle_Type at=ANG_RAD) const;
00273         inline Rotation get_rotation() const { return rotation; }
00281         inline std::string get_tag() const { return tag; }
00289         inline Color get_color() const { return segment.get_color(); }
00290 
00292         void draw(Drawer &d);
00294         const VisualVector& operator=(const VisualVector &v);
00296         const VisualVector& operator=(const GVector &gv);
00297     };
00298    
00304     typedef VisualVector* vv_ptr_t;
00310     typedef VisualVector& vv_ref_t;
00316     typedef const VisualVector* const_vv_ptr_t;
00322     typedef const VisualVector& const_vv_ref_t;
00323 }
00324 
00325 #endif  /* _VISUALVECTOR_H */

Generated on Sat Sep 8 19:37:29 2007 for libgvectors by  doxygen 1.4.7