Commit b8a97dbd authored by David Bommes's avatar David Bommes

added function to easily create circles

git-svn-id: 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2d90dc6b
......@@ -709,6 +709,31 @@ smooth_uniform_laplace3()
template <class PointT>
set_to_circle(const PointT _center, const PointT _normal, double _radius, unsigned int _n_samples)
// get local basis vectors
PointT n = _normal; n.normalize();
PointT u = ACG::Geometry::perpendicular(_normal); u*=_radius/u.norm();
PointT v = n % u;
for(unsigned int i=0; i<_n_samples; ++i)
double alpha = double(i)*2.0*M_PI/double(_n_samples);
this->add_point(_center + u*cos(alpha) + v*sin(alpha));
template <class PointT>
template <class MeshT, class SpatialSearchT>
......@@ -223,6 +223,10 @@ public:
/// \brief Cubic laplacian smoothing
void smooth_uniform_laplace3();
/// \brief creating a circle with center _center and radius _radius lying in tangent plane specified by _normal
void set_to_circle(const PointT _center, const PointT _normal, double _radius, unsigned int _n_samples = 100);
/** \brief Project polyline points to nearest surface points (use spatial search!!!)
* \note The points of the polyline are updated in place!
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment