Projection area calculation method and device based on three-dimensional model, equipment and medium

The method efficiently calculates the projection area of a three-dimensional model by transforming coordinates, setting grid state information, and determining the projection area, addressing the inefficiencies of existing methods.

CN119090941APending Publication Date: 2024-12-06SHENZHEN YUNBO SOFTWARE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411075033.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

The existing method for calculating the orthographic projection area of a three-dimensional model is complex and inefficient, requiring repeated calculations and consuming significant time.

Method used

A method involving acquiring original data of the three-dimensional model, performing coordinate transformation, calculating the index range of the target projection, setting grid state information, and determining the projection area based on a grid state information.

Benefits of technology

The method achieves low time complexity and enables quick calculation of the projection area in any direction, improving efficiency and reducing calculation time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119090941A_ABST
    Figure CN119090941A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer graphic processing, and discloses a projection area calculation method and device based on a three-dimensional model, equipment and a medium, the method comprises the following steps: obtaining original data of the three-dimensional model, the original data comprising a first direction vector and original coordinate information of the three-dimensional model, the first direction vector is a normal vector of the projection plane, and the direction of the first direction vector is the projection direction of the three-dimensional model; performing coordinate conversion according to the original data, and obtaining a coordinate conversion relation; calculating an index range of a target projection of the three-dimensional model on the projection plane by using the coordinate conversion relationship; setting grid state information of the target projected on the projection plane according to the index range; and calculating the projection area of the target projection according to the grid state information. The projection area calculation method is low in time complexity, and the projection area of the three-dimensional model in any direction can be rapidly calculated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer graphics processing technology, and in particular to a projection area calculation method, device, equipment and medium based on a three-dimensional model. Background Art

[0002] Orthographic projection area is a commonly used method in the field of CAE (Computer Aided Engineering) simulation design. Currently, the commonly used method in China and internationally is the bounding box. This method requires repeated calculation of the bounding box, and has many calculation steps, a complex method, low efficiency, a long time consumption, and is not efficient enough. Summary of the invention

[0003] The main problem to be solved by the present invention is to provide a method, device, equipment and medium for calculating the projection area based on a three-dimensional model, so as to solve the problem that when using the existing method to calculate the orthographic projection area of ​​a three-dimensional model, the calculation method is complicated and the efficiency is low.

[0004] In order to solve the above technical problems, a technical solution adopted by the present invention is to provide a projection area calculation method based on a three-dimensional model, the method comprising the following steps:

[0005] Acquire original data of the three-dimensional model, the original data including a first direction vector and original coordinate information of the three-dimensional model, the first direction vector is a normal vector of a projection plane, and the direction of the first direction vector is a projection direction of the three-dimensional model;

[0006] According to the original data, coordinate transformation is performed to obtain a coordinate transformation relationship;

[0007] Calculating the index range of the target projection of the three-dimensional model on the projection plane using the coordinate transformation relationship;

[0008] According to the index range, setting grid state information of the target projected on the projection plane;

[0009] The projection area of ​​the target projection is calculated according to the grid state information.

[0010] In some embodiments, the coordinate conversion is performed according to the original data, comprising the steps of:

[0011] According to the first direction vector, obtaining a second direction vector located on the projection plane;

[0012] Taking a cross product of the first direction vector and the second direction vector to obtain a third direction vector;

[0013] A target origin is determined according to the original coordinate information, and a target coordinate system is constructed using the target origin, the first direction vector, the second direction vector, and the third direction vector.

[0014] In some embodiments, the use of the coordinate transformation relationship to calculate the index range of the target projection of the three-dimensional model on the projection plane includes the steps of:

[0015] Obtaining a projection coordinate range of the target projected on the projection plane according to the original coordinate information and the coordinate conversion relationship;

[0016] Establishing a two-dimensional grid according to the projection coordinate range, wherein the two-dimensional grid includes a plurality of grid cells;

[0017] The index range of the target projection in the two-dimensional grid is determined according to the target coordinates of the three-dimensional model in the target coordinate system.

[0018] In some embodiments, the step of setting the grid state information of the target projected on the projection plane according to the index range comprises the steps of:

[0019] Traversing all grid cells within the index range, defining a line connecting the centroid of the grid cell and the centroid of the target projection as a centroid line, and determining whether the centroid line intersects with an edge of the target projection.

[0020] If the centroid line intersects the edge of the target projection, the grid cell is not within the target projection, and the grid cell is set to 0;

[0021] If the centroid line does not intersect the edge of the target projection, the grid unit is within the target projection, and the grid unit is set to 1; wherein the grid state information is whether the grid unit is set to 1 or 0.

[0022] In some embodiments, the determining whether the centroid line intersects with the edge of the target projection comprises the steps of:

[0023] The origin of the plane coordinate system where the target projection is located, the edge of the unit projection contained in the target projection, the centroid of the unit projection and the centroid of the grid unit are combined into a parametric equation, the parameter values ​​therein are solved, and then according to the range of the parameter values, the intersection of the centroid line and the edge of the target projection is determined.

