Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] simple transformation on Mesh_3 vertices

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] simple transformation on Mesh_3 vertices


Chronological Thread 
  • From: Hamid G <>
  • To:
  • Subject: Re: [cgal-discuss] simple transformation on Mesh_3 vertices
  • Date: Tue, 15 Nov 2011 03:45:40 -0500

On Mon, Nov 14, 2011 at 12:06 PM, Sebastien Loriot (GeometryFactory)
<>
wrote:
> typedef C3t3::Triangulation::Weighted_point Weighted_point;
> typrdef C3t3::Triangulation::Finite_vertices_iterator Vertices_iterator;
>
> for (Vertices_iterator itv=c3t3.triangulation().finite_vertices_begin(),
>                     itv_end=c3t3.triangulation().finite_vertices_end();
>     itv!=itv_end;++itv)
> {
>  itv->point()=
>    Weighted_point(itv->point().point()+K::Vector_3(x0,y0,z0),
>                   itv->point().weight());
> }
>

Thanks for the help.
I was just wondering how I could do this using a function object
that can be passed to STL's helpers such as 'std::transform'

I tried something like this:

class addoffset : public std::unary_function<Tr::Vertex,void>
{
K::Vector_3 _offset;
public:
explicit addoffset(double x, double y, double z) :
_offset(K::Vector_3(x,y,z)) {}

void operator()(Tr::Vertex& v)
{
v.point()=Weighted_point(v.point().point() + _offset,
v.point().weight());
}
};

addoffset Offset(x0,y0,z0);
std::transform(tr.finite_vertices_begin(), tr.finite_vertices_end(),
tr.finite_vertices_begin(),Offset);

which of-course didn't work.



Archive powered by MHonArc 2.6.16.

Top of Page