ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
Utility.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
12 
13 namespace cloudViewer {
14 namespace t {
15 namespace geometry {
16 
17 inline void CheckDepthTensor(const core::Tensor& depth) {
18  if (depth.NumElements() == 0) {
19  utility::LogError("Input depth is empty.");
20  }
21  if (depth.GetDtype() != core::UInt16 && depth.GetDtype() != core::Float32) {
22  utility::LogError("Unsupported depth image dtype {}.",
23  depth.GetDtype().ToString());
24  }
25 }
26 
27 inline void CheckColorTensor(const core::Tensor& color) {
28  if (color.NumElements() == 0) {
29  utility::LogError("Input color is empty.");
30  }
31  if (color.GetDtype() != core::UInt8 && color.GetDtype() != core::Float32) {
32  utility::LogError("Unsupported color image dtype {}.",
33  color.GetDtype().ToString());
34  }
35 }
36 
37 inline void CheckIntrinsicTensor(const core::Tensor& intrinsic) {
38  if (intrinsic.GetShape() != core::SizeVector{3, 3}) {
39  utility::LogError("Unsupported intrinsic matrix shape {}",
40  intrinsic.GetShape());
41  }
42 
43  if (intrinsic.GetDtype() != core::Dtype::Float64) {
44  utility::LogError("Unsupported intrinsic matrix dtype {}",
45  intrinsic.GetDtype().ToString());
46  }
47 
48  if (!intrinsic.IsContiguous()) {
49  utility::LogError("Intrinsic matrix must be contiguous.");
50  }
51 }
52 
53 inline void CheckExtrinsicTensor(const core::Tensor& extrinsic) {
54  if (extrinsic.GetShape() != core::SizeVector{4, 4}) {
55  utility::LogError("Unsupported extrinsic matrix shape {}",
56  extrinsic.GetShape());
57  }
58 
59  if (extrinsic.GetDtype() != core::Dtype::Float64) {
60  utility::LogError("Unsupported extrinsic matrix dtype {}",
61  extrinsic.GetDtype().ToString());
62  }
63 
64  if (!extrinsic.IsContiguous()) {
65  utility::LogError("Extrinsic matrix must be contiguous.");
66  }
67 }
68 
69 inline void CheckBlockCoordinates(const core::Tensor& block_coords) {
70  if (block_coords.GetDtype() != core::Dtype::Int32) {
71  utility::LogError("Unsupported block coordinate dtype {}",
72  block_coords.GetDtype().ToString());
73  }
74 }
75 
78  core::AssertTensorShape(T, {4, 4});
81  if (!T.IsContiguous()) {
82  utility::LogError("T is expected to be contiguous");
83  }
84 
85  core::Tensor Tinv({4, 4}, core::Float64, core::Device("CPU:0"));
86  const double* T_ptr = T.GetDataPtr<double>();
87  double* Tinv_ptr = Tinv.GetDataPtr<double>();
88 
89  // R' = R.T
90  Tinv_ptr[0 * 4 + 0] = T_ptr[0 * 4 + 0];
91  Tinv_ptr[0 * 4 + 1] = T_ptr[1 * 4 + 0];
92  Tinv_ptr[0 * 4 + 2] = T_ptr[2 * 4 + 0];
93 
94  Tinv_ptr[1 * 4 + 0] = T_ptr[0 * 4 + 1];
95  Tinv_ptr[1 * 4 + 1] = T_ptr[1 * 4 + 1];
96  Tinv_ptr[1 * 4 + 2] = T_ptr[2 * 4 + 1];
97 
98  Tinv_ptr[2 * 4 + 0] = T_ptr[0 * 4 + 2];
99  Tinv_ptr[2 * 4 + 1] = T_ptr[1 * 4 + 2];
100  Tinv_ptr[2 * 4 + 2] = T_ptr[2 * 4 + 2];
101 
102  // t' = -R.T @ t = -R' @ t
103  Tinv_ptr[0 * 4 + 3] = -(Tinv_ptr[0 * 4 + 0] * T_ptr[0 * 4 + 3] +
104  Tinv_ptr[0 * 4 + 1] * T_ptr[1 * 4 + 3] +
105  Tinv_ptr[0 * 4 + 2] * T_ptr[2 * 4 + 3]);
106  Tinv_ptr[1 * 4 + 3] = -(Tinv_ptr[1 * 4 + 0] * T_ptr[0 * 4 + 3] +
107  Tinv_ptr[1 * 4 + 1] * T_ptr[1 * 4 + 3] +
108  Tinv_ptr[1 * 4 + 2] * T_ptr[2 * 4 + 3]);
109  Tinv_ptr[2 * 4 + 3] = -(Tinv_ptr[2 * 4 + 0] * T_ptr[0 * 4 + 3] +
110  Tinv_ptr[2 * 4 + 1] * T_ptr[1 * 4 + 3] +
111  Tinv_ptr[2 * 4 + 2] * T_ptr[2 * 4 + 3]);
112 
113  // Remaining part
114  Tinv_ptr[3 * 4 + 0] = 0;
115  Tinv_ptr[3 * 4 + 1] = 0;
116  Tinv_ptr[3 * 4 + 2] = 0;
117  Tinv_ptr[3 * 4 + 3] = 1;
118 
119  return Tinv;
120 }
121 } // namespace geometry
122 } // namespace t
123 } // namespace cloudViewer
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
ccPointCloud::hasColors
bool hasColors() const override
Returns whether colors are enabled or not.
Definition: ecvPointCloud.cpp:1689
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
ccMesh::CreateArrow
static std::shared_ptr< ccMesh > CreateArrow(double cylinder_radius=1.0, double cone_radius=1.5, double cylinder_height=5.0, double cone_height=4.0, int resolution=20, int cylinder_split=4, int cone_split=1)
Definition: TriangleMeshFactory.cpp:2766
ccMesh::GetNonManifoldVertices
std::vector< int > GetNonManifoldVertices() const
Definition: TriangleMeshFactory.cpp:921
M_PI
constexpr double M_PI
Pi.
Definition: CVConst.h:19
ccMesh::RemoveNonManifoldEdges
ccMesh & RemoveNonManifoldEdges()
Function that removes all non-manifold edges, by successively deleting triangles with the smallest su...
Definition: TriangleMeshFactory.cpp:225
cloudViewer::t::geometry::TriangleMesh::CreateCylinder
static TriangleMesh CreateCylinder(double radius=1.0, double height=2.0, int resolution=20, int split=4, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:135
ccMesh::IsBoundingBoxIntersecting
bool IsBoundingBoxIntersecting(const ccMesh &other) const
Definition: TriangleMeshFactory.cpp:1020
pcl
Definition: MaterialConverter.h:18
cloudViewer::core::UInt16
const Dtype UInt16
Definition: Dtype.cpp:49
ccMesh::GetOrderedEdge
static Eigen::Vector2i GetOrderedEdge(int vidx0, int vidx1)
Helper function to get an edge with ordered vertex indices.
Definition: ecvMesh.h:1005
cloudViewer::t::geometry::GetOrderedEdge
static Edge< T > GetOrderedEdge(T vidx0, T vidx1)
brief Helper function to get an edge with ordered vertex indices.
Definition: TriangleMesh.cpp:1672
ccMesh::ClusterConnectedTriangles
std::tuple< std::vector< int >, std::vector< size_t >, std::vector< double > > ClusterConnectedTriangles() const
Function that clusters connected triangles, i.e., triangles that are connected via edges are assigned...
Definition: TriangleMeshFactory.cpp:1175
ccMesh::ComputeAdjacencyList
ccMesh & ComputeAdjacencyList()
Function to compute adjacency list, call before adjacency list is.
Definition: TriangleMeshFactory.cpp:1416
ccMesh::ComputeTriangleArea
static double ComputeTriangleArea(const Eigen::Vector3d &p0, const Eigen::Vector3d &p1, const Eigen::Vector3d &p2)
Function that computes the area of a mesh triangle.
Definition: TriangleMeshFactory.cpp:1628
Vector3Tpl::normalize
void normalize()
Sets vector norm to unity.
Definition: CVGeom.h:428
ccMesh::SamplePointsPoissonDisk
std::shared_ptr< ccPointCloud > SamplePointsPoissonDisk(size_t number_of_points, double init_factor=5, const std::shared_ptr< ccPointCloud > pcl_init=nullptr, bool use_triangle_normal=false, int seed=-1)
Definition: TriangleMeshFactory.cpp:1431
cloudViewer::core::make_pair
CLOUDVIEWER_HOST_DEVICE Pair< First, Second > make_pair(const First &_first, const Second &_second)
Definition: SlabTraits.h:49
ccMesh::CreateIcosahedron
static std::shared_ptr< ccMesh > CreateIcosahedron(double radius=1.0, bool create_uv_map=false)
Definition: TriangleMeshFactory.cpp:1959
cloudViewer::t::geometry::TriangleMesh::CreateTetrahedron
static TriangleMesh CreateTetrahedron(double radius=1.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:99
x
normal_z x
Definition: my_point_types.h:165
ccPointCloud::getPointColor
const ecvColor::Rgb & getPointColor(unsigned pointIndex) const override
Returns color corresponding to a given point.
Definition: ecvPointCloud.cpp:1535
ecvColor::RgbTpl::ToEigen
static Eigen::Vector3d ToEigen(const Type col[3])
Definition: ecvColorTypes.h:72
ccMesh::RemoveTrianglesByMask
void RemoveTrianglesByMask(const std::vector< bool > &triangle_mask)
This function removes the triangles that are masked in triangle_mask. Call RemoveUnreferencedVertices...
Definition: TriangleMeshFactory.cpp:1260
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
Tuple3Tpl::x
Type x
Definition: CVGeom.h:137
ccMesh::SamplePointsUniformlyImpl
std::shared_ptr< ccPointCloud > SamplePointsUniformlyImpl(size_t number_of_points, std::vector< double > &triangle_areas, double surface_area, bool use_triangle_normal, int seed)
Definition: TriangleMeshFactory.cpp:1720
ccMesh::CreateCone
static std::shared_ptr< ccMesh > CreateCone(double radius=1.0, double height=2.0, int resolution=20, int split=1, bool create_uv_map=false)
Definition: TriangleMeshFactory.cpp:2544
cloudViewer::VerticesIndexes::i2
unsigned i2
Definition: GenericIndexedMesh.h:19
knncpp::Vector2i
Eigen::Matrix< Index, 2, 1 > Vector2i
Definition: knncpp.h:29
ccPointCloud::getEigenNormal
Eigen::Vector3d getEigenNormal(size_t index) const
Definition: ecvPointCloud.cpp:1600
core::Tensor
cloudViewer::t::geometry::TriangleMesh::CreateOctahedron
static TriangleMesh CreateOctahedron(double radius=1.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:111
cloudViewer::VerticesIndexes
Triangle described by the indexes of its 3 vertices.
Definition: GenericIndexedMesh.h:16
ccMesh::size
virtual unsigned size() const override
Returns the number of triangles.
Definition: ecvMesh.cpp:2143
ccMesh::GetSurfaceArea
double GetSurfaceArea() const
Definition: TriangleMeshFactory.cpp:1644
normal
double normal[3]
Definition: FileIOFactory.cpp:53
ccMesh::FilterSmoothLaplacianHelper
void FilterSmoothLaplacianHelper(std::shared_ptr< ccMesh > &mesh, const std::vector< CCVector3 > &prev_vertices, const std::vector< CCVector3 > &prev_vertex_normals, const ColorsTableType &prev_vertex_colors, const std::vector< std::unordered_set< int >> &adjacency_list, double lambda, bool filter_vertex, bool filter_normal, bool filter_color) const
Definition: TriangleMeshFactory.cpp:645
ccHObjectCaster::ToPointCloud
static ccPointCloud * ToPointCloud(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccPointCloud.
Definition: ecvHObjectCaster.cpp:54
cloudViewer::t::geometry::TriangleMesh::CreateCone
static TriangleMesh CreateCone(double radius=1.0, double height=2.0, int resolution=20, int split=1, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:151
AssertTensorDevice
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:45
cloudViewer::t::geometry::InverseTransformation
core::Tensor InverseTransformation(const core::Tensor &T)
TODO(wei): find a proper place for such functionalities.
Definition: Utility.h:77
cloudViewer::t::geometry::CheckBlockCoordinates
void CheckBlockCoordinates(const core::Tensor &block_coords)
Definition: Utility.h:69
ccPointCloud::getPointNormal
const CCVector3 & getPointNormal(unsigned pointIndex) const override
Returns normal corresponding to a given point.
Definition: ecvPointCloud.cpp:1555
CV_TYPES::POINT_CLOUD
@ POINT_CLOUD
Definition: CVTypes.h:104
cloudViewer::core::Tensor::IsContiguous
bool IsContiguous() const
Definition: Tensor.h:1036
cloudViewer::PointCloudTpl::getPoint
const CCVector3 * getPoint(unsigned index) const override
Definition: PointCloudTpl.h:143
ccMesh::ComputeVertexNormals
ccMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
Definition: TriangleMeshFactory.cpp:1388
ccObject::setLocked
virtual void setLocked(bool state)
Sets the "enabled" property.
Definition: ecvObject.h:117
ccMesh::RemoveDuplicatedVertices
ccMesh & RemoveDuplicatedVertices()
Function that removes duplicated verties, i.e., vertices that have identical coordinates.
Definition: TriangleMeshFactory.cpp:31
ccMesh::MergeCloseVertices
ccMesh & MergeCloseVertices(double eps)
Function that will merge close by vertices to a single one. The vertex position, normal and color wil...
Definition: TriangleMeshFactory.cpp:309
ccMesh::FilterSharpen
std::shared_ptr< ccMesh > FilterSharpen(int number_of_iterations, double strength, FilterScope scope=FilterScope::All) const
Function to sharpen triangle mesh.
Definition: TriangleMeshFactory.cpp:413
ccMesh::GetSelfIntersectingTriangles
std::vector< Eigen::Vector2i > GetSelfIntersectingTriangles() const
Definition: TriangleMeshFactory.cpp:981
cloudViewer::PointCloudTpl::size
unsigned size() const override
Definition: PointCloudTpl.h:38
ccPointCloud
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Definition: ecvPointCloud.h:146
ccMesh::NormalizeNormals
ccMesh & NormalizeNormals()
Definition: TriangleMeshFactory.cpp:1400
ccMesh::OrientTriangles
bool OrientTriangles()
Definition: TriangleMeshFactory.cpp:1166
ccPointCloud::resizeTheNormsTable
bool resizeTheNormsTable()
Resizes the compressed normals array.
Definition: ecvPointCloud.cpp:1281
cloudViewer::t::geometry::TriangleMesh::CreateSphere
static TriangleMesh CreateSphere(double radius=1.0, int resolution=20, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:86
ccPointCloud::resizeTheRGBTable
bool resizeTheRGBTable(bool fillWithWhite=false)
Resizes the RGB colors array.
Definition: ecvPointCloud.cpp:1226
ccMesh::ComputeEdgeWeightsCot
std::unordered_map< Eigen::Vector2i, double, cloudViewer::utility::hash_eigen< Eigen::Vector2i > > ComputeEdgeWeightsCot(const std::unordered_map< Eigen::Vector2i, std::vector< int >, cloudViewer::utility::hash_eigen< Eigen::Vector2i >> &edges_to_vertices, double min_weight=std::numeric_limits< double >::lowest()) const
Function that computes for each edge in the triangle mesh and passed as parameter edges_to_vertices t...
Definition: TriangleMeshFactory.cpp:1346
ccMesh::IsSelfIntersecting
bool IsSelfIntersecting() const
Definition: TriangleMeshFactory.cpp:1016
ccMesh::IsOrientable
bool IsOrientable() const
Definition: TriangleMeshFactory.cpp:1157
color
math::float4 color
Definition: LineSetBuffers.cpp:46
cloudViewer::t::geometry::vtkutils::CreateTriangleMeshFromVtkPolyData
TriangleMesh CreateTriangleMeshFromVtkPolyData(vtkPolyData *polydata, bool copy)
Definition: VtkUtils.cpp:431
ccMesh::CreateOctahedron
static std::shared_ptr< ccMesh > CreateOctahedron(double radius=1.0, bool create_uv_map=false)
Definition: TriangleMeshFactory.cpp:1902
cloudViewer::utility::swap
void swap(optional< T > &x, optional< T > &y) noexcept(noexcept(x.swap(y)))
Definition: Optional.h:890
TriangleMesh.h
cloudViewer::core::Dtype
Definition: Dtype.h:21
ccMesh::RemoveDuplicatedTriangles
ccMesh & RemoveDuplicatedTriangles()
Function that removes duplicated triangles, i.e., removes triangles that reference the same three ver...
Definition: TriangleMeshFactory.cpp:84
cloudViewer::PointCloudTpl::getPointPtr
CCVector3 * getPointPtr(size_t index)
Definition: PointCloudTpl.h:146
cloudViewer::t::geometry::TriangleMesh
A triangle mesh contains vertices and triangles.
Definition: TriangleMesh.h:98
normals
double normals[3]
Definition: TriangleMeshIO.cpp:54
ecvKDTreeFlann.h
width
int width
Definition: FileIOFactory.cpp:142
ccMesh::GetEdgeToVerticesMap
std::unordered_map< Eigen::Vector2i, std::vector< int >, cloudViewer::utility::hash_eigen< Eigen::Vector2i > > GetEdgeToVerticesMap() const
Definition: TriangleMeshFactory.cpp:1610
NormsIndexesTableType
Array of compressed 3D normals (single index)
Definition: ecvAdvancedTypes.h:21
Parallel.h
cloudViewer::t::geometry::CheckExtrinsicTensor
void CheckExtrinsicTensor(const core::Tensor &extrinsic)
Definition: Utility.h:53
size
int size
Definition: FileIOFactory.cpp:130
ccMesh::IsEdgeManifold
bool IsEdgeManifold(bool allow_boundary_edges=true) const
Definition: TriangleMeshFactory.cpp:909
cloudViewer::core::Dtype::Float64
static const Dtype Float64
Definition: Dtype.h:25
cloudViewer::utility::IntersectionTest::TriangleTriangle3d
static bool TriangleTriangle3d(const Eigen::Vector3d &p0, const Eigen::Vector3d &p1, const Eigen::Vector3d &p2, const Eigen::Vector3d &q0, const Eigen::Vector3d &q1, const Eigen::Vector3d &q2)
Definition: IntersectionTest.cpp:32
height
int height
Definition: FileIOFactory.cpp:143
cloudViewer::PointCloudTpl::setPoint
void setPoint(size_t index, const CCVector3 &P)
Definition: PointCloudTpl.h:259
y
normal_z y
Definition: my_point_types.h:168
ccMesh::GetTriangleArea
double GetTriangleArea(size_t triangle_idx) const
Definition: TriangleMeshFactory.cpp:1637
cloudViewer::core::None
constexpr utility::nullopt_t None
Definition: TensorKey.h:20
ccMesh::PaintUniformColor
ccMesh & PaintUniformColor(const Eigen::Vector3d &color)
Assigns each vertex in the ccMesh the same color.
Definition: TriangleMeshFactory.cpp:398
ccMesh::GetMaxBound
virtual Eigen::Vector3d GetMaxBound() const override
Returns max bounds for geometry coordinates.
Definition: ecvMesh.cpp:828
Vector3Tpl< PointCoordinateType >
cloudViewer::t::geometry::TriangleMesh::CreateIcosahedron
static TriangleMesh CreateIcosahedron(double radius=1.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:123
ccMesh::SamplePointsUniformly
std::shared_ptr< ccPointCloud > SamplePointsUniformly(size_t number_of_points, bool use_triangle_normal=false, int seed=-1)
Definition: TriangleMeshFactory.cpp:1831
e
const double * e
Definition: essential_matrix_poly.h:10
cloudViewer::core::Int32
const Dtype Int32
Definition: Dtype.cpp:46
ccMesh::CreateCoordinateFrame
static std::shared_ptr< ccMesh > CreateCoordinateFrame(double size=1.0, const Eigen::Vector3d &origin=Eigen::Vector3d(0.0, 0.0, 0.0))
Definition: TriangleMeshFactory.cpp:2808
cloudViewer::PointCloudTpl::getPoints
std::vector< CCVector3 > & getPoints()
Definition: PointCloudTpl.h:149
ccPointCloud::NormalizeNormals
ccPointCloud & NormalizeNormals()
Normalize point normals to length 1.`.
Definition: PointCloudFactory.cpp:290
std::swap
void swap(cloudViewer::core::SmallVectorImpl< T > &LHS, cloudViewer::core::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
Definition: SmallVector.h:1370
LogDebug
#define LogDebug(...)
Definition: Logging.h:90
ecvQhull.h
cloudViewer::VerticesIndexes::i3
unsigned i3
Definition: GenericIndexedMesh.h:19
next
math::float4 next
Definition: LineSetBuffers.cpp:45
cloudViewer::core::Device
Definition: Device.h:18
cloudViewer::t::geometry::TriangleMesh::CreateArrow
static TriangleMesh CreateArrow(double cylinder_radius=1.0, double cone_radius=1.5, double cylinder_height=5.0, double cone_height=4.0, int resolution=20, int cylinder_split=4, int cone_split=1, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:183
cloudViewer::VerticesIndexes::i
unsigned i[3]
Definition: GenericIndexedMesh.h:21
cloudViewer::t::geometry::CheckColorTensor
void CheckColorTensor(const core::Tensor &color)
Definition: Utility.h:27
ccPointCloud::getEigenColor
Eigen::Vector3d getEigenColor(size_t index) const
Definition: ecvPointCloud.cpp:1625
OrientTriangleHelper
bool OrientTriangleHelper(const std::vector< Eigen::Vector3i > &triangles, F &swap)
Definition: TriangleMeshFactory.cpp:1053
TensorCheck.h
ecvMesh.h
ccMesh::ComputeConvexHull
std::tuple< std::shared_ptr< ccMesh >, std::vector< size_t > > ComputeConvexHull() const
Definition: TriangleMeshFactory.cpp:409
ccPointCloud::hasNormals
bool hasNormals() const override
Returns whether normals are enabled or not.
Definition: ecvPointCloud.cpp:1693
cloudViewer::core::UInt8
const Dtype UInt8
Definition: Dtype.cpp:48
ccMesh::CreateTorus
static std::shared_ptr< ccMesh > CreateTorus(double torus_radius=1.0, double tube_radius=0.5, int radial_resolution=30, int tubular_resolution=20)
Definition: TriangleMeshFactory.cpp:2689
cloudViewer::utility::hash_eigen
Definition: Helper.h:73
ccMesh::RemoveDegenerateTriangles
ccMesh & RemoveDegenerateTriangles()
Function that removes degenerate triangles, i.e., triangles that reference a single vertex multiple t...
Definition: TriangleMeshFactory.cpp:193
cloudViewer::utility::IntersectionTest::AABBAABB
static bool AABBAABB(const Eigen::Vector3d &min0, const Eigen::Vector3d &max0, const Eigen::Vector3d &min1, const Eigen::Vector3d &max1)
Definition: IntersectionTest.cpp:16
cloudViewer::core::Dtype::ToString
std::string ToString() const
Definition: Dtype.h:65
cloudViewer::core::Float64
const Dtype Float64
Definition: Dtype.cpp:43
knncpp::Vector3i
Eigen::Matrix< Index, 3, 1 > Vector3i
Definition: knncpp.h:30
a
a[190]
Definition: essential_matrix_poly.h:19
ccMesh::IsWatertight
bool IsWatertight() const
Definition: TriangleMeshFactory.cpp:1162
cloudViewer::t::geometry::GetEdgeToTrianglesMap
static std::unordered_map< Edge< T >, std::vector< size_t >, utility::hash_tuple< Edge< T > > > GetEdgeToTrianglesMap(const core::Tensor &tris_cpu)
Definition: TriangleMesh.cpp:1680
ccPointCloud::rgbColors
ColorsTableType * rgbColors() const
Returns pointer on RGB colors table.
Definition: ecvPointCloud.h:914
cloudViewer::core::Float32
const Dtype Float32
Definition: Dtype.cpp:42
Tuple3Tpl::z
Type z
Definition: CVGeom.h:137
ccArray::getValue
Type & getValue(size_t index)
Definition: ecvArray.h:100
cloudViewer::core::SizeVector
Definition: SizeVector.h:70
ccMesh::RemoveVerticesByIndex
void RemoveVerticesByIndex(const std::vector< size_t > &vertex_indices)
This function removes the vertices with index in vertex_indices. Note that also all triangles associa...
Definition: TriangleMeshFactory.cpp:1283
ccMesh::ComputeTriangleNormals
ccMesh & ComputeTriangleNormals(bool normalized=true)
Function to compute triangle normals, usually called before rendering.
Definition: TriangleMeshFactory.cpp:1380
origin
Eigen::Vector3d origin
Definition: VoxelGridIO.cpp:26
ccPointCloud::resize
bool resize(unsigned numberOfPoints) override
Resizes all the active features arrays.
Definition: ecvPointCloud.cpp:1476
cloudViewer::geometry::KDTreeFlann::SearchRadius
int SearchRadius(const T &query, double radius, std::vector< int > &indices, std::vector< double > &distance2) const
Definition: ecvKDTreeFlann.h:144
LogError
#define LogError(...)
Definition: Logging.h:60
ccMesh::RemoveUnreferencedVertices
ccMesh & RemoveUnreferencedVertices()
This function removes vertices from the triangle mesh that are not referenced in any triangle of the ...
Definition: TriangleMeshFactory.cpp:139
ecvHObjectCaster.h
ccMesh::FilterSmoothSimple
std::shared_ptr< ccMesh > FilterSmoothSimple(int number_of_iterations, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh with simple neighbour average.
Definition: TriangleMeshFactory.cpp:535
cloudViewer::t::geometry::TriangleMesh::CreateText
static TriangleMesh CreateText(const std::string &text, double depth=0.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:236
cloudViewer::t::geometry::TriangleMesh::CreateCoordinateFrame
static TriangleMesh CreateCoordinateFrame(double size=1.0, const Eigen::Vector3d &origin=Eigen::Vector3d(0.0, 0.0, 0.0), core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:203
VtkUtils.h
cloudViewer::t::geometry::TriangleMesh::CreateTorus
static TriangleMesh CreateTorus(double torus_radius=1.0, double tube_radius=0.5, int radial_resolution=30, int tubular_resolution=20, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:167
cloudViewer::PointCloudTpl::setEigenPoint
void setEigenPoint(size_t index, const Eigen::Vector3d &point)
Definition: PointCloudTpl.h:272
cloudViewer::t::geometry::TriangleMesh::CreateMobius
static TriangleMesh CreateMobius(int length_split=70, int width_split=15, int twists=1, double radius=1, double flatness=1, double width=1, double scale=1, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:217
ccMesh::getTriangle
Eigen::Vector3i getTriangle(size_t index) const
Definition: ecvMesh.cpp:2448
uv
math::float2 uv
Definition: PointCloudBuffers.cpp:51
AssertTensorDtype
#define AssertTensorDtype(tensor,...)
Definition: TensorCheck.h:21
cloudViewer::geometry::KDTreeFlann
KDTree with FLANN for nearest neighbor search.
Definition: ecvKDTreeFlann.h:33
ccMesh::clear
void clear()
Definition: ecvMesh.cpp:2126
cloudViewer::GenericMesh::FilterScope
FilterScope
Indicates the scope of filter operations.
Definition: GenericMesh.h:44
ccNormalVectors::GetNormalPtr
static CCVector3 & GetNormalPtr(unsigned normIndex)
Definition: ecvNormalVectors.h:40
ccPointCloud::setPointNormals
void setPointNormals(const std::vector< CCVector3 > &normals)
Definition: ecvPointCloud.cpp:1590
ccMesh::CreateBox
static std::shared_ptr< ccMesh > CreateBox(double width=1.0, double height=1.0, double depth=1.0, bool create_uv_map=false, bool map_texture_to_each_face=false)
Definition: TriangleMeshFactory.cpp:2091
ccMesh
Triangular mesh.
Definition: ecvMesh.h:35
ccMesh::getVertice
Eigen::Vector3d getVertice(size_t index) const
Definition: ecvMesh.cpp:2213
ccMesh::GetEdgeToTrianglesMap
std::unordered_map< Eigen::Vector2i, std::vector< int >, cloudViewer::utility::hash_eigen< Eigen::Vector2i > > GetEdgeToTrianglesMap() const
Definition: TriangleMeshFactory.cpp:1589
cloudViewer::core::Tensor::NumElements
int64_t NumElements() const
Definition: Tensor.h:1170
ccMesh::RemoveVerticesByMask
void RemoveVerticesByMask(const std::vector< bool > &vertex_mask)
This function removes the vertices that are masked in vertex_mask. Note that also all triangles assoc...
Definition: TriangleMeshFactory.cpp:1299
IntersectionTest.h
Tensor.h
ccMesh::IsVertexManifold
bool IsVertexManifold() const
Definition: TriangleMeshFactory.cpp:977
cloudViewer::t::geometry::CheckIntrinsicTensor
void CheckIntrinsicTensor(const core::Tensor &intrinsic)
Definition: Utility.h:37
ccMesh::GetMinBound
virtual Eigen::Vector3d GetMinBound() const override
Returns min bounds for geometry coordinates.
Definition: ecvMesh.cpp:820
LogWarning
#define LogWarning(...)
Definition: Logging.h:72
Tuple3Tpl::y
Type y
Definition: CVGeom.h:137
ccMesh::CreateMobius
static std::shared_ptr< ccMesh > CreateMobius(int length_split=70, int width_split=15, int twists=1, double radius=1, double flatness=1, double width=1, double scale=1)
Definition: TriangleMeshFactory.cpp:2850
cloudViewer::t::geometry::vtkutils::CreateVtkImageDataFromTensor
CLOUDVIEWER_LOCAL vtkSmartPointer< vtkImageData > CreateVtkImageDataFromTensor(core::Tensor &tensor, bool copy)
Definition: VtkUtils.cpp:186
ccMesh::FilterSmoothLaplacian
std::shared_ptr< ccMesh > FilterSmoothLaplacian(int number_of_iterations, double lambda, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh using Laplacian.
Definition: TriangleMeshFactory.cpp:706
cloudViewer::geometry::Qhull::ComputeConvexHull
static std::tuple< std::shared_ptr< ccMesh >, std::vector< size_t > > ComputeConvexHull(const std::vector< Eigen::Vector3d > &points)
Definition: ecvQhull.cpp:34
ccMesh::EulerPoincareCharacteristic
int EulerPoincareCharacteristic() const
Definition: TriangleMeshFactory.cpp:879
ccMesh::CreateSphere
static std::shared_ptr< ccMesh > CreateSphere(double radius=1.0, int resolution=20, bool create_uv_map=false)
Definition: TriangleMeshFactory.cpp:2180
ccPointCloud::setPointNormal
void setPointNormal(size_t pointIndex, const CCVector3 &N)
Sets a particular point normal (shortcut)
Definition: ecvPointCloud.cpp:1681
ccMesh::GetNonManifoldEdges
std::vector< Eigen::Vector2i > GetNonManifoldEdges(bool allow_boundary_edges=true) const
Definition: TriangleMeshFactory.cpp:895
ccPointCloud::getPointNormals
std::vector< CCVector3 > getPointNormals() const
Definition: ecvPointCloud.cpp:1574
PointCoordinateType
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
cloudViewer::t::geometry::TriangleMesh::FromLegacy
static geometry::TriangleMesh FromLegacy(const ccMesh &mesh_legacy, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMesh.cpp:379
ecvColor::RgbTpl::FromEigen
constexpr static RgbTpl FromEigen(const Eigen::Vector3d &t)
Definition: ecvColorTypes.h:86
AssertTensorShape
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:61
ccPointCloud::shrinkToFit
void shrinkToFit()
Removes unused capacity.
Definition: ecvPointCloud.h:357
cloudViewer::PointCloudTpl::addEigenPoint
void addEigenPoint(const Eigen::Vector3d &point)
Definition: PointCloudTpl.h:290
ccPointCloud::PaintUniformColor
ccPointCloud & PaintUniformColor(const Eigen::Vector3d &color)
Assigns each vertex in the ccMesh the same color.
Definition: PointCloudFactory.cpp:1497
cloudViewer::core::Dtype::Int32
static const Dtype Int32
Definition: Dtype.h:28
ccEntityAction::computeNormals
bool computeNormals(const ccHObject::Container &selectedEntities, QWidget *parent)
Definition: ecvEntityAction.cpp:1570
AssertTensorDtypes
#define AssertTensorDtypes(tensor,...)
Definition: TensorCheck.h:33
ccMesh::CreateTetrahedron
static std::shared_ptr< ccMesh > CreateTetrahedron(double radius=1.0, bool create_uv_map=false)
Definition: TriangleMeshFactory.cpp:1851
ccMesh::FilterSmoothTaubin
std::shared_ptr< ccMesh > FilterSmoothTaubin(int number_of_iterations, double lambda=0.5, double mu=-0.53, FilterScope scope=FilterScope::All) const
Function to smooth triangle mesh using method of Taubin, "Curve and Surface Smoothing Without Shrinka...
Definition: TriangleMeshFactory.cpp:785
ccObject::setEnabled
virtual void setEnabled(bool state)
Sets the "enabled" property.
Definition: ecvObject.h:102
cloudViewer::t::geometry::TriangleMesh::CreateIsosurfaces
static TriangleMesh CreateIsosurfaces(const core::Tensor &volume, const std::vector< double > contour_values={0.0}, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:279
ccPointCloud::setPointColor
void setPointColor(size_t pointIndex, const ecvColor::Rgb &col)
Sets a particular point color.
Definition: ecvPointCloud.cpp:1649
ccMesh::CreatePlane
static std::shared_ptr< ccMesh > CreatePlane(double width=1.0, double height=1.0, bool create_uv_map=false)
Definition: TriangleMeshFactory.cpp:2047
ccMesh::GetTrianglePlane
Eigen::Vector4d GetTrianglePlane(size_t triangle_idx) const
Definition: TriangleMeshFactory.cpp:1713
cloudViewer::core::Int64
const Dtype Int64
Definition: Dtype.cpp:47
ecvPointCloud.h
ccMesh::RemoveTrianglesByIndex
void RemoveTrianglesByIndex(const std::vector< size_t > &triangle_indices)
This function removes the triangles with index in triangle_indices. Call RemoveUnreferencedVertices t...
Definition: TriangleMeshFactory.cpp:1243
cloudViewer::core::Tensor::To
Tensor To(Dtype dtype, bool copy=false) const
Definition: Tensor.cpp:739
ccMesh::IsIntersecting
bool IsIntersecting(const ccMesh &other) const
Definition: TriangleMeshFactory.cpp:1026
ccMesh::CreateCylinder
static std::shared_ptr< ccMesh > CreateCylinder(double radius=1.0, double height=2.0, int resolution=20, int split=4, bool create_uv_map=false)
Definition: TriangleMeshFactory.cpp:2368
cloudViewer::VerticesIndexes::i1
unsigned i1
Definition: GenericIndexedMesh.h:19
cloudViewer::t::geometry::TriangleMesh::CreateBox
static TriangleMesh CreateBox(double width=1.0, double height=1.0, double depth=1.0, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMeshFactory.cpp:22
ccMesh::GetVolume
double GetVolume() const
Definition: TriangleMeshFactory.cpp:1664
ccMesh::ComputeTrianglePlane
static Eigen::Vector4d ComputeTrianglePlane(const Eigen::Vector3d &p0, const Eigen::Vector3d &p1, const Eigen::Vector3d &p2)
Definition: TriangleMeshFactory.cpp:1697
cloudViewer::t::geometry::CheckDepthTensor
void CheckDepthTensor(const core::Tensor &depth)
Definition: Utility.h:17
ColorsTableType
Array of RGB colors for each point.
Definition: ecvAdvancedTypes.h:82
cloudViewer::core::Tensor::GetDataPtr
T * GetDataPtr()
Definition: Tensor.h:1144