[0024] In some embodiments, the calculating the projection area of ​​the target projection according to the grid state information comprises the steps of:

[0025] According to the grid state information, determining whether each of the grid units is set to 1;

[0026] Counting the proportion of the grid cells set to 1 in the projection coordinate range of the target projection;

[0027] The projection area of ​​the target projection is obtained according to the projection coordinate range and the proportion value.

[0028] The present invention also provides a projection area calculation device based on a three-dimensional model, comprising:

[0029] A data acquisition unit, configured to acquire original data of a three-dimensional model, wherein the original data includes a first direction vector and original coordinate information of the three-dimensional model, wherein the first direction vector is a normal vector of a projection plane, and the direction of the first direction vector is a projection direction of the three-dimensional model;

[0030] A coordinate conversion unit, used for performing coordinate conversion according to the original data and obtaining a coordinate conversion relationship;

[0031] An index determination unit, configured to calculate an index range of a target projection of the three-dimensional model on the projection plane using the coordinate transformation relationship;

[0032] A state setting unit, used for setting the grid state information of the target projected on the projection plane according to the index range;

[0033] A calculation unit is used to calculate the projection area of ​​the target projection according to the grid state information.

[0034] In some embodiments, the computing unit comprises:

[0035] A judging subunit, used to judge whether each grid unit within the projection coordinate range of the target projection is set to 1 according to the grid state information;

[0036] A statistical subunit, used for counting the proportion of the grid cells set to 1 in the projection coordinate range;

[0037] The acquisition subunit is used to obtain the projection area of ​​the target projection according to the projection coordinate range and the proportion value.

[0038] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0039] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0040] The beneficial effects of the present invention are as follows: the present invention discloses a method, device, equipment and medium for calculating projection area based on a three-dimensional model, the method comprising the following steps: obtaining original data of the three-dimensional model, the original data comprising a first direction vector and original coordinate information of the three-dimensional model, the first direction vector being the normal vector of the projection plane, and the direction of the first direction vector being the projection direction of the three-dimensional model; performing coordinate transformation according to the original data, and obtaining a coordinate transformation relationship; calculating the index range of the target projection of the three-dimensional model on the projection plane using the coordinate transformation relationship; setting the grid state information of the target projection on the projection plane according to the index range; and calculating the projection area of ​​the target projection according to the grid state information. The projection area calculation method of the present invention has low time complexity and can quickly calculate the projection area of ​​the three-dimensional model in any direction. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 It is a flow chart of an embodiment of a method for calculating projection area based on a three-dimensional model of the present application;

[0042] Figure 2 This is a specific flow chart of step S2 in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0043] Figure 3 It is a schematic diagram of the process of coordinate conversion in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0044] Figure 4 This is a schematic diagram of the result of coordinate transformation in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0045] Figure 5 It is a coordinate diagram including coordinate conversion relationship in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0046] Figure 6 This is a specific flow chart of step S3 in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0047] Figure 7 It is a schematic diagram of a two-dimensional grid established in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0048] Figure 8 It is a schematic diagram of the intersection of a centroid line and an edge of a three-dimensional unit in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0049] Fig. 9It is a schematic diagram of an embodiment of a projection area calculation method based on a three-dimensional model of the present application, in which a centroid connecting line does not intersect with an edge of a three-dimensional unit;

[0050] Fig.10 It is a schematic diagram of the result of setting the grid state information of the projection of a three-dimensional unit in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0051] Fig.11 It is a schematic diagram of the result of setting the grid state information of the target projection in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0052] Fig.12 This is a specific flow chart of step S5 in an embodiment of a projection area calculation method based on a three-dimensional model of the present application;

[0053] Fig.13 It is a structural block diagram of an embodiment of a projection area calculation device based on a three-dimensional model of the present application;

[0054] Fig.14 It is a structural block diagram of a calculation unit in an embodiment of a projection area calculation device based on a three-dimensional model of the present application;

[0055] Fig.15 It is a structural block diagram of an index determination unit in an embodiment of a projection area calculation device based on a three-dimensional model of the present application;

[0056] Fig.16 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;

[0057] Fig.17 It is a schematic block diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0058] In order to facilitate the understanding of the present invention, the present invention is described in more detail below in conjunction with the accompanying drawings and specific embodiments. Preferred embodiments of the present invention are provided in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.

[0059] It should be noted that, unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more related listed items.

[0060] The application scenarios of this application are as follows: establish a three-dimensional model, input three-dimensional point data, and directly obtain the result in the projection direction. At present, this calculation can be used to calculate the windward area of ​​cars, airplanes, and three-dimensional objects such as missiles. It is an indispensable step in calculating wind resistance and conducting wind resistance design and appearance design of three-dimensional objects such as cars, airplanes, and missiles.

[0061] like Figure 1 As shown, a projection area calculation method based on a three-dimensional model of the present application is shown, comprising the following steps:

[0062] Step S1: Acquire original data of the three-dimensional model.

