Open3D (C++ API)  0.18.0+80ae047
Public Member Functions | Static Public Member Functions | Protected Attributes
open3d::t::geometry::LineSet Class Reference

A LineSet contains points and lines joining them and optionally attributes on the points and lines. More...

#include <LineSet.h>

Inheritance diagram for open3d::t::geometry::LineSet:
open3d::t::geometry::Geometry open3d::t::geometry::DrawableGeometry open3d::core::IsDevice

Public Member Functions

 LineSet (const core::Device &device=core::Device("CPU:0"))
 Construct an empty LineSet on the provided device. More...
 
 LineSet (const core::Tensor &point_positions, const core::Tensor &line_indices)
 
virtual ~LineSet () override
 
LineSet To (const core::Device &device, bool copy=false) const
 
LineSet Clone () const
 Returns copy of the line set on the same device. More...
 
std::string ToString () const
 Text description. More...
 
const TensorMapGetPointAttr () const
 Getter for point_attr_ TensorMap. Used in Pybind. More...
 
TensorMapGetPointAttr ()
 Getter for point_attr_ TensorMap. More...
 
core::TensorGetPointAttr (const std::string &key)
 
core::TensorGetPointPositions ()
 
const TensorMapGetLineAttr () const
 Getter for line_attr_ TensorMap. Used in Pybind. More...
 
TensorMapGetLineAttr ()
 Getter for line_attr_ TensorMap. More...
 
core::TensorGetLineAttr (const std::string &key)
 
core::TensorGetLineIndices ()
 
core::TensorGetLineColors ()
 
const core::TensorGetPointAttr (const std::string &key) const
 
void RemovePointAttr (const std::string &key)
 
const core::TensorGetPointPositions () const
 
const core::TensorGetLineAttr (const std::string &key) const
 
void RemoveLineAttr (const std::string &key)
 
const core::TensorGetLineIndices () const
 
const core::TensorGetLineColors () const
 
void SetPointAttr (const std::string &key, const core::Tensor &value)
 
void SetPointPositions (const core::Tensor &value)
 
void SetLineAttr (const std::string &key, const core::Tensor &value)
 
void SetLineIndices (const core::Tensor &value)
 Set the value of the "indices" attribute in line_attr_. More...
 
void SetLineColors (const core::Tensor &value)
 
bool HasPointAttr (const std::string &key) const
 
bool HasPointPositions () const
 
bool HasLineAttr (const std::string &key) const
 
bool HasLineIndices () const
 
bool HasLineColors () const
 
LineSetClear () override
 Clear all data in the line set. More...
 
bool IsEmpty () const override
 Returns !HasPointPositions(), line indices are ignored. More...
 
core::Tensor GetMinBound () const
 Returns the max bound for point coordinates. More...
 
core::Tensor GetMaxBound () const
 Returns the max bound for point coordinates. More...
 
core::Tensor GetCenter () const
 Returns the center for point coordinates. More...
 
LineSetTransform (const core::Tensor &transformation)
 Transforms the points and lines of the LineSet. More...
 
LineSetTranslate (const core::Tensor &translation, bool relative=true)
 Translates the points and lines of the LineSet. More...
 
LineSetScale (double scale, const core::Tensor &center)
 Scales the points and lines of the LineSet. More...
 
LineSetRotate (const core::Tensor &R, const core::Tensor &center)
 Rotates the points and lines of the line set. Custom attributes (e.g.: point or line normals) are not transformed. More...
 
core::Device GetDevice () const override
 Returns the device attribute of this LineSet. More...
 
open3d::geometry::LineSet ToLegacy () const
 Convert to a legacy Open3D LineSet. More...
 
AxisAlignedBoundingBox GetAxisAlignedBoundingBox () const
 Create an axis-aligned bounding box from point attribute "positions". More...
 
OrientedBoundingBox GetOrientedBoundingBox () const
 Create an oriented bounding box from point attribute "positions". More...
 
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
 
- 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::MaterialGetMaterial ()
 Get material associated with this Geometry. More...
 
const visualization::rendering::MaterialGetMaterial () 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 geometry::LineSet FromLegacy (const open3d::geometry::LineSet &lineset_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 point_attr_
 
TensorMap line_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...
 

Detailed Description

A LineSet contains points and lines joining them and optionally attributes on the points and lines.

The LineSet 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: point_attr_ and line_attr_. In most cases, the length of an attribute should be equal to the length of the data corresponding to the primary key. For instance, point_attr_["colors"] should have the same length as point_attr_["positions"].

Although the attributes are all stored in a key-value pair dictionary, the attributes have different levels:

Note that {Get|Set|Has}{Point|Line}Attr() functions also work "positions" and "indices".

Constructor & Destructor Documentation

◆ LineSet() [1/2]

open3d::t::geometry::LineSet::LineSet ( const core::Device device = core::Device("CPU:0"))

Construct an empty LineSet on the provided device.

◆ LineSet() [2/2]

open3d::t::geometry::LineSet::LineSet ( const core::Tensor point_positions,
const core::Tensor line_indices 
)

Construct a LineSet from points and lines.

The input tensors will be directly used as the underlying storage of the line set (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 LineSet will have a fixed size and calling to functions like SynchronizedPushBack will raise an exception.

The resulting LineSet will have the same dtype and device as the tensor. The device for points must be consistent with lines.

Parameters
point_positionsA tensor with element shape {3}.
line_indicesA tensor with element shape {2} and Int DtypeCode.

◆ ~LineSet()

virtual open3d::t::geometry::LineSet::~LineSet ( )
inlineoverridevirtual

Member Function Documentation

◆ Clear()

LineSet& open3d::t::geometry::LineSet::Clear ( )
inlineoverridevirtual

Clear all data in the line set.

Implements open3d::t::geometry::Geometry.

◆ Clone()

LineSet open3d::t::geometry::LineSet::Clone ( ) const
inline

Returns copy of the line set on the same device.

◆ ExtrudeLinear()

TriangleMesh open3d::t::geometry::LineSet::ExtrudeLinear ( const core::Tensor vector,
double  scale = 1.0,
bool  capping = true 
) const

Sweeps the line set along a direction vector.

Parameters
vectorThe direction vector.
scaleScalar factor which essentially scales the direction vector.
cappingIf true adds caps to the mesh.
Returns
A triangle mesh with the result of the sweep operation.

◆ ExtrudeRotation()

TriangleMesh open3d::t::geometry::LineSet::ExtrudeRotation ( double  angle,
const core::Tensor axis,
int  resolution = 16,
double  translation = 0.0,
bool  capping = true 
) const

Sweeps the line set rotationally about an axis.

Parameters
angleThe rotation angle in degree.
axisThe rotation axis.
resolutionThe resolution defines the number of intermediate sweeps about the rotation axis.
translationThe translation along the rotation axis.
cappingIf true adds caps to the mesh.
Returns
A triangle mesh with the result of the sweep operation.

◆ FromLegacy()

geometry::LineSet open3d::t::geometry::LineSet::FromLegacy ( const open3d::geometry::LineSet lineset_legacy,
core::Dtype  float_dtype = core::Float32,
core::Dtype  int_dtype = core::Int64,
const core::Device device = core::Device("CPU:0") 
)
static

Create a LineSet from a legacy Open3D LineSet.

Parameters
lineset_legacyLegacy Open3D LineSet.
float_dtypeFloat32 or Float64, used to store floating point values, e.g. points, normals, colors.
int_dtypeInt32 or Int64, used to store index values, e.g. line indices.
deviceThe device where the resulting LineSet resides.

◆ GetAxisAlignedBoundingBox()

AxisAlignedBoundingBox open3d::t::geometry::LineSet::GetAxisAlignedBoundingBox ( ) const

Create an axis-aligned bounding box from point attribute "positions".

◆ GetCenter()

core::Tensor open3d::t::geometry::LineSet::GetCenter ( ) const
inline

Returns the center for point coordinates.

◆ GetDevice()

core::Device open3d::t::geometry::LineSet::GetDevice ( ) const
inlineoverridevirtual

Returns the device attribute of this LineSet.

Implements open3d::t::geometry::Geometry.

◆ GetLineAttr() [1/4]

TensorMap& open3d::t::geometry::LineSet::GetLineAttr ( )
inline

Getter for line_attr_ TensorMap.

◆ GetLineAttr() [2/4]

const TensorMap& open3d::t::geometry::LineSet::GetLineAttr ( ) const
inline

Getter for line_attr_ TensorMap. Used in Pybind.

◆ GetLineAttr() [3/4]

core::Tensor& open3d::t::geometry::LineSet::GetLineAttr ( const std::string &  key)
inline

Get line attributes in line_attr_. Throws exception if the attribute does not exist.

Parameters
keyAttribute name.

◆ GetLineAttr() [4/4]

const core::Tensor& open3d::t::geometry::LineSet::GetLineAttr ( const std::string &  key) const
inline

Get line attributes in line_attr_. Throws exception if the attribute does not exist.

Parameters
keyAttribute name.

◆ GetLineColors() [1/2]

core::Tensor& open3d::t::geometry::LineSet::GetLineColors ( )
inline

Get the value of the "colors" attribute in line_attr_. Convenience function.

◆ GetLineColors() [2/2]

const core::Tensor& open3d::t::geometry::LineSet::GetLineColors ( ) const
inline

Get the value of the "colors" attribute in line_attr_. Convenience function.

◆ GetLineIndices() [1/2]

core::Tensor& open3d::t::geometry::LineSet::GetLineIndices ( )
inline

Get the value of the "indices" attribute in line_attr_. Convenience function.

◆ GetLineIndices() [2/2]

const core::Tensor& open3d::t::geometry::LineSet::GetLineIndices ( ) const
inline

Get the value of the "indices" attribute in line_attr_. Convenience function.

◆ GetMaxBound()

core::Tensor open3d::t::geometry::LineSet::GetMaxBound ( ) const
inline

Returns the max bound for point coordinates.

◆ GetMinBound()

core::Tensor open3d::t::geometry::LineSet::GetMinBound ( ) const
inline

Returns the max bound for point coordinates.

◆ GetOrientedBoundingBox()

OrientedBoundingBox open3d::t::geometry::LineSet::GetOrientedBoundingBox ( ) const

Create an oriented bounding box from point attribute "positions".

◆ GetPointAttr() [1/4]

TensorMap& open3d::t::geometry::LineSet::GetPointAttr ( )
inline

Getter for point_attr_ TensorMap.

◆ GetPointAttr() [2/4]

const TensorMap& open3d::t::geometry::LineSet::GetPointAttr ( ) const
inline

Getter for point_attr_ TensorMap. Used in Pybind.

◆ GetPointAttr() [3/4]

core::Tensor& open3d::t::geometry::LineSet::GetPointAttr ( const std::string &  key)
inline

Get point attributes in point_attr_. Throws exception if the attribute does not exist.

Parameters
keyAttribute name.

◆ GetPointAttr() [4/4]

const core::Tensor& open3d::t::geometry::LineSet::GetPointAttr ( const std::string &  key) const
inline

Get point attributes. Throws exception if the attribute does not exist.

Parameters
keyAttribute name.

◆ GetPointPositions() [1/2]

core::Tensor& open3d::t::geometry::LineSet::GetPointPositions ( )
inline

Get the value of the "positions" attribute in point_attr_. Convenience function.

◆ GetPointPositions() [2/2]

const core::Tensor& open3d::t::geometry::LineSet::GetPointPositions ( ) const
inline

Get the value of the "positions" attribute in point_attr_. Convenience function.

◆ HasLineAttr()

bool open3d::t::geometry::LineSet::HasLineAttr ( const std::string &  key) const
inline

Returns true if all of the following are true in line_attr_: 1) attribute key exist 2) attribute's length as "indices"'s length 3) attribute's length > 0

◆ HasLineColors()

bool open3d::t::geometry::LineSet::HasLineColors ( ) const
inline

Returns true if all of the following are true in line_attr_: 1) attribute "colors" exist 2) attribute "colors"'s length as "indices"'s length 3) attribute "colors"'s length > 0 Convenience function.

◆ HasLineIndices()

bool open3d::t::geometry::LineSet::HasLineIndices ( ) const
inline

Check if the "indices" attribute's value in line_attr_ has length > 0. Convenience function.

◆ HasPointAttr()

bool open3d::t::geometry::LineSet::HasPointAttr ( const std::string &  key) const
inline

Returns true if all of the following are true in point_attr_: 1) attribute key exist 2) attribute's length as "points"'s length 3) attribute's length > 0

◆ HasPointPositions()

bool open3d::t::geometry::LineSet::HasPointPositions ( ) const
inline

Check if the "positions" attribute's value in point_attr_ has length > 0. Convenience function.

◆ IsEmpty()

bool open3d::t::geometry::LineSet::IsEmpty ( ) const
inlineoverridevirtual

Returns !HasPointPositions(), line indices are ignored.

Implements open3d::t::geometry::Geometry.

◆ RemoveLineAttr()

void open3d::t::geometry::LineSet::RemoveLineAttr ( const std::string &  key)
inline

Removes line attribute by key value. Primary attribute "indices" cannot be removed. Throws warning if attribute key does not exists.

Parameters
keyAttribute name.

◆ RemovePointAttr()

void open3d::t::geometry::LineSet::RemovePointAttr ( const std::string &  key)
inline

Removes point attribute by key value. Primary attribute "positions" cannot be removed. Throws warning if attribute key does not exists.

Parameters
keyAttribute name.

◆ Rotate()

LineSet & open3d::t::geometry::LineSet::Rotate ( const core::Tensor R,
const core::Tensor center 
)

Rotates the points and lines of the line set. Custom attributes (e.g.: point or line normals) are not transformed.

Parameters
RRotation [Tensor of shape {3,3}].
centerCenter [Tensor of shape {3}] about which the LineSet is to be scaled.
Returns
Rotated line set.

◆ Scale()

LineSet & open3d::t::geometry::LineSet::Scale ( double  scale,
const core::Tensor center 
)

Scales the points and lines of the LineSet.

Parameters
scaleScale magnitude.
centerCenter [Tensor of shape {3}] about which the LineSet is
Returns
Scaled line set.

◆ SetLineAttr()

void open3d::t::geometry::LineSet::SetLineAttr ( const std::string &  key,
const core::Tensor value 
)
inline

Set line attributes. If the attribute key already exists, its value will be overwritten, otherwise, the new key will be created.

Parameters
keyAttribute name.
valueA tensor.

◆ SetLineColors()

void open3d::t::geometry::LineSet::SetLineColors ( const core::Tensor value)
inline

Set the value of the "colors" attribute in line_attr_. This is a convenience function.

◆ SetLineIndices()

void open3d::t::geometry::LineSet::SetLineIndices ( const core::Tensor value)
inline

Set the value of the "indices" attribute in line_attr_.

◆ SetPointAttr()

void open3d::t::geometry::LineSet::SetPointAttr ( const std::string &  key,
const core::Tensor value 
)
inline

Set point attributes. If the attribute key already exists, its value will be overwritten, otherwise, the new key will be created.

Parameters
keyAttribute name.
valueA tensor.

◆ SetPointPositions()

void open3d::t::geometry::LineSet::SetPointPositions ( const core::Tensor value)
inline

Set the value of the "positions" attribute in point_attr_. Convenience function.

◆ To()

LineSet open3d::t::geometry::LineSet::To ( const core::Device device,
bool  copy = false 
) const

Transfer the line set to a specified device.

Parameters
deviceThe targeted device to convert to.
copyIf true, a new line set is always created; if false, the copy is avoided when the original line set is already on the targeted device.

◆ ToLegacy()

open3d::geometry::LineSet open3d::t::geometry::LineSet::ToLegacy ( ) const

Convert to a legacy Open3D LineSet.

◆ ToString()

std::string open3d::t::geometry::LineSet::ToString ( ) const

Text description.

◆ Transform()

LineSet & open3d::t::geometry::LineSet::Transform ( const core::Tensor transformation)

Transforms the points and lines of the LineSet.

Custom attributes (e.g.: point or line normals) are not transformed.

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'

Parameters
transformationTransformation [Tensor of shape {4,4}].
Returns
Transformed line set.

◆ Translate()

LineSet & open3d::t::geometry::LineSet::Translate ( const core::Tensor translation,
bool  relative = true 
)

Translates the points and lines of the LineSet.

Parameters
translationTranslation tensor of shape {3}
relativeIf true (default) translates relative to center of LineSet.
Returns
Translated line set.

Field Documentation

◆ device_

core::Device open3d::t::geometry::LineSet::device_ = core::Device("CPU:0")
protected

◆ line_attr_

TensorMap open3d::t::geometry::LineSet::line_attr_
protected

◆ point_attr_

TensorMap open3d::t::geometry::LineSet::point_attr_
protected

The documentation for this class was generated from the following files: