//=========================================================================== // GoTools Core - SINTEF Geometry Tools Core library, version 2.0.1 // // Copyright (C) 2000-2007, 2010 SINTEF ICT, Applied Mathematics, Norway. // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation version 2 of the License. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., // 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. // // Contact information: E-mail: tor.dokken@sintef.no // SINTEF ICT, Department of Applied Mathematics, // P.O. Box 124 Blindern, // 0314 Oslo, Norway. // // Other licenses are also available for this software, notably licenses // for: // - Building commercial software. // - Building software whose source code you wish to keep private. //=========================================================================== 00054 #ifndef _MSC_VER // Getting rid of warning C4996 on Windows 00055 std::copy(start, start + Dim * numpoints, points_[0].begin()); 00056 #else 00057 stdext::unchecked_copy(start, start + Dim * numpoints, points_[0].begin()); 00058 #endif // _MSC_VER 00059 }
Go::PointCloud< Dim >::PointCloud | ( | std::vector< Array< double, Dim > > & | points | ) | [inline] |
Constructor specifying a PointCloud from an Array of points.
Definition at line 62 of file PointCloud.h.
00063 : points_(points) 00064 {}
virtual Go::PointCloud< Dim >::~PointCloud | ( | ) | [inline, virtual] |
virtual BoundingBox Go::PointCloud< Dim >::boundingBox | ( | ) | const [inline, virtual] |
Return the object's bounding box.
Implements Go::GeomObject.
Definition at line 71 of file PointCloud.h.
References Go::PointCloud< Dim >::points_, and Go::BoundingBox::setFromArray().
static ClassType Go::PointCloud< Dim >::classType | ( | ) | [inline, static] |
Return the class type identifier of a given class derived from GeomObject.
Reimplemented from Go::GeomObject.
Definition at line 87 of file PointCloud.h.
References Go::Class_PointCloud.
Referenced by Go::PointCloud< Dim >::instanceType().
00088 { return Class_PointCloud; }
virtual PointCloud* Go::PointCloud< Dim >::clone | ( | ) | const [inline, virtual] |
Clone the GeomObject and return a pointer to the clone.
Implements Go::GeomObject.
Definition at line 100 of file PointCloud.h.
References Go::PointCloud< Dim >::PointCloud().
00101 { return new PointCloud(*this); }
virtual int Go::PointCloud< Dim >::dimension | ( | ) | const [inline, virtual] |
Query the dimension of the space where the PointCloud lies.
Implements Go::GeomObject.
Definition at line 79 of file PointCloud.h.
virtual ClassType Go::PointCloud< Dim >::instanceType | ( | ) | const [inline, virtual] |
Return the class type identifier of a given, derived instance of GeomObject.
Implements Go::GeomObject.
Definition at line 83 of file PointCloud.h.
References Go::PointCloud< Dim >::classType().
00084 { return PointCloud::classType(); }
int Go::PointCloud< Dim >::numPoints | ( | ) | const [inline] |
Query the number of points in the PointCloud.
Definition at line 106 of file PointCloud.h.
References Go::PointCloud< Dim >::points_.
00107 { return points_.size(); }
const Array<double, Dim>& Go::PointCloud< Dim >::point | ( | int | i | ) | const [inline] |
Get the coordinates of a point in the point cloud (const-version).
i | the index of the requested point |
Definition at line 120 of file PointCloud.h.
References Go::PointCloud< Dim >::points_.
00121 { return points_[i]; }
Array<double, Dim>& Go::PointCloud< Dim >::point | ( | int | i | ) | [inline] |
Get the coordinates of a point in the point cloud.
i | the index of the requested point |
Definition at line 113 of file PointCloud.h.
References Go::PointCloud< Dim >::points_.
00114 { return points_[i]; }
const std::vector<Array<double, Dim> >& Go::PointCloud< Dim >::pointVector | ( | ) | [inline] |
Get a reference to the vector where the points are stored.
Definition at line 137 of file PointCloud.h.
References Go::PointCloud< Dim >::points_.
00138 { return points_; }
const double* Go::PointCloud< Dim >::rawData | ( | ) | const [inline] |
Get a const pointer to the memory area where the point coordinates are (consecutively) stored.
Definition at line 132 of file PointCloud.h.
References Go::PointCloud< Dim >::points_.
00133 { return points_[0].begin(); }
double* Go::PointCloud< Dim >::rawData | ( | ) | [inline] |
Get a pointer to the memory area where the point coordinates are (consecutively) stored.
Definition at line 126 of file PointCloud.h.
References Go::PointCloud< Dim >::points_.
00127 { return points_[0].begin(); }
virtual void Go::PointCloud< Dim >::read | ( | std::istream & | is | ) | [inline, virtual] |
read object from stream
is | stream from which object is read |
Implements Go::Streamable.
Definition at line 141 of file PointCloud.h.
References ALWAYS_ERROR_IF, Go::PointCloud< Dim >::points_, and THROW.
00142 { 00143 bool is_good = is.good(); 00144 if (!is_good) { 00145 THROW("Invalid geometry file!"); 00146 } 00147 int nump; 00148 is >> nump; 00149 ALWAYS_ERROR_IF(nump < 1, "Less than one point in cloud."); 00150 is_good = is.good(); 00151 if (!is_good) { 00152 THROW("Invalid geometry file!"); 00153 } 00154 points_.resize(nump); 00155 for (int i = 0; i < nump; ++i) { 00156 for (int d = 0; d < Dim; ++d) { 00157 is >> points_[i][d]; 00158 } 00159 } 00160 00161 is_good = is.good(); 00162 if (!is_good) { 00163 THROW("Invalid geometry file!"); 00164 } 00165 }
virtual void Go::PointCloud< Dim >::write | ( | std::ostream & | os | ) | const [inline, virtual] |
write object to stream
os | stream to which object is written |
Implements Go::Streamable.
Definition at line 168 of file PointCloud.h.
References Go::PointCloud< Dim >::points_.
00169 { 00170 os << std::setprecision(15); 00171 00172 int nump = points_.size(); 00173 os << nump << '\n'; 00174 for(int i = 0; i < nump; ++i) { 00175 os << points_[i][0]; 00176 for (int d = 1; d < Dim; ++d) { 00177 os << ' ' << points_[i][d]; 00178 } 00179 os << '\n'; 00180 } 00181 os << std::endl; 00182 }
std::vector<Array<double, Dim> > Go::PointCloud< Dim >::points_ [private] |
Definition at line 185 of file PointCloud.h.
Referenced by Go::PointCloud< Dim >::boundingBox(), Go::PointCloud< Dim >::numPoints(), Go::PointCloud< Dim >::point(), Go::PointCloud< Dim >::PointCloud(), Go::PointCloud< Dim >::pointVector(), Go::PointCloud< Dim >::rawData(), Go::PointCloud< Dim >::read(), and Go::PointCloud< Dim >::write().