edge.h

00001 //
00002 // edge.h
00003 //
00004 // Copyright (C) 1996 Limit Point Systems, Inc.
00005 //
00006 // Author: Curtis Janssen <cljanss@limitpt.com>
00007 // Maintainer: LPS
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
00026 //
00027 
00028 #ifndef _math_isosurf_edge_h
00029 #define _math_isosurf_edge_h
00030 
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034 
00035 #include <set>
00036 
00037 #include <math/isosurf/vertex.h>
00038 
00039 namespace sc {
00040 
00041 class Edge: public RefCount {
00042   private:
00043     int _order;
00044     Ref<Vertex> *_vertices; // nvertices = _order + 1
00045   public:
00046     Edge(const Ref<Vertex> &p1,
00047          const Ref<Vertex> &p2)
00048     {
00049       _order = 1;
00050       _vertices = new Ref<Vertex>[2];
00051       _vertices[0]=p1; _vertices[1]=p2;
00052     }
00053     Edge(const Ref<Vertex> &p1,
00054          const Ref<Vertex> &p2,
00055          const Ref<Vertex> &p3);
00056     Edge(const Ref<Vertex> &p1,
00057          const Ref<Vertex> &p2,
00058          const Ref<Vertex> &p3,
00059          const Ref<Vertex> &p4);
00060     ~Edge();
00061     int order() const { return _order; }
00062     double straight_length();
00063     // return the endpoints
00064     Ref<Vertex> vertex(int i) const
00065     {
00066       return i?_vertices[_order]:_vertices[0];
00067     }
00068     // returns endpoints or interior vertex 0 <= i <= order
00069     Ref<Vertex> interior_vertex(int i) const
00070     {
00071       return _vertices[i];
00072     }
00073     // add the endpoints to the set
00074     void add_vertices(std::set<Ref<Vertex> >&);
00075     void set_order(int order, const Ref<Volume>&vol,double isovalue);
00076     // find the position of a point on the edge
00077     int interpolate(double location, SCVector3&point, SCVector3&norm);
00078     // find the true position of a point using the isosurface
00079     int interpolate(double location, SCVector3&point, SCVector3&norm,
00080                      const Ref<Volume> &vol, double isovalue);
00081 };
00082 
00083 }
00084 
00085 #endif
00086 
00087 // Local Variables:
00088 // mode: c++
00089 // c-file-style: "CLJ"
00090 // End:

Generated at Mon Dec 3 23:23:36 2007 for MPQC 2.3.1 using the documentation package Doxygen 1.5.2.