Open3D (C++ API)
0.18.0+6e910d9
|
A LineSet contains points and lines joining them and optionally attributes on the points and lines. More...
#include <LineSet.h>
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 TensorMap & | GetPointAttr () const |
Getter for point_attr_ TensorMap. Used in Pybind. More... | |
TensorMap & | GetPointAttr () |
Getter for point_attr_ TensorMap. More... | |
core::Tensor & | GetPointAttr (const std::string &key) |
core::Tensor & | GetPointPositions () |
const TensorMap & | GetLineAttr () const |
Getter for line_attr_ TensorMap. Used in Pybind. More... | |
TensorMap & | GetLineAttr () |
Getter for line_attr_ TensorMap. More... | |
core::Tensor & | GetLineAttr (const std::string &key) |
core::Tensor & | GetLineIndices () |
core::Tensor & | GetLineColors () |
const core::Tensor & | GetPointAttr (const std::string &key) const |
void | RemovePointAttr (const std::string &key) |
const core::Tensor & | GetPointPositions () const |
const core::Tensor & | GetLineAttr (const std::string &key) const |
void | RemoveLineAttr (const std::string &key) |
const core::Tensor & | GetLineIndices () const |
const core::Tensor & | GetLineColors () 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 |
LineSet & | Clear () 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... | |
LineSet & | Transform (const core::Tensor &transformation) |
Transforms the points and lines of the LineSet. More... | |
LineSet & | Translate (const core::Tensor &translation, bool relative=true) |
Translates the points and lines of the LineSet. More... | |
LineSet & | Scale (double scale, const core::Tensor ¢er) |
Scales the points and lines of the LineSet. More... | |
LineSet & | Rotate (const core::Tensor &R, const core::Tensor ¢er) |
Rotates the points and lines of the line set. Custom attributes (e.g.: point or line normals) are not transformed. More... | |
LineSet & | PaintUniformColor (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... | |
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 |
bool | IsSYCL () 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 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 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 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 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".
open3d::t::geometry::LineSet::LineSet | ( | const core::Device & | device = core::Device("CPU:0") | ) |
Construct an empty LineSet on the provided device.
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
.
point_positions | A tensor with element shape {3}. |
line_indices | A tensor with element shape {2} and Int DtypeCode. |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Clear all data in the line set.
Implements open3d::t::geometry::Geometry.
|
inline |
Returns copy of the line set on the same device.
|
static |
Factory function to create a LineSet from intrinsic and extrinsic matrices.
view_width_px | The width of the view, in pixels. |
view_height_px | The height of the view, in pixels. |
intrinsic | The intrinsic matrix {3,3} shape. |
extrinsic | The extrinsic matrix {4,4} shape. |
scale | camera scale |
color | tensor with float32 dtype and shape {3}. Default is blue. |
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.
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::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.
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. |
|
static |
AxisAlignedBoundingBox open3d::t::geometry::LineSet::GetAxisAlignedBoundingBox | ( | ) | const |
Create an axis-aligned bounding box from point attribute "positions".
|
inline |
Returns the center for point coordinates.
|
inlineoverridevirtual |
Returns the device attribute of this LineSet.
Implements open3d::t::geometry::Geometry.
|
inline |
Getter for line_attr_ TensorMap. Used in Pybind.
|
inline |
Get line attributes in line_attr_. Throws exception if the attribute does not exist.
key | Attribute name. |
|
inline |
Get line attributes in line_attr_. Throws exception if the attribute does not exist.
key | Attribute name. |
|
inline |
Get the value of the "colors" attribute in line_attr_. Convenience function.
|
inline |
Get the value of the "colors" attribute in line_attr_. Convenience function.
|
inline |
Get the value of the "indices" attribute in line_attr_. Convenience function.
|
inline |
Get the value of the "indices" attribute in line_attr_. Convenience function.
|
inline |
Returns the max bound for point coordinates.
|
inline |
Returns the max bound for point coordinates.
OrientedBoundingBox open3d::t::geometry::LineSet::GetOrientedBoundingBox | ( | ) | const |
Create an oriented bounding box from point attribute "positions".
|
inline |
Getter for point_attr_ TensorMap. Used in Pybind.
|
inline |
Get point attributes in point_attr_. Throws exception if the attribute does not exist.
key | Attribute name. |
|
inline |
Get point attributes. Throws exception if the attribute does not exist.
key | Attribute name. |
|
inline |
Get the value of the "positions" attribute in point_attr_. Convenience function.
|
inline |
Get the value of the "positions" attribute in point_attr_. Convenience function.
|
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
|
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.
|
inline |
Check if the "indices" attribute's value in line_attr_ has length > 0. Convenience function.
|
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
|
inline |
Check if the "positions" attribute's value in point_attr_ has length > 0. Convenience function.
|
inlineoverridevirtual |
Returns !HasPointPositions(), line indices are ignored.
Implements open3d::t::geometry::Geometry.
LineSet & open3d::t::geometry::LineSet::PaintUniformColor | ( | const core::Tensor & | color | ) |
|
inline |
Removes line attribute by key value. Primary attribute "indices" cannot be removed. Throws warning if attribute key does not exists.
key | Attribute name. |
|
inline |
Removes point attribute by key value. Primary attribute "positions" cannot be removed. Throws warning if attribute key does not exists.
key | Attribute name. |
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.
R | Rotation [Tensor of shape {3,3}]. |
center | Center [Tensor of shape {3}] about which the LineSet is to be scaled. |
LineSet & open3d::t::geometry::LineSet::Scale | ( | double | scale, |
const core::Tensor & | center | ||
) |
|
inline |
Set line 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 line_attr_. This is a convenience function.
|
inline |
Set the value of the "indices" attribute in line_attr_.
|
inline |
Set point 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 "positions" attribute in point_attr_. Convenience function.
LineSet open3d::t::geometry::LineSet::To | ( | const core::Device & | device, |
bool | copy = false |
||
) | const |
Transfer the line set to a specified device.
device | The targeted device to convert to. |
copy | If 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. |
open3d::geometry::LineSet open3d::t::geometry::LineSet::ToLegacy | ( | ) | const |
Convert to a legacy Open3D LineSet.
std::string open3d::t::geometry::LineSet::ToString | ( | ) | const |
Text description.
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'
transformation | Transformation [Tensor of shape {4,4}]. |
LineSet & open3d::t::geometry::LineSet::Translate | ( | const core::Tensor & | translation, |
bool | relative = true |
||
) |
|
protected |
|
protected |
|
protected |