13 #include <type_traits>
14 #include <unordered_map>
508 double torus_radius = 1.0,
509 double tube_radius = 0.5,
510 int radial_resolution = 30,
511 int tubular_resolution = 20,
534 double cylinder_radius = 1.0,
535 double cone_radius = 1.5,
536 double cylinder_height = 5.0,
537 double cone_height = 4.0,
539 int cylinder_split = 4,
555 const Eigen::Vector3d &origin = Eigen::Vector3d(0.0, 0.0, 0.0),
576 int length_split = 70,
577 int width_split = 15,
597 const std::string &text,
614 const std::vector<double> contour_values = {0.0},
660 bool relative =
true);
719 const std::vector<double> contour_values = {0.0})
const;
732 const ccMesh &mesh_legacy,
755 static std::unordered_map<std::string, geometry::TriangleMesh>
793 bool preserve_volume =
true)
const;
807 double tolerance = 1e-6)
const;
820 double tolerance = 1e-6)
const;
833 double tolerance = 1e-6)
const;
883 float max_stretch = 1.f / 6,
884 int parallel_partitions = 1,
914 const std::unordered_set<std::string> &vertex_attr = {},
917 bool update_material =
true);
945 const std::unordered_set<std::string> &triangle_attr = {},
948 bool update_material =
true);
961 double translation = 0.0,
962 bool capping =
true)
const;
971 bool capping =
true)
const;
999 bool copy_attributes =
true)
const;
1025 const std::vector<Image> &images,
1026 const std::vector<core::Tensor> &intrinsic_matrices,
1027 const std::vector<core::Tensor> &extrinsic_matrices,
1028 int tex_size = 1024,
1029 bool update_material =
true);
1055 bool use_triangle_normal =
false);
1096 MetricParameters
params = MetricParameters())
const;
cmdLineReadable * params[]
#define AssertTensorDevice(tensor,...)
#define AssertTensorShape(tensor,...)
int64_t GetLength() const
Tensor Max(const SizeVector &dims, bool keepdim=false) const
Tensor Min(const SizeVector &dims, bool keepdim=false) const
Tensor Mean(const SizeVector &dims, bool keepdim=false) const
A bounding box that is aligned along the coordinate axes and defined by the min_bound and max_bound.
Mix-in class for geometry types that can be visualized.
A LineSet contains points and lines joining them and optionally attributes on the points and lines.
A bounding box oriented along an arbitrary frame of reference.
std::size_t Erase(const std::string key)
Erase elements for the TensorMap by key value, if the key exists. If the key does not exists,...
bool Contains(const std::string &key) const
A triangle mesh contains vertices and triangles.
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"))
bool HasTriangleNormals() const
TriangleMesh SimplifyQuadricDecimation(double target_reduction, bool preserve_volume=true) const
TriangleMesh(const core::Device &device=core::Device("CPU:0"))
TriangleMesh & Translate(const core::Tensor &translation, bool relative=true)
Translates the VertexPositions of the TriangleMesh.
core::Tensor ComputeMetrics(const TriangleMesh &mesh2, std::vector< Metric > metrics={Metric::ChamferDistance}, MetricParameters params=MetricParameters()) const
void SetTriangleNormals(const core::Tensor &value)
core::Tensor & GetTriangleIndices()
core::Tensor & GetVertexNormals()
const core::Tensor & GetTriangleIndices() const
TriangleMesh BooleanIntersection(const TriangleMesh &mesh, double tolerance=1e-6) const
static TriangleMesh CreateIsosurfaces(const core::Tensor &volume, const std::vector< double > contour_values={0.0}, const core::Device &device=core::Device("CPU:0"))
double GetSurfaceArea() const
Function that computes the surface area of the mesh, i.e. the sum of the individual triangle surfaces...
const core::Tensor & GetVertexPositions() const
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 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"))
TriangleMesh & Clear() override
Clear all data in the trianglemesh.
core::Tensor & GetVertexAttr(const std::string &key)
static geometry::TriangleMesh FromLegacy(const ccMesh &mesh_legacy, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
TriangleMesh SelectFacesByMask(const core::Tensor &mask) const
TensorMap & GetVertexAttr()
Getter for vertex_attr_ TensorMap.
TriangleMesh Clone() const
Returns copy of the triangle mesh on the same device.
const TensorMap & GetVertexAttr() const
Getter for vertex_attr_ TensorMap. Used in Pybind.
core::Tensor GetMaxBound() const
const core::Tensor & GetTriangleColors() const
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"))
bool HasVertexNormals() const
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"))
Image ProjectImagesToAlbedo(const std::vector< Image > &images, const std::vector< core::Tensor > &intrinsic_matrices, const std::vector< core::Tensor > &extrinsic_matrices, int tex_size=1024, bool update_material=true)
static std::unordered_map< std::string, geometry::TriangleMesh > FromTriangleMeshModel(const cloudViewer::visualization::rendering::TriangleMeshModel &model, core::Dtype float_dtype=core::Float32, core::Dtype int_dtype=core::Int64, const core::Device &device=core::Device("CPU:0"))
TriangleMesh RemoveUnreferencedVertices()
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)
bool HasVertexPositions() const
core::Tensor & GetVertexPositions()
const core::Tensor & GetVertexAttr(const std::string &key) const
std::string ToString() const
Text description.
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"))
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....
bool HasTriangleColors() const
TriangleMesh RemoveNonManifoldEdges()
TensorMap & GetTriangleAttr()
Getter for triangle_attr_ TensorMap.
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"))
const core::Tensor & GetVertexNormals() const
core::Tensor & GetTriangleNormals()
void RemoveTriangleAttr(const std::string &key)
TriangleMesh ExtrudeRotation(double angle, const core::Tensor &axis, int resolution=16, double translation=0.0, bool capping=true) const
AxisAlignedBoundingBox GetAxisAlignedBoundingBox() const
Create an axis-aligned bounding box from vertex attribute "positions".
core::Tensor & GetVertexColors()
core::Device GetDevice() const override
Returns the device of the geometry.
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)
void SetVertexPositions(const core::Tensor &value)
const core::Tensor & GetVertexColors() const
bool HasTriangleIndices() const
TriangleMesh To(const core::Device &device, bool copy=false) const
core::Tensor GetNonManifoldEdges(bool allow_boundary_edges=true) const
TriangleMesh & NormalizeNormals()
Normalize both triangle normals and vertex normals to length 1.
core::Tensor & GetTriangleAttr(const std::string &key)
void SetTriangleIndices(const core::Tensor &value)
Set the value of the "indices" attribute in triangle_attr_.
TriangleMesh BooleanUnion(const TriangleMesh &mesh, double tolerance=1e-6) const
PointCloud SamplePointsUniformly(size_t number_of_points, bool use_triangle_normal=false)
int PCAPartition(int max_faces)
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 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"))
const core::Tensor & GetTriangleNormals() const
ccMesh ToLegacy() const
Convert to a legacy CloudViewer TriangleMesh.
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"))
void SetVertexNormals(const core::Tensor &value)
TriangleMesh & Scale(double scale, const core::Tensor ¢er)
Scales the VertexPositions of the TriangleMesh.
TriangleMesh FillHoles(double hole_size=1e6) const
virtual ~TriangleMesh() override
bool HasVertexAttr(const std::string &key) const
TriangleMesh & Rotate(const core::Tensor &R, const core::Tensor ¢er)
Rotates the VertexPositions, VertexNormals and TriangleNormals (if exists).
TriangleMesh & ComputeTriangleAreas()
Function to compute triangle areas and save it as a triangle attribute "areas". Prints a warning,...
void RemoveVertexAttr(const std::string &key)
TriangleMesh ExtrudeLinear(const core::Tensor &vector, double scale=1.0, bool capping=true) const
TriangleMesh BooleanDifference(const TriangleMesh &mesh, double tolerance=1e-6) const
bool HasVertexColors() const
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"))
core::Tensor & GetTriangleColors()
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)
bool HasTriangleAttr(const std::string &key) const
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 specifi...
TriangleMesh ComputeConvexHull(bool joggle_inputs=false) const
TriangleMesh & ComputeVertexNormals(bool normalized=true)
Function to compute vertex normals, usually called before rendering.
const core::Tensor & GetTriangleAttr(const std::string &key) const
void SetVertexAttr(const std::string &key, const core::Tensor &value)
void SetVertexColors(const core::Tensor &value)
void SetTriangleColors(const core::Tensor &value)
TriangleMesh SelectByIndex(const core::Tensor &indices, bool copy_attributes=true) const
bool IsEmpty() const override
Returns !HasVertexPositions(), triangles are ignored.
void SetTriangleAttr(const std::string &key, const core::Tensor &value)
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"))
TriangleMesh & Transform(const core::Tensor &transformation)
Transforms the VertexPositions, VertexNormals and TriangleNormals (if exist) of the TriangleMesh.
const TensorMap & GetTriangleAttr() const
Getter for triangle_attr_ TensorMap. Used in Pybind.
TriangleMesh & ComputeTriangleNormals(bool normalized=true)
Function to compute triangle normals, usually called before rendering.
OrientedBoundingBox GetOrientedBoundingBox() const
Create an oriented bounding box from vertex attribute "positions".
core::Tensor GetCenter() const
core::Tensor GetMinBound() const
::ccPointCloud PointCloud
@ ChamferDistance
Chamfer Distance.
constexpr nullopt_t nullopt
Generic file read and write utility for python interface.