ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvPlane.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // Local
11 #include "ecvGenericPrimitive.h"
13 
15 
19 public:
21 
28  PointCoordinateType yWidth,
29  const ccGLMatrix* transMat = nullptr,
30  QString name = QString("Plane"));
31 
33 
35  ccPlane(QString name = QString("Plane"));
36 
38  virtual CV_CLASS_ENUM getClassID() const override {
39  return CV_TYPES::PLANE;
40  }
41 
42  // inherited from ccGenericPrimitive
43  virtual QString getTypeName() const override { return "Plane"; }
44  virtual ccGenericPrimitive* clone() const override;
45 
46  // inherited from ccHObject
47  virtual ccBBox getOwnFitBB(ccGLMatrix& trans) override;
48 
50  PointCoordinateType getXWidth() const { return m_xWidth; }
51 
53  PointCoordinateType getYWidth() const { return m_yWidth; }
54 
56  CCVector3 getCenter() const {
57  return m_transformation.getTranslationAsVec3D();
58  }
59 
61  void setXWidth(PointCoordinateType w, bool autoUpdate = true) {
62  m_xWidth = w;
63  if (autoUpdate) updateRepresentation();
64  }
65 
67  void setYWidth(PointCoordinateType h, bool autoUpdate = true) {
68  m_yWidth = h;
69  if (autoUpdate) updateRepresentation();
70  }
71 
72  // inherited from ccPlanarEntityInterface
73  CCVector3 getNormal() const override {
74  return m_transformation.getColumnAsVec3D(2);
75  }
76 
78  bool setAsTexture(QImage image, QString imageFilename = QString());
79 
81  static bool SetQuadTexture(ccMesh* quadMesh,
82  QImage image,
83  QString imageFilename = QString());
84 
86 
92  double* rms = 0);
93 
95 
99  void getEquation(CCVector3& N, PointCoordinateType& constVal) const;
100 
102 
106  const PointCoordinateType* getEquation();
107 
109  void flip();
110 
111 protected:
112  // inherited from ccDrawable
113  virtual void drawMeOnly(CC_DRAW_CONTEXT& context) override;
114 
115  // inherited from ccGenericPrimitive
116  bool toFile_MeOnly(QFile& out, short dataVersion) const override;
117  short minimumFileVersion_MeOnly() const override;
118  bool fromFile_MeOnly(QFile& in,
119  short dataVersion,
120  int flags,
121  LoadedIDMap& oldToNewIDMap) override;
122  virtual bool buildUp() override;
123 
126 
129 
130  // Array [a,b,c,d] such that ax+by+cz = d
131  PointCoordinateType m_PlaneEquation[4];
132 };
ccGenericPrimitive::minimumFileVersion_MeOnly
short minimumFileVersion_MeOnly() const override
Definition: ecvGenericPrimitive.cpp:154
ccBBox
Bounding box structure.
Definition: ecvBBox.h:25
ccPlane::m_yWidth
PointCoordinateType m_yWidth
Width along 'Y' dimension.
Definition: ecvPlane.h:128
ccPlane::getCenter
CCVector3 getCenter() const
Returns the center.
Definition: ecvPlane.h:56
ccPlane::getNormal
CCVector3 getNormal() const override
Returns the entity normal.
Definition: ecvPlane.h:73
ccPlane::getXWidth
PointCoordinateType getXWidth() const
Returns 'X' width.
Definition: ecvPlane.h:50
ccGenericPrimitive::updateRepresentation
virtual bool updateRepresentation()
Updates internal representation (as a mesh)
Definition: ecvGenericPrimitive.cpp:194
ccPlane::setXWidth
void setXWidth(PointCoordinateType w, bool autoUpdate=true)
Sets 'X' width.
Definition: ecvPlane.h:61
ccHObject::getOwnFitBB
virtual ccBBox getOwnFitBB(ccGLMatrix &trans)
Returns best-fit bounding-box (if available)
Definition: ecvHObject.cpp:1009
CV_CLASS_ENUM
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
context
ImGuiContext * context
Definition: Window.cpp:76
ecvPlanarEntityInterface.h
ccPlane::m_xWidth
PointCoordinateType m_xWidth
Width along 'X' dimension.
Definition: ecvPlane.h:125
ccMesh::drawMeOnly
void drawMeOnly(CC_DRAW_CONTEXT &context) override
Enables (OpenGL) stipple mask.
Definition: ecvMesh.cpp:2635
Vector3Tpl< PointCoordinateType >
ccGenericPrimitive::clone
virtual ccGenericPrimitive * clone() const =0
Clones primitive.
CV_TYPES::PLANE
@ PLANE
Definition: CVTypes.h:120
ccPlane::setYWidth
void setYWidth(PointCoordinateType h, bool autoUpdate=true)
Sets 'Y' width.
Definition: ecvPlane.h:67
ccGenericPrimitive::toFile_MeOnly
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
Definition: ecvGenericPrimitive.cpp:135
image
std::shared_ptr< core::Tensor > image
Definition: FilamentRenderer.cpp:184
ecvGenericPrimitive.h
ccPlane::getYWidth
PointCoordinateType getYWidth() const
Returns 'Y' width.
Definition: ecvPlane.h:53
cloudViewer::GenericIndexedCloudPersist
A generic 3D point cloud with index-based and presistent access to points.
Definition: GenericIndexedCloudPersist.h:18
ccGLMatrix
Float version of ccGLMatrixTpl.
Definition: ecvGLMatrix.h:19
ccPlane::getClassID
virtual CV_CLASS_ENUM getClassID() const override
Returns class ID.
Definition: ecvPlane.h:38
ccMesh
Triangular mesh.
Definition: ecvMesh.h:35
CV_DB_LIB_API
#define CV_DB_LIB_API
Definition: CV_db.h:15
ccGLDrawContext
Display context.
Definition: ecvDrawContext.h:365
ccGenericPrimitive::fromFile_MeOnly
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
Definition: ecvGenericPrimitive.cpp:160
ccGenericPrimitive
Generic primitive interface.
Definition: ecvGenericPrimitive.h:16
PointCoordinateType
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
ccGenericPrimitive::buildUp
virtual bool buildUp()=0
Builds primitive.
ccPlane
Plane (primitive)
Definition: ecvPlane.h:17
ccPlane::getTypeName
virtual QString getTypeName() const override
Returns type name (sphere, cylinder, etc.)
Definition: ecvPlane.h:43
ccPlanarEntityInterface
Interface for a planar entity.
Definition: ecvPlanarEntityInterface.h:18
name
std::string name
Definition: FileIOFactory.cpp:129