Google

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

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 <util/container/avlset.h>
00036 #include <math/isosurf/vertex.h>
00037 
00038 namespace sc {
00039 
00040 class Edge: public RefCount {
00041   private:
00042     int _order;
00043     Ref<Vertex> *_vertices; // nvertices = _order + 1
00044   public:
00045     Edge(const Ref<Vertex> &p1,
00046          const Ref<Vertex> &p2)
00047     {
00048       _order = 1;
00049       _vertices = new Ref<Vertex>[2];
00050       _vertices[0]=p1; _vertices[1]=p2;
00051     }
00052     Edge(const Ref<Vertex> &p1,
00053          const Ref<Vertex> &p2,
00054          const Ref<Vertex> &p3);
00055     Edge(const Ref<Vertex> &p1,
00056          const Ref<Vertex> &p2,
00057          const Ref<Vertex> &p3,
00058          const Ref<Vertex> &p4);
00059     ~Edge();
00060     int order() const { return _order; }
00061     double straight_length();
00062     // return the endpoints
00063     Ref<Vertex> vertex(int i) const
00064     {
00065       return i?_vertices[_order]:_vertices[0];
00066     }
00067     // returns endpoints or interior vertex 0 <= i <= order
00068     Ref<Vertex> interior_vertex(int i) const
00069     {
00070       return _vertices[i];
00071     }
00072     // add the endpoints to the set
00073     void add_vertices(AVLSet<Ref<Vertex> >&);
00074     void set_order(int order, const Ref<Volume>&vol,double isovalue);
00075     // find the position of a point on the edge
00076     int interpolate(double location, SCVector3&point, SCVector3&norm);
00077     // find the true position of a point using the isosurface
00078     int interpolate(double location, SCVector3&point, SCVector3&norm,
00079                      const Ref<Volume> &vol, double isovalue);
00080 };
00081 
00082 }
00083 
00084 #endif
00085 
00086 // Local Variables:
00087 // mode: c++
00088 // c-file-style: "CLJ"
00089 // End:

Generated at Fri Jan 10 08:14:08 2003 for MPQC 2.1.3 using the documentation package Doxygen 1.2.14.