[0063] It should be noted that the three-dimensional model includes a plurality of three-dimensional units, each of which includes a plurality of points (ie, three-dimensional grid points). In the original coordinate system, each point corresponds to an original coordinate.

[0064] Combination Figure 3 , the original data includes the first direction vector and the original coordinate information of the 3D model 1, the first direction vector is the normal vector of projection plane 3, the first direction vector The direction is the projection direction of the three-dimensional model 1, and the original coordinate information of the three-dimensional model 1 is the original coordinate corresponding to each point on the three-dimensional model 1 in the original coordinate system O-xyz.

[0065] Among them, the original coordinate system O-xyz is WCS (World Coordinate System). WCS is the basic reference frame in three-dimensional space. It provides a global, invariant coordinate system for determining the absolute position of all objects and scenes. It is the basis of all other coordinate systems and cannot be redefined.

[0066] Step S2: Perform coordinate transformation according to the original data and obtain the coordinate transformation relationship.

[0067] like Figure 2 As shown, in the process of coordinate transformation according to the original data, the following sub-steps are included:

[0068] Step S21: According to the first direction vector, obtain a second direction vector located on the projection plane.

[0069] like Figure 3 and Figure 4 As shown, according to the first direction vector Get two non-overlapping projection points P and Q on projection plane 3, subtract the coordinates of point P from the coordinates of point Q, and get Will Normalize to get the second direction vector And the second direction vector Located on projection plane 3.

[0070] Step S22: perform a cross product of the first direction vector and the second direction vector to obtain a third direction vector.

[0071] like Figure 3 As shown, the first direction vector and the second direction vector Do the cross product to get the third direction vector Since the result of the cross product of two vectors is a vector, and the resulting vectors are perpendicular to the two vectors, the third direction vector The first direction vector and the second direction vector Vertical. At the same time, since the first direction vector is the normal vector of projection plane 3, the second direction vector Located on projection plane 3, the first direction vector and the second direction vector Mutually perpendicular, that is, the first direction vector Second direction vector and the third direction vector They are perpendicular to each other, and can be further divided into two directions according to the first direction vector Second direction vector and the third direction vector Construct a three-dimensional coordinate system.

[0072] Step S23: Determine the target origin according to the original coordinate information, and construct a target coordinate system using the target origin, the first direction vector, the second direction vector and the third direction vector.

[0073] like Figure 4 As shown, in this embodiment, the maximum boundary point of the three-dimensional model 1 in the projection direction is first found, and the original coordinates of the maximum boundary point in the original coordinate system O-xyz are determined; then, based on the original coordinates of the maximum boundary point, the coordinate point with a straight-line distance of 2 unit lengths from the maximum boundary point in the projection direction is used as the target origin O' of the target coordinate system O'-x'y'z', and the distance between the maximum boundary point of the three-dimensional model 1 in the projection direction and the projection plane 3 is 2 unit lengths.

[0074] In this embodiment, a coordinate point whose straight-line distance from the maximum boundary point is 2 unit lengths is selected as the target origin O', so that the target origin O' is selected outside the range of the three-dimensional model 1, which does not affect the accuracy of the calculation results. At the same time, it can also avoid the projection plane 3 falling in the three-dimensional model 1, preventing the subsequent calculations from becoming more complicated.

[0075] In some other embodiments, it is sufficient to ensure that the projection plane 3 does not intersect with the three-dimensional model 1 .

[0076] It should be noted that the target coordinate system O'-x'y'z' is the UCS (User Coordinate System), which provides a variable coordinate system for coordinate input, operation plane and observation. Defining a UCS means changing the position of the origin (0, 0, 0) and the direction of the xy plane and z axis.

[0077] In the present application, the UCS can be positioned and oriented at any position in the three-dimensional space according to the projection direction of the three-dimensional model 1. In actual use, multiple UCSs can be defined, saved and reused at any time, so that the projection plane 3 can correspond to a plane coordinate system in the target coordinate system O'-x'y'z', which is convenient for calculating the projection area of ​​the target projection 2.

[0078] Among them, according to the principle of dot product between basis vectors of the coordinate system, the coordinate transformation relationship between the target coordinate system O'-x'y'z' and the original coordinate system O-xyz can be obtained.

[0079] Since the original coordinate system O-xyz and the target coordinate system O'-x'y'z' are both Cartesian coordinate systems, the basis of the original coordinate system O-xyz can be expressed using the basis of the target coordinate system O'-x'y'z':

[0080]

[0081] Among them, i, j, k are the basis of the original coordinate system O-xyz, i', j', k' are the basis of the target coordinate system O'-x'y'z', are the basis vector coefficients of the original coordinate system O-xyz relative to the target coordinate system O'-x'y'z'.

[0082] Similarly, the basis of the target coordinate system O'-x'y'z' can be expressed using the basis of the original coordinate system O-xyz:

[0083]

[0084] in, are the basis vector coefficients of the target coordinate system O'-x'y'z' relative to the original coordinate system O-xyz.

