Subject: CGAL users discussion list
List archive
- From: Merlin Etzold <>
- To:
- Subject: Re: [cgal-discuss] Change of vertex coordinates in Polyhdron_3
- Date: Wed, 6 Apr 2016 19:14:25 +0100
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:iDKOGxMD4uRgtn7GUmUl6mtUPXoX/o7sNwtQ0KIMzox0KPXyrarrMEGX3/hxlliBBdydsKIUzbaP+Pm5ACQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTnkbzrsMSKOk1hv3mUX/BbFF2OtwLft80b08NJC50a7V/3mEZOYPlc3mhyJFiezF7W78a0+4N/oWwL46pyv50IbKPhYq5tTaBEFC90dCcu9cjzvF/CSxGO7z0SSCINgx9QCk/E6h/9GZz+uy+/uutm0zSBJp7KSuU/Vj2mqqtqUxT1kzwvNjgj8WiRhNYjorhcpUeEqgZ7woicTZ2HM/5yNvfYcMkeRGxIU9pDUChNKoy5ZooLSeEGOLAL/MHGu1ISoE7mVkGXD+T1x2oQiw==
Dear Andreas,
Thank you very much for your reply - I will try it out tomorrow. I have a question: I would have never worked that out for myself - is there any reference (which I have obviously missed so far) where the underlying design ideas are explained?Merlin A. Etzold, PhD
24 Oyster Row+44 7851 467997
On 6 April 2016 at 15:26, Andreas Fabri <> wrote:
The Polyhedron does not allow to directly change coordinates.
You can do it with the help of property maps.
A property map is something for that there are
global functions get and put to acces, for example,
the point property of a vertex.
This is used systematically in the Polygon Mesh
Processing, package, so learning how to use them
for the simple problem you want to solve, will
save you time later.
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
#include <CGAL/boost/graph/properties_Polyhedron_3.h>
#include <fstream>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef boost::graph_traits<Polyhedron> GraphTraits;
typedef GraphTraits::vertex_descriptor vertex_descriptor;
int main(int, char** argv)
{
std::ifstream in(argv[1]);
Polyhedron P;
in >> P;
// First obtain the type of the property map:
typedef boost::property_map<Polyhedron, CGAL::vertex_point_t>::type PM;
// Then obtain the property map for P
PM coord = get(CGAL::vertex_point,P);
BOOST_FOREACH(vertex_descriptor vd, vertices(P)){
// Now access the property
Point_3 p = get(coord, vd);
p = p + (p - CGAL::ORIGIN);
put(coord, vd, p);
}
BOOST_FOREACH(vertex_descriptor vd, vertices(P)){
std::cout << get(coord, vd) << std::endl;
}
return 0;--
}
On 06/04/2016 16:06, Merlin Etzold wrote:
Dear All,
Sorry if this is a duplication - I tried to ask the question previously
as a follow-on to another question:
I have a Polyhedron_3 and want to alter the position of individual
vertices to distort the shape. However, I have not found a way how to
actually change the vertex coordinates - only how to read them out. Help
would be much appreciated.
Thank you and best wishes,
Merlin :)
Merlin A. Etzold, PhD
24 Oyster Row
Cambridge
CB5 8LJ
United Kindgom
+44 7851 467997
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project
phone: +33.492.954.912 skype: andreas.fabri
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] Change of vertex coordinates in Polyhdron_3, Merlin Etzold, 04/06/2016
- Re: [cgal-discuss] Change of vertex coordinates in Polyhdron_3, Andreas Fabri, 04/06/2016
- Re: [cgal-discuss] Change of vertex coordinates in Polyhdron_3, Merlin Etzold, 04/06/2016
- Re: [cgal-discuss] Change of vertex coordinates in Polyhdron_3, Andreas Fabri, 04/06/2016
Archive powered by MHonArc 2.6.18.