Open3D (C++ API)
0.11.0
|
A TriangleMesh contains vertices and triangles. More...
#include <TriangleMesh.h>
Public Member Functions | |
TriangleMesh (core::Dtype vertex_dtype=core::Dtype::Float32, core::Dtype triangle_dtype=core::Dtype::Int64, const core::Device &device=core::Device("CPU:0")) | |
Construct an empty trianglemesh. More... | |
TriangleMesh (const core::TensorList &vertices, const core::TensorList &triangles) | |
virtual | ~TriangleMesh () override |
core::TensorList & | GetVertexAttr (const std::string &key) |
core::TensorList & | GetVertices () |
core::TensorList & | GetVertexColors () |
core::TensorList & | GetVertexNormals () |
core::TensorList & | GetTriangleAttr (const std::string &key) |
core::TensorList & | GetTriangles () |
core::TensorList & | GetTriangleNormals () |
core::TensorList & | GetTriangleColors () |
const core::TensorList & | GetVertexAttr (const std::string &key) const |
const core::TensorList & | GetVertices () const |
const core::TensorList & | GetVertexColors () const |
const core::TensorList & | GetVertexNormals () const |
const core::TensorList & | GetTriangleAttr (const std::string &key) const |
const core::TensorList & | GetTriangles () const |
const core::TensorList & | GetTriangleNormals () const |
const core::TensorList & | GetTriangleColors () const |
void | SetVertexAttr (const std::string &key, const core::TensorList &value) |
void | SetVertices (const core::TensorList &value) |
void | SetVertexColors (const core::TensorList &value) |
void | SetVertexNormals (const core::TensorList &value) |
void | SetTriangleAttr (const std::string &key, const core::TensorList &value) |
void | SetTriangles (const core::TensorList &value) |
Set the vlaue of the "triangles" attribute in triangle_attr_. More... | |
void | SetTriangleNormals (const core::TensorList &value) |
void | SetTriangleColors (const core::TensorList &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 |
void | VertexSynchronizedPushBack (const std::unordered_map< std::string, core::Tensor > &map_keys_to_tensors) |
void | TriangleSynchronizedPushBack (const std::unordered_map< std::string, core::Tensor > &map_keys_to_tensors) |
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 |
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... | |
Static Public Member Functions | |
static geometry::TriangleMesh | FromLegacyTrangleMesh (const geometry::TriangleMesh &mesh_legacy, core::Dtype dtype=core::Dtype::Float32, const core::Device &device=core::Device("CPU:0")) |
Create a TriangleMesh from a legacy Open3D TriangleMesh. More... | |
Protected Attributes | |
core::Device | device_ = core::Device("CPU:0") |
TensorListMap | vertex_attr_ |
TensorListMap | 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 TensorList 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 | ( | core::Dtype | vertex_dtype = core::Dtype::Float32 , |
core::Dtype | triangle_dtype = core::Dtype::Int64 , |
||
const core::Device & | device = core::Device("CPU:0") |
||
) |
Construct an empty trianglemesh.
open3d::t::geometry::TriangleMesh::TriangleMesh | ( | const core::TensorList & | vertices, |
const core::TensorList & | triangles | ||
) |
Construct a trianglemesh from vertices and triangles.
The input tensorlists will be directly used as the underlying storage of the trianglemsh (no memory copy). If the tensorlist is created in-place from a pre-allocated buffer, the tensorlist 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 tensorlist. The device for vertices
must be consistent with triangles
.
vertices | A tensorlist with element shape (3,). |
triangles | A tensorlist with element shape (3,). |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Clear all data in the trianglemesh.
Implements open3d::t::geometry::Geometry.
|
inlinestatic |
Create a TriangleMesh from a legacy Open3D TriangleMesh.
|
inline |
|
inline |
|
inline |
|
inline |
|
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 |
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 tensorlist. |
|
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 tensorlist. |
|
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.
|
inline |
Convert to a legacy Open3D TriangleMesh.
|
inline |
|
inline |
|
inline |
Synchronized push back to the triangle_attr_, data will be copied. Before push back, all existing tensorlists must have the same length.
map_keys_to_tensors | The keys and values to be pushed back. It must contain the same keys and each corresponding tensor must have the same dtype and device. |
|
inline |
Synchronized push back to the vertex_attr_, data will be copied. Before push back, all existing tensorlists must have the same length.
map_keys_to_tensors | The keys and values to be pushed back. It must contain the same keys and each corresponding tensor must have the same dtype and device. |
|
protected |
|
protected |
|
protected |