[0085] Among them, by finding the dot product of the vectors and establishing the calculation equation related to the basis vector coefficients, the basis vector coefficients in various directions can be further obtained.

[0086] First, establish the calculation equation related to a0 and A0.

[0087] Because there are:

[0088]

[0089] therefore,

[0090]

[0091] Similarly, the calculation equations related to the remaining basis vector coefficients can be established:

[0092]

[0093]

[0094] Secondly, it should be noted that the first direction vector Second direction vector and the third direction vector They all belong to the basis vectors, so we can use the first direction vector Second direction vector and the third direction vector Derive the basis vector coefficients in all directions.

[0095] For the basis vector coefficients in the x' axis direction, first determine P(x1,y1,z1),Q(x2,y2,z2), then The basis vectors of the x' axis corresponding to the target coordinate system O'-x'y'z' are:

[0096]

[0097] Therefore, the basis vector coefficient in the x' axis direction is: A0 = n 2x ,B0=n 2y ,C0=n 2z .

[0098] Similarly, we can get:

[0099] The basis vector coefficient in the y' axis direction is: A1 = n 3x ,B1=n 3y ,C1=n 3z .

[0100] The basis vector coefficient in the z' axis direction is: A2 = n 1x ,B2=n 1y ,C2=n 1z .

[0101] like Figure 5 As shown, the obtained coordinate transformation relationship includes:

[0102] x new =x old *n2x +y old *n 3x +z old *n 1x ,

[0103] y new =x old *n 2y +y old *n 3y +z old *n 1y ,

[0104] z new =x old *n 2z +y old *n 3z +z old *n 1z ,

[0105] Among them, (x new ,y new ,z new ) is the radius vector The coordinates in the target coordinate system O'-x'y'z', (x old ,y old ,z old ) is the coordinate of point S on the three-dimensional model in the original coordinate system O-xyz, is the basis vector coefficient of the target coordinate system O'-x'y'z' relative to the original coordinate system O-xyz, (n 1x ,n 1y ,n 1z ) is the first direction vector (n 2x ,n 2y ,n 2z ) is the second direction vector (n 3x ,n 3y ,n 3z ) is the third direction vector

[0106] x′ new =x new +x O'O ,

[0107] y′ new =y new +y O'O ,

[0108] z′ new =z new +z O'O ,

