Open3D (C++ API)
0.12.0
|
A TriangleMesh contains vertices and triangles. More...
#include <TriangleMesh.h>
Public Member Functions | |
TriangleMesh (const core::Device &device=core::Device("CPU:0")) | |
Construct an empty trianglemesh. More... | |
TriangleMesh (const core::Tensor &vertices, const core::Tensor &triangles) | |
virtual | ~TriangleMesh () override |
const TensorMap & | GetVertexAttr () const |
Getter for vertex_attr_ TensorMap. Used in Pybind. More... | |
core::Tensor & | GetVertexAttr (const std::string &key) |
core::Tensor & | GetVertices () |
core::Tensor & | GetVertexColors () |
core::Tensor & | GetVertexNormals () |
const TensorMap & | GetTriangleAttr () const |
Getter for triangle_attr_ TensorMap. Used in Pybind. More... | |
core::Tensor & | GetTriangleAttr (const std::string &key) |
core::Tensor & | GetTriangles () |
core::Tensor & | GetTriangleNormals () |
core::Tensor & | GetTriangleColors () |
const core::Tensor & | GetVertexAttr (const std::string &key) const |
const core::Tensor & | GetVertices () const |
const core::Tensor & | GetVertexColors () const |
const core::Tensor & | GetVertexNormals () const |
const core::Tensor & | GetTriangleAttr (const std::string &key) const |
const core::Tensor & | GetTriangles () const |
const core::Tensor & | GetTriangleNormals () const |
const core::Tensor & | GetTriangleColors () const |
void | SetVertexAttr (const std::string &key, const core::Tensor &value) |
void | SetVertices (const core::Tensor &value) |
void | SetVertexColors (const core::Tensor &value) |
void | SetVertexNormals (const core::Tensor &value) |
void | SetTriangleAttr (const std::string &key, const core::Tensor &value) |
void | SetTriangles (const core::Tensor &value) |
Set the vlaue of the "triangles" attribute in triangle_attr_. More... | |
void | SetTriangleNormals (const core::Tensor &value) |
void | SetTriangleColors (const core::Tensor &value) |
bool | HasVertexAttr (const std::string &key) const |
bool | HasVertices () const |
bool | HasVertexColors () const |
bool | HasVertexNormals () const |
bool | HasTriangleAttr (const std::string &key) const |
bool | HasTriangles () const |
bool | HasTriangleNormals () const |
bool | HasTriangleColors () const |
TriangleMesh & | Clear () override |
Clear all data in the trianglemesh. More... | |
bool | IsEmpty () const override |
Returns !HasVertices(), triangles are ignored. More... | |
core::Tensor | GetMinBound () const |
core::Tensor | GetMaxBound () const |
core::Tensor | GetCenter () const |
TriangleMesh & | Transform (const core::Tensor &transformation) |
TriangleMesh & | Translate (const core::Tensor &translation, bool relative=true) |
TriangleMesh & | Scale (double scale, const core::Tensor ¢er) |
TriangleMesh & | Rotate (const core::Tensor &R, const core::Tensor ¢er) |
core::Device | GetDevice () const |
open3d::geometry::TriangleMesh | ToLegacyTriangleMesh () const |
Convert to a legacy Open3D TriangleMesh. More... | |
Public Member Functions inherited from open3d::t::geometry::Geometry | |
virtual | ~Geometry () |
GeometryType | GetGeometryType () const |
Returns one of registered geometry types. More... | |
int | Dimension () const |
Returns whether the geometry is 2D or 3D. More... | |
std::string | GetName () const |
void | SetName (const std::string &name) |
Static Public Member Functions | |
static geometry::TriangleMesh | FromLegacyTriangleMesh (const open3d::geometry::TriangleMesh &mesh_legacy, core::Dtype float_dtype=core::Dtype::Float32, core::Dtype int_dtype=core::Dtype::Int64, const core::Device &device=core::Device("CPU:0")) |
Protected Attributes | |
core::Device | device_ = core::Device("CPU:0") |
TensorMap | vertex_attr_ |
TensorMap | triangle_attr_ |
Additional Inherited Members | |
Public Types inherited from open3d::t::geometry::Geometry | |
enum | GeometryType { GeometryType::Unspecified = 0, GeometryType::PointCloud = 1, GeometryType::VoxelGrid = 2, GeometryType::Octree = 3, GeometryType::LineSet = 4, GeometryType::MeshBase = 5, GeometryType::TriangleMesh = 6, GeometryType::HalfEdgeTriangleMesh = 7, GeometryType::Image = 8, GeometryType::RGBDImage = 9, GeometryType::TetraMesh = 10, GeometryType::OrientedBoundingBox = 11, GeometryType::AxisAlignedBoundingBox = 12 } |
Specifies possible geometry types. More... | |
Protected Member Functions inherited from open3d::t::geometry::Geometry | |
Geometry (GeometryType type, int dimension) | |
Parameterized Constructor. More... | |
A TriangleMesh contains vertices and triangles.
The TriangleMesh class stores the attribute data in key-value pairs for flexibility, where the key is a string representing the attribute name and value is a Tensor containing the attribute data.
By default, there are two sets of dictionaries, i.e. vertex_attr_
and triangle_attr_
. In most cases, the length of an attribute should be equal to the length of the the data corresponding to the master key. For instance vertex_attr_["normals"]
should have the same length as vertex_attr_["vertices"]
.
Although the attributes are all stored in a key-value pair dictionary, the attributes have different levels:
Note that the level 0 and level 1 convenience functions can also be achieved via the generalized helper functions.
open3d::t::geometry::TriangleMesh::TriangleMesh | ( | const core::Device & | device = core::Device("CPU:0") | ) |
Construct an empty trianglemesh.
open3d::t::geometry::TriangleMesh::TriangleMesh | ( | const core::Tensor & | vertices, |
const core::Tensor & | triangles | ||
) |
Construct a trianglemesh from vertices and triangles.
The input tensors will be directly used as the underlying storage of the trianglemsh (no memory copy). If the tensor is created in-place from a pre-allocated buffer, the tensor has a fixed size and thus the resulting trianglemesh will have a fixed size and calling to functions like SynchronizedPushBack
will raise an exception.
The resulting trianglemesh will have the same dtype and device as the tensor. The device for vertices
must be consistent with triangles
.
vertices | A tensor with element shape (3,). |
triangles | A tensor with element shape (3,). |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Clear all data in the trianglemesh.
Implements open3d::t::geometry::Geometry.
|
static |
Create a TriangleMesh from a legacy Open3D TriangleMesh.
mesh_legacy | Legacy Open3D TriangleMesh. |
float_dtype | Float32 or Float64, used to store floating point values, e.g. vertices, normals, colors. |
int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
device | The device where the resulting TriangleMesh resides in. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Getter for triangle_attr_ TensorMap. Used in Pybind.
|
inline |
Get triangle attributes in triangle_attr_. Throws exception if the attribute does not exist.
key | Attribute name. |
|
inline |
Get triangle attributes in triangle_attr_. Throws exception if the attribute does not exist.
key | Attribute name. |
|
inline |
Get the value of the "colors" attribute in triangle_attr_. Convenience function.
|
inline |
Get the value of the "colors" attribute in triangle_attr_. Convenience function.
|
inline |
Get the value of the "normals" attribute in triangle_attr_. Convenience function.
|
inline |
Get the value of the "normals" attribute in triangle_attr_. Convenience function.
|
inline |
Get the value of the "triangles" attribute in triangle_attr_. Convenience function.
|
inline |
Get the value of the "triangles" attribute in triangle_attr_. Convenience function.
|
inline |
Getter for vertex_attr_ TensorMap. Used in Pybind.
|
inline |
Get vertex attributes in vertex_attr_. Throws exception if the attribute does not exist.
key | Attribute name. |
|
inline |
Get vertex attributes. Throws exception if the attribute does not exist.
key | Attribute name. |
|
inline |
Get the value of the "colors" attribute in vertex_attr_. Convenience function.
|
inline |
Get the value of the "colors" attribute in vertex_attr_. Convenience function.
|
inline |
Get the value of the "normals" attribute in vertex_attr_. Convenience function.
|
inline |
Get the value of the "normals" attribute in vertex_attr_. Convenience function.
|
inline |
Get the value of the "vertices" attribute in vertex_attr_. Convenience function.
|
inline |
Get the value of the "vertices" attribute in vertex_attr_. Convenience function.
|
inline |
Returns true if all of the followings are true in triangle_attr_: 1) attribute key exist 2) attribute's length as triangles' length 3) attribute's length > 0
|
inline |
Returns true if all of the followings are true in triangle_attr_: 1) attribute "colors" exist 2) attribute "colors"'s length as vertices' length 3) attribute "colors"'s length > 0 Convenience function.
|
inline |
Returns true if all of the followings are true in triangle_attr_: 1) attribute "normals" exist 2) attribute "normals"'s length as vertices' length 3) attribute "normals"'s length > 0 Convenience function.
|
inline |
Check if the "triangles" attribute's value in triangle_attr_ has length
0.
Convenience function.
|
inline |
Returns true if all of the followings are true in vertex_attr_: 1) attribute key exist 2) attribute's length as vertices' length 3) attribute's length > 0
|
inline |
Returns true if all of the followings are true in vertex_attr_: 1) attribute "colors" exist 2) attribute "colors"'s length as vertices' length 3) attribute "colors"'s length > 0 Convenience function.
|
inline |
Returns true if all of the followings are true in vertex_attr_: 1) attribute "normals" exist 2) attribute "normals"'s length as vertices' length 3) attribute "normals"'s length > 0 Convenience function.
|
inline |
Check if the "vertices" attribute's value in vertex_attr_ has length > 0. Convenience function.
|
inlineoverridevirtual |
Returns !HasVertices(), triangles are ignored.
Implements open3d::t::geometry::Geometry.
|
inline |
|
inline |
|
inline |
Set triangle attributes. If the attribute key already exists, its value will be overwritten, otherwise, the new key will be created.
key | Attribute name. |
value | A tensor. |
|
inline |
Set the value of the "colors" attribute in triangle_attr_. This is a convenience function.
|
inline |
Set the value of the "normals" attribute in triangle_attr_. This is a convenience function.
|
inline |
Set the vlaue of the "triangles" attribute in triangle_attr_.
|
inline |
Set vertex attributes. If the attribute key already exists, its value will be overwritten, otherwise, the new key will be created.
key | Attribute name. |
value | A tensor. |
|
inline |
Set the value of the "colors" attribute in vertex_attr_. Convenience function.
|
inline |
Set the value of the "normals" attribute in vertex_attr_. This is a convenience function.
|
inline |
Set the value of the "vertices" attribute in vertex_attr_. Convenience function.
open3d::geometry::TriangleMesh open3d::t::geometry::TriangleMesh::ToLegacyTriangleMesh | ( | ) | const |
Convert to a legacy Open3D TriangleMesh.
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |