Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

math_translate.H

Go to the documentation of this file.
00001 /*
00002  * Copyright 2000, Brown University, Providence, RI.
00003  * 
00004  *                         All Rights Reserved
00005  * 
00006  * Permission to use, copy, modify, and distribute this software and its
00007  * documentation for any purpose other than its incorporation into a
00008  * commercial product is hereby granted without fee, provided that the
00009  * above copyright notice appear in all copies and that both that
00010  * copyright notice and this permission notice appear in supporting
00011  * documentation, and that the name of Brown University not be used in
00012  * advertising or publicity pertaining to distribution of the software
00013  * without specific, written prior permission.
00014  * 
00015  * BROWN UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00016  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ANY
00017  * PARTICULAR PURPOSE.  IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE FOR
00018  * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00019  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00020  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00021  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00022  */
00023 #ifndef GLUE_MLIB_MATH_TRANSLATE_H
00024 #define GLUE_MLIB_MATH_TRANSLATE_H
00025 #include "points.H"
00026 
00027 // MathTranslate - base class with stubs for translating between types
00028 class DllImpExp MathTranslate {
00029    protected:
00030       static MathTranslate *instance_;
00031    public:
00032       virtual ~MathTranslate() {}
00033       virtual Wpt  toWpt(cXYpt &xypt, cWpt &parallel_wpt) = 0;
00034       virtual Wpt  toWpt(cXYpt &xypt, double distance) = 0;
00035       virtual Wpt  toWpt(cXYpt &xypt) = 0;
00036       virtual Wvec toWvec(cXYpt &xypt) = 0;
00037 
00038       virtual XYpt    toXYpt(cWpt &wpt) = 0;
00039 
00040       // View
00041       virtual void    view_size(int &width, int &height) = 0;
00042       virtual void    view_pixels(double &, NDCpt &) = 0;
00043       virtual double  VIEW_ASPECT() = 0;
00044       virtual Wtransf VIEW_NDC_TRANS() = 0;
00045 
00046       // ROOM space
00047       virtual void  setROOM_TO_WORLD(cWtransf &/*xf*/) { }
00048       virtual void  setWORLD_TO_ROOM(cWtransf &/*xf*/) { }
00049       virtual const Wtransf &ROOM_TO_WORLD() = 0;
00050       virtual const Wtransf &WORLD_TO_ROOM() = 0;
00051       virtual ROOMpt   toROOM(cWpt &p)  { Wpt a(WORLD_TO_ROOM()*p); 
00052                       return ROOMpt(a[0],a[1],a[2]); }
00053       virtual ROOMvec  toROOM(cWvec &v) { Wvec a(WORLD_TO_ROOM()*v); 
00054                       return ROOMvec(a[0],a[1],a[2]); }
00055       virtual Wpt  toW(cROOMpt &p)      { return ROOM_TO_WORLD()*
00056                          Wpt(p[0],p[1],p[2]); }
00057       virtual Wvec toW(cROOMvec &v)     { return ROOM_TO_WORLD()*
00058                          Wvec(v[0],v[1],v[2]); }
00059 
00060       static MathTranslate *instance()              { return instance_; }
00061       static void set_instance(MathTranslate *inst) { instance_ = inst; }
00062 };
00063 #endif

Generated on Mon Sep 15 16:25:56 2003 for gluebase by doxygen1.2.18