MEPP2 Project
Geometry_traits_pcl_point_cloud.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as
6 // published by the Free Software Foundation; either version 3 of
7 // the License, or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
15 //#include "FEVV/Wrappings/Geometry_traits_operators.h"
16 
17 namespace FEVV {
18 
19 
32 {
33 public:
38 };
39 
46 template<>
48 {
50 };
51 
52 
63 template< typename MeshT >
65 {
66 public:
67  typedef MeshT Mesh;
70  typedef typename Kernel::Point Point;
71  typedef typename Kernel::Vector Vector;
72  typedef typename Kernel::Scalar Scalar;
73 
74  Geometry_traits(const Mesh &m) : m_mesh(const_cast< Mesh & >(m)) {}
75 
76  static Scalar get_x(const Point &p) { return p[0]; }
77 
78  static Scalar get_y(const Point &p) { return p[1]; }
79 
80  static Scalar get_z(const Point &p) { return p[2]; }
81 
82  static Vector normal(const Point &p1, const Point &p2, const Point &p3)
83  {
84  // calculate two vectors from the three points
85  Vector v1 = p1 - p2; // Eigen
86  Vector v2 = p1 - p3; // Eigen
87 
88  // take the cross product of the two vectors to get the normal
89  return cross_product(v1, v2);
90  }
91 
92  static Vector unit_normal(const Point &p1, const Point &p2, const Point &p3)
93  {
94  return normal(p1, p2, p3).normalized(); // Eigen
95  }
96 
97  static Scalar dot_product(const Vector &v1, const Vector &v2)
98  {
99  return v1.dot(v2); // Eigen
100  }
101 
102  static Vector cross_product(const Vector &v1, const Vector &v2)
103  {
104  return v1.cross(v2); // Eigen
105  }
106 
107  static Scalar length2(const Vector &v) { return v.squaredNorm(); } // Eigen
108 
109  static Scalar length(const Vector &v) { return v.norm(); } // Eigen
110 
111  static Scalar length(const Point &p1, const Point &p2)
112  {
113  Vector v = p1 - p2; // Eigen
114  return length(v);
115  }
116 
117  static Vector normalize(const Vector &v)
118  {
119  return v.normalized(); // Eigen
120  }
121 
122  static Vector add_v(const Vector &v1, const Vector &v2)
123  {
124  return v1 + v2; // Eigen
125  };
126 
127  // we need addP and add functions to have function names
128  // consistent with those of OpenMesh geometry trait
129  static Point add_pv(const Point &p, const Vector &v)
130  {
131  return p + v; // Eigen
132  };
133 
134  // subP to be consistent with addP
135  static Point sub_pv(const Point &p, const Vector &v)
136  {
137  return p - v; // Eigen
138  };
139 
140  static Vector sub_p(const Point &p, const Point &q)
141  {
142  return p - q; // Eigen
143  };
144 
145  static Vector sub_v(const Vector &v1, const Vector &v2)
146  {
147  return v1 - v2; // Eigen
148  };
149 
150 
151  static Vector scalar_mult(const Vector &v, Scalar s)
152  {
153  return s * v; // Eigen
154  }
155 
156  static const Vector NULL_VECTOR;
157  static const Point ORIGIN;
158 
159 protected:
161 };
162 
167 template< typename MeshT >
170 
175 template< typename MeshT >
178 
179 } // namespace FEVV
180 
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::Geometry_traits
Geometry_traits(const Mesh &m)
Definition: Geometry_traits_pcl_point_cloud.h:74
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::add_v
static Vector add_v(const Vector &v1, const Vector &v2)
Definition: Geometry_traits_pcl_point_cloud.h:122
Vector
AIFMesh::Vector Vector
Definition: Graph_properties_aif.h:22
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::length2
static Scalar length2(const Vector &v)
Definition: Geometry_traits_pcl_point_cloud.h:107
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::length
static Scalar length(const Point &p1, const Point &p2)
Definition: Geometry_traits_pcl_point_cloud.h:111
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::Self
Geometry_traits< MeshT, PCLPointCloud_kernel_generator > Self
Definition: Geometry_traits_pcl_point_cloud.h:68
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::scalar_mult
static Vector scalar_mult(const Vector &v, Scalar s)
Definition: Geometry_traits_pcl_point_cloud.h:151
FEVV::PCLPointCloud_kernel_generator::Vector
FEVV::PCLVector Vector
Definition: Geometry_traits_pcl_point_cloud.h:36
FEVV::RetrieveKernel< FEVV::PCLPointCloud >::Kernel
PCLPointCloud_kernel_generator Kernel
Definition: Geometry_traits_pcl_point_cloud.h:49
FEVV::PCLPointCloud
pcl::PointCloud< PCLEnrichedPoint > PCLPointCloud
Definition: DataStructures_pcl_point_cloud.h:28
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::length
static Scalar length(const Vector &v)
Definition: Geometry_traits_pcl_point_cloud.h:109
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::ORIGIN
static const Point ORIGIN
Initialisation of static member ORIGIN.
Definition: Geometry_traits_pcl_point_cloud.h:157
FEVV::Geometry_traits
Refer to Geometry_traits_documentation_dummy for further documentation on provided types and algorith...
Definition: Geometry_traits.h:162
Point
AIFMesh::Point Point
Definition: Graph_properties_aif.h:21
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::get_z
static Scalar get_z(const Point &p)
Definition: Geometry_traits_pcl_point_cloud.h:80
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::normalize
static Vector normalize(const Vector &v)
Definition: Geometry_traits_pcl_point_cloud.h:117
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::unit_normal
static Vector unit_normal(const Point &p1, const Point &p2, const Point &p3)
Definition: Geometry_traits_pcl_point_cloud.h:92
FEVV::PCLPointCloud_kernel_generator
PCL Point Cloud specialization. Refer to for concrete usage .
Definition: Geometry_traits_pcl_point_cloud.h:32
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::Scalar
Kernel::Scalar Scalar
Definition: Geometry_traits_pcl_point_cloud.h:72
FEVV::Math::Vector::cross_product
static std::vector< ElementType > cross_product(const ElementType v1[DIM], const ElementType v2[DIM])
Definition: MatrixOperations.hpp:460
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::get_x
static Scalar get_x(const Point &p)
Definition: Geometry_traits_pcl_point_cloud.h:76
FEVV::RetrieveKernel
A generic definition, that is template specialized for every supported native implementation,...
Definition: Geometry_traits.h:118
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::normal
static Vector normal(const Point &p1, const Point &p2, const Point &p3)
Definition: Geometry_traits_pcl_point_cloud.h:82
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::PCLPoint
Eigen::Vector3f PCLPoint
Definition: DataStructures_pcl_point_cloud.h:32
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::Vector
Kernel::Vector Vector
Definition: Geometry_traits_pcl_point_cloud.h:71
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::sub_v
static Vector sub_v(const Vector &v1, const Vector &v2)
Definition: Geometry_traits_pcl_point_cloud.h:145
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::NULL_VECTOR
static const Vector NULL_VECTOR
Initialisation of static member NULL_VECTOR.
Definition: Geometry_traits_pcl_point_cloud.h:156
DataStructures_pcl_point_cloud.h
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::sub_pv
static Point sub_pv(const Point &p, const Vector &v)
Definition: Geometry_traits_pcl_point_cloud.h:135
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::Kernel
RetrieveKernel< Mesh >::Kernel Kernel
Definition: Geometry_traits_pcl_point_cloud.h:69
Geometry_traits.h
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::Mesh
MeshT Mesh
Definition: Geometry_traits_pcl_point_cloud.h:67
FEVV::PCLKernelType
float PCLKernelType
Definition: DataStructures_pcl_point_cloud.h:25
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >
PCLPointCloud specialization of the Geometry_traits generic class. For usage refer to Geometry traits...
Definition: Geometry_traits_pcl_point_cloud.h:65
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::dot_product
static Scalar dot_product(const Vector &v1, const Vector &v2)
Definition: Geometry_traits_pcl_point_cloud.h:97
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::cross_product
static Vector cross_product(const Vector &v1, const Vector &v2)
Definition: Geometry_traits_pcl_point_cloud.h:102
FEVV::DataStructures::AIF::AIFMesh
This class represents an AIF structure. AIF structure can deal with both manifold and non-manifold su...
Definition: AIFMesh.hpp:47
FEVV::PCLPointCloud_kernel_generator::Scalar
FEVV::PCLKernelType Scalar
Definition: Geometry_traits_pcl_point_cloud.h:37
FEVV::PCLVector
Eigen::Vector3f PCLVector
Definition: DataStructures_pcl_point_cloud.h:33
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::Point
Kernel::Point Point
Definition: Geometry_traits_pcl_point_cloud.h:70
FEVV::PCLPointCloud_kernel_generator::Point
FEVV::PCLPoint Point
Definition: Geometry_traits_pcl_point_cloud.h:35
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::add_pv
static Point add_pv(const Point &p, const Vector &v)
Definition: Geometry_traits_pcl_point_cloud.h:129
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::sub_p
static Vector sub_p(const Point &p, const Point &q)
Definition: Geometry_traits_pcl_point_cloud.h:140
FEVV::PCLPointCloud_kernel_generator::Kernel
PCLPointCloud_kernel_generator Kernel
Definition: Geometry_traits_pcl_point_cloud.h:34
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::m_mesh
Mesh & m_mesh
Definition: Geometry_traits_pcl_point_cloud.h:160
FEVV::Geometry_traits< MeshT, PCLPointCloud_kernel_generator >::get_y
static Scalar get_y(const Point &p)
Definition: Geometry_traits_pcl_point_cloud.h:78