A potree-based point cloud model placement method and device
By creating a virtual coordinate system that responds to translation and rotation operations, and using cube and cylinder objects to generate transformation matrices to adjust the placement of point cloud models, the problem of point cloud models not being displayed intuitively on the web is solved, enabling more intuitive point cloud observation and measurement operations.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGDONG WEIMEIJIA TECH CO LTD
- Filing Date
- 2022-10-12
- Publication Date
- 2026-07-21
Smart Images

Figure CN115588093B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of point cloud data rendering, and in particular to a method and apparatus for placing point cloud models based on Potree. Background Technology
[0002] In reverse engineering, the set of point data on the surface of a product obtained through measuring instruments is also called a point cloud. Point clouds are typically obtained using a 3D coordinate measuring machine, which produces a relatively small number of points with large spacing between them; these are called sparse point clouds. Point clouds obtained using a 3D laser scanner or photogrammetric scanner, on the other hand, produce a large number of dense points; these are called dense point clouds. In practical applications, business 3D models are often quite large (over 100MB). Considering factors such as network bandwidth, to quickly display and manipulate these models on the web, choosing Three.js would be quite labor-intensive. Choosing Potree is relatively more convenient because it has already made many optimizations in file separation downloading and fast rendering.
[0003] Displaying point cloud data based on Potree on the web typically doesn't transform the entire point cloud model. Point cloud measurement and rendering operations are based on the initial position and rotation of the point cloud model in world space. However, for point cloud data generated from 3D scanned models, the position and rotation of the entire scanned point cloud model in world space are often not so "regular." For example, a cuboid point cloud model is not an axis-aligned cuboid in world space. Therefore, operations like measuring the volume, area, and length of a specific region of the point cloud are not so intuitive. It requires careful adjustment of the virtual camera's position in the scene, locating the area to be measured, and creating a bounding box. If this bounding box is not initially axis-aligned, its position and rotation need further adjustment to ensure that the lines and faces of the bounding box are as parallel as possible to the lines and faces of the cuboid. Each measurement may require similar operations, making point cloud measurement and observation unintuitive and the process cumbersome. Summary of the Invention
[0004] This invention provides a method and apparatus for placing point cloud models based on Potree, which enables the point cloud to be presented more intuitively and neatly in world space after transformation, facilitating the observation and measurement of the point cloud.
[0005] To achieve the above objectives, a first aspect of this application provides a method and apparatus for placing point cloud models based on Potree, comprising:
[0006] Read the point cloud data and use the Potree renderer to render the point cloud model into world space; the world space is a virtual coordinate system.
[0007] Create a cube to respond to translation operations and three cylinders to respond to rotation operations;
[0008] Create a first 3D object and a second 3D object; wherein, the sub-objects of the first 3D object include the cube and the second 3D object; the sub-objects of the second 3D object include the three cylinders;
[0009] A coordinate system is generated based on the first 3D object and the second 3D object, and the position of the generated coordinate system is adjusted and the displacement and rotation of the coordinate system are recorded in conjunction with the point cloud model.
[0010] Calculate the transformation matrix with respect to the first three-dimensional object based on the displacement and rotation.
[0011] Calculate and save the inverse of the transformation matrix, and apply the inverse matrix to the point cloud model to obtain the point cloud model after changing the placement method.
[0012] In one possible implementation of the first aspect, after reading the point cloud data and rendering the point cloud model to world space using the Potree renderer, the method further includes:
[0013] Configure the view mode and camera mode of the Potree renderer; the view mode includes top view, bottom view, left view, right view, front view and back view; the camera mode includes orthographic camera mode and perspective camera mode.
[0014] In one possible implementation of the first aspect, adjusting the position of the generated coordinate system and recording the displacement of the coordinate system specifically includes:
[0015] When the origin of the coordinate system is translated in the browser viewport, the amount of translation change is recorded; the amount of translation change is the magnitude and direction of the translation operation in the browser viewport.
[0016] Based on the ratio of the horizontal coordinate change to the browser viewport width and the vertical coordinate change to the browser window height, the 3D engine interface is called to project and obtain the translation change vector.
[0017] Based on the view type, the coordinates of the first 3D object in world space before translation, and the translation change vector, the coordinates of the first 3D object in world space after translation are obtained.
[0018] In one possible implementation of the first aspect, adjusting the position of the generated coordinate system and recording the rotation of the coordinate system specifically includes:
[0019] When the coordinate system axes are rotated in the browser viewport, the amount of rotation change is recorded; the amount of rotation change is the magnitude and direction of the rotation action in the browser viewport.
[0020] The rotation change is projected into world space by calling the 3D engine interface to obtain the rotation change vector;
[0021] Based on the view type, the coordinates of the first 3D object in world space before rotation, and the rotation change vector, the rotation amount of the first 3D object in world space after translation is obtained.
[0022] In one possible implementation of the first aspect, the recording of translational changes specifically includes:
[0023] Record the mouse position in the browser viewport before and after the translation.
[0024] In one possible implementation of the first aspect, the first rotation change is obtained based on the ratio of the horizontal coordinate of the mouse position in the browser viewport before rotation to the width of the browser viewport, and based on the ratio of the vertical coordinate of the mouse position in the browser viewport before rotation to the height of the browser viewport.
[0025] The second rotation change is obtained by comparing the ratio of the horizontal coordinate of the mouse position in the browser viewport after rotation to the width of the browser viewport, and the ratio of the vertical coordinate of the mouse position in the browser viewport after rotation to the height of the browser viewport.
[0026] In one possible implementation of the first aspect, generating a coordinate system based on the first three-dimensional object and the second three-dimensional object specifically includes:
[0027] A coordinate system is generated with the first 3D object as the origin bounding box and the second 3D object as three mutually perpendicular coordinate axes.
[0028] In one possible implementation of the first aspect, calculating and storing the inverse of the transformation matrix, and applying the inverse matrix to the point cloud model to obtain the point cloud model with the changed placement, specifically includes:
[0029] Copy the transformation matrix of the first 3D object to the variable Matrix, calculate the inverse matrix InverseMatrix of the variable Matrix, and apply InverseMatrix to the point cloud model.
[0030] A second aspect of this application provides a method and apparatus for placing point cloud models based on Potree, including:
[0031] The rendering module is used to read point cloud data and use the Potree renderer to render the point cloud model into world space; the world space is a virtual coordinate system.
[0032] The 3D object creation module is used to create a cube that responds to translation operations and three cylinders that respond to rotation operations.
[0033] The 3D object creation module is also used to create a first 3D object and a second 3D object; wherein, the sub-objects of the first 3D object include the cube and the second 3D object; and the sub-objects of the second 3D object include the three cylinders.
[0034] The adjustment module is used to generate a coordinate system based on the first three-dimensional object and the second three-dimensional object, and, in conjunction with the point cloud model, adjust the position of the generated coordinate system and record the displacement and rotation of the coordinate system.
[0035] The calculation module is used to calculate the transformation matrix with respect to the first three-dimensional object based on the displacement and the rotation.
[0036] The placement module is used to calculate and save the inverse matrix of the transformation matrix, and apply the inverse matrix to the point cloud model to obtain the point cloud model after changing the placement method.
[0037] Compared to existing technologies, the present invention provides a method and apparatus for placing point cloud models based on Potree. It establishes a coordinate system that can respond to user translation and rotation operations, confirms the placement requirements of the point cloud system operator based on the user's operation on the coordinate system, and then obtains a transformation matrix for the first three-dimensional object. Based on the transformation matrix, the point cloud is repositioned in world space, so that the point cloud can be presented more intuitively and neatly in world space after coordinate transformation, which facilitates the observation and measurement of the point cloud.
[0038] Furthermore, when establishing a coordinate system that can respond to user translation and rotation operations, since the sub-objects of the first three-dimensional object include the cube and the second three-dimensional object, and the sub-objects of the second three-dimensional object include the three cylinders, it can be ensured that when dragging the origin of the coordinate system for translation, all three coordinate axes can be translated simultaneously, and rotating the three axes of the coordinate system will not affect the origin of the coordinate system. Attached Figure Description
[0039] Figure 1 This is a flowchart illustrating a point cloud model placement method based on Potree provided in an embodiment of the present invention;
[0040] Figure 2 This is a state diagram of the initial placement of a point cloud model provided in an embodiment of the present invention;
[0041] Figure 3 This is a schematic diagram of coordinate system adjustment provided in an embodiment of the present invention;
[0042] Figure 4 This is a state diagram of a point cloud model after being rearranged, provided in an embodiment of the present invention. Detailed Implementation
[0043] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] Please see Figure 1 An embodiment of the present invention provides a method for placing point cloud models based on Potree, comprising:
[0045] S10. Read the point cloud data and use the Potree renderer to render the point cloud model into world space; the world space is a virtual coordinate system.
[0046] S11. Create a cube to respond to translation operations and three cylinders to respond to rotation operations.
[0047] S12. Create a first three-dimensional object and a second three-dimensional object; wherein, the sub-objects of the first three-dimensional object include the cube and the second three-dimensional object; the sub-objects of the second three-dimensional object include the three cylinders.
[0048] S13. Generate a coordinate system based on the first three-dimensional object and the second three-dimensional object, and adjust the position of the generated coordinate system in conjunction with the point cloud model, and record the displacement and rotation of the coordinate system.
[0049] S14. Calculate the transformation matrix of the first three-dimensional object based on the displacement and rotation.
[0050] S15. Calculate and save the inverse matrix of the transformation matrix, and apply the inverse matrix to the point cloud model to obtain the point cloud model after changing the placement method.
[0051] Point cloud data consists of a metadata file and several point cloud binary files. The metadata file records the basic attributes of the entire point cloud, such as the number of points, bounding box data, octree hierarchy, and point attributes. Each point cloud binary file contains detailed data for each specific point, such as the point's location and color.
[0052] Since point cloud data is typically stored on server storage media, such as the Alibaba Cloud OSS database, the 3D scanning data management platform associated with this invention uses a web interface to retrieve the point cloud data via HTTP requests. The open-source Potree point cloud renderer then renders the entire point cloud data model in the browser. The browser contains a display scene representing the world space where the point cloud resides, as well as the point cloud model itself. At this point, the point cloud model is in its original state, which is generally unsuitable for observation, measurement, or other operations.
[0053] This invention, based on the Potree point cloud renderer, proposes and applies a Potree-based point cloud model placement method in a 3D scanning point cloud data management system. This method allows point clouds to be rearranged in world space according to the operator's needs, resulting in a more intuitive and orderly presentation of the point cloud after coordinate transformation, facilitating observation and measurement. Furthermore, users can create and save multiple coordinate transformation results for the point cloud. During each observation and measurement, existing coordinate transformation results can be selected to quickly and orderly place the point cloud model in the world space.
[0054] For example, after reading the point cloud data and rendering the point cloud model to world space using the Potree renderer, the method further includes:
[0055] Configure the view mode and camera mode of the Potree renderer; the view mode includes top view, bottom view, left view, right view, front view and back view; the camera mode includes orthographic camera mode and perspective camera mode.
[0056] The Potree renderer provides six views for observing point clouds: top, bottom, left, right, front, and back. Based on user needs, one of these views is selected, denoted as `viewMode`. All subsequent operations are based on the selected view.
[0057] Generally, the camera in the Potree renderer is set to orthographic camera mode. The following examples are all based on orthographic camera mode.
[0058] After reading the point cloud data, a new coordinate system needs to be established that can respond to user operations.
[0059] For example, the specific steps of S11-S12 are as follows:
[0060] First, create a Box geometry object to respond to translation operations.
[0061] Based on Three.js, the code creates a geometry of type THREE.BoxGeometry, which is a cube, and a material of type THREE.MeshBasicMaterial. Using the geometry and material as parameters, a model of type THREE.Mesh is created, denoted as pickVolume. The pickVolume is bound to a drag event to respond to the operation of dragging this model with the mouse.
[0062] Then create three mutually perpendicular coordinate axes to respond to rotation operations:
[0063] (1) Based on Three.js, the code creates a geometry of type THREE.CylinderGeometry, which is a cylinder. It also creates a material of type THREE.MeshBasicMaterial. Using the geometry and material as parameters, it creates a model of type THREE.Mesh, denoted as pickLineX. It binds the drag event to pickLineX to respond to the operation of dragging the model with the mouse.
[0064] (2) Repeat step (1) twice to create two cylindrical models, denoted as pickLineY and pickLineZ respectively. This creates three cylindrical models with identical initial states representing coordinate axes: pickLineX, pickLineY, and pickLineZ. The states of the three coordinate axes in the world coordinate system are shown.
[0065] (3) For pickLineX, rotate 90 degrees clockwise around the z-axis; for pickLineY, keep it unchanged; for pickLineZ, rotate 90 degrees clockwise around the x-axis. After the rotation adjustment, the three orthogonal (i.e., mutually perpendicular) cylindrical models are created. These are used as coordinate axes to adjust the rotation of the point cloud. Each axis can respond to mouse dragging and rotate in world space.
[0066] Then set the origin bounding box and the three mutually perpendicular coordinate axes as child objects of the same Object3D object:
[0067] Based on Three.js, create two THREE.Object3D objects (i.e., create a first 3D object and a second 3D object), denoted as ucsHelper (the first 3D object) and ucsAixsHelper (the second 3D object), respectively. Add pickVolume to the child object list of ucsHelper; add pickLineX, pickLineY, and pickLineZ to the child object list of ucsAixsHelper; add ucsAixsHelper to the child object list of ucsHelper; add the ucsHelper object to the world scene.
[0068] This parent-child relationship design ensures that when dragging and translating the pickVolume (representing the origin of the coordinate system), the pickLineX, pickLineY, and pickLineZ can be translated simultaneously; and rotating the three axes of the coordinate system will not affect the pickVolume.
[0069] After the above steps, a virtual coordinate system is generated in the world scene. This coordinate system contains a geometry representing the origin and geometry representing the three coordinate axes.
[0070] For example, adjusting the position of the generated coordinate system and recording the displacement of the coordinate system in S13 specifically includes:
[0071] When the origin of the coordinate system is translated in the browser viewport, the amount of translation change is recorded; the amount of translation change is the magnitude and direction of the translation operation in the browser viewport.
[0072] Based on the ratio of the horizontal coordinate change to the browser viewport width and the vertical coordinate change to the browser window height, the 3D engine interface is called to project and obtain the translation change vector.
[0073] Based on the view type, the coordinates of the first 3D object in world space before translation, and the translation change vector, the coordinates of the first 3D object in world space after translation are obtained.
[0074] For example, the recorded translation change specifically includes:
[0075] Record the mouse position in the browser viewport before and after the translation.
[0076] Point cloud platform system operators use the mouse to drag and drop the origin of the coordinate system:
[0077] (1) Let the current position of the mouse in the browser viewport be (x1, y1) and the position of the mouse in the browser viewport in the previous frame be (x0, y0). Then the change in mouse movement is (x1-x0, y1-y0). (x1-x0) and (y1-y0) are initialized with the browser viewport width clientWidth and browser viewport height clientHeight, respectively, i.e. (x1-x0) / clientWidth, (y1-y0) / clientHeight, and are denoted as dx and dy, respectively.
[0078] Let position be the current position of ucsHelper in the rendering scene, which is a three-dimensional vector.
[0079] (2) Let the variable dt = (dx, dy, 0.5). Use the Three.js interface unproject to backproject this variable to world space coordinates. The result is denoted as translate. It should be noted that the value of the third parameter can be between 0 and 1, because this dimension variable will not affect the result. In computer graphics algorithms, it is generally taken as 0.5.
[0080] (3) Calculate the new position of the ucsHelper object in the world coordinate system based on the view type and the lastPosition of the ucsHelper object in the previous frame:
[0081] If it is a left view and a right view, the calculation formula is as follows:
[0082] Position.x=lastPosition.x;
[0083] Position.y=lastPosition.y+translate.y;
[0084] Position.z=lastPosition.z+translate.z;
[0085] For front and rear views, the calculation formula is as follows:
[0086] Position.x=lastPosition.x+translate.x;
[0087] Position.y=lastPosition.y;
[0088] Position.z=lastPosition.z+translate.z;
[0089] For top and bottom views, the calculation formula is as follows:
[0090] Position.x=lastPosition.x+translate.x;
[0091] Position.y=lastPosition.y+translate.y;
[0092] Position.z=lastPosition.z;
[0093] Record this Position value.
[0094] For example, adjusting the position of the generated coordinate system and recording the rotation amount of the coordinate system in S13 specifically includes:
[0095] When the coordinate system axes are rotated in the browser viewport, the amount of rotation change is recorded; the amount of rotation change is the magnitude and direction of the rotation action in the browser viewport.
[0096] The rotation change is projected into world space by calling the 3D engine interface to obtain the rotation change vector;
[0097] Based on the view type, the coordinates of the first 3D object in world space before rotation, and the rotation change vector, the rotation amount of the first 3D object in world space after translation is obtained.
[0098] For example, the first rotation change is obtained based on the ratio of the horizontal coordinate of the mouse position in the browser viewport before rotation to the width of the browser viewport, and the ratio of the vertical coordinate of the mouse position in the browser viewport before rotation to the height of the browser viewport.
[0099] The second rotation change is obtained by comparing the ratio of the horizontal coordinate of the mouse position in the browser viewport after rotation to the width of the browser viewport, and the ratio of the vertical coordinate of the mouse position in the browser viewport after rotation to the height of the browser viewport.
[0100] Point cloud platform system operators use the mouse to drag and drop coordinate axes:
[0101] At this point, the position of ucsHelper remains unchanged, denoted as position.
[0102] (4) Let the current position of the mouse in the browser viewport be (x1, y1), and initialize it with the browser viewport width clientWidth and clientHeight respectively, dx1 = x1 / clientWidth, dy1 = y1 / clientHeight; let the position of the mouse in the browser viewport in the previous frame be (x0, y0), and initialize it with the browser viewport width clientWidth and clientHeight respectively, dx0 = x0 / clientWidth, dy0 = y0 / clientHeight.
[0103] Set the variable oldPoint to a three-dimensional vector, oldPoint = (dx0, dy0, 0.5); set the variable newPoint to a three-dimensional variable, newPoint = (dx1, dy1, 0.5).
[0104] (5) Use the Three.js interface unproject to backproject the oldPoint and newPoint variables to world space coordinates. The result is still denoted as oldPoint and newPoint.
[0105] Set two vectors, oldDir and newDir;
[0106] oldDir=(oldPoint.x–position.x,oldPoint.y–position.y,oldPoint.z–position.z);
[0107] newDir=(newPoint.x–position.x, newPoint.y–position.y, newPoint.z–position.z);
[0108] (6) Calculate the new rotation of the ucsHelper object based on the view type and the lastRotation of the ucsHelper object in the world coordinate system in the previous frame:
[0109] If it is a left view and a right view, the calculation method is as follows:
[0110] oldDir.x = 0;
[0111] newDir.x = 0;
[0112] Angle = oldDir.angleTo(newDir), where angleTo is a Three.js interface used to calculate the angle between two vectors;
[0113] Dir = oldDir.cross(newDir), cross is a Three.js interface used to calculate the cross product of two vectors, and the result is a vector.
[0114] If Dir.x >= 0, it indicates that the coordinate axis is rotated counterclockwise.
[0115] Rotation.x=oldRotation.x+Angle;
[0116] Rotation.y = oldRotation.y;
[0117] Rotation.z = oldRotation.z;
[0118] If Dix.x < 0, it indicates that the coordinate axis is selected by dragging clockwise;
[0119] Rotation.x=oldRotation.x–Angle;
[0120] Rotation.y = oldRotation.y;
[0121] Rotation.z = oldRotation.z;
[0122] For front and rear views, the calculation method is as follows:
[0123] oldDir.y = 0;
[0124] newDir.y = 0;
[0125] Angle = oldDir.angleTo(newDir), where angleTo is a Three.js interface used to calculate the angle between two vectors;
[0126] Dir = oldDir.cross(newDir), cross is a Three.js interface used to calculate the cross product of two vectors, and the result is a vector;
[0127] If Dir.y < 0, it indicates that the coordinate axis is rotated counterclockwise.
[0128] Rotation.x = oldRotation.x;
[0129] Rotation.y=oldRotation.y+Angle;
[0130] Rotation.z = oldRotation.z;
[0131] If Dix.xy>=0, it means that the coordinate axes are selected by dragging clockwise;
[0132] Rotation.x = oldRotation.x;
[0133] Rotation.y=oldRotation.y–Angle;
[0134] Rotation.z = oldRotation.z;
[0135] If it is a top view and a bottom view, the calculation method is as follows:
[0136] oldDir.z = 0;
[0137] newDir.z = 0;
[0138] Angle = oldDir.angleTo(newDir), where angleTo is a Three.js interface used to calculate the angle between two vectors;
[0139] Dir = oldDir.cross(newDir), cross is a Three.js interface used to calculate the cross product of two vectors, and the result is a vector;
[0140] If Dir.z >= 0, it indicates that the coordinate axis is rotated counterclockwise.
[0141] Rotation.x = oldRotation.x;
[0142] Rotation.y = oldRotation.y;
[0143] Rotation.z=oldRotation.z+Angle;
[0144] If Dix.z < 0, it indicates that the coordinate axis is selected by dragging clockwise;
[0145] Rotation.x = oldRotation.x;
[0146] Rotation.y = oldRotation.y;
[0147] Rotation.z=oldRotation.z–Angle;
[0148] At this point, the new rotation of ucsHelper is calculated based on the rotation of the coordinate axis after dragging the mouse.
[0149] For example, generating a coordinate system based on the first three-dimensional object and the second three-dimensional object specifically includes:
[0150] A coordinate system is generated with the first 3D object as the origin bounding box and the second 3D object as three mutually perpendicular coordinate axes.
[0151] For example, the step of calculating and saving the inverse of the transformation matrix, and applying the inverse matrix to the point cloud model to obtain the point cloud model with the changed placement, specifically includes:
[0152] Copy the transformation matrix of the first 3D object to the variable Matrix, calculate the inverse matrix InverseMatrix of the variable Matrix, and apply InverseMatrix to the point cloud model.
[0153] Based on the calculation results above, the new position and rotation of ucsHelper can be applied to this point cloud model to translate and rotate the origin and the three axes of the coordinate system to a new state.
[0154] The variable `Matrix` is set to a matrix type in Three.js, specifically `Matrix4`. The transformation matrix of the `ucsHelper` object is copied to `Matrix`, the inverse matrix of `Matrix` is calculated (resulting in `InverseMatrix`), and this `InverseMatrix` is applied to the entire point cloud model to obtain the new orientation of the point cloud model in world space. The `InverseMatrix` is recorded and saved to the backend database for future use.
[0155] The above steps can be repeated to generate multiple coordinate transformation matrices and save them to the backend database, allowing the point cloud model to be switched to different placement postures.
[0156] Compared to existing technologies, the present invention provides a Potree-based point cloud model placement method that establishes a coordinate system that can respond to user translation and rotation operations. Based on the user's operation on the coordinate system, the placement requirements of the point cloud system operator are confirmed, and a transformation matrix about the first three-dimensional object is obtained. The point cloud is then repositioned in world space according to the transformation matrix, so that the point cloud can be presented more intuitively and neatly in world space after coordinate transformation, which facilitates the observation and measurement of the point cloud.
[0157] Furthermore, when establishing a coordinate system that can respond to user translation and rotation operations, since the sub-objects of the first three-dimensional object include the cube and the second three-dimensional object, and the sub-objects of the second three-dimensional object include the three cylinders, it can be ensured that when dragging the origin of the coordinate system for translation, all three coordinate axes can be translated simultaneously, and rotating the three axes of the coordinate system will not affect the origin of the coordinate system.
[0158] Another embodiment of this application provides a method and apparatus for placing point cloud models based on Potree, including: a rendering module, a 3D object creation module, an adjustment module, a calculation module, and a placement module.
[0159] The rendering module is used to read point cloud data and use the Potree renderer to render the point cloud model into world space; the world space is a virtual coordinate system.
[0160] The 3D object creation module is used to create a cube that responds to translation operations and three cylinders that respond to rotation operations.
[0161] The three-dimensional object creation module is also used to create a first three-dimensional object and a second three-dimensional object; wherein, the sub-objects of the first three-dimensional object include the cube and the second three-dimensional object; and the sub-objects of the second three-dimensional object include the three cylinders.
[0162] The adjustment module is used to generate a coordinate system based on the first three-dimensional object and the second three-dimensional object, and, in conjunction with the point cloud model, adjust the position of the generated coordinate system and record the displacement and rotation of the coordinate system.
[0163] The calculation module is used to calculate the transformation matrix of the first three-dimensional object based on the displacement and the rotation.
[0164] The placement module is used to calculate and save the inverse matrix of the transformation matrix, and apply the inverse matrix to the point cloud model to obtain the point cloud model after changing the placement method.
[0165] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0166] Compared to existing technologies, the present invention provides a Potree-based point cloud model placement device that establishes a coordinate system that can respond to user translation and rotation operations. Based on the user's operation on the coordinate system, the placement requirements of the point cloud system operator are confirmed, and a transformation matrix for the first three-dimensional object is obtained. The point cloud is then repositioned in world space according to the transformation matrix, so that the point cloud can be presented more intuitively and neatly in world space after coordinate transformation, which facilitates the observation and measurement of the point cloud.
[0167] Furthermore, when establishing a coordinate system that can respond to user translation and rotation operations, since the sub-objects of the first three-dimensional object include the cube and the second three-dimensional object, and the sub-objects of the second three-dimensional object include the three cylinders, it can be ensured that when dragging the origin of the coordinate system for translation, all three coordinate axes can be translated simultaneously, and rotating the three axes of the coordinate system will not affect the origin of the coordinate system.
[0168] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A method for placing point cloud models based on Potree, characterized in that, include: Read the point cloud data and use the Potree renderer to render the point cloud model into world space; The world space described is a virtual coordinate system; Create a cube to respond to translation operations and three cylinders to respond to rotation operations; Create a first 3D object and a second 3D object; wherein, the sub-objects of the first 3D object include the cube and the second 3D object; the sub-objects of the second 3D object include the three cylinders; A coordinate system is generated based on the first 3D object and the second 3D object, and the position of the generated coordinate system is adjusted and the displacement and rotation of the coordinate system are recorded in conjunction with the point cloud model. Calculate the transformation matrix with respect to the first three-dimensional object based on the displacement and rotation. Calculate and save the inverse of the transformation matrix, and apply the inverse matrix to the point cloud model to obtain the point cloud model after changing the placement method; The process of adjusting the position of the generated coordinate system and recording the displacement of the coordinate system specifically includes: When the origin of the coordinate system is translated in the browser viewport, the amount of translation change is recorded; the amount of translation change is the magnitude and direction of the translation operation in the browser viewport. Based on the ratio of the horizontal coordinate change to the browser viewport width and the vertical coordinate change to the browser window height, the 3D engine interface is called to project and obtain the translation change vector. Based on the view type, the coordinates of the first 3D object in world space before translation, and the translation change vector, the coordinates of the first 3D object in world space after translation are obtained. The process of adjusting the position of the generated coordinate system and recording the rotation amount of the coordinate system specifically includes: When the coordinate system axes are rotated in the browser viewport, the amount of rotation change is recorded; the amount of rotation change is the magnitude and direction of the rotation action in the browser viewport. The rotation change is projected into world space by calling the 3D engine interface to obtain the rotation change vector; Based on the view type, the coordinates of the first 3D object in world space before rotation, and the rotation change vector, the rotation amount of the first 3D object in world space after translation is obtained.
2. The point cloud model placement method based on Potree as described in claim 1, characterized in that, After reading the point cloud data and rendering the point cloud model to world space using the Potree renderer, the process also includes: Configure the view mode and camera mode of the Potree renderer; the view mode includes top view, bottom view, left view, right view, front view and back view; the camera mode includes orthographic camera mode and perspective camera mode.
3. The point cloud model placement method based on Potree as described in claim 1, characterized in that, The recorded translation changes specifically include: Record the mouse position in the browser viewport before and after the translation.
4. The point cloud model placement method based on Potree as described in claim 1, characterized in that, The recorded rotational changes specifically include: The first rotation change is obtained by the ratio of the horizontal coordinate of the mouse position in the browser viewport before rotation to the width of the browser viewport, and by the ratio of the vertical coordinate of the mouse position in the browser viewport before rotation to the height of the browser viewport. The second rotation change is obtained by comparing the ratio of the horizontal coordinate of the mouse position in the browser viewport after rotation to the width of the browser viewport, and the ratio of the vertical coordinate of the mouse position in the browser viewport after rotation to the height of the browser viewport.
5. The point cloud model placement method based on Potree as described in claim 1, characterized in that, The step of generating a coordinate system based on the first three-dimensional object and the second three-dimensional object specifically includes: A coordinate system is generated with the first 3D object as the origin bounding box and the second 3D object as three mutually perpendicular coordinate axes.
6. The point cloud model placement method based on Potree as described in claim 1, characterized in that, The calculation and storage of the inverse of the transformation matrix, followed by applying the inverse matrix to the point cloud model to obtain the point cloud model with the changed placement, specifically includes: Copy the transformation matrix of the first 3D object to the variable Matrix, calculate the inverse matrix InverseMatrix of the variable Matrix, and apply InverseMatrix to the point cloud model.
7. A point cloud model placement device based on Potree, characterized in that, include: The rendering module is used to read point cloud data and use the Potree renderer to render the point cloud model into world space. The world space described is a virtual coordinate system; The 3D object creation module is used to create a cube that responds to translation operations and three cylinders that respond to rotation operations. The 3D object creation module is also used to create a first 3D object and a second 3D object; wherein, the sub-objects of the first 3D object include the cube and the second 3D object; and the sub-objects of the second 3D object include the three cylinders. The adjustment module is used to generate a coordinate system based on the first three-dimensional object and the second three-dimensional object, and, in conjunction with the point cloud model, adjust the position of the generated coordinate system and record the displacement and rotation of the coordinate system. The calculation module is used to calculate the transformation matrix with respect to the first three-dimensional object based on the displacement and the rotation. The placement module is used to calculate and save the inverse of the transformation matrix, and apply the inverse matrix to the point cloud model to obtain the point cloud model after changing the placement method; The process of adjusting the position of the generated coordinate system and recording the displacement of the coordinate system specifically includes: When the origin of the coordinate system is translated in the browser viewport, the amount of translation change is recorded; the amount of translation change is the magnitude and direction of the translation operation in the browser viewport. Based on the ratio of the horizontal coordinate change to the browser viewport width and the vertical coordinate change to the browser window height, the 3D engine interface is called to project and obtain the translation change vector. Based on the view type, the coordinates of the first 3D object in world space before translation, and the translation change vector, the coordinates of the first 3D object in world space after translation are obtained. The process of adjusting the position of the generated coordinate system and recording the rotation amount of the coordinate system specifically includes: When the coordinate system axes are rotated in the browser viewport, the amount of rotation change is recorded; the amount of rotation change is the magnitude and direction of the rotation action in the browser viewport. The rotation change is projected into world space by calling the 3D engine interface to obtain the rotation change vector; Based on the view type, the coordinates of the first 3D object in world space before rotation, and the rotation change vector, the rotation amount of the first 3D object in world space after translation is obtained.