ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::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 cloudViewer::t::geometry::LineSet:
Collaboration diagram for cloudViewer::t::geometry::LineSet:

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...
 
LineSetPaintUniformColor (const core::Tensor &color)
 Assigns uniform color to all lines of the LineSet. More...
 
core::Device GetDevice () const override
 Returns the device attribute of this LineSet. More...
 
cloudViewer::geometry::LineSet ToLegacy () const
 Convert to a legacy CloudViewer 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 cloudViewer::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 cloudViewer::core::IsDevice
 IsDevice ()=default
 
virtual ~IsDevice ()=default
 
bool IsCPU () const
 
bool IsCUDA () const
 
bool IsSYCL () const
 
- Public Member Functions inherited from cloudViewer::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 cloudViewer::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 LineSet CreateCameraVisualization (int view_width_px, int view_height_px, const core::Tensor &intrinsic, const core::Tensor &extrinsic, double scale, const core::Tensor &color={})
 

Protected Attributes

core::Device device_ = core::Device("CPU:0")
 
TensorMap point_attr_
 
TensorMap line_attr_
 

Additional Inherited Members

- Public Types inherited from cloudViewer::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 cloudViewer::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".

Definition at line 85 of file LineSet.h.

Constructor & Destructor Documentation

◆ LineSet() [1/2]

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

Construct an empty LineSet on the provided device.

Definition at line 26 of file LineSet.cpp.

◆ LineSet() [2/2]

cloudViewer::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.

Definition at line 32 of file LineSet.cpp.

References AssertTensorDevice, and cloudViewer::core::Tensor::GetDevice().

◆ ~LineSet()

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

Definition at line 108 of file LineSet.h.

Member Function Documentation

◆ Clear()

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

Clear all data in the line set.

Implements cloudViewer::t::geometry::Geometry.

Definition at line 280 of file LineSet.h.

References line_attr_, and point_attr_.

◆ Clone()

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

Returns copy of the line set on the same device.

Definition at line 118 of file LineSet.h.

References GetDevice(), and To().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ CreateCameraVisualization()

LineSet cloudViewer::t::geometry::LineSet::CreateCameraVisualization ( int  view_width_px,
int  view_height_px,
const core::Tensor intrinsic,
const core::Tensor extrinsic,
double  scale,
const core::Tensor color = {} 
)
static

Factory function to create a LineSet from intrinsic and extrinsic matrices.

Parameters
view_width_pxThe width of the view, in pixels.
view_height_pxThe height of the view, in pixels.
intrinsicThe intrinsic matrix {3,3} shape.
extrinsicThe extrinsic matrix {4,4} shape.
scalecamera scale
colortensor with float32 dtype and shape {3}. Default is blue.

Definition at line 231 of file LineSet.cpp.

References AssertTensorShape, color, cloudViewer::core::Float32, points, cloudViewer::core::Tensor::Slice(), and cloudViewer::core::Tensor::To().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ ExtrudeLinear()

TriangleMesh cloudViewer::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.

Definition at line 204 of file LineSet.cpp.

References cloudViewer::t::geometry::vtkutils::ExtrudeLinearTriangleMesh().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ ExtrudeRotation()

TriangleMesh cloudViewer::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.

Definition at line 194 of file LineSet.cpp.

References cloudViewer::t::geometry::vtkutils::ExtrudeRotationTriangleMesh().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ FromLegacy()

geometry::LineSet cloudViewer::t::geometry::LineSet::FromLegacy ( const cloudViewer::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

◆ GetAxisAlignedBoundingBox()

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

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

Definition at line 190 of file LineSet.cpp.

References cloudViewer::t::geometry::AxisAlignedBoundingBox::CreateFromPoints(), and GetPointPositions().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ GetCenter()

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

Returns the center for point coordinates.

Definition at line 296 of file LineSet.h.

References GetPointPositions(), and cloudViewer::core::Tensor::Mean().

Referenced by cloudViewer::t::geometry::pybind_lineset(), and Translate().

◆ GetDevice()

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

Returns the device attribute of this LineSet.

Implements cloudViewer::t::geometry::Geometry.

Definition at line 348 of file LineSet.h.

References device_.

Referenced by Clone(), PaintUniformColor(), Scale(), To(), ToString(), and Translate().

◆ GetLineAttr() [1/4]

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

Getter for line_attr_ TensorMap.

Definition at line 145 of file LineSet.h.

References line_attr_.

◆ GetLineAttr() [2/4]

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

◆ GetLineAttr() [3/4]

core::Tensor& cloudViewer::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.

Definition at line 151 of file LineSet.h.

References line_attr_.

◆ GetLineAttr() [4/4]

const core::Tensor& cloudViewer::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.

Definition at line 186 of file LineSet.h.

References line_attr_.

◆ GetLineColors() [1/2]

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

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

Definition at line 161 of file LineSet.h.

References GetLineAttr().

Referenced by cloudViewer::visualization::rendering::TLineSetBuffersBuilder::TLineSetBuffersBuilder(), and ToLegacy().

◆ GetLineColors() [2/2]

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

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

Definition at line 204 of file LineSet.h.

References GetLineAttr().

◆ GetLineIndices() [1/2]

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

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

Definition at line 157 of file LineSet.h.

References GetLineAttr().

Referenced by HasLineAttr(), PaintUniformColor(), cloudViewer::visualization::rendering::TLineSetBuffersBuilder::TLineSetBuffersBuilder(), ToLegacy(), and ToString().

◆ GetLineIndices() [2/2]

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

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

Definition at line 198 of file LineSet.h.

References GetLineAttr().

◆ GetMaxBound()

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

◆ GetMinBound()

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

◆ GetOrientedBoundingBox()

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

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

Definition at line 211 of file LineSet.cpp.

References cloudViewer::t::geometry::OrientedBoundingBox::CreateFromPoints(), and GetPointPositions().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ GetPointAttr() [1/4]

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

Getter for point_attr_ TensorMap.

Definition at line 127 of file LineSet.h.

References point_attr_.

◆ GetPointAttr() [2/4]

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

◆ GetPointAttr() [3/4]

core::Tensor& cloudViewer::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.

Definition at line 133 of file LineSet.h.

References point_attr_.

◆ GetPointAttr() [4/4]

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

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

Parameters
keyAttribute name.

Definition at line 166 of file LineSet.h.

References point_attr_.

◆ GetPointPositions() [1/2]

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

◆ GetPointPositions() [2/2]

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

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

Definition at line 178 of file LineSet.h.

References GetPointAttr().

◆ HasLineAttr()

bool cloudViewer::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

Definition at line 263 of file LineSet.h.

References cloudViewer::t::geometry::TensorMap::Contains(), cloudViewer::core::Tensor::GetLength(), GetLineAttr(), GetLineIndices(), and line_attr_.

Referenced by HasLineColors(), and HasLineIndices().

◆ HasLineColors()

bool cloudViewer::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.

Definition at line 277 of file LineSet.h.

References HasLineAttr().

Referenced by cloudViewer::visualization::rendering::TLineSetBuffersBuilder::TLineSetBuffersBuilder(), and ToLegacy().

◆ HasLineIndices()

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

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

Definition at line 270 of file LineSet.h.

References HasLineAttr().

Referenced by cloudViewer::visualization::rendering::TLineSetBuffersBuilder::TLineSetBuffersBuilder(), and ToLegacy().

◆ HasPointAttr()

bool cloudViewer::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

Definition at line 250 of file LineSet.h.

References cloudViewer::t::geometry::TensorMap::Contains(), cloudViewer::core::Tensor::GetLength(), GetPointAttr(), GetPointPositions(), and point_attr_.

Referenced by HasPointPositions().

◆ HasPointPositions()

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

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

Definition at line 257 of file LineSet.h.

References HasPointAttr().

Referenced by IsEmpty(), and ToLegacy().

◆ IsEmpty()

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

Returns !HasPointPositions(), line indices are ignored.

Implements cloudViewer::t::geometry::Geometry.

Definition at line 287 of file LineSet.h.

References HasPointPositions().

◆ PaintUniformColor()

LineSet & cloudViewer::t::geometry::LineSet::PaintUniformColor ( const core::Tensor color)

Assigns uniform color to all lines of the LineSet.

Parameters
colorRGB color for the LineSet. {3,} shaped Tensor. Floating color values are clipped between 0.0 and 1.0.

Definition at line 215 of file LineSet.cpp.

References cloudViewer::core::Tensor::AsRvalue(), AssertTensorShape, color, cloudViewer::core::Tensor::Empty(), cloudViewer::core::Float32, cloudViewer::core::Float64, GetDevice(), cloudViewer::core::Tensor::GetLength(), GetLineIndices(), and SetLineColors().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ RemoveLineAttr()

void cloudViewer::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.

Definition at line 194 of file LineSet.h.

References cloudViewer::t::geometry::TensorMap::Erase(), and line_attr_.

◆ RemovePointAttr()

void cloudViewer::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.

Definition at line 174 of file LineSet.h.

References cloudViewer::t::geometry::TensorMap::Erase(), and point_attr_.

◆ Rotate()

LineSet & cloudViewer::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.

Definition at line 126 of file LineSet.cpp.

References AssertTensorShape, GetPointPositions(), and cloudViewer::t::geometry::kernel::transform::RotatePoints().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ Scale()

LineSet & cloudViewer::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.

Definition at line 116 of file LineSet.cpp.

References cloudViewer::core::Tensor::Add_(), AssertTensorShape, GetDevice(), GetPointPositions(), cloudViewer::core::Tensor::Mul_(), cloudViewer::core::Tensor::Sub_(), and cloudViewer::core::Tensor::To().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ SetLineAttr()

void cloudViewer::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.

Definition at line 228 of file LineSet.h.

References AssertTensorDevice, device_, and line_attr_.

Referenced by SetLineColors(), SetLineIndices(), and To().

◆ SetLineColors()

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

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

Definition at line 241 of file LineSet.h.

References AssertTensorShape, cloudViewer::utility::nullopt, and SetLineAttr().

Referenced by FromLegacy(), and PaintUniformColor().

◆ SetLineIndices()

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

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

Definition at line 234 of file LineSet.h.

References AssertTensorShape, cloudViewer::utility::nullopt, and SetLineAttr().

Referenced by FromLegacy().

◆ SetPointAttr()

void cloudViewer::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.

Definition at line 211 of file LineSet.h.

References AssertTensorDevice, device_, and point_attr_.

Referenced by SetPointPositions(), and To().

◆ SetPointPositions()

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

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

Definition at line 218 of file LineSet.h.

References AssertTensorShape, cloudViewer::utility::nullopt, and SetPointAttr().

Referenced by FromLegacy().

◆ To()

LineSet cloudViewer::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.

Definition at line 42 of file LineSet.cpp.

References copy, GetDevice(), line_attr_, point_attr_, SetLineAttr(), and SetPointAttr().

Referenced by Clone(), cloudViewer::t::geometry::pybind_lineset(), and cloudViewer::visualization::rendering::TLineSetBuffersBuilder::TLineSetBuffersBuilder().

◆ ToLegacy()

◆ ToString()

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

Text description.

Definition at line 56 of file LineSet.cpp.

References format, GetDevice(), GetLineIndices(), GetPointPositions(), line_attr_, and point_attr_.

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ Transform()

LineSet & cloudViewer::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.

Definition at line 97 of file LineSet.cpp.

References AssertTensorShape, GetPointPositions(), and cloudViewer::t::geometry::kernel::transform::TransformPoints().

Referenced by cloudViewer::t::geometry::pybind_lineset().

◆ Translate()

LineSet & cloudViewer::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.

Definition at line 103 of file LineSet.cpp.

References AssertTensorShape, GetCenter(), GetDevice(), GetPointPositions(), and cloudViewer::core::Tensor::To().

Referenced by cloudViewer::t::geometry::pybind_lineset().

Member Data Documentation

◆ device_

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

Definition at line 412 of file LineSet.h.

Referenced by GetDevice(), SetLineAttr(), and SetPointAttr().

◆ line_attr_

TensorMap cloudViewer::t::geometry::LineSet::line_attr_
protected

Definition at line 414 of file LineSet.h.

Referenced by Clear(), GetLineAttr(), HasLineAttr(), RemoveLineAttr(), SetLineAttr(), To(), and ToString().

◆ point_attr_

TensorMap cloudViewer::t::geometry::LineSet::point_attr_
protected

Definition at line 413 of file LineSet.h.

Referenced by Clear(), GetPointAttr(), HasPointAttr(), RemovePointAttr(), SetPointAttr(), To(), and ToString().


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