Open3D (C++ API)
0.18.0
|
A triangle mesh contains vertices and triangles. More...
#include <TriangleMesh.h>
Public Member Functions | |
TriangleMesh (const core::Device &device=core::Device("CPU:0")) | |
TriangleMesh (const core::Tensor &vertex_positions, const core::Tensor &triangle_indices) | |
virtual | ~TriangleMesh () override |
std::string | ToString () const |
Text description. More... | |
TriangleMesh | To (const core::Device &device, bool copy=false) const |
TriangleMesh | Clone () const |
Returns copy of the triangle mesh on the same device. More... | |
const TensorMap & | GetVertexAttr () const |
Getter for vertex_attr_ TensorMap. Used in Pybind. More... | |
TensorMap & | GetVertexAttr () |
Getter for vertex_attr_ TensorMap. More... | |
core::Tensor & | GetVertexAttr (const std::string &key) |
core::Tensor & | GetVertexPositions () |
core::Tensor & | GetVertexColors () |
core::Tensor & | GetVertexNormals () |
const TensorMap & | GetTriangleAttr () const |
Getter for triangle_attr_ TensorMap. Used in Pybind. More... | |
TensorMap & | GetTriangleAttr () |
Getter for triangle_attr_ TensorMap. More... | |
core::Tensor & | GetTriangleAttr (const std::string &key) |
core::Tensor & | GetTriangleIndices () |
core::Tensor & | GetTriangleNormals () |
core::Tensor & | GetTriangleColors () |
const core::Tensor & | GetVertexAttr (const std::string &key) const |
void | RemoveVertexAttr (const std::string &key) |
const core::Tensor & | GetVertexPositions () const |
const core::Tensor & | GetVertexColors () const |
const core::Tensor & | GetVertexNormals () const |
const core::Tensor & | GetTriangleAttr (const std::string &key) const |
void | RemoveTriangleAttr (const std::string &key) |
const core::Tensor & | GetTriangleIndices () const |
const core::Tensor & | GetTriangleNormals () const |
const core::Tensor & | GetTriangleColors () const |
void | SetVertexAttr (const std::string &key, const core::Tensor &value) |
void | SetVertexPositions (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 | SetTriangleIndices (const core::Tensor &value) |
Set the value of the "indices" 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 | HasVertexPositions () const |
bool | HasVertexColors () const |
bool | HasVertexNormals () const |
bool | HasTriangleAttr (const std::string &key) const |
bool | HasTriangleIndices () const |
bool | HasTriangleNormals () const |
bool | HasTriangleColors () const |
TriangleMesh & | Clear () override |
Clear all data in the trianglemesh. More... | |
bool | IsEmpty () const override |
Returns !HasVertexPositions(), triangles are ignored. More... | |
core::Tensor | GetMinBound () const |
core::Tensor | GetMaxBound () const |
core::Tensor | GetCenter () const |
TriangleMesh & | Transform (const core::Tensor &transformation) |
Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh. More... | |
TriangleMesh & | Translate (const core::Tensor &translation, bool relative=true) |
Translates the VertexPositions of the TriangleMesh. More... | |
TriangleMesh & | Scale (double scale, const core::Tensor ¢er) |
Scales the VertexPositions of the TriangleMesh. More... | |
TriangleMesh & | Rotate (const core::Tensor &R, const core::Tensor ¢er) |
Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists). More... | |
TriangleMesh & | NormalizeNormals () |
Normalize both triangle normals and vertex normals to length 1. More... | |
TriangleMesh & | ComputeTriangleNormals (bool normalized=true) |
Function to compute triangle normals, usually called before rendering. More... | |
TriangleMesh & | ComputeVertexNormals (bool normalized=true) |
Function to compute vertex normals, usually called before rendering. More... | |
double | GetSurfaceArea () const |
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces. More... | |
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. Parts of the mesh on the positive side of the plane will be kept and triangles intersected by the plane will be cut. More... | |
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 specific contour values defined by the specified plane. More... | |
core::Device | GetDevice () const override |
Returns the device of the geometry. More... | |
open3d::geometry::TriangleMesh | ToLegacy () const |
Convert to a legacy Open3D TriangleMesh. More... | |
TriangleMesh | ComputeConvexHull (bool joggle_inputs=false) const |
TriangleMesh | SimplifyQuadricDecimation (double target_reduction, bool preserve_volume=true) const |
TriangleMesh | BooleanUnion (const TriangleMesh &mesh, double tolerance=1e-6) const |
TriangleMesh | BooleanIntersection (const TriangleMesh &mesh, double tolerance=1e-6) const |
TriangleMesh | BooleanDifference (const TriangleMesh &mesh, double tolerance=1e-6) const |
AxisAlignedBoundingBox | GetAxisAlignedBoundingBox () const |
Create an axis-aligned bounding box from vertex attribute "positions". More... | |
OrientedBoundingBox | GetOrientedBoundingBox () const |
Create an oriented bounding box from vertex attribute "positions". More... | |
TriangleMesh | FillHoles (double hole_size=1e6) const |
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) |
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) |
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) |
TriangleMesh | ExtrudeRotation (double angle, const core::Tensor &axis, int resolution=16, double translation=0.0, bool capping=true) const |
TriangleMesh | ExtrudeLinear (const core::Tensor &vector, double scale=1.0, bool capping=true) const |
int | PCAPartition (int max_faces) |
TriangleMesh | SelectFacesByMask (const core::Tensor &mask) const |
TriangleMesh | SelectByIndex (const core::Tensor &indices) const |
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) |
Public Member Functions inherited from open3d::core::IsDevice | |
IsDevice ()=default | |
virtual | ~IsDevice ()=default |
bool | IsCPU () const |
bool | IsCUDA () const |
Public Member Functions inherited from open3d::t::geometry::DrawableGeometry | |
DrawableGeometry () | |
~DrawableGeometry () | |
bool | HasMaterial () const |
Check if a material has been applied to this Geometry with SetMaterial. More... | |
visualization::rendering::Material & | GetMaterial () |
Get material associated with this Geometry. More... | |
const visualization::rendering::Material & | GetMaterial () const |
Get const reference to material associated with this Geometry. More... | |
void | SetMaterial (const visualization::rendering::Material &material) |
Set the material properties associate with this Geometry. More... | |
Static Public Member Functions | |
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")) |
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")) |
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")) |
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")) |
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")) |
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")) |
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")) |
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")) |
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")) |
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")) |
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")) |
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")) |
static geometry::TriangleMesh | FromLegacy (const open3d::geometry::TriangleMesh &mesh_legacy, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::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 class | GeometryType { Unspecified = 0 , PointCloud = 1 , VoxelGrid = 2 , Octree = 3 , LineSet = 4 , MeshBase = 5 , TriangleMesh = 6 , HalfEdgeTriangleMesh = 7 , Image = 8 , RGBDImage = 9 , TetraMesh = 10 , OrientedBoundingBox = 11 , 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 triangle mesh contains vertices and triangles.
The triangle mesh class stores the attribute data in key-value maps. There are two maps: the vertex attributes map, and the triangle attribute map.
Note that the we can also use the generalized helper functions for the default and common attributes.
open3d::t::geometry::TriangleMesh::TriangleMesh | ( | const core::Device & | device = core::Device("CPU:0") | ) |
Construct an empty trianglemesh on the provided device.
device | The device on which to initialize the trianglemesh (default: 'CPU:0'). |
open3d::t::geometry::TriangleMesh::TriangleMesh | ( | const core::Tensor & | vertex_positions, |
const core::Tensor & | triangle_indices | ||
) |
Construct a trianglemesh from vertices and triangles.
The input tensors will be directly used as the underlying storage of the triangle mesh (no memory copy). The device for vertex_positions
must be consistent with triangle_indices
.
vertex_positions | A tensor with element shape {3}. |
triangle_indices | A tensor with element shape {3}. |
|
inlineoverridevirtual |
std::unordered_map< std::string, core::Tensor > open3d::t::geometry::TriangleMesh::BakeTriangleAttrTextures | ( | int | size, |
const std::unordered_set< std::string > & | triangle_attr = {} , |
||
double | margin = 2. , |
||
double | fill = 0. , |
||
bool | update_material = true |
||
) |
Bake triangle attributes into textures.
This function assumes a triangle attribute with name 'texture_uvs'.
This function always uses the CPU device.
size | The width and height of the texture in pixels. Only square textures are supported. |
vertex_attr | The vertex attributes for which textures should be generated. |
margin | The margin in pixels. The recommended value is 2. The margin are additional pixels around the UV islands to avoid discontinuities. |
fill | The value used for filling texels outside the UV islands. |
update_material | If true updates the material of the mesh. Baking a vertex attribute with the name 'albedo' will become the albedo texture in the material. Existing textures in the material will be overwritten. |
std::unordered_map< std::string, core::Tensor > open3d::t::geometry::TriangleMesh::BakeVertexAttrTextures | ( | int | size, |
const std::unordered_set< std::string > & | vertex_attr = {} , |
||
double | margin = 2. , |
||
double | fill = 0. , |
||
bool | update_material = true |
||
) |
Bake vertex attributes into textures.
This function assumes a triangle attribute with name 'texture_uvs'. Only float type attributes can be baked to textures.
This function always uses the CPU device.
size | The width and height of the texture in pixels. Only square textures are supported. |
vertex_attr | The vertex attributes for which textures should be generated. |
margin | The margin in pixels. The recommended value is 2. The margin are additional pixels around the UV islands to avoid discontinuities. |
fill | The value used for filling texels outside the UV islands. |
update_material | If true updates the material of the mesh. Baking a vertex attribute with the name 'albedo' will become the albedo texture in the material. Existing textures in the material will be overwritten. |
TriangleMesh open3d::t::geometry::TriangleMesh::BooleanDifference | ( | const TriangleMesh & | mesh, |
double | tolerance = 1e-6 |
||
) | const |
Computes the mesh that encompasses the volume after subtracting the volume of the second operand. Both meshes should be manifold.
This function always uses the CPU device.
mesh | This is the second operand for the boolean operation. |
tolerance | Threshold which determines when point distances are considered to be 0. |
TriangleMesh open3d::t::geometry::TriangleMesh::BooleanIntersection | ( | const TriangleMesh & | mesh, |
double | tolerance = 1e-6 |
||
) | const |
Computes the mesh that encompasses the intersection of the volumes of two meshes. Both meshes should be manifold.
This function always uses the CPU device.
mesh | This is the second operand for the boolean operation. |
tolerance | Threshold which determines when point distances are considered to be 0. |
TriangleMesh open3d::t::geometry::TriangleMesh::BooleanUnion | ( | const TriangleMesh & | mesh, |
double | tolerance = 1e-6 |
||
) | const |
Computes the mesh that encompasses the union of the volumes of two meshes. Both meshes should be manifold.
This function always uses the CPU device.
mesh | This is the second operand for the boolean operation. |
tolerance | Threshold which determines when point distances are considered to be 0. |
|
inlineoverridevirtual |
Clear all data in the trianglemesh.
Implements open3d::t::geometry::Geometry.
TriangleMesh open3d::t::geometry::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. Parts of the mesh on the positive side of the plane will be kept and triangles intersected by the plane will be cut.
point | A point on the plane as [Tensor of dim {3}]. |
normal | The normal of the plane as [Tensor of dim {3}]. The normal points to the positive side of the plane for which the geometry will be kept. |
|
inline |
Returns copy of the triangle mesh on the same device.
TriangleMesh open3d::t::geometry::TriangleMesh::ComputeConvexHull | ( | bool | joggle_inputs = false | ) | const |
Compute the convex hull of the triangle mesh using qhull.
This runs on the CPU.
joggle_inputs | (default False). Handle precision problems by randomly perturbing the input data. Set to True if perturbing the input iis acceptable but you need convex simplicial output. If False, neighboring facets may be merged in case of precision problems. See QHull docs for more details. |
TriangleMesh & open3d::t::geometry::TriangleMesh::ComputeTriangleNormals | ( | bool | normalized = true | ) |
Function to compute triangle normals, usually called before rendering.
std::tuple< float, int, int > open3d::t::geometry::TriangleMesh::ComputeUVAtlas | ( | size_t | size = 512 , |
float | gutter = 1.0f , |
||
float | max_stretch = 1.f / 6 , |
||
int | parallel_partitions = 1 , |
||
int | nthreads = 0 |
||
) |
Creates an UV atlas and adds it as triangle attr 'texture_uvs' to the mesh.
Input meshes must be manifold for this method to work.
The algorithm is based on:
This function always uses the CPU device.
size | The target size of the texture (size x size). The uv coordinates will still be in the range [0..1] but parameters like gutter use pixels as units. |
gutter | This is the space around the uv islands in pixels. |
max_stretch | The maximum amount of stretching allowed. The parameter range is [0..1] with 0 meaning no stretch allowed. |
parallel_partitions | The approximate number of partitions created before computing the UV atlas for parallelizing the computation. Parallelization can be enabled with values > 1. Note that parallelization increases the number of UV islands and can lead to results with lower quality. |
nthreads | The number of threads used when parallel_partitions is > 1. Set to 0 for automatic number of thread detection. |
TriangleMesh & open3d::t::geometry::TriangleMesh::ComputeVertexNormals | ( | bool | normalized = true | ) |
Function to compute vertex normals, usually called before rendering.
|
static |
Create a arrow triangle mesh.
cylinder_radius | defines the radius of the cylinder. |
cone_radius | defines the radius of the cone. |
cylinder_height | defines the height of the cylinder. The axis of cylinder is from (0, 0, 0) to (0, 0, cylinder_height). |
cone_height | defines the height of the cone. The axis of the cone will be from (0, 0, cylinder_height) to (0, 0, cylinder_height + cone_height). |
resolution | defines the resolution of the cone. The circle will be split into resolution segments. |
cylinder_split | defines the number of segments along the cylinder_height direction. |
cone_split | defines the number of segments along the cone_height direction. |
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. |
|
static |
Create a box triangle mesh. One vertex of the box will be placed at the origin and the box aligns with the positive x, y, and z axes.
width | is x-directional length. |
height | is y-directional length. |
depth | is z-directional length. |
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. |
|
static |
Create a cone triangle mesh.
radius | defines the radius of the cone. |
height | defines the height of the cone. The axis of the cone will be from (0, 0, 0) to (0, 0, height). |
resolution | defines the resolution of the cone. The circle will be split into resolution segments. |
split | defines the number of segments along the height direction. |
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. |
|
static |
Create a coordinate frame mesh.
size | defines the size of the coordinate frame. |
origin | defines the origin of the coordinate frame. |
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. |
|
static |
Create a cylinder triangle mesh.
radius | defines the radius of the cylinder. |
height | defines the height of the cylinder. The axis of the cylinder will be from (0, 0, -height/2) to (0, 0, height/2). |
resolution | defines the resolution of the cylinder. The circle will be split into resolution segments |
split | defines the number of segments along the height direction. |
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. |
|
static |
Create a icosahedron triangle mesh. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.
radius | defines the distance from centroid to mesh vetices. |
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. |
|
static |
Create a Mobius strip.
length_split | defines the number of segments along the Mobius strip. |
width_split | defines the number of segments along the width of the Mobius strip. |
twists | defines the number of twists of the strip. |
radius | defines the radius of the Mobius strip. |
flatness | controls the height of the strip. |
width | controls the width of the Mobius strip. |
scale | is used to scale the entire Mobius strip. |
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. |
|
static |
Create a octahedron triangle mesh. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.
radius | defines the distance from centroid to mesh vetices. |
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. |
|
static |
Create a sphere triangle mesh. The sphere with radius will be centered at (0, 0, 0). Its axis is aligned with z-axis.
radius | defines the radius of the sphere. |
resolution | defines the resolution of the sphere. The longitudes will be split into resolution segments (i.e. there are resolution + 1 latitude lines including the north and south pole). The latitudes will be split into `2 * resolution segments (i.e. there are 2 * resolution longitude lines.) |
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. |
|
static |
Create a tetrahedron triangle mesh. The centroid of the mesh will be placed at (0, 0, 0) and the vertices have a distance of radius to the center.
radius | defines the distance from centroid to mesh vetices. |
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. |
|
static |
Create a text triangle mesh.
text | The text for generating the mesh. ASCII characters 32-126 are supported (includes alphanumeric characters and punctuation). In addition the line feed ' ' is supported to start a new line. |
depth | The depth of the generated mesh. If depth is 0 then a flat mesh will be generated. |
int_dtype | Int32 or Int64, used to store index values, e.g. triangles. |
device | The device where the resulting TriangleMesh resides in. |
|
static |
Create a torus triangle mesh.
torus_radius | defines the radius from the center of the torus to the center of the tube. |
tube_radius | defines the radius of the torus tube. |
radial_resolution | defines the number of segments along the radial direction. |
tubular_resolution | defines the number of segments along the tubular direction. |
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. |
TriangleMesh open3d::t::geometry::TriangleMesh::ExtrudeLinear | ( | const core::Tensor & | vector, |
double | scale = 1.0 , |
||
bool | capping = true |
||
) | const |
Sweeps the triangle mesh along a direction vector.
vector | The direction vector. |
scale | Scalar factor which essentially scales the direction vector. |
capping | If true adds caps to the mesh. |
TriangleMesh open3d::t::geometry::TriangleMesh::ExtrudeRotation | ( | double | angle, |
const core::Tensor & | axis, | ||
int | resolution = 16 , |
||
double | translation = 0.0 , |
||
bool | capping = true |
||
) | const |
Sweeps the triangle mesh rotationally about an axis.
angle | The rotation angle in degree. |
axis | The rotation axis. |
resolution | The resolution defines the number of intermediate sweeps about the rotation axis. |
translation | The translation along the rotation axis. |
capping | If true adds caps to the mesh. |
TriangleMesh open3d::t::geometry::TriangleMesh::FillHoles | ( | double | hole_size = 1e6 | ) | const |
Fill holes by triangulating boundary edges.
This function always uses the CPU device.
hole_size | This is the approximate threshold for filling holes. The value describes the maximum radius of holes to be filled. |
|
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. |
AxisAlignedBoundingBox open3d::t::geometry::TriangleMesh::GetAxisAlignedBoundingBox | ( | ) | const |
Create an axis-aligned bounding box from vertex attribute "positions".
|
inline |
|
inlineoverridevirtual |
Returns the device of the geometry.
Implements open3d::t::geometry::Geometry.
|
inline |
|
inline |
OrientedBoundingBox open3d::t::geometry::TriangleMesh::GetOrientedBoundingBox | ( | ) | const |
Create an oriented bounding box from vertex attribute "positions".
double open3d::t::geometry::TriangleMesh::GetSurfaceArea | ( | ) | const |
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces.
|
inline |
Getter for triangle_attr_ TensorMap.
|
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 "indices" attribute in triangle_attr_. Convenience function.
|
inline |
Get the value of the "indices" 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 |
Getter for vertex_attr_ TensorMap.
|
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 "positions" attribute in vertex_attr_. Convenience function.
|
inline |
Get the value of the "positions" attribute in vertex_attr_. Convenience function.
|
inline |
Returns true if all of the following 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 following 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 |
Check if the "indices" attribute's value in triangle_attr_ has length
0.
Convenience function.
|
inline |
Returns true if all of the following 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 |
Returns true if all of the following 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 following 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 following 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 "positions" attribute's value in vertex_attr_ has length > 0. Convenience function.
|
inlineoverridevirtual |
Returns !HasVertexPositions(), triangles are ignored.
Implements open3d::t::geometry::Geometry.
TriangleMesh & open3d::t::geometry::TriangleMesh::NormalizeNormals | ( | ) |
Normalize both triangle normals and vertex normals to length 1.
int open3d::t::geometry::TriangleMesh::PCAPartition | ( | int | max_faces | ) |
Partition the mesh by recursively doing PCA. This function creates a new triangle attribute with the name "partition_ids".
max_faces | The maximum allowed number of faces in a partition. |
|
inline |
Removes triangle attribute by key value. Primary attribute "indices" cannot be removed. Throws warning if attribute key does not exists.
key | Attribute name. |
|
inline |
Removes vertex attribute by key value. Primary attribute "positions" cannot be removed. Throws warning if attribute key does not exists.
key | Attribute name. |
TriangleMesh & open3d::t::geometry::TriangleMesh::Rotate | ( | const core::Tensor & | R, |
const core::Tensor & | center | ||
) |
Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists).
R | Rotation [Tensor of dim {3,3}]. |
center | Center [Tensor of dim {3}] about which the TriangleMesh is to be scaled. |
TriangleMesh & open3d::t::geometry::TriangleMesh::Scale | ( | double | scale, |
const core::Tensor & | center | ||
) |
Scales the VertexPositions of the TriangleMesh.
scale | Scale [double] of dimension |
center | Center [Tensor of dim {3}] about which the TriangleMesh is to be scaled. |
TriangleMesh open3d::t::geometry::TriangleMesh::SelectByIndex | ( | const core::Tensor & | indices | ) | const |
Returns a new mesh with the vertices selected by a vector of indices. If an item from the indices list exceeds the max vertex number of the mesh or has a negative value, it is ignored.
indices | An integer list of indices. Duplicates are allowed, but ignored. Signed and unsigned integral types are allowed. |
TriangleMesh open3d::t::geometry::TriangleMesh::SelectFacesByMask | ( | const core::Tensor & | mask | ) | const |
Returns a new mesh with the faces selected by a boolean mask.
mask | A boolean mask with the shape (N) with N as the number of faces in the mesh. |
|
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 "indices" attribute in triangle_attr_.
|
inline |
Set the value of the "normals" attribute in triangle_attr_. This is a convenience function.
|
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 "positions" attribute in vertex_attr_. Convenience function.
TriangleMesh open3d::t::geometry::TriangleMesh::SimplifyQuadricDecimation | ( | double | target_reduction, |
bool | preserve_volume = true |
||
) | const |
Function to simplify mesh using Quadric Error Metric Decimation by Garland and Heckbert.
This function always uses the CPU device.
target_reduction | The factor of triangles to delete, i.e., setting this to 0.9 will return a mesh with about 10% of the original triangle count. It is not guaranteed that the target reduction factor will be reached. |
preserve_volume | If set to true this enables volume preservation which reduces the error in triangle normal direction. |
LineSet open3d::t::geometry::TriangleMesh::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 specific contour values defined by the specified plane.
point | A point on the plane as [Tensor of dim {3}]. |
normal | The normal of the plane as [Tensor of dim {3}]. |
contour_values | Contour values at which slices will be generated. The value describes the signed distance to the plane. |
TriangleMesh open3d::t::geometry::TriangleMesh::To | ( | const core::Device & | device, |
bool | copy = false |
||
) | const |
Transfer the triangle mesh to a specified device.
device | The targeted device to convert to. |
copy | If true, a new triangle mesh is always created; if false, the copy is avoided when the original triangle mesh is already on the targeted device. |
open3d::geometry::TriangleMesh open3d::t::geometry::TriangleMesh::ToLegacy | ( | ) | const |
Convert to a legacy Open3D TriangleMesh.
std::string open3d::t::geometry::TriangleMesh::ToString | ( | ) | const |
Text description.
TriangleMesh & open3d::t::geometry::TriangleMesh::Transform | ( | const core::Tensor & | transformation | ) |
Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh.
Transformation matrix is a 4x4 matrix. T (4x4) = [[ R(3x3) t(3x1) ], [ O(1x3) s(1x1) ]] (s = 1 for Transformation without scaling)
It applies the following general transform to each positions
and normals
. |x'| | R(0,0) R(0,1) R(0,2) t(0)| |x| |y'| = | R(1,0) R(1,1) R(1,2) t(1)| @ |y| |z'| | R(2,0) R(2,1) R(2,2) t(2)| |z| |w'| | O(0,0) O(0,1) O(0,2) s | |1|
[x, y, z] = [x', y', z'] / w'
transformation | Transformation [Tensor of dim {4,4}]. |
TriangleMesh & open3d::t::geometry::TriangleMesh::Translate | ( | const core::Tensor & | translation, |
bool | relative = true |
||
) |
Translates the VertexPositions of the TriangleMesh.
translation | translation tensor of dimension {3} |
relative | if true (default): translates relative to Center |
|
protected |
|
protected |
|
protected |