 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
23 namespace trianglemesh {
29 #if defined(__CUDACC__)
30 void NormalizeNormalsCUDA
36 const int64_t n =
normals.GetLength();
39 scalar_t* ptr =
normals.GetDataPtr<scalar_t>();
43 int64_t idx = 3 * workload_idx;
44 scalar_t
x = ptr[idx];
45 scalar_t
y = ptr[idx + 1];
46 scalar_t
z = ptr[idx + 2];
52 scalar_t norm = sqrt(
x *
x +
y *
y +
z *
z);
66 #if defined(__CUDACC__)
67 void ComputeTriangleNormalsCUDA
75 const int64_t n =
normals.GetLength();
79 scalar_t* normal_ptr =
normals.GetDataPtr<scalar_t>();
80 const int64_t* triangle_ptr = triangles_d.
GetDataPtr<int64_t>();
81 const scalar_t* vertex_ptr = vertices.
GetDataPtr<scalar_t>();
85 int64_t idx = 3 * workload_idx;
87 int64_t triangle_id1 = triangle_ptr[idx];
88 int64_t triangle_id2 = triangle_ptr[idx + 1];
89 int64_t triangle_id3 = triangle_ptr[idx + 2];
91 scalar_t v01[3], v02[3];
92 v01[0] = vertex_ptr[3 * triangle_id2] -
93 vertex_ptr[3 * triangle_id1];
94 v01[1] = vertex_ptr[3 * triangle_id2 + 1] -
95 vertex_ptr[3 * triangle_id1 + 1];
96 v01[2] = vertex_ptr[3 * triangle_id2 + 2] -
97 vertex_ptr[3 * triangle_id1 + 2];
98 v02[0] = vertex_ptr[3 * triangle_id3] -
99 vertex_ptr[3 * triangle_id1];
100 v02[1] = vertex_ptr[3 * triangle_id3 + 1] -
101 vertex_ptr[3 * triangle_id1 + 1];
102 v02[2] = vertex_ptr[3 * triangle_id3 + 2] -
103 vertex_ptr[3 * triangle_id1 + 2];
111 #if defined(__CUDACC__)
112 void ComputeTriangleAreasCUDA
119 const int64_t n = triangle_areas.GetLength();
120 const core::Dtype dtype = triangle_areas.GetDtype();
124 scalar_t* area_ptr = triangle_areas.GetDataPtr<scalar_t>();
125 const int64_t* triangle_ptr = triangles_d.
GetDataPtr<int64_t>();
126 const scalar_t* vertex_ptr = vertices.
GetDataPtr<scalar_t>();
130 int64_t idx = 3 * workload_idx;
132 int64_t triangle_id1 = triangle_ptr[idx];
133 int64_t triangle_id2 = triangle_ptr[idx + 1];
134 int64_t triangle_id3 = triangle_ptr[idx + 2];
136 scalar_t v01[3], v02[3];
137 v01[0] = vertex_ptr[3 * triangle_id2] -
138 vertex_ptr[3 * triangle_id1];
139 v01[1] = vertex_ptr[3 * triangle_id2 + 1] -
140 vertex_ptr[3 * triangle_id1 + 1];
141 v01[2] = vertex_ptr[3 * triangle_id2 + 2] -
142 vertex_ptr[3 * triangle_id1 + 2];
143 v02[0] = vertex_ptr[3 * triangle_id3] -
144 vertex_ptr[3 * triangle_id1];
145 v02[1] = vertex_ptr[3 * triangle_id3 + 1] -
146 vertex_ptr[3 * triangle_id1 + 1];
147 v02[2] = vertex_ptr[3 * triangle_id3 + 2] -
148 vertex_ptr[3 * triangle_id1 + 2];
150 area_ptr[workload_idx] =
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
double colors[3]
Definition: TriangleMeshIO.cpp:53
Definition: TensorMap.h:31
Dtype GetDtype() const
Definition: Tensor.h:1164
core::Tensor & GetVertexNormals()
Definition: TriangleMesh.h:156
size_t n_sampled_points
Definition: Geometry.h:110
const Dtype UInt16
Definition: Dtype.cpp:49
static Edge< T > GetOrderedEdge(T vidx0, T vidx1)
brief Helper function to get an edge with ordered vertex indices.
Definition: TriangleMesh.cpp:1672
CLOUDVIEWER_LOCAL TriangleMesh ExtrudeRotationTriangleMesh(const Geometry &geometry, const double angle, const core::Tensor &axis, int resolution, double translation, bool capping)
Definition: VtkUtils.cpp:529
static std::unordered_map< std::string, geometry::TriangleMesh > FromTriangleMeshModel(const cloudViewer::visualization::rendering::TriangleMeshModel &model, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMesh.cpp:602
TriangleMesh SimplifyQuadricDecimation(double target_reduction, bool preserve_volume=true) const
Definition: TriangleMesh.cpp:709
PointCloud To(const core::Device &device, bool copy=false) const
Definition: PointCloud.cpp:112
int64_t GetLength() const
Definition: Tensor.h:1125
normal_z x
Definition: my_point_types.h:165
void ComputeTriangleAreasCPU(const core::Tensor &vertices, const core::Tensor &triangles, core::Tensor &triangle_areas)
Definition: TriangleMeshImpl.h:116
core::Tensor & GetTriangleIndices()
Definition: TriangleMesh.h:174
CLOUDVIEWER_HOST_DEVICE CLOUDVIEWER_FORCE_INLINE scalar_t cross_mag_3x1(const scalar_t *A_3x1_input, const scalar_t *B_3x1_input)
Definition: Matrix.h:76
SizeVector GetShape() const
Definition: Tensor.h:1127
Image To(const core::Device &device, bool copy=false) const
Transfer the image to a specified device.
Definition: Image.h:132
bool copy
Definition: VtkUtils.cpp:74
void mix_3x3(T *out, const T *a, const T *b, const T *c, float wts[3])
Definition: TriangleMeshCPU.cpp:60
virtual unsigned size() const override
Returns the number of triangles.
Definition: ecvMesh.cpp:2143
TriangleMesh & ComputeTriangleNormals(bool normalized=true)
Function to compute triangle normals, usually called before rendering.
Definition: TriangleMesh.cpp:241
std::vector< Eigen::Vector2d > TensorToEigenVector2dVector(const core::Tensor &tensor)
Converts a tensor of shape (N, 2) to std::vector<Eigen::Vector2d>. An exception will be thrown if the...
Definition: EigenConverter.cpp:145
void SetVertexColors(const core::Tensor &value)
Definition: TriangleMesh.h:268
A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound.
Definition: BoundingVolume.h:47
double normal[3]
Definition: FileIOFactory.cpp:53
void Fill(S v)
Fill the whole Tensor with a scalar value, the scalar will be casted to the Tensor's Dtype.
Definition: Tensor.h:1400
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:181
const Dtype UInt32
Definition: Dtype.cpp:50
TriangleMesh BooleanDifference(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:775
bool HasVertexNormals() const
Definition: TriangleMesh.h:337
bool IsCUDA() const
Definition: Device.h:99
template void mix_3x3< float >(float *out, const float *a, const float *b, const float *c, float wts[3])
Tensor Reshape(const SizeVector &dst_shape) const
Definition: Tensor.cpp:671
std::unordered_map< std::string, core::Tensor > BakeTriangleAttrTextures(int size, const std::unordered_set< std::string > &triangle_attr={}, double margin=2., double fill=0., bool update_material=true)
Definition: TriangleMesh.cpp:1041
Weighted graph edge.
Definition: PointProjectionTools.cpp:491
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:45
Tensor Contiguous() const
Definition: Tensor.cpp:772
void addVertexNormals(const std::vector< Eigen::Vector3d > &normals)
Definition: ecvMesh.cpp:2273
std::string GetPath() const
Path to the pcd format point cloud.
Definition: Dataset.h:693
cloudViewer::VerticesIndexes * getTriangleVertIndexes(unsigned triangleIndex) override
Returns the indexes of the vertices of a given triangle.
Definition: ecvMesh.cpp:2599
CLOUDVIEWER_LOCAL LineSet CreateLineSetFromVtkPolyData(vtkPolyData *polydata, bool copy)
Definition: VtkUtils.cpp:473
std::string GetPrimaryKey() const
Returns the primary key of the TensorMap.
Definition: TensorMap.h:159
static Material FromMaterialRecord(const MaterialRecord &mat)
Convert from MaterialRecord.
Definition: Material.cpp:149
static core::Tensor ComputeTriangleAreasHelper(const TriangleMesh &mesh)
Definition: TriangleMesh.cpp:316
TriangleMesh & Translate(const core::Tensor &translation, bool relative=true)
Translates the VertexPositions of the TriangleMesh.
Definition: TriangleMesh.cpp:167
void InclusivePrefixSum(const Tin *first, const Tin *last, Tout *out)
Definition: ParallelScan.h:66
void SetVertexAttr(const std::string &key, const core::Tensor &value)
Definition: TriangleMesh.h:254
TriangleMesh SelectFacesByMask(const core::Tensor &mask) const
Definition: TriangleMesh.cpp:1176
std::array< core::Tensor, 3 > SamplePointsUniformlyCPU(const core::Tensor &triangles, const core::Tensor &vertices, const core::Tensor &triangle_areas, const core::Tensor &vertex_normals, const core::Tensor &vertex_colors, const core::Tensor &triangle_normals, const core::Tensor &texture_uvs, const core::Tensor &albedo, size_t number_of_points)
Definition: TriangleMeshCPU.cpp:76
bool HasTriangleNormals() const
Definition: TriangleMesh.h:360
core::Tensor GetCenter() const
Definition: TriangleMesh.h:632
Tensor Slice(int64_t dim, int64_t start, int64_t stop, int64_t step=1) const
Definition: Tensor.cpp:857
static std::shared_ptr< ccMesh > CreateFromPointCloudBallPivoting(const ccPointCloud &pcd, const std::vector< double > &radii)
Definition: SurfaceReconstructionBallPivoting.cpp:770
The Image class stores image with customizable rows, cols, channels, dtype and device.
Definition: Image.h:29
void ComputeVertexNormalsCPU(const core::Tensor &triangles, const core::Tensor &triangle_normals, core::Tensor &vertex_normals)
Definition: TriangleMeshCPU.cpp:23
std::string ToString() const
Text description.
Definition: TriangleMesh.cpp:96
Image ProjectImagesToAlbedo(const std::vector< Image > &images, const std::vector< core::Tensor > &intrinsic_matrices, const std::vector< core::Tensor > &extrinsic_matrices, int tex_size=1024, bool update_material=true)
Definition: TriangleMesh.cpp:1471
bool hasTriangleUvs() const
Definition: ecvMesh.h:717
Tensor GetItem(const TensorKey &tk) const
Definition: Tensor.cpp:473
core::Tensor & GetTriangleNormals()
Definition: TriangleMesh.h:178
TriangleMesh CreateTriangleMeshFromVtkPolyData(vtkPolyData *polydata, bool copy)
Definition: VtkUtils.cpp:431
std::vector< Eigen::Vector2d > triangle_uvs_
List of uv coordinates per triangle.
Definition: ecvMesh.h:625
void NormalizeNormalsCPU(core::Tensor &normals)
Definition: TriangleMeshImpl.h:34
uint32_t AddTriangles(const core::Tensor &vertex_positions, const core::Tensor &triangle_indices)
Add a triangle mesh to the scene.
Definition: RaycastingScene.cpp:1237
A point cloud contains a list of 3D points.
Definition: PointCloud.h:82
double GetSurfaceArea() const
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces...
Definition: TriangleMesh.cpp:361
A bounding box oriented along an arbitrary frame of reference.
Definition: BoundingVolume.h:258
core::Tensor ComputeMetrics(const TriangleMesh &mesh2, std::vector< Metric > metrics={Metric::ChamferDistance}, MetricParameters params=MetricParameters()) const
Definition: TriangleMesh.cpp:1894
visualization::rendering::Material & GetMaterial()
Get material associated with this Geometry.
Definition: DrawableGeometry.h:28
TriangleMesh(const core::Device &device=core::Device("CPU:0"))
Definition: TriangleMesh.cpp:74
A triangle mesh contains vertices and triangles.
Definition: TriangleMesh.h:98
double normals[3]
Definition: TriangleMeshIO.cpp:54
TensorMap Contiguous() const
Definition: TensorMap.cpp:74
std::string ToString() const
Returns string representation of device, e.g. "CPU:0", "CUDA:0".
Definition: Device.cpp:89
core::Tensor result
Definition: VtkUtils.cpp:76
TriangleMesh ExtrudeLinear(const core::Tensor &vector, double scale=1.0, bool capping=true) const
Definition: TriangleMesh.cpp:1105
void Remap(const core::Tensor &src_im, const core::Tensor &dst2src_xmap, const core::Tensor &dst2src_ymap, core::Tensor &dst_im, Image::InterpType interp_type)
Definition: IPPImage.cpp:311
int width
Definition: FileIOFactory.cpp:142
#define CLOUDVIEWER_DEVICE
Definition: CUDAUtils.h:45
bool HasTriangleAttr(const std::string &key) const
Definition: TriangleMesh.h:343
#define CUDA_CALL(cuda_function,...)
Definition: CUDAUtils.h:49
Tensor Add_(const Tensor &value)
Definition: Tensor.cpp:1117
int64_t NumDims() const
Definition: Tensor.h:1172
#define IPP_CALL(ipp_function,...)
Definition: IPPImage.h:96
void SetTriangleAttr(const std::string &key, const core::Tensor &value)
Definition: TriangleMesh.h:285
vtkSmartPointer< vtkPolyData > CreateVtkPolyDataFromGeometry(const Geometry &geometry, const std::unordered_set< std::string > &point_attr_include, const std::unordered_set< std::string > &face_attr_include, const std::unordered_set< std::string > &point_attr_exclude, const std::unordered_set< std::string > &face_attr_exclude, bool copy)
Definition: VtkUtils.cpp:369
TensorMap triangle_attr_
Definition: TriangleMesh.h:1101
int size
Definition: FileIOFactory.cpp:130
static void CopyAttributesByMasks(TriangleMesh &dst, const TriangleMesh &src, const core::Tensor &vertex_mask, const core::Tensor &tri_mask)
Definition: TriangleMesh.cpp:1153
int height
Definition: FileIOFactory.cpp:143
core::Tensor & GetVertexColors()
Definition: TriangleMesh.h:152
bool HasVertexColors() const
Definition: TriangleMesh.h:330
bool Contains(const std::string &key) const
Definition: TensorMap.h:187
Holder for various parameters required by metrics.
Definition: Geometry.h:103
void addTriangle(unsigned i1, unsigned i2, unsigned i3)
Adds a triangle to the mesh.
Definition: ecvMesh.cpp:2428
Tensor Sub_(const Tensor &value)
Definition: Tensor.cpp:1153
normal_z y
Definition: my_point_types.h:168
CLOUDVIEWER_LOCAL TriangleMesh ExtrudeLinearTriangleMesh(const Geometry &geometry, const core::Tensor &vector, double scale, bool capping)
Definition: VtkUtils.cpp:580
void addVertexColors(const std::vector< Eigen::Vector3d > &colors)
Definition: ecvMesh.cpp:2327
BENCHMARK_CAPTURE(BenchmarkCreateFromPointCloudBallPivoting, Without Non Finite Points, true) -> Unit(benchmark::kMillisecond)
TriangleMesh & NormalizeNormals()
Normalize both triangle normals and vertex normals to length 1.
Definition: TriangleMesh.cpp:207
TriangleMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
Definition: TriangleMesh.cpp:277
TensorMap vertex_attr_
Definition: TriangleMesh.h:1100
constexpr utility::nullopt_t None
Definition: TensorKey.h:20
TriangleMesh SelectByIndex(const core::Tensor &indices, bool copy_attributes=true) const
Definition: TriangleMesh.cpp:1247
LineSet SlicePlane(const core::Tensor &point, const core::Tensor &normal, const std::vector< double > contour_values={0.0}) const
Extract contour slices given a plane. This method extracts slices as LineSet from the mesh at specifi...
Definition: TriangleMesh.cpp:671
static Tensor Zeros(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor fill with zeros.
Definition: Tensor.cpp:406
const double * e
Definition: essential_matrix_poly.h:10
const Dtype Int32
Definition: Dtype.cpp:46
const TensorMap & GetVertexAttr() const
Getter for vertex_attr_ TensorMap. Used in Pybind.
Definition: TriangleMesh.h:133
TriangleMesh RemoveNonManifoldEdges()
Definition: TriangleMesh.cpp:1697
#define LogDebug(...)
Definition: Logging.h:90
GeometryType
Specifies possible geometry types.
Definition: Geometry.h:28
int PCAPartition(int max_faces)
Definition: TriangleMesh.cpp:1112
std::unordered_map< std::string, core::Tensor > CastRays(const core::Tensor &rays, const int nthreads=0) const
Computes the first intersection of the rays with the scene.
Definition: RaycastingScene.cpp:1321
CLOUDVIEWER_HOST_DEVICE CLOUDVIEWER_FORCE_INLINE void cross_3x1(const scalar_t *A_3x1_input, const scalar_t *B_3x1_input, scalar_t *C_3x1_output)
Definition: Matrix.h:62
double Mean(const std::vector< T > &elems)
Definition: math.h:227
void AssertSizeSynchronized() const
Assert IsSizeSynchronized().
Definition: TensorMap.cpp:48
std::unordered_set< std::string > GetKeySet() const
Returns a set with all keys.
Definition: TensorMap.h:162
static Image FromLegacy(const cloudViewer::geometry::Image &image_legacy, const core::Device &Device=core::Device("CPU:0"))
Create from a legacy CloudViewer Image.
Definition: Image.cpp:505
static void UpdateTriangleIndicesByVertexMask(core::Tensor &tris_cpu, const core::Tensor &vertex_mask)
Definition: TriangleMesh.cpp:1132
const SizeVector & GetShapeRef() const
Definition: Tensor.h:1129
std::vector< MeshInfo > meshes_
Definition: Model.h:25
OrientedBoundingBox GetOrientedBoundingBox() const
Create an oriented bounding box from vertex attribute "positions".
Definition: TriangleMesh.cpp:785
Tensor IndexGet(const std::vector< Tensor > &index_tensors) const
Advanced indexing getter. This will always allocate a new Tensor.
Definition: Tensor.cpp:905
TriangleMesh To(const core::Device &device, bool copy=false) const
Definition: TriangleMesh.cpp:621
const Dtype UInt8
Definition: Dtype.cpp:48
Eigen::MatrixXd::Index Index
Definition: knncpp.h:26
const Dtype Bool
Definition: Dtype.cpp:52
std::string ToString() const
Definition: Dtype.h:65
TriangleMesh BooleanUnion(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:762
core::Tensor EigenVector3iVectorToTensor(const std::vector< Eigen::Vector3i > &values, core::Dtype dtype, const core::Device &device)
Converts a vector of Eigen::Vector3i to a (N, 3) tensor. This function also takes care of dtype conve...
Definition: EigenConverter.cpp:179
core::Tensor ComputeMetricsCommon(core::Tensor distance12, core::Tensor distance21, std::vector< Metric > metrics, MetricParameters params)
Definition: Metrics.cpp:16
std::tuple< float, int, int > ComputeUVAtlas(TriangleMesh &mesh, const size_t width, const size_t height, const float gutter, const float max_stretch, int parallel_partitions, int nthreads)
Definition: UVUnwrapping.cpp:175
Data class for PCDPointCloud contains the fragment.pcd point cloud mesh from the Redwood Living Room ...
Definition: Dataset.h:688
const Dtype Float64
Definition: Dtype.cpp:43
Eigen::Matrix< Index, 3, 1 > Vector3i
Definition: knncpp.h:30
a[190]
Definition: essential_matrix_poly.h:19
Device GetDevice() const override
Definition: Tensor.cpp:1435
std::vector< Eigen::Vector3d > getVertexColors() const
Definition: ecvMesh.cpp:2311
core::Device device_
Definition: TriangleMesh.h:1099
#define DISPATCH_DTYPE_TO_TEMPLATE_WITH_BOOL(DTYPE,...)
Definition: Dispatch.h:68
PointCloud SamplePointsUniformly(size_t number_of_points, bool use_triangle_normal=false)
Definition: TriangleMesh.cpp:1821
bool IsEmpty() const override
Returns !HasVertexPositions(), triangles are ignored.
Definition: TriangleMesh.h:626
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
int points
Definition: FileIOFactory.cpp:144
void SetVertexPositions(const core::Tensor &value)
Definition: TriangleMesh.h:261
std::vector< Eigen::Vector3d > getEigenVertices() const
Definition: ecvMesh.cpp:2368
static core::Tensor CreateRaysPinhole(const core::Tensor &intrinsic_matrix, const core::Tensor &extrinsic_matrix, int width_px, int height_px)
Creates rays for the given camera parameters.
Definition: RaycastingScene.cpp:1629
const Dtype Float32
Definition: Dtype.cpp:42
std::vector< visualization::rendering::MaterialRecord > materials_
Definition: Model.h:26
Definition: SizeVector.h:70
void SetTriangleNormals(const core::Tensor &value)
Definition: TriangleMesh.h:298
const Dtype Undefined
Definition: Dtype.cpp:41
Tensor Mul_(const Tensor &value)
Definition: Tensor.cpp:1189
static OrientedBoundingBox CreateFromPoints(const core::Tensor &points, bool robust=false, MethodOBBCreate method=MethodOBBCreate::MINIMAL_APPROX)
Definition: BoundingVolume.cpp:584
bool HasVertexPositions() const
Definition: TriangleMesh.h:323
#define LogError(...)
Definition: Logging.h:60
bool HasVertexAttr(const std::string &key) const
Definition: TriangleMesh.h:314
Definition: VtkUtils.cpp:28
TriangleMesh ClipPlane(const core::Tensor &point, const core::Tensor &normal) const
Clip mesh with a plane. This method clips the triangle mesh with the specified plane....
Definition: TriangleMesh.cpp:640
#define DISPATCH_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: Dispatch.h:31
A scene class with basic ray casting and closest point queries.
Definition: RaycastingScene.h:30
static constexpr bool HAVE_IPP
Do we use IPP for accelerating image processing operations?
Definition: Image.h:339
std::vector< Eigen::Vector3d > getVertexNormals() const
Definition: ecvMesh.cpp:2266
const TensorMap & GetTriangleAttr() const
Getter for triangle_attr_ TensorMap. Used in Pybind.
Definition: TriangleMesh.h:159
for(size_t i=0;i< 36;++i)
Definition: essential_matrix_poly.h:14
std::vector< std::pair< std::string, Material > > materials_
Definition: ecvMesh.h:704
core::Tensor ComputeDistance(const core::Tensor &query_points, const int nthreads=0)
Computes the distance to the surface of the scene.
Definition: RaycastingScene.cpp:1492
static AxisAlignedBoundingBox CreateFromPoints(const core::Tensor &points)
Definition: BoundingVolume.cpp:233
void addEigenVertices(const std::vector< Eigen::Vector3d > &vertices)
Definition: ecvMesh.cpp:2377
bool IsCPU() const
Definition: Device.h:95
core::Tensor GetNonManifoldEdges(bool allow_boundary_edges=true) const
Definition: TriangleMesh.cpp:1781
void SetVertexNormals(const core::Tensor &value)
Definition: TriangleMesh.h:275
#define AssertTensorDtype(tensor,...)
Definition: TensorCheck.h:21
std::vector< Eigen::Vector3f > Points
Definition: FastGlobalRegistration.h:13
TensorKey is used to represent single index, slice or advanced indexing on a Tensor.
Definition: TensorKey.h:26
core::Device GetDevice() const override
Returns the device of the geometry.
Definition: TriangleMesh.h:721
Triangular mesh.
Definition: ecvMesh.h:35
static Tensor Empty(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor with uninitialized values.
Definition: Tensor.cpp:400
ccMesh ToLegacy() const
Convert to a legacy CloudViewer TriangleMesh.
Definition: TriangleMesh.cpp:479
int64_t NumElements() const
Definition: Tensor.h:1170
TriangleMesh RemoveUnreferencedVertices()
Definition: TriangleMesh.cpp:1354
TriangleMesh FillHoles(double hole_size=1e6) const
Definition: TriangleMesh.cpp:789
#define LogWarning(...)
Definition: Logging.h:72
#define DISPATCH_FLOAT_DTYPE_TO_TEMPLATE(DTYPE,...)
Definition: Dispatch.h:78
Tensor Sum(const SizeVector &dims, bool keepdim=false) const
Definition: Tensor.cpp:1240
TriangleMesh & Scale(double scale, const core::Tensor ¢er)
Scales the VertexPositions of the TriangleMesh.
Definition: TriangleMesh.cpp:181
static bool IsNegative(T val)
brief Static negative checker for signed integer types
Definition: TriangleMesh.cpp:1232
bool HasTriangleIndices() const
Definition: TriangleMesh.h:353
bool HasMaterial() const
Check if a material has been applied to this Geometry with SetMaterial.
Definition: DrawableGeometry.h:25
std::tuple< float, int, int > ComputeUVAtlas(size_t size=512, float gutter=1.0f, float max_stretch=1.f/6, int parallel_partitions=1, int nthreads=0)
Definition: TriangleMesh.cpp:803
A LineSet contains points and lines joining them and optionally attributes on the points and lines.
Definition: LineSet.h:85
TriangleMesh ComputeConvexHull(bool joggle_inputs=false) const
Definition: TriangleMesh.cpp:635
core::Tensor EigenVector2dVectorToTensor(const std::vector< Eigen::Vector2d > &values, core::Dtype dtype, const core::Device &device)
Converts a vector of Eigen::Vector2d to a (N, 2) tensor. This function also takes care of dtype conve...
Definition: EigenConverter.cpp:172
TriangleMesh & ComputeTriangleAreas()
Function to compute triangle areas and save it as a triangle attribute "areas". Prints a warning,...
Definition: TriangleMesh.cpp:335
TriangleMesh & Rotate(const core::Tensor &R, const core::Tensor ¢er)
Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists).
Definition: TriangleMesh.cpp:192
void ParallelFor(const Device &device, int64_t n, const func_t &func)
Definition: ParallelFor.h:111
TriangleMesh & Transform(const core::Tensor &transformation)
Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh.
Definition: TriangleMesh.cpp:152
normal_z z
Definition: my_point_types.h:165
std::vector< Eigen::Vector3i > TensorToEigenVector3iVector(const core::Tensor &tensor)
Converts a tensor of shape (N, 3) to std::vector<Eigen::Vector3i>. An exception will be thrown if the...
Definition: EigenConverter.cpp:155
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
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:61
std::unordered_map< std::string, core::Tensor > BakeVertexAttrTextures(int size, const std::unordered_set< std::string > &vertex_attr={}, double margin=2., double fill=0., bool update_material=true)
Definition: TriangleMesh.cpp:975
void SetPointNormals(const core::Tensor &value)
Set the value of the "normals" attribute. Convenience function.
Definition: PointCloud.h:198
@ Linear
Bilinear interpolation.
std::tuple< int, core::Tensor > PCAPartition(core::Tensor &points, int max_points)
Definition: PCAPartition.cpp:83
#define AssertTensorDtypes(tensor,...)
Definition: TensorCheck.h:33
std::shared_ptr< ccPointCloud > CreatePointCloudFromFile(const std::string &filename, const std::string &format, bool print_progress)
Definition: PointCloudIO.cpp:84
TriangleMesh BooleanIntersection(const TriangleMesh &mesh, double tolerance=1e-6) const
Definition: TriangleMesh.cpp:768
void ComputeTriangleNormalsCPU(const core::Tensor &vertices, const core::Tensor &triangles, core::Tensor &normals)
Definition: TriangleMeshImpl.h:71
std::vector< Eigen::Vector3d > TensorToEigenVector3dVector(const core::Tensor &tensor)
Converts a tensor of shape (N, 3) to std::vector<Eigen::Vector3d>. An exception will be thrown if the...
Definition: EigenConverter.cpp:150
DtypeCode
Definition: Dtype.h:37
void Project(core::Tensor &depth, utility::optional< std::reference_wrapper< core::Tensor >> image_colors, const core::Tensor &points, utility::optional< std::reference_wrapper< const core::Tensor >> colors, const core::Tensor &intrinsics, const core::Tensor &extrinsics, float depth_scale, float depth_max)
Definition: PointCloud.cpp:63
void SetTriangleIndices(const core::Tensor &value)
Set the value of the "indices" attribute in triangle_attr_.
Definition: TriangleMesh.h:291
core::Tensor & GetVertexPositions()
Definition: TriangleMesh.h:148
static void BenchmarkCreateFromPointCloudBallPivoting(benchmark::State &state, const bool remove_non_finite_points)
Definition: TriangleMesh.cpp:21
static double distance(T *pot1, T *pot2)
Definition: utils.h:111
constexpr float EPS
Definition: IoUImpl.h:20
const Dtype Int64
Definition: Dtype.cpp:47
char type
Definition: FileIOFactory.cpp:131
AxisAlignedBoundingBox GetAxisAlignedBoundingBox() const
Create an axis-aligned bounding box from vertex attribute "positions".
Definition: TriangleMesh.cpp:781
Definition: Material.h:22
Tensor To(Dtype dtype, bool copy=false) const
Definition: Tensor.cpp:739
long vertex_num
Definition: FileIOFactory.cpp:48
The base geometry class.
Definition: Geometry.h:23
void SetMaterial(const visualization::rendering::Material &material)
Set the material properties associate with this Geometry.
Definition: DrawableGeometry.h:36
::ccPointCloud PointCloud
Definition: PointCloud.h:19
core::Tensor EigenVector3dVectorToTensor(const std::vector< Eigen::Vector3d > &values, core::Dtype dtype, const core::Device &device)
Converts a vector of Eigen::Vector3d to a (N, 3) tensor. This function also takes care of dtype conve...
Definition: EigenConverter.cpp:165
#define DISPATCH_INT_DTYPE_PREFIX_TO_TEMPLATE(DTYPE, PREFIX,...)
Definition: Dispatch.h:118
TriangleMesh ExtrudeRotation(double angle, const core::Tensor &axis, int resolution=16, double translation=0.0, bool capping=true) const
Definition: TriangleMesh.cpp:1095
DtypeCode GetDtypeCode() const
Definition: Dtype.h:61
#define DISPATCH_FLOAT_INT_DTYPE_TO_TEMPLATE(FDTYPE, IDTYPE,...)
Definition: Dispatch.h:91
TriangleMesh ComputeConvexHull(bool joggle_inputs=false) const
Definition: PointCloud.cpp:1201
T * GetDataPtr()
Definition: Tensor.h:1144
void SetPointColors(const core::Tensor &value)
Set the value of the "colors" attribute. Convenience function.
Definition: PointCloud.h:192
bool HasVertices() const
Definition: ecvMesh.h:208