00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_SURFACE_IMPL_HH 00020 #define OST_SURFACE_IMPL_HH 00021 00022 #include <vector> 00023 00024 #include <ost/mol/surface_prop.hh> 00025 #include <ost/mol/spatial_organizer.hh> 00026 00027 #include "surface_impl_fw.hh" 00028 00029 namespace ost { namespace mol { namespace impl { 00030 00032 typedef SpatialOrganizer<SurfaceVertexID> SpatialSurfaceVertexOrganizer; 00033 00035 class DLLEXPORT_OST_MOL SurfaceImpl { 00036 00037 typedef std::vector<SurfaceVertex> VertexList; 00038 typedef std::vector<SurfaceTri> FaceList; 00039 00040 public: 00041 SurfaceImpl(); 00042 00043 SurfaceVertexID AddVertex(const SurfaceVertex& v); 00044 SurfaceTriID AddTri(SurfaceVertexID v0, SurfaceVertexID v1, SurfaceVertexID v2); 00045 00046 void Attach(const EntityHandle& eh, Real cutoff); 00047 void Attach(const EntityView& ev, Real cutoff); 00048 00049 SurfaceVertex& Vertex(SurfaceVertexID id); 00050 const SurfaceVertex& Vertex(SurfaceVertexID id) const; 00051 00052 SurfaceTri& Tri(SurfaceTriID id); 00053 const SurfaceTri& Tri(SurfaceTriID id) const; 00054 00055 std::vector<SurfaceVertexID> GetVertexIDList() const; 00056 std::vector<SurfaceVertexID> GetTriIDList() const; 00057 00058 SurfaceVertexList FindWithin(const geom::Vec3& pos, Real distance); 00059 00060 void Invert(); 00061 00062 private: 00063 VertexList vertex_list_; 00064 FaceList face_list_; 00065 00066 SpatialSurfaceVertexOrganizer vertex_organizer_; 00067 00068 std::vector<SurfaceVertexID> vertex_id_list_; 00069 std::vector<SurfaceTriID> tri_id_list_; 00070 }; 00071 00072 }}} // ns 00073 00074 #endif