[0109] Among them, (x' new ,y' new ,z' new ) is the coordinate of point S on the three-dimensional model in the target coordinate system O'-x'y'z', O is the origin of the original coordinate system O-xyz, and O' is the target origin.

[0110] Step S3: using the coordinate transformation relationship, calculate the index range of the target projection of the three-dimensional model on the projection plane.

[0111] like Figure 6 As shown, step S3 includes the following sub-steps:

[0112] Step S31: Obtain the projection coordinate range of the target projection on the projection plane according to the original coordinate information and the coordinate conversion relationship.

[0113] Combination Figure 5 , using the coordinate conversion relationship, substitute the original coordinates of each point on the three-dimensional model 1 in the original coordinate system O-xyz into the corresponding coordinate conversion formula, obtain the target coordinates of each point in the target coordinate system O'-x'y'z', confirm the coordinate range of each three-dimensional unit on the x'y' plane corresponding to the target coordinate system O'-x'y'z', compare the coordinate range of each three-dimensional unit, record the maximum and minimum values ​​of the coordinates in the x' axis direction, and the maximum and minimum values ​​of the coordinates in the y' axis direction, so as to obtain the projection coordinate range of the target projection 2 of the three-dimensional model 1 on the projection plane. Among them, the projection coordinate range includes the coordinate range in the x' axis direction (x min ,x max ), and the coordinate range in the y' direction (y min ,y max ), x min is the minimum value of the x' axis coordinate in the coordinate range of all three-dimensional elements. max is the maximum value of the x'-axis coordinate in the coordinate range of all three-dimensional elements, and y min is the minimum value of the coordinates in the y' direction in the coordinate range of all three-dimensional elements, y max It is the maximum value of the coordinate in the y' direction in the coordinate range of all three-dimensional elements.

[0114] Step S32: establishing a two-dimensional grid according to the projection coordinate range, wherein the two-dimensional grid includes a plurality of grid units.

[0115] like Figure 7 As shown, through the coordinate range on the x' axis (x min ,x max ), and the coordinate range on the y' axis (y min ,y max), forming a two-dimensional rectangle, dividing the two-dimensional rectangle to form a two-dimensional grid 4, and the two-dimensional grid 4 includes 7*8=56 grid units, and the projections of multiple three-dimensional units of the three-dimensional model 1 exist inside the two-dimensional grid 4, wherein the projection of each three-dimensional unit is a polygon, and each polygon has a centroid, that is, the center of the polygon.

[0116] In some other embodiments, the projection coordinate range and the number of grid cells of the two-dimensional grid 4 are adaptively adjusted according to the size of the three-dimensional model 1 and the number of three-dimensional cells to facilitate the calculation of the projection area of ​​the target projection 2, wherein the more grid cells of the two-dimensional grid 4, the higher the accuracy of the calculation result.

[0117] Step S33: determining the index range of the target projection in the two-dimensional grid according to the target coordinates of the three-dimensional model in the target coordinate system.

[0118] Based on the above content, it can be known that the target projection 2 includes the projections of multiple three-dimensional units. Therefore, to determine the index range of the target projection 2 in the two-dimensional grid, it is necessary to first determine the index range of the projection of each three-dimensional unit in the two-dimensional grid. Among them, the index range includes the horizontal grid range in the x'-axis direction and the vertical grid range in the y'-axis direction. The minimum and maximum coordinates of the projection of the three-dimensional unit in the x'-axis direction correspond to two grid units in the x'-axis direction, respectively, thereby determining the horizontal grid range in the x'-axis direction, and the minimum and maximum coordinates of the projection of the three-dimensional unit in the y'-axis direction correspond to two grid units in the y'-axis direction, respectively, thereby determining the vertical grid range in the y'-axis direction. Therefore, the index range can be expressed as Among them, (I min ,I max ) represents the horizontal grid range, I min and I max Indicates the minimum and maximum numbers of the grid cells within the horizontal grid range, (J min ,J max ) represents the vertical grid range, J min and J max They respectively represent the minimum and maximum numbers of the grid cells within the vertical grid range.

[0119] According to the coordinate range of each three-dimensional unit on the x'y' plane corresponding to the target coordinate system O'-x'y'z' determined in step S31, all three-dimensional units are traversed to determine the index range of the projection of each three-dimensional unit in the two-dimensional grid 4.

[0120] like Figure 7As shown, the projection corresponding to a three-dimensional unit is unit projection 21, then the target projection 1 includes unit projection 21. Taking unit projection 21 as an example, the index range of unit projection 21 in the two-dimensional grid 4 is Correspondingly, the index ranges of the projections corresponding to other three-dimensional units in the two-dimensional grid can also be expressed accordingly, which will not be described in detail here.

[0121] Step S4: according to the index range, set the grid state information of the target projection on the projection plane.

[0122] After determining the index range of the projections corresponding to all three-dimensional cells in the two-dimensional grid, the step of determining the index range of the target projection in the two-dimensional grid is completed. According to the index range of the projection corresponding to each three-dimensional cell in the two-dimensional grid, the grid state information of the grid cell where the projection corresponding to each three-dimensional cell is located can be set.

[0123] Specifically, step S4 includes the following steps:

[0124] Traverse all grid cells within the index range, define the line connecting the centroid of the grid cell and the centroid of the target projection as the centroid line, and determine whether the centroid line intersects with the edge of the target projection;

[0125] If the centroid line intersects the edge of the target projection, the grid cell is not within the target projection and the grid cell is set to 0;

[0126] If the centroid line does not intersect the edge of the target projection, the grid cell is within the target projection, and the grid cell is set to 1; wherein the grid state information is whether the grid cell is set to 1 or 0.

[0127] Combination Figure 8-Figure 10 As shown, taking unit projection 21 as an example, let the centroid of unit projection 21 be N, the centroid of grid unit (3, 5) be M1, the line connecting M1 and N intersects with the edge AB of unit projection 21, the corresponding grid unit (3, 5) is not in unit projection 21, and the grid unit (3, 5) is set to 0. Let the centroid of grid unit (4, 4) be M2, the line connecting M2 and N does not intersect with all the edges of unit projection 21, the corresponding grid unit (4, 4) is in unit projection 21, and the grid unit (4, 4) is set to 1. Accordingly, traverse the index range All grid cells within the Fig.10 Results shown.

[0128] The process of judging whether the centroid line intersects the edge of the target projection includes the following steps:

[0129] The origin of the plane coordinate system where the target projection is located, the edge of the unit projection contained in the target projection, the centroid of the unit projection and the centroid of the grid unit are combined into a parametric equation, the parameter values ​​are solved, and then the intersection of the centroid line and the edge of the target projection is determined based on the range of the parameter values.

[0130] Corresponding to the above steps, specifically, when determining whether the centroid line intersects with the edge of the unit projection 21, the steps include:

[0131] First, the combined parametric equations include: and Solve the parameter values ​​λ and μ, where O1 is the origin of the plane coordinate system O1-x'y' where the target projection 2 is located, AB is the edge of the unit projection 21 contained in the target projection 2, N is the centroid of the unit projection 21, M is the centroid of the grid unit, and λ and μ are the first parameter and the second parameter, respectively.

[0132] The parameter equations are further calculated as follows:

[0133]

[0134] Among them, (x B ,y B ) is the coordinate of point B on the plane coordinate system O1-x'y', (x A ,y A ) is the coordinate of point A on the plane coordinate system O1-x'y', (x M ,y M ) is the coordinate of point M on the plane coordinate system O1-x'y', (x N ,y N ) are the coordinates of point N in the plane coordinate system O1-x'y'.

[0135] Secondly, if the parameter value range is: λ∈[0,1],μ∈[0,1], then the centroid line intersects with the edge of the unit projection 21; otherwise, the centroid line does not intersect with the edge of the unit projection 21.

[0136] Among them, for the projections corresponding to other three-dimensional cells, the steps of setting the grid state information of the grid cell where the corresponding projection is located are similar to the above process and will not be repeated here. It should be noted that for the grid cell that has been set to 1, it cannot be set to 0 in the step of setting the grid state information of the grid cell where the subsequent three-dimensional cell corresponding projection is located.

[0137] Step S5: Calculate the projection area of ​​the target projection according to the grid state information.

[0138] In the present application, since the projection coordinate range is fixed, the total area of ​​the two-dimensional grid 4 can be directly calculated. According to the number of grid cells set to 1, the proportion (proportion value) of the target projection 2 in the two-dimensional grid 4 can be determined. The total area of ​​the two-dimensional grid 4 is multiplied by the proportion to obtain the projection area of ​​the target projection 2.

[0139] Specifically, if Fig.12 As shown, step S5 includes the following sub-steps:

[0140] Step S51: judging whether each grid unit is set to 1 according to the grid status information.

[0141] Combination Fig.11 , traverse all grid cells in the two-dimensional grid 4, determine whether each grid cell is set to 1, retain all grid cells set to 1, and the remaining grid cells are grid cells set to 0 and grid cells not set to 1 or 0.

[0142] Step S52: Count the proportion of the grid cells set to 1 in the projection coordinate range of the target projection.

[0143] Combination Fig.11 For target projection 2, the number of all grid cells set to 1 that are retained is 22, and the proportion of grid cells set to 1 in the entire two-dimensional grid is 22 / 56=11 / 28, that is, the proportion of grid cells set to 1 in the projection coordinate range of target projection 2 is 11 / 28, and the corresponding proportion of grid cells set to 1 in the index range of target projection 2 (including the index range of the projections corresponding to all three-dimensional cells in the two-dimensional grid 4) is 22 / 43.

[0144] Step S53: Obtain the projection area of ​​the target projection according to the projection coordinate range and the proportion value.

[0145] Among them, according to the coordinate range on the x' axis (x min ,x max ) and the coordinate range on the y' axis (y min ,y max ), we can get the total area of ​​the two-dimensional grid 4 as (x max -x min )(y max -y min ). The total area (x max -x min )(y max -y min ) and the proportion value 11 / 28, the projection area of ​​target projection 2 is 11 / 28 (x max -x min )(ymax -y min ).

[0146] It should be noted that, in actual use, the number of three-dimensional units constituting the three-dimensional model 1 may be tens of thousands, the corresponding number of points constituting all three-dimensional units may be hundreds of thousands, and the corresponding number of grid units of the two-dimensional grid 4 may be thousands or even tens of thousands. For ease of understanding, the above embodiment mainly describes the method for calculating the projection area of ​​the corresponding three-dimensional model 1 when the number of three-dimensional units constituting the three-dimensional model 1 is in the single digit and the number of grid units of the two-dimensional grid 4 is in the hundreds.

[0147] The time complexity of the projection area calculation method based on the three-dimensional model of the present application is O(n), where n is the number of three-dimensional units of the three-dimensional model (the so-called three-dimensional unit is the small polyhedron divided from the three-dimensional model), and the calculation time is linearly related to n.

[0148] Based on the same inventive concept, Fig.13 As shown, the present application also provides a projection area calculation device based on a three-dimensional model, the device comprising:

[0149] A data acquisition unit 101 is used to acquire original data of the three-dimensional model, where the original data includes a first direction vector and original coordinate information of the three-dimensional model, where the first direction vector is a normal vector of the projection plane, and the direction of the first direction vector is a projection direction of the three-dimensional model;

[0150] A coordinate conversion unit 102 is used to perform coordinate conversion according to the original data and obtain a coordinate conversion relationship;

[0151] An index determination unit 103, used to calculate an index range of a target projection of the three-dimensional model on the projection plane by using a coordinate transformation relationship;

[0152] A state setting unit 104, used to set the grid state information of the target projection on the projection plane according to the index range;

[0153] The calculation unit 105 is used to calculate the projection area of ​​the target projection according to the grid state information.

[0154] like Fig.14 As shown, the calculation unit 105 includes a judgment subunit 106, a statistics subunit 107 and an acquisition subunit 108. The judgment subunit 106 is used to judge whether each grid unit within the projection coordinate range of the target projection is set to 1 according to the grid state information; the statistics subunit 107 is used to count the proportion of the grid units set to 1 in the projection coordinate range; the acquisition subunit 108 is used to obtain the projection area of ​​the target projection according to the projection coordinate range and the proportion.

[0155] Among them, Fig.15 As shown, the index determination unit 103 may also include a coordinate sub-unit 110, a grid sub-unit 111 and an index sub-unit 112, wherein the coordinate sub-unit 110 is used to obtain a projection coordinate range of the target projection on the projection plane according to the original coordinate information and the coordinate conversion relationship; the grid sub-unit 111 is used to establish a two-dimensional grid according to the projection coordinate range, and the two-dimensional grid includes a plurality of grid units; the index sub-unit 112 is used to determine an index range of the target projection in the two-dimensional grid according to the target coordinates of the three-dimensional model in the target coordinate system.

[0156] Correspondingly, other functional units such as the data acquisition unit 101, the coordinate conversion unit 102 and the state setting unit 104 are respectively used to realize their respective corresponding functions, which can be referred to the description in the above-mentioned corresponding method embodiments and will not be repeated here.

[0157] Based on the same inventive concept, the present application also provides an electronic device, which includes a processor, a memory and a communication circuit, and the processor is connected to the memory and the communication circuit respectively; wherein the communication circuit is used for communication connection, the memory is used to store a computer program, and the processor is used to execute the computer program to implement the above-mentioned projection area calculation method.

[0158] See also Fig.16 The electronic device described in the embodiment of the present application may specifically include a processor 210 and a memory 220. The memory 220 is coupled to the processor 210.

[0159] The processor 210 is used to control the operation of the electronic device. The processor 210 may also be referred to as a CPU (Central Processing Unit). The processor 210 may be an integrated circuit chip having the ability to process signals. The processor 210 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 210 may also be any conventional processor, etc.

[0160] The memory 220 is used to store computer programs, and may be a RAM, a ROM, or other types of storage terminals. Specifically, the memory 220 may include one or more computer-readable storage media, which may be non-transitory or transient. The memory 220 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage terminals, flash memory storage terminals. In some embodiments, the non-transitory computer-readable storage medium in the memory 220 is used to store at least one program code.

[0161] The processor 210 is used to execute the computer program stored in the memory 220 to implement the methods described in the various method embodiments of the present application.

[0162] In some embodiments, the electronic device may further include: a peripheral terminal interface 230 and at least one peripheral terminal. The processor 210, the memory 220 and the peripheral terminal interface 230 may be connected via a bus or a signal line. Each peripheral terminal may be connected to the peripheral terminal interface 230 via a bus, a signal line or a circuit board. Specifically, the peripheral terminal includes: at least one of a radio frequency circuit 240, a display screen 250, an audio circuit 260 and a power supply 270.

[0163] The peripheral terminal interface 230 may be used to connect at least one peripheral terminal related to I / O (Input / output) to the processor 210 and the memory 220. In some embodiments, the processor 210, the memory 220, and the peripheral terminal interface 230 are integrated on the same chip or circuit board; in some other implementations, any one or two of the processor 210, the memory 220, and the peripheral terminal interface 230 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0164] The radio frequency circuit 240 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 240 communicates with the communication network and other IoT devices through electromagnetic signals, and the radio frequency circuit 240 is the communication circuit of the electronic device. The radio frequency circuit 240 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 240 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, an operator identity module card, and the like. The radio frequency circuit 240 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 240 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.

[0165] The display screen 250 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 250 is a touch display screen, the display screen 250 also has the ability to collect touch signals on the surface or above the surface of the display screen 250. The touch signal can be input to the processor 210 as a control signal for processing. At this time, the display screen 250 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 250 can be one, set on the front panel of the electronic device; in other embodiments, the display screen 250 can be at least two, respectively set on different surfaces of the electronic device or in a folding design; in other embodiments, the display screen 250 can be a flexible display screen, set on a curved surface or a folding surface of the electronic device. Even, the display screen 250 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 250 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).

[0166] The audio circuit 260 may include a microphone and a speaker. The microphone is used to collect sound waves from the operator and the environment, and convert the sound waves into electrical signals and input them into the processor 210 for processing, or input them into the radio frequency circuit 240 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged in different parts of the electronic device. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 210 or the radio frequency circuit 240 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 260 may also include a headphone jack.

[0167] The power supply 270 is used to power various components in the electronic device. The power supply 270 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 270 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0168] For a detailed description of the functions and execution processes of each functional module or component in the electronic device embodiment of the present application, reference can be made to the description in the above-mentioned method embodiments of the present application, which will not be repeated here.

[0169] In the several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the various embodiments of the electronic devices described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0170] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0171] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0172] Based on the same inventive concept, the present application also provides a computer-readable storage medium storing a computer program, which can be executed by a processor to implement the above-mentioned projection area calculation method.

[0173] See also Fig.17 , if the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium 300. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions / computer programs to enable an IoT device (which can be a personal computer, server, or network terminal, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical disks, and electronic terminals such as computers, mobile phones, laptops, tablet computers, cameras, etc. having the above-mentioned storage media.

[0174] The description of the execution process of the program data in the computer-readable storage medium can refer to the description in the above-mentioned method embodiments of the present application, and will not be repeated here.

[0175] It can be seen that the present invention discloses a method, device, equipment and medium for calculating the projection area based on a three-dimensional model, the method comprising the following steps: obtaining the original data of the three-dimensional model, the original data comprising a first direction vector and the original coordinate information of the three-dimensional model, the first direction vector being the normal vector of the projection plane, and the direction of the first direction vector being the projection direction of the three-dimensional model; performing coordinate transformation according to the original data, and obtaining a coordinate transformation relationship; using the coordinate transformation relationship, calculating the index range of the target projection of the three-dimensional model on the projection plane; according to the index range, setting the grid state information of the target projection on the projection plane; and calculating the projection area of ​​the target projection according to the grid state information. The time complexity of the projection area calculation method of the present invention is O(n), and the projection area of ​​the three-dimensional model in any direction can be quickly calculated.

[0176] The above are only embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any equivalent structural transformations made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are included in the protection scope of the present invention.

Claims

1. A method for calculating the projection area based on a three-dimensional model. It is characterized in that The method comprises the following steps: Acquire original data of the three-dimensional model, the original data including a first direction vector and original coordinate information of the three-dimensional model, the first direction vector is a normal vector of a projection plane, and the direction of the first direction vector is a projection direction of the three-dimensional model; According to the original data, coordinate transformation is performed to obtain a coordinate transformation relationship; Calculating the index range of the target projection of the three-dimensional model on the projection plane using the coordinate transformation relationship; According to the index range, setting grid state information of the target projected on the projection plane; The projection area of ​​the target projection is calculated according to the grid state information.

2. The method for calculating the projection area according to claim 1, It is characterized in that The coordinate conversion is performed according to the original data, comprising the steps of: According to the first direction vector, obtaining a second direction vector located on the projection plane; Taking a cross product of the first direction vector and the second direction vector to obtain a third direction vector; A target origin is determined according to the original coordinate information, and a target coordinate system is constructed using the target origin, the first direction vector, the second direction vector, and the third direction vector.

3. The method for calculating the projection area according to claim 2, It is characterized in that The method of calculating the index range of the target projection of the three-dimensional model on the projection plane by using the coordinate transformation relationship comprises the steps of: Obtaining a projection coordinate range of the target projected on the projection plane according to the original coordinate information and the coordinate conversion relationship; Establishing a two-dimensional grid according to the projection coordinate range, wherein the two-dimensional grid includes a plurality of grid cells; The index range of the target projection in the two-dimensional grid is determined according to the target coordinates of the three-dimensional model in the target coordinate system.

4. The method for calculating the projection area according to claim 1, It is characterized in that The step of setting the grid state information of the target projected on the projection plane according to the index range comprises the steps of: Traversing all grid cells within the index range, defining a line connecting the centroid of the grid cell and the centroid of the target projection as a centroid line, and determining whether the centroid line intersects with an edge of the target projection; If the centroid line intersects the edge of the target projection, the grid cell is not within the target projection, and the grid cell is set to 0; If the centroid line does not intersect the edge of the target projection, the grid unit is within the target projection, and the grid unit is set to 1; wherein the grid state information is whether the grid unit is set to 1 or 0.

5. The method for calculating the projection area according to claim 4, It is characterized in that The step of determining whether the centroid line intersects with the edge of the target projection comprises the following steps: The origin of the plane coordinate system where the target projection is located, the edge of the unit projection contained in the target projection, the centroid of the unit projection and the centroid of the grid unit are combined into a parametric equation, the parameter values ​​therein are solved, and then according to the range of the parameter values, the intersection of the centroid line and the edge of the target projection is determined.

6. The method for calculating the projection area according to claim 4, It is characterized in that The step of calculating the projection area of ​​the target projection according to the grid state information comprises the steps of: According to the grid state information, determining whether each of the grid units is set to 1; Counting the proportion of the grid cells set to 1 in the projection coordinate range of the target projection; The projection area of ​​the target projection is obtained according to the projection coordinate range and the proportion value.

7. A projection area calculation device based on a three-dimensional model, It is characterized in that The device comprises: A data acquisition unit, configured to acquire original data of a three-dimensional model, wherein the original data includes a first direction vector and original coordinate information of the three-dimensional model, wherein the first direction vector is a normal vector of a projection plane, and the direction of the first direction vector is a projection direction of the three-dimensional model; A coordinate conversion unit, used for performing coordinate conversion according to the original data and obtaining a coordinate conversion relationship; An index determination unit, configured to calculate an index range of a target projection of the three-dimensional model on the projection plane using the coordinate transformation relationship; A state setting unit, used for setting the grid state information of the target projected on the projection plane according to the index range; A calculation unit is used to calculate the projection area of ​​the target projection according to the grid state information.

8. The projection area calculation device according to claim 7, It is characterized in that The computing unit comprises: A judging subunit, used to judge whether each grid unit within the projection coordinate range of the target projection is set to 1 according to the grid state information; A statistical subunit, used for counting the proportion of the grid cells set to 1 in the projection coordinate range; The acquisition subunit is used to obtain the projection area of ​​the target projection according to the projection coordinate range and the proportion value.

9. An electronic device, It is characterized in that The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.

10. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.