CN115272605A - Method, device and equipment for picking up three-dimensional model component and storage medium - Google Patents

Method, device and equipment for picking up three-dimensional model component and storage medium Download PDF

Info

Publication number
CN115272605A
CN115272605A CN202110476544.5A CN202110476544A CN115272605A CN 115272605 A CN115272605 A CN 115272605A CN 202110476544 A CN202110476544 A CN 202110476544A CN 115272605 A CN115272605 A CN 115272605A
Authority
CN
China
Prior art keywords
dimensional model
picked
component
model component
picking
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110476544.5A
Other languages
Chinese (zh)
Inventor
尤勇敏
其他发明人请求不公开姓名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiuling Jiangsu Digital Intelligent Technology Co Ltd
Original Assignee
Jiuling Jiangsu Digital Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiuling Jiangsu Digital Intelligent Technology Co Ltd filed Critical Jiuling Jiangsu Digital Intelligent Technology Co Ltd
Priority to CN202110476544.5A priority Critical patent/CN115272605A/en
Publication of CN115272605A publication Critical patent/CN115272605A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/10Constructive solid geometry [CSG] using solid primitives, e.g. cylinders, cubes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • G06F30/13Architectural design, e.g. computer-aided architectural design [CAAD] related to design of buildings, bridges, landscapes, production plants or roads

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Geometry (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Civil Engineering (AREA)
  • Architecture (AREA)
  • Software Systems (AREA)
  • Computer Graphics (AREA)
  • Structural Engineering (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • General Engineering & Computer Science (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a method for picking up a three-dimensional model component, which comprises the following steps: constructing a detection ray based on the position of the picking point, and determining whether the detection ray intersects with the three-dimensional model component to be picked; if the disjointness is determined, acquiring a first model sub-component group of the three-dimensional model component to be picked according to a preset rule; projecting the first model subcomponent set to a display plane to obtain a second model subcomponent set; determining whether a distance between a pickup point position in the display plane and at least one sub-component in the second model sub-component group is less than a preset threshold; and if the number of the three-dimensional model components is smaller than a preset threshold value, picking up the three-dimensional model components to be picked up. The invention realizes that the three-dimensional model can be picked up within a preset pixel distance range from the mouse clicking position by using a ray detection method in combination with a screen projection method, so that the accuracy of picking up the three-dimensional model by a user is improved and the operation difficulty is reduced.

Description

Method, device and equipment for picking up three-dimensional model component and storage medium
Technical Field
The invention relates to the technical field of building informatization, in particular to a method, a device, equipment and a storage medium for picking up a three-dimensional model component.
Background
Building Information Model (BIM) is a new tool in architecture, engineering and civil engineering to represent computer aided design with three-dimensional graphics as main, object oriented, architecture related. The BIM technology plays an important role in improving production efficiency, saving cost and shortening construction period through building datamation and information model integration. The method has five characteristics of visualization, coordination, simulation, optimization and graphing. WebGL is a 3D drawing protocol, and can realize that 3D scenes and building information models can be displayed in a browser more smoothly without the support of browser plug-ins.
When the BIM engine based on the WebGL displays the BIM model, the BIM model needs to be picked up and operated according to mouse clicking. And when the user wishes to click, but the mouse position is close but does not completely fall within the screen pixel range of the BIM, the target model cannot be selected.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a method, a device, equipment and a storage medium for picking up a three-dimensional model component, which can pick up the three-dimensional model within a preset pixel distance range from a mouse clicking position by utilizing a ray detection method in combination with a screen projection method, so as to improve the accuracy of picking up the three-dimensional model by a user and reduce the operation difficulty.
To achieve the above object, an embodiment of the present invention provides a method for picking up a three-dimensional model component, the method including: constructing a detection ray based on the position of the picking point, and determining whether the detection ray intersects with the three-dimensional model component to be picked; if the detection ray is determined to be not intersected with the three-dimensional model component to be picked, acquiring a first model sub-component group of the three-dimensional model component to be picked according to a preset rule; projecting the first model subcomponent set to a display plane to obtain a second model subcomponent set; determining whether a distance between a pickup point position in the display plane and at least one subcomponent in the second model subcomponent group is less than a preset threshold; and picking up the three-dimensional model component to be picked up if the distance between the position of the picking-up point in the display plane and at least one sub-component in the second model sub-component group is smaller than a preset threshold value.
The determining whether the detection ray intersects with the three-dimensional model member to be picked up further comprises: judging whether the three-dimensional model component to be picked up has a bounding box or not; if the bounding box exists in the three-dimensional model component to be picked, acquiring the bounding box and judging whether the detection ray intersects with the bounding box; and if the bounding box does not exist in the three-dimensional model component to be picked up, or the bounding box exists in the three-dimensional model component to be picked up but the detection ray does not intersect with the bounding box, determining that the detection ray does not intersect with the three-dimensional model component to be picked up.
Further, it is determined that the bounding box does not exist for the three-dimensional model component to be picked up if at least one of the following exists: the three-dimensional model component to be picked up is a point-shaped component with a single vertex; or in the case where the three-dimensional model member to be picked up is a linear member having two vertices, the linear member is parallel to at least one plane of a preset plurality of planes.
The method further comprises: and under the condition that the bounding box exists and the detection ray is judged to be intersected with the bounding box, judging whether a polygon formed by vertex connecting lines of the three-dimensional model component to be picked up is intersected with the detection ray or not.
Judging whether a polygon formed by the vertex connecting lines of the three-dimensional model components to be picked up intersects with the detection ray comprises the following steps: judging whether a triangle formed by connecting lines of any three vertexes of the three-dimensional model component to be picked intersects with the detection ray or not; and if all triangles formed by connecting lines of any three vertexes do not intersect with the detection ray, determining that the detection ray does not intersect with the three-dimensional model component to be picked.
The obtaining of the first model subcomponent group of the three-dimensional model component to be picked up according to a preset rule further includes: acquiring a first model subcomponent group according to index data of a three-dimensional model component to be picked up, wherein: when the three-dimensional model component to be picked up includes only a point-like sub-component having a single apex or a line-like sub-component having two apexes, the first model sub-component group is the point-like sub-component or the line-like sub-component, respectively; and when the three-dimensional model component to be picked up comprises three-dimensional model sub-components except the dot-shaped sub-components or the linear sub-components, the first model sub-component group comprises a combination of linear sub-components with two vertexes formed after the three-dimensional model component to be picked up is split according to the index data.
Embodiments of the present invention also provide an apparatus for picking up a three-dimensional model member, the apparatus including: the acquisition module is used for acquiring a first model sub-component group of the three-dimensional model component to be picked according to a preset rule under the condition that the detection ray is determined not to be intersected with the three-dimensional model component to be picked; a projection module for projecting the first model subcomponent group to a display plane to obtain a second model subcomponent group; and the determining module is used for picking up the three-dimensional model component to be picked up when the distance between the position of the picking-up point in the display plane and at least one of the second model subcomponents is determined to be less than a preset threshold value. Further, the device also comprises a judging module which is used for constructing a detection ray based on the position of the picked point and determining whether the detection ray intersects with the three-dimensional model component to be picked.
Embodiments of the present invention also provide a computer device, including a memory, and a processor, where the memory stores thereon a computer program operable on the processor, and the processor implements the steps of the picking method of a three-dimensional model component described in any one of the above embodiments when executing the computer program.
Embodiments of the present invention also provide a computer-readable storage medium on which a computer program is stored, which, when being executed by a processor, realizes the steps of the picking method of a three-dimensional model component described in any one of the above embodiments.
The method has the advantages that the method can pick up the three-dimensional model within a preset pixel distance range from the mouse clicking position by utilizing a ray detection method in combination with a screen projection method, and particularly can pick up the three-dimensional model component when the three-dimensional model is only a point or line segment component, so that the accuracy of picking up the three-dimensional model by a user is improved, and the operation difficulty is reduced.
Drawings
The technical solution and other advantages of the present invention will become apparent from the following detailed description of specific embodiments of the present invention, which is to be read in connection with the accompanying drawings.
Fig. 1 shows a flow chart of a picking method of a three-dimensional model member provided by a first embodiment of the present invention.
Fig. 2 shows a further flow chart of the picking method of the three-dimensional model component provided by the first embodiment of the present invention.
Fig. 3 to 6 respectively show schematic diagrams of application scenarios one to four of the method for picking up a three-dimensional model component according to the first embodiment of the present invention.
Fig. 7 is a schematic structural view showing a pickup device for a three-dimensional model member according to a second embodiment of the present invention.
Fig. 8 shows a schematic structural diagram of a computer device provided by an embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
The terms "first," "second," "third," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the objects so described are interchangeable under appropriate circumstances. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover a non-exclusive inclusion. Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware circuits or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly and may be, for example, fixedly connected, detachably connected, or integrally connected; may be mechanically, electrically or may be in communication with each other; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
The present invention will be described in further detail with reference to the accompanying drawings and detailed description, in order to make the objects, features and advantages thereof more comprehensible.
Fig. 1 shows a flow chart of a picking method of a three-dimensional model member provided by a first embodiment of the present invention. The method for picking up the three-dimensional model component provided by the embodiment can be applied to computer equipment. The computer device may be an electronic device with a drawing application installed, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, or a personal digital assistant, and the specific form of the computer device is not limited in this embodiment.
In addition, according to the method for picking up a three-dimensional model component provided by the first embodiment of the present invention, the execution subject may be the device for picking up a three-dimensional model component as provided by the second embodiment, and the device may be implemented as a part or all of a computer device by software, hardware, or a combination of software and hardware. The implementation subject of the following method embodiments is described by taking a computer device as an example, so as to realize that, for example, in a WebGL environment, a three-dimensional model component can be picked up within a preset pixel distance range from a mouse click position, thereby improving the accuracy of picking up the three-dimensional model component by a user and reducing the operation difficulty.
Referring to fig. 1, a method for picking up a three-dimensional model member according to a first embodiment of the present invention includes the steps of:
step S10, constructing a detection ray based on the position of a picked point, and determining whether the detection ray intersects with a three-dimensional model component to be picked;
step S20, if the detection ray is determined not to intersect with the three-dimensional model component to be picked, acquiring a first model subcomponent group of the three-dimensional model component to be picked according to a preset rule;
step S30, projecting the first model subcomponent group to a display plane to obtain a second model subcomponent group;
step S40, determining whether the distance between the position of the picking point in the display plane and at least one sub-component in the second model sub-component group is smaller than a preset threshold value;
and S50, if the distance between the position of the picking point in the display plane and at least one sub-component in the second model sub-component group is smaller than a preset threshold value, picking up the three-dimensional model component to be picked.
Each step of the method of the present embodiment is further described below.
In step S10, in the computer device, the building information model (i.e., the BIM model) may be loaded by the building class software in a browser provided by the computer device and presented on a two-dimensional screen of the computer device. After the BIM model is loaded, the data of the model component is stored in a memory in a vertex and index mode. The memory may be located in a browser, a local hard disk of a computer, or a remote server, which is not limited herein. For each BIM model component, a unique identification number (namely an id value), a piece of vertex information and a piece of index information are recorded, and the BIM model component and a camera object are added into a three-dimensional scene (namely a three-dimensional space) as a precondition for mouse pickup. The three-dimensional scene is a three-dimensional space defined by a coordinate system of a camera viewpoint with a viewpoint (i.e., a camera) as an origin.
In the present embodiment, it is possible to acquire vertex information of a model member by the stored index information while identifying the model member as a model member having a plurality of vertices, a point-like member having a single vertex, or a linear member having two vertices. Specifically, the index value in the vertex data of the model component corresponds to a manner of obtaining vertex information, for example, a vertex array [ v, v, v ], where v represents a vertex, and the index value is a type array (typearray), and a storage size of the index value determines a type of the obtained data, for example, the storage size is 1, that is, 1 point is obtained from the vertex array for use, and the model component is configured as a point component; if the storage size is 2, connecting two points to a line segment; the storage size is 3, and three points are sequentially connected to form an angle shape.
Fig. 3 and 4 are schematic diagrams illustrating a first application scenario and a second scenario, respectively, of the method for picking up a three-dimensional model component according to the first embodiment of the present invention. Specifically, as shown in fig. 3 and 4, the camera 1 is used as a viewpoint origin in a three-dimensional space, the model component 2 is a model component displayed in the three-dimensional space, and the model component 3 is a corresponding model component displayed in the screen space 4 (i.e., a two-dimensional plane) after the model component 1 is subjected to coordinate transformation, projection, and the like. After loading the scene and generating the data related to the BIM model component, the mouse clicks the model component 3 displayed on the screen, and the screen coordinates of the mouse click position (i.e., the pick point position) are recorded.
And after obtaining the screen coordinates of the mouse clicking position, judging whether the detection ray intersects with the model component 2 to be picked up. When it is judged that the detection ray intersects the model member 2 to be picked up, the model member 2 is directly picked up. When it is determined that the detection ray does not intersect with the model component 2 to be picked, it is necessary to further determine whether to pick up the model component 2 by a subsequent projection method. Fig. 2 is a schematic flow chart of a method for picking up a three-dimensional model component according to a first embodiment of the present invention, which specifically shows the step of determining whether to pick up a model component by detecting a ray method, and mainly includes:
step S11, judging whether a bounding box exists in the model component, if so, acquiring the bounding box of the model component, if not, regarding that the detection ray does not intersect with the three-dimensional model component to be picked up, and further judging whether the model component is picked up or not by a projection method;
step S12, judging whether the detection ray intersects with the acquired bounding box;
step S121, when the detection ray intersects with the bounding box, further judging whether a polygon formed by vertex connecting lines of the model component intersects with the detection ray, if so, picking up the model component, and if not, determining that the detection ray does not intersect with the model component to be picked up, and further judging whether to pick up the model component through a projection method;
and S122, when the detection ray does not intersect with the bounding box, determining that the detection ray does not intersect with the model component to be picked, and further judging whether the model component is picked up or not by a projection method.
In the present embodiment, taking the scene one in fig. 3 as an example, the detection ray 5 is set as a ray generated from the camera 1 of the three-dimensional scene as the ray starting point O via the mouse click position, which may be understood as the screen coordinate of the click position or the projection coordinate of the click position in the three-dimensional space. The radiation direction D of the detection radiation 5 can be obtained according to the following steps: converting the two-dimensional screen coordinate point D (x, y) of the click position into a three-dimensional space according to the camera projection matrix, obtaining the projection point coordinate P (x ', y') of the corresponding three-dimensional space, setting a default z coordinate value, and finally determining the ray direction D through the projection point coordinate of the three-dimensional space and the camera position coordinate point.
In step S11, determining whether the detection ray intersects with the model component 2 to be picked further includes determining whether a bounding box exists in the model component 2, if so, obtaining the bounding box of the model component, otherwise, determining that the detection ray does not intersect with the three-dimensional model component to be picked, and further determining whether to pick up the model component 2 by projection. In this embodiment, a bounding box refers to a cube that can contain an object.
Fig. 5 is a schematic diagram illustrating a third scenario of the picking method for a three-dimensional model component according to the first embodiment of the present invention, where no bounding box exists in the model component, that is, a bounding box cannot be calculated. Specifically, as shown in fig. 5, the absence of a bounding box (or the absence of a bounding box) of the model member includes at least one of the following cases: the three-dimensional model member to be picked up is a dot-like member 41 having a single apex; or when the three-dimensional model member to be picked up is a linear member 42 having two vertexes (i.e., end points) and the linear member 42 is parallel to at least one plane among planes (-X, -Y, -Z, Z) in 6 directions in a cartesian coordinate system as described below. It is to be understood that the model member may be identified as a model member having a plurality of vertices, a point-like member having a single vertex, or a line-like member having two vertices by the aforementioned index values. When the model member does not have a bounding box, it is not possible to determine whether or not the model member is picked up by a method of determining whether or not the detection ray intersects with the bounding box (i.e., the ray method fails), and it is necessary to further determine whether or not the model member is picked up by a projection method.
In the present embodiment, when it is determined that the bounding box exists for the model member 2, the bounding box for the model member 2 is acquired. For convenience of understanding, in the first and second scenarios shown in fig. 3 and 4, the model component 2 is rectangular, and its bounding box is the model component 2 itself, and taking the rectangular bounding box as an example, 6 planes of the bounding box can be obtained by the following plane formula:
Figure BDA0003047589420000071
Figure BDA0003047589420000072
Figure BDA0003047589420000073
where-X, X, -Y, Y, -Z, Z are planes in 6 directions in a Cartesian coordinate system and Pi is the vertex coordinate. The space formed by the 6 intersecting surfaces is a cuboid, namely a rectangular enclosure box, which encloses a model component.
It should be noted that, the specific manner of the bounding box of the model component in this step can be set by the designer according to the actual scene and the user's requirements. The bounding box from which the model member is obtained may be a bounding box from which a preset BIM model is obtained, for example; bounding boxes may also be generated from the model components. The embodiment is not limited in any way as long as the processor can obtain the bounding box of the model member in this step.
In step S12, it is determined whether the detection ray intersects the acquired bounding box. In this embodiment, the process of determining whether the detection ray 5 intersects with the bounding box includes: assuming that O is the ray starting point, D is the ray direction, N is the plane normal, P0 represents one point on the plane, P represents an arbitrary point on the plane (i.e., the intersection point to be solved), and when P = P0, 0 · N =0, then the plane equation (P-P0) · N =0, so (O + D · t-P0) · N =0, (O-P0) · N · t =0, and finally t = (P0-O) · N/D · N is obtained (where D · N ≠ 0). Where t is a scalar, and when t has no solution (i.e., D · N = 0), it is regarded that the detection ray 5 has no intersection with the plane. After traversing all planes of the bounding box, if the detection ray 5 has no intersection with all planes, it is determined that the detection ray 5 does not intersect with the bounding box, as shown in the second scenario of fig. 4. Conversely, when the detection ray 5 has an intersection with at least one plane, it is determined that the detection ray 5 intersects the bounding box, as shown in the first scenario of fig. 3.
Step S121, as shown in the first scenario of fig. 3, when the detection ray 5 intersects with the bounding box, further determining whether a polygon formed by connecting lines of vertices of the model component 2 intersects with the detection ray 5, if so, directly performing an operation of picking up the model component 2, and if not, determining that the detection ray 5 does not intersect with the model component 2 to be picked up, and further determining whether to pick up the model component 2 by a projection method.
The following triangle intersection algorithm may be adopted to determine whether the polygon formed by the vertex connecting lines of the model component 2 intersects the detection ray: judging whether a triangle formed by connecting lines of any three vertexes of the model component 2 is intersected with the detection ray 5 or not; and when all triangles formed by connecting lines of any three vertexes do not intersect with the detection ray 5, determining that the detection ray does not intersect with the three-dimensional model member to be picked. The triangle intersection algorithm may adopt a triangle intersection algorithm known to those skilled in the art, such as a centroid method, a homodromous method, and the like. Taking the barycentric method of the triangle intersection algorithm as an example, three vertices of the triangle are three-dimensional coordinate points a, B, and C obtained from the vertex list through the index information of the model component, and therefore, for any point P (i.e., the intersection to be found) in the plane, the following equation can be used to represent the three-dimensional coordinate points:
P=A+u*(C-A)+v*(B-A)
if the coefficient u or v is negative, it is equivalent to moving in the opposite direction, i.e., the BA or CA direction. Then if we want P to be inside triangle ABC, point se:Sub>A when u =0 and v =0, point B when u =0, v =1, and point C when u =1, v =0, we work out the above equations to get P-se:Sub>A = u (C-se:Sub>A) + v (B-se:Sub>A), let v0= C-se:Sub>A, v1= B-se:Sub>A, v2= P-se:Sub>A, then v2= u + v0+ v1, we get two equations by multiplying v0 and v1 on both sides of the equation respectively:
(v 2) · v0= (u × v0+ v × v 1) · v0; and
(v2)·v1=(u*v0+v*v1)·v1
note that u and v are numerical values, and v0, v1 and v2 are vectors, so the dot product can be expanded to yield:
v2 · v0= u (v 0 · v 0) + v (v 1 · v 0); and
v2·v1=u*(v0·v1)+v*(v1·v1)
solving this equation yields:
u=((v1·v1)(v2·v0)-(v1·v0)(v2·v1))/((v0·v0)(v1·v1)-(v0·v1)(v1·v0))
v=((v0·v0)(v2·v1)-(v0·v1)(v2·v0))/((v0·v0)(v1·v1)-(v0·v1)(v1·v0))
and solving u and v, namely if the following three conditions are met:
u>=0
v>=0
u+v<=1
the detection ray has an intersection point in the triangle, if the detection ray intersects the triangle judgment, the detection ray intersects the model component, the information of all intersected model components is judged according to the method, and the detection ray is picked up and operated according to the requirement.
In step S122, when the detection ray 5 does not intersect with the bounding box, it is determined that the detection ray 5 does not intersect with the model component 2 to be picked up, and it is necessary to determine whether to pick up the model component 2 by a subsequent projection method.
In step S20, when it is determined that the detection ray does not intersect with the three-dimensional model component to be picked up, that is, when the result of picking up the model component is not obtained yet by the intersection algorithm of the detection ray with the bounding box and the triangle intersection algorithm, it is necessary to perform a projection method to determine whether to pick up the model component 2. Specifically, a first model subcomponent group is obtained according to index data of a model component to be picked up, wherein: when the model member to be picked up includes only a point member having a single apex or a linear member having two apexes, the first model sub-member group is the point member or the linear member, respectively; and when the model component to be picked up comprises a three-dimensional model component except a point component or a linear component, the first model sub-component group comprises a combination of linear components with two vertexes formed after the three-dimensional model component to be picked up is split according to the index data. Specifically, two points in the vertex array are taken to be connected into a line segment according to the index value.
In step S30, the first set of model sub-components is projected onto a display plane, e.g. a screen, to obtain a second set of model sub-components. For example, when the model member to be picked up includes only a point-like member having a single apex or a linear member having two apexes, the coordinates of its apexes in a three-dimensional space are converted to screen coordinates by a camera projection matrix, resulting in a projected line segment on the screen; when the model component to be picked up comprises a three-dimensional model component except a point component or a linear component, similarly, converting coordinates of two end points (namely vertexes) of the line segment in the split first model sub-component group in a three-dimensional space into screen coordinates through a camera projection matrix to obtain a projection line segment on the screen, wherein a transformation formula from the model space to the screen space is as follows:
the screen coordinate point P _ screen = P _ world · M _ camera ^ (-1) · M _ project;
wherein P _ world is the world coordinate point of the line segment end point, the camera matrix is M _ camera, and the projection matrix is M _ projection.
In step S40, the three-dimensional model component is picked up when it is determined that a distance between a position of a pickup point in the display plane and at least one of the second model subcomponents is less than a preset threshold. Specifically, fig. 6 is a schematic diagram illustrating an application scenario four of the method for picking up a three-dimensional model component according to the first embodiment of the present invention. As shown in fig. 6, coordinates of the end points a and B of the line segment 31 of the model component 2 in the three-dimensional space are converted to screen coordinates (end points a 'and B') by the camera projection matrix, a judgment is made based on the distance D between the screen position D of the mouse click and the converted projected line segment 32, and if the distance D is smaller than a preset pixel distance, it is considered that the component click result is successfully acquired, and a result of picking up the model component 2 is returned. When traversing all the line segment components in the model component 2 and the distance D between the projection line segment and the screen position D clicked by the mouse is larger than the preset pixel distance, obtaining the result of determining the component click failure and returning the result of not picking up the model component 2. It should be understood by those skilled in the art that the distance from the screen location point D to the projected line segment can be calculated by tangent method or similar calculation methods known to those skilled in the art, and the embodiment is not limited herein.
Fig. 7 is a schematic structural view showing a pickup apparatus 100 for a three-dimensional model component according to a second embodiment of the present invention. The apparatus 100 comprises: the acquisition module 10 is configured to acquire a first model subcomponent group of a three-dimensional model component to be picked up according to a preset rule under the condition that it is determined that a detection ray does not intersect with the three-dimensional model component to be picked up; a projection module 20 for projecting the first model subcomponent group to a display plane to obtain a second model subcomponent group; and a determining module 30 for picking up the three-dimensional model component to be picked up when it is determined that a distance between a position of a pickup point in the display plane and at least one of the second model subcomponents is less than a preset threshold. The apparatus 100 further comprises a determining module 40 for constructing a detection ray based on the picked-up point position and determining whether the detection ray intersects with the three-dimensional model component to be picked up.
Meanwhile, it should be understood that the relevant features of the second embodiment and the first embodiment can be referred to and referred to each other, and are not repeated herein.
According to the invention, by combining the ray detection and the projection detection, the effects of accurately picking up the detection ray which is positioned outside the model member but is very close to the model member and accurately picking up the linear member and the point member which cannot be detected by the detection ray are realized.
Fig. 8 shows a schematic structural diagram of a computer device 200 provided by an embodiment of the present invention. The computer device includes a processor 310, a memory 320, a network interface 330, a display screen 340, and an input device 350 connected by a system bus 300. Wherein the processor 310 of the computer device 200 is used to provide computing and control capabilities. The memory 320 of the computer device 200 includes a nonvolatile storage medium, an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface 330 of the computer device 200 is used to communicate with an external computer device through a network connection. The computer program is executed by the processor 310 to implement a picking method of a three-dimensional model member. The display 340 of the computer device 200 may be a liquid crystal display or an electronic ink display, and the input device 350 of the computer device 200 may be a touch layer covered on the display 340, a key, a trackball or a touch pad arranged on a housing of the computer device 200, or an external keyboard, a touch pad or a mouse.
Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory, a processor, a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
constructing a detection ray based on the position of the picking point, and determining whether the detection ray intersects with the three-dimensional model component to be picked; if the detection ray is determined to be not intersected with the three-dimensional model component to be picked, acquiring a first model sub-component group of the three-dimensional model component to be picked according to a preset rule; projecting the first model subcomponent set to a display plane to obtain a second model subcomponent set; determining whether a distance between a pickup point position in the display plane and at least one subcomponent in the second model subcomponent group is less than a preset threshold; and picking up the three-dimensional model component to be picked up if the distance between the position of the picking-up point in the display plane and at least one of the second model component group is smaller than a preset threshold value.
For specific limitations and implementation manners of the above steps, reference may be made to the first embodiment, which is not described herein again.
In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the following steps of a picking method for three-dimensional model components:
constructing a detection ray based on the position of the picking point, and determining whether the detection ray intersects with the three-dimensional model component to be picked; if the detection ray is determined to be not intersected with the three-dimensional model component to be picked, acquiring a first model sub-component group of the three-dimensional model component to be picked according to a preset rule; projecting the first model subcomponent set to a display plane to obtain a second model subcomponent set; determining whether a distance between a pickup point position in the display plane and at least one subcomponent in the second model subcomponent group is less than a preset threshold; and picking up the three-dimensional model component to be picked up if the distance between the position of the picking-up point in the display plane and at least one of the second model component group is smaller than a preset threshold value.
For specific limitations and implementation of the above steps, reference may be made to the first embodiment, which is not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct Rambus Dynamic RAM (DRDRAM), and Rambus Dynamic RAM (RDRAM), among others.
The above detailed description is provided for the picking method, apparatus, device and storage medium of a three-dimensional model component according to the embodiments of the present invention, and a specific example is applied in this document to explain the principle and the implementation of the present invention, and the description of the above embodiments is only used to help understanding the technical solution and the core idea of the present invention; those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method of picking up a three-dimensional model component, the method comprising:
constructing a detection ray based on the position of the picking point, and determining whether the detection ray intersects with the three-dimensional model component to be picked;
if the detection ray is determined to be not intersected with the three-dimensional model component to be picked, acquiring a first model sub-component group of the three-dimensional model component to be picked according to a preset rule;
projecting the first model subcomponent set to a display plane to obtain a second model subcomponent set;
determining whether a distance between a pickup point position in the display plane and at least one sub-component in the second model sub-component group is less than a preset threshold; and
and if the distance between the position of the picking point in the display plane and at least one sub-component in the second model sub-component group is smaller than a preset threshold value, picking the three-dimensional model component to be picked.
2. The method for picking up a three-dimensional model component according to claim 1, wherein said determining whether the detection ray intersects with the three-dimensional model component to be picked up further comprises:
judging whether the three-dimensional model component to be picked up has a bounding box or not;
if the bounding box exists in the three-dimensional model component to be picked, acquiring the bounding box and judging whether the detection ray intersects with the bounding box; and
and if the bounding box does not exist in the three-dimensional model component to be picked up, or the bounding box exists in the three-dimensional model component to be picked up but the detection ray does not intersect with the bounding box, determining that the detection ray does not intersect with the three-dimensional model component to be picked up.
3. The method for picking up a three-dimensional model component according to claim 2, wherein it is judged that the bounding box does not exist for the three-dimensional model component to be picked up if at least one of the following exists:
the three-dimensional model component to be picked up is a point-shaped component with a single vertex; or
In the case where the three-dimensional model member to be picked up is a linear member having two vertexes, the linear member is parallel to at least one plane of a preset plurality of planes.
4. The method of picking up a three-dimensional model component according to claim 2, characterized in that the method further comprises: and under the condition that the bounding box exists and the detection ray is judged to be intersected with the bounding box, judging whether a polygon formed by connecting lines of vertexes of the three-dimensional model component to be picked up is intersected with the detection ray.
5. The method for picking up a three-dimensional model component according to claim 4, wherein the determining whether the polygon formed by the connecting lines of the vertices of the three-dimensional model component to be picked up intersects with the detection ray comprises: judging whether a triangle formed by connecting lines of any three vertexes of the three-dimensional model component to be picked intersects with the detection ray or not; and if all triangles formed by connecting lines of any three vertexes do not intersect with the detection ray, determining that the detection ray does not intersect with the three-dimensional model component to be picked.
6. The method for picking up a three-dimensional model component according to claim 1, wherein obtaining the first model subcomponent group of the three-dimensional model component to be picked up according to a preset rule further comprises:
acquiring a first model subcomponent group according to index data of a three-dimensional model component to be picked up, wherein:
when the three-dimensional model component to be picked up includes only a point-like sub-component having a single apex or a line-like sub-component having two apexes, the first model sub-component group is the point-like sub-component or the line-like sub-component, respectively; and
when the three-dimensional model component to be picked up comprises three-dimensional model sub-components except for point-shaped sub-components or linear sub-components, the first model sub-component group comprises a combination of linear sub-components with two vertexes formed after the three-dimensional model component to be picked up is split according to the index data.
7. An apparatus for picking up a three-dimensional model component, characterized in that the apparatus comprises:
the acquisition module is used for acquiring a first model sub-component group of the three-dimensional model component to be picked according to a preset rule under the condition that the detection ray is determined not to be intersected with the three-dimensional model component to be picked;
a projection module for projecting the first model subcomponent group to a display plane to obtain a second model subcomponent group; and
a determining module, configured to pick up the three-dimensional model component to be picked up when it is determined that a distance between a position of a pickup point in the display plane and at least one of the second model subcomponents is less than a preset threshold.
8. The apparatus for picking up a three-dimensional model member according to claim 7, wherein the apparatus further comprises a judging module for constructing a detection ray based on the picked-up point position and determining whether the detection ray intersects with the three-dimensional model member to be picked up.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps in the method of picking up a three-dimensional model element according to any one of claims 1 to 7.
CN202110476544.5A 2021-04-29 2021-04-29 Method, device and equipment for picking up three-dimensional model component and storage medium Pending CN115272605A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110476544.5A CN115272605A (en) 2021-04-29 2021-04-29 Method, device and equipment for picking up three-dimensional model component and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110476544.5A CN115272605A (en) 2021-04-29 2021-04-29 Method, device and equipment for picking up three-dimensional model component and storage medium

Publications (1)

Publication Number Publication Date
CN115272605A true CN115272605A (en) 2022-11-01

Family

ID=83745423

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110476544.5A Pending CN115272605A (en) 2021-04-29 2021-04-29 Method, device and equipment for picking up three-dimensional model component and storage medium

Country Status (1)

Country Link
CN (1) CN115272605A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116012562A (en) * 2022-12-28 2023-04-25 中建电子信息技术有限公司 Method for rapidly completing BIM three-dimensional visualization platform model manufacture
CN118570419A (en) * 2024-08-02 2024-08-30 芯瑞微(上海)电子科技有限公司 Method for judging space positions of vertexes and geometric bodies and unit attribute assignment method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116012562A (en) * 2022-12-28 2023-04-25 中建电子信息技术有限公司 Method for rapidly completing BIM three-dimensional visualization platform model manufacture
CN118570419A (en) * 2024-08-02 2024-08-30 芯瑞微(上海)电子科技有限公司 Method for judging space positions of vertexes and geometric bodies and unit attribute assignment method

Similar Documents

Publication Publication Date Title
JP7060758B2 (en) Tracking target positioning methods, devices, equipment and storage media
EP3806041A1 (en) Method and apparatus for jointly calibrating external parameters of multiple cameras, device and medium
CN111127422B (en) Image labeling method, device, system and host
CN113240769B (en) Spatial link relation identification method and device and storage medium
US20190206078A1 (en) Method and device for determining pose of camera
CN115272605A (en) Method, device and equipment for picking up three-dimensional model component and storage medium
WO2021077982A1 (en) Mark point recognition method, apparatus and device, and storage medium
JP2009129189A (en) Object recognition method
JP2010511228A (en) Interact with 2D content on 3D surface
TW201616451A (en) System and method for selecting point clouds using a free selection tool
CN110895823B (en) Texture obtaining method, device, equipment and medium for three-dimensional model
JP2022541977A (en) Image labeling method, device, electronic device and storage medium
CA3182430A1 (en) Systems and methods for automatic alignment of drawings
CN114926549B (en) Three-dimensional point cloud processing method, device, equipment and storage medium
CN114782627A (en) Three-dimensional model collision detection method and device, electronic equipment and medium
CN107958236B (en) Face recognition sample image generation method and terminal
CN113129362A (en) Method and device for acquiring three-dimensional coordinate data
CN116931772A (en) Method and terminal for editing three-dimensional model in webpage
CN113628284B (en) Pose calibration data set generation method, device and system, electronic equipment and medium
CN112685279B (en) Script recording method, script recording device and terminal equipment
CN115018763A (en) Pit detection method, device and equipment based on curved surface fitting and storage medium
CN114565721A (en) Object determination method, device, equipment, storage medium and program product
CN113487685A (en) Calibration method, device and equipment of line laser scanning camera and storage medium
JP5464671B2 (en) Image processing apparatus, image processing method, and image processing program
KR101873983B1 (en) Apparatus for providing structure information, and recording medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination