| [5d30c1] | 1 | //
 | 
|---|
 | 2 | // edge.h
 | 
|---|
 | 3 | //
 | 
|---|
 | 4 | // Copyright (C) 1996 Limit Point Systems, Inc.
 | 
|---|
 | 5 | //
 | 
|---|
 | 6 | // Author: Curtis Janssen <cljanss@limitpt.com>
 | 
|---|
 | 7 | // Maintainer: LPS
 | 
|---|
 | 8 | //
 | 
|---|
 | 9 | // This file is part of the SC Toolkit.
 | 
|---|
 | 10 | //
 | 
|---|
 | 11 | // The SC Toolkit is free software; you can redistribute it and/or modify
 | 
|---|
 | 12 | // it under the terms of the GNU Library General Public License as published by
 | 
|---|
 | 13 | // the Free Software Foundation; either version 2, or (at your option)
 | 
|---|
 | 14 | // any later version.
 | 
|---|
 | 15 | //
 | 
|---|
 | 16 | // The SC Toolkit is distributed in the hope that it will be useful,
 | 
|---|
 | 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 19 | // GNU Library General Public License for more details.
 | 
|---|
 | 20 | //
 | 
|---|
 | 21 | // You should have received a copy of the GNU Library General Public License
 | 
|---|
 | 22 | // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
 | 
|---|
 | 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
|---|
 | 24 | //
 | 
|---|
 | 25 | // The U.S. Government is granted a limited license as per AL 91-7.
 | 
|---|
 | 26 | //
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | #ifndef _math_isosurf_edge_h
 | 
|---|
 | 29 | #define _math_isosurf_edge_h
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | #ifdef __GNUC__
 | 
|---|
 | 32 | #pragma interface
 | 
|---|
 | 33 | #endif
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | #include <set>
 | 
|---|
 | 36 | 
 | 
|---|
 | 37 | #include <math/isosurf/vertex.h>
 | 
|---|
 | 38 | 
 | 
|---|
 | 39 | namespace sc {
 | 
|---|
 | 40 | 
 | 
|---|
 | 41 | class Edge: public RefCount {
 | 
|---|
 | 42 |   private:
 | 
|---|
 | 43 |     int _order;
 | 
|---|
 | 44 |     Ref<Vertex> *_vertices; // nvertices = _order + 1
 | 
|---|
 | 45 |   public:
 | 
|---|
 | 46 |     Edge(const Ref<Vertex> &p1,
 | 
|---|
 | 47 |          const Ref<Vertex> &p2)
 | 
|---|
 | 48 |     {
 | 
|---|
 | 49 |       _order = 1;
 | 
|---|
 | 50 |       _vertices = new Ref<Vertex>[2];
 | 
|---|
 | 51 |       _vertices[0]=p1; _vertices[1]=p2;
 | 
|---|
 | 52 |     }
 | 
|---|
 | 53 |     Edge(const Ref<Vertex> &p1,
 | 
|---|
 | 54 |          const Ref<Vertex> &p2,
 | 
|---|
 | 55 |          const Ref<Vertex> &p3);
 | 
|---|
 | 56 |     Edge(const Ref<Vertex> &p1,
 | 
|---|
 | 57 |          const Ref<Vertex> &p2,
 | 
|---|
 | 58 |          const Ref<Vertex> &p3,
 | 
|---|
 | 59 |          const Ref<Vertex> &p4);
 | 
|---|
 | 60 |     ~Edge();
 | 
|---|
 | 61 |     int order() const { return _order; }
 | 
|---|
 | 62 |     double straight_length();
 | 
|---|
 | 63 |     // return the endpoints
 | 
|---|
 | 64 |     Ref<Vertex> vertex(int i) const
 | 
|---|
 | 65 |     {
 | 
|---|
 | 66 |       return i?_vertices[_order]:_vertices[0];
 | 
|---|
 | 67 |     }
 | 
|---|
 | 68 |     // returns endpoints or interior vertex 0 <= i <= order
 | 
|---|
 | 69 |     Ref<Vertex> interior_vertex(int i) const
 | 
|---|
 | 70 |     {
 | 
|---|
 | 71 |       return _vertices[i];
 | 
|---|
 | 72 |     }
 | 
|---|
 | 73 |     // add the endpoints to the set
 | 
|---|
 | 74 |     void add_vertices(std::set<Ref<Vertex> >&);
 | 
|---|
 | 75 |     void set_order(int order, const Ref<Volume>&vol,double isovalue);
 | 
|---|
 | 76 |     // find the position of a point on the edge
 | 
|---|
 | 77 |     int interpolate(double location, SCVector3&point, SCVector3&norm);
 | 
|---|
 | 78 |     // find the true position of a point using the isosurface
 | 
|---|
 | 79 |     int interpolate(double location, SCVector3&point, SCVector3&norm,
 | 
|---|
 | 80 |                      const Ref<Volume> &vol, double isovalue);
 | 
|---|
 | 81 | };
 | 
|---|
 | 82 | 
 | 
|---|
 | 83 | }
 | 
|---|
 | 84 | 
 | 
|---|
 | 85 | #endif
 | 
|---|
 | 86 | 
 | 
|---|
 | 87 | // Local Variables:
 | 
|---|
 | 88 | // mode: c++
 | 
|---|
 | 89 | // c-file-style: "CLJ"
 | 
|---|
 | 90 | // End:
 | 
|---|