Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Determining normals and Poisson surface reconstruction or: convert <Point, Vector> pair to Point_with_normal_3?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Determining normals and Poisson surface reconstruction or: convert <Point, Vector> pair to Point_with_normal_3?


Chronological Thread 
  • From: Andreas Fabri <>
  • To:
  • Subject: Re: [cgal-discuss] Determining normals and Poisson surface reconstruction or: convert <Point, Vector> pair to Point_with_normal_3?
  • Date: Sun, 16 Jul 2017 16:56:54 +0200
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=None ; spf=None
  • Ironport-phdr: 9a23:/WYctxaGViFNXiDu9klJOEf/LSx+4OfEezUN459isYplN5qZr8+/bnLW6fgltlLVR4KTs6sC0LuJ9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQtFiT6/bL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjmk8qxlSgLniD0fOjAk7m/XhMx+jKVYrhyvqRNwzIzbb52aOvdlYqPQf8kXSXZdUstfVyFMBJ63YYsVD+oGOOZVt5Xwp10TohukGwajHvjvwSJIiHDsxqI6yeUhGhzB0QM6GdIBrW7Uo8vvO6cJS+y1wrPHwi7Zb/NXwjr955bHchckof6SQbJwa8rQyUc1GAzZklWQrpblPjOP2usRtGib6vNtWOSygGAprAFxpyKgxsYqioTRmo0VxUrL9SFjzIYyP924R0h2asOnHptIryyXOIp7Ttk/T210uCs20LMLtJqhcCUL1Zgr3wDTZ+aaf4WI+B7vSeScLSpiiH54Zr6ygQu5/1K6xe3mTMa01U5HripbndnIsXAAzwLf5tKCSvt640us2zWC2xrW6u5eIEA0kbPXK5k8wr4sjJYTtlrDHi/slEXwkqCWal0o+umu6+v5frXrvpCROo5uhg3jLqgjmtazDOo8PwQUXmWX5Pyw1Lj58k34RLVKgOc2kq7csJ3CP8sboLO2AxVL3Yk58BazFTmm384DknkdLVJIYx2HgJbuO1HLPv/4Ee2/glSikDhx2//GIrrhAo/NL3TZjLjherN951ZGyAUv1dBf+45UCrYZLf3vVU/+rtjYAgYkPAy12OboFMh91pgFWW+UGa+YMKbSsUeS6e41IumMYpUVuDfnJPQ/6f7ulyxxpVhIdqag2d4baWuzA+99C0Sfe3vlxNkbQkkQuQ9rZermklCLSnZ9bnyoXupo7zc3Eo+vFsHNT4q3gZSO0SC+E4FMd25PAUyLC2aufIKBDaRfIBmOK9Nsx2RXHYOqTJUsgEmj
  • Organization: GeometryFactory

Hello,

The idea of the property map is that the point set algorithms
work with an input range of type WhatSoEver, and the
point property map from an item of the range extracts a point
and the normal property map a normal.

The following should work for you:

typedef Kernel::Point_3 Point;
typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
typedef Kernel::Sphere_3 Sphere;
typedef std::vector<Point_with_normal> PointList;

#ifdef CGAL_LINKED_WITH_TBB
typedef CGAL::Parallel_tag Concurrency_tag;
#else
typedef CGAL::Sequential_tag Concurrency_tag;
#endif

PointList points;

const int nb_neighbors = 18;

CGAL::jet_estimate_normals<Concurrency_tag>(
points.begin(), points.end(),
CGAL::Identity_property_map<Point>(),
CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()),
nb_neighbors);

Poisson_reconstruction_function function(
points.begin(), points.end(),
CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()));

should do what you want.

Best,

Andreas

On 14/07/2017 15:36, Oliver Arend wrote:
I have a file with a bunch of 3D points stored in binary. Now I want to both
estimate the normal and then use these to do a Poisson surface
reconstruction. Unfortunately the example for normal estimation at
http://doc.cgal.org/latest/Point_set_processing_3/Point_set_processing_3_2no
rmals_example_8cpp-example.html
uses

typedef std::pair<Point, Vector> PointVectorPair;
std::list<PointVectorPair> points;

to store the points, and accesses points and normals through

CGAL::First_of_pair_property_map<PointVectorPair>
CGAL::Second_of_pair_property_map<PointVectorPair>

respectively.

After I have successfully estimated the normals for all my points I would
like to reconstruct the surface using Poisson. The example at
http://doc.cgal.org/latest/Poisson_surface_reconstruction_3/Poisson_surface_
reconstruction_3_2poisson_reconstruction_example_8cpp-example.html
uses

typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
typedef std::vector<Point_with_normal> PointList;
PointList points;

to store the points.

Now it seems I can't simply pass the <Point, Vector> pair like in the
example

Poisson_reconstruction_function function(points.begin(), points.end(),
CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) );

(even if I define PointList to be std::list<PointVectorPair>)

Please excuse my ignorance, but I am at a complete loss as to how to
approach this.

So how can I either
- do the whole normal estimation and Poisson reconstruction using a single
set of points (one of the above) or
- convert from <Point, Vector> pairs to Point_with_normal_3?

Thanks in advance
Oliver



--
Andreas Fabri, PhD
Chief Officer, GeometryFactory
Editor, The CGAL Project

phone: +33.492.954.912 skype: andreas.fabri



Archive powered by MHonArc 2.6.18.

Top of Page