Method, system, electronic device and storage medium for determining sampling points within a space
By determining the target convex angle and sampling ray in a space plane with holes, calculating the intersection coordinates, and selecting the nearest intersection point as the sampling point, the problem of low point acquisition efficiency and high resource consumption in the prior art is solved, realizing efficient and accurate sampling point acquisition, which is suitable for Boolean operations on complex graphics.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- PINMING TECH CO LTD
- Filing Date
- 2023-04-28
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies are inefficient and resource-intensive when sampling points in a plane with holes, making it difficult to obtain the correct sampling points. This is especially true for complex shapes such as extremely thin rings and concave polygons, where conventional methods are prone to falling into hole regions or consuming excessive resources.
By obtaining the target convex angle in the sampled graphic of the building component, the sampling ray is determined, and the intersection coordinates are obtained by traversing the edge lines. The sampling point is determined in the graphic using the intersection coordinates. The intersection point is calculated using the directional area ratio method of similar triangles, and the intersection point closest to the starting point of the ray is selected as the sampling point.
It enables efficient and accurate acquisition of sampling points within a perforated spatial plane, avoiding resource waste. It is suitable for complex graphics such as extremely thin rings and concave polygons, ensuring that the sampling points are located inside the graphics and improving the accuracy of Boolean operations.
Smart Images

Figure CN116631004B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer graphics technology, and in particular to a method, system, electronic device, and storage medium for determining sampling points in space. Background Technology
[0002] In architectural drawings, it is often necessary to perform Boolean operations on different components, such as intersection, union, and difference, to obtain the required surface. The shapes of these components may be very complex. Therefore, the correctness of point selection is very important when performing Boolean operations, as it will directly affect the final Boolean operation result.
[0003] In related technologies, most point sampling methods in the spatial plane use the midpoint of two points separated by a point in the graphic point set as the sampling point. However, for concave polygons and other graphics with holes, the sampling points obtained by this method may not be in the actual graphic. Alignment and detection are performed in the spatial plane. If the detection fails, it needs to be detected again until the sampling point located in the plane is obtained.
[0004] In summary, the point-sampling methods in related technologies have at least the following drawbacks:
[0005] 1. For extremely thin annular shapes, the method of using the midpoint will most likely fall into the region with holes, and even after multiple samplings, it is still difficult to find an effective sampling point;
[0006] 2. Although existing mature algorithms (such as BSP algorithm, Binary Space Partitioning) can be used to detect whether the sampling points are valid (whether they fall into the region with holes), this process is resource-intensive, and the resources consumed are extremely large when encountering components with holes of different shapes, such as concave polygons.
[0007] 3. For non-standard grid-shaped maps, it is impossible to obtain the correct sampling points.
[0008] Currently, no effective solution has been proposed for the problem of not being able to quickly obtain points in a plane with holes in the related technologies. Summary of the Invention
[0009] This application provides a method, system, computer device, and computer-readable storage medium for determining sampling points in a perforated space, so as to at least solve the problem in the related art of not being able to quickly obtain points in a perforated space plane.
[0010] In a first aspect, embodiments of this application provide a method for determining sampling points in space, the method comprising:
[0011] Obtain the sampled graphic of the building component in the drawing, and determine the target convex corner in the sampled graphic;
[0012] Obtain the sampling ray corresponding to the target convex angle, traverse the edges of the graphic to be sampled, and obtain the coordinates of the intersection points of all edges of the graphic to be sampled with the sampling ray;
[0013] Based on the coordinates of the intersection point, the sampling point is determined in the graphic to be sampled.
[0014] In some embodiments, obtaining the sampling ray corresponding to the target convex angle includes:
[0015] Obtain the initial and final sides of the target convex angle, and the corresponding first and second vectors;
[0016] The ray direction is determined by accumulating the first vector and the second vector, and the sampling ray is determined based on the vertex coordinates of the target convex angle and the ray direction.
[0017] In some embodiments, the ray direction is the average vector direction of the first vector and the second vector, and the ray direction points into the interior of the pattern to be sampled.
[0018] In some embodiments, for a pattern to be sampled that contains holes, determining the sampling point in the pattern based on the intersection of the rays includes:
[0019] Based on the coordinates of the intersection points and the vertex coordinates of the target convex angle, determine the relative distance between each intersection point and the target convex angle;
[0020] From multiple sets of relative distances, obtain the target intersection point corresponding to the set with the smallest relative distance;
[0021] The sampling line segment is determined based on the intersection of the vertex coordinates and the target point, and the sampling point is selected in the sampling line segment.
[0022] In some embodiments, the coordinates of the intersection points of all edges of the graphic to be sampled and the sampling ray are obtained by using the directional area ratio of similar triangles.
[0023] In some embodiments, obtaining the coordinates of the intersection points of all edges of the graphic to be sampled and the sampling ray includes:
[0024] Determine directed line segments on the sampling ray that can intersect the edge line;
[0025] The directed line segment is translated to one end of the edge line to obtain a second directed line segment;
[0026] The perpendicular lines of the endpoints of the second directed line segment to the edge line segment are determined respectively to obtain the first perpendicular line segment and the second perpendicular line segment;
[0027] The target ratio is determined based on the first vertical line segment and the second vertical line segment, and the intersection coordinates are determined based on the vertex coordinates of the target convex angle, the target ratio, and the sampling direction.
[0028] In some embodiments, determining the target convex angle in the image to be sampled includes: traversing all endpoints of the image to be sampled in a clockwise or counterclockwise direction, and determining the normal vector corresponding to the vector formed by any endpoint, its preceding endpoint, and its following endpoint;
[0029] Determine whether the direction of the normal vector is consistent with the traversal order. If so, mark the angle corresponding to the endpoint as a convex angle, and select one convex angle from all convex angles as the target convex angle.
[0030] Secondly, embodiments of this application provide a system for determining sampling points in space, the system comprising: an acquisition module and a sampling point selection module, wherein:
[0031] The acquisition module is used to acquire the sampled graphic of the building component in the drawing, determine the target convex angle in the sampled graphic, and...
[0032] Obtain the sampling ray corresponding to the target convex angle, traverse the edges of the graphic to be sampled, and obtain the coordinates of the intersection points of all edges of the graphic to be sampled with the sampling ray;
[0033] The sampling point selection module is used to determine the sampling point in the graphic to be sampled based on the intersection coordinates.
[0034] Thirdly, embodiments of this application provide a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.
[0035] Fourthly, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect above.
[0036] Compared to related technologies, this application provides a method for determining sampling points in space. This method involves obtaining the corresponding architectural component's drawing in a blueprint, identifying a target convex corner within that drawing, obtaining the sampling ray corresponding to the target convex corner, traversing the edges of the drawing, and obtaining the coordinates of all intersection points between the edges and the sampling ray. Based on these intersection coordinates, sampling points are determined within the drawing. This method solves the problem of rapidly selecting sampling points in a plane with openings, achieving accurate and efficient selection of sampling points without consuming excessive resources. Attached Figure Description
[0037] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0038] Figure 1 This is a schematic diagram illustrating the application environment of a method for determining sampling points in a spatial plane according to an embodiment of this application;
[0039] Figure 2 This is a flowchart of a method for determining sampling points in space according to an embodiment of this application;
[0040] Figure 3 This is a schematic diagram of determining a sampling ray according to an embodiment of this application;
[0041] Figure 4 This is a schematic diagram illustrating the determination of sampling points in a perforated space according to an embodiment of this application;
[0042] Figure 5 This is a schematic diagram illustrating the determination of sampling points for an extremely thin annular pattern according to an embodiment of this application;
[0043] Figure 6 This is a schematic diagram illustrating the determination of sampling points for a concave polygonal shape according to an embodiment of this application;
[0044] Figure 7 This is a schematic diagram of a tic-tac-toe pattern according to an embodiment of this application;
[0045] Figure 8 This is a schematic diagram illustrating the calculation of the intersection point of a sampling ray and a graphic edge according to an embodiment of this application;
[0046] Figure 9 This is a schematic diagram of a system for determining sampling points in space according to an embodiment of this application;
[0047] Figure 10 This is a schematic diagram of the internal structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0049] Obviously, the accompanying drawings described below are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar scenarios based on these drawings without any inventive effort. Furthermore, it is understood that although the efforts made in this development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, any changes to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.
[0050] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0051] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application refers to two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following objects are in an "or" relationship. The terms "first," "second," and "third" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.
[0052] In this document, it should be understood that the terms used may be technical means used to implement part of this invention or other summary technical terms. For example, the terms may include:
[0053] Building components: Building components refer to the various parts or elements that make up a building, including but not limited to walls, columns, beams, slabs, frames, foundations, roofs, stairs, handrails, doors, and windows. These components can be classified according to their different characteristics such as materials, shapes, structures, and functions.
[0054] Convex angle: An angle less than 180° and greater than 0° is called a convex angle, also known as a minor angle.
[0055] Concave angle: An angle less than 360° and greater than 180° is called a concave angle, also known as a concave angle.
[0056] Convex polygon: A polygon whose interior angle is less than 180 degrees is a concave polygon.
[0057] A concave polygon is defined as having at least one interior angle greater than 180 degrees (a concave angle).
[0058] The method for determining sampling points in a spatial plane provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, Figure 1This is a schematic diagram illustrating the application environment of a method for determining sampling points in a spatial plane according to an embodiment of this application, such as... Figure 1 As shown, terminal 10 communicates with server 11 via a network. Terminal 10 is equipped with computer graphics-based architectural engineering software. During actual operation, terminal 10 obtains resource data reflecting the construction drawings from server 11 via the internet and edits this resource data in the architectural engineering software. For example, it samples the graphic corresponding to any building component, selecting a certain number of sampling points. It should be noted that in this embodiment, terminal 10 can be a smartphone, tablet, or other computer device, and server 11 can be a standalone server or a cloud server cluster.
[0059] This application provides a method for determining sampling points in space. Figure 2 This is a flowchart of a method for determining sampling points in space according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:
[0060] S201, Obtain the sampling graphic corresponding to the building component, and determine the target convex corner in the sampling graphic;
[0061] The building components involved in this embodiment can be components of any shape, such as rectangles, circles, polygons, convex polygons, etc.; the sampling graphic corresponding to the building component can be the shape of the building component in the architectural engineering software drawing.
[0062] Furthermore, in this embodiment, the target convex angle can be any convex angle in the image to be sampled, and the target convex angle can be any angle less than 180°. In order to obtain the ray pointing into the image, a convex angle needs to be determined in the image to be sampled first, and the ray used to determine the sampling point is determined by the direction of the bisector of the convex angle.
[0063] Specifically, determining the target convex angle in the image to be sampled includes: traversing all endpoints of the image to be sampled in a clockwise or counterclockwise direction, determining the normal vector corresponding to the vector formed by any endpoint, its predecessor endpoint, and its successor endpoint; determining whether the direction of the normal vector is consistent with the traversal order; if so, marking the angle corresponding to that endpoint as a convex angle, and selecting one convex angle from all convex angles as the target convex angle.
[0064] S202, obtain the sampling ray corresponding to the target convex corner, traverse the edges of the graphic to be sampled, and obtain the coordinates of the intersection points of all edges of the graphic to be sampled and the sampling ray;
[0065] Figure 3 This is a schematic diagram of determining a sampling ray according to an embodiment of this application, such as... Figure 3As shown, the sampling ray can be determined by accumulating the vectors diverging from both sides of the target convex angle. The endpoint of the sampling ray is the vertex of the convex angle, and the direction of the sampling ray is the direction of the average vector of the two vectors of the target convex angle.
[0066] Specifically, the sampled ray can be represented as: L = P + t * d, where P represents the starting point, d represents the vector of the imagined direction, and t represents the gain parameter used to simulate an infinitely long ray.
[0067] Furthermore, each edge of the graphic to be processed is determined, and the intersection points of the sampling ray with each edge of the graphic to be processed are calculated. Specifically, in this embodiment, the intersection points of the sampling ray with each edge can be solved by using the directional area ratio of similar triangles.
[0068] In this embodiment, the solution for the intersection points of the sampling ray and each edge line is obtained by using the directed area ratio of similar triangles, which generally includes the following steps:
[0069] Suppose two line segments are AB and CD. First, we need to determine whether line segments AB and CD intersect. If they do not intersect, then there is no intersection point. If they intersect, we can use the vector method of linear algebra to solve the problem.
[0070] Step 1: Convert line segments AB and CD into vectors AB and CD, respectively.
[0071] Step 2: Calculate the cross product of vectors AB and CD to obtain a vector E;
[0072] Step 3: Calculate the cross product of vectors CD and E to obtain vector F; calculate the cross product of vectors AB and E to obtain vector G; calculate the cross product of vectors CD and F to obtain vector H; calculate the dot product of vectors G and H to obtain the real number t.
[0073] Step 4: Obtain the coordinates of the intersection point O as either A+t*AB or C+t*CD.
[0074] It should be noted that the above method of determining the intersection point using the directional area ratio of similar triangles is only a specific example. It should be understood that, within the technical framework of determining sampling points based on convex ray in this application, any specific method used to calculate the coordinates of the intersection point of the ray and the edge should fall within the reasonable implementation scope of the solution in this application.
[0075] S203, Based on the intersection coordinates, determine the sampling points in the graphic to be sampled.
[0076] Preferably, in this embodiment, the midpoint of the line segment formed by the intersection point closest to the ray's origin and the ray's origin can be selected as the sampling point. Since any selected convex angle sampling ray must point inside the graphic, the midpoint obtained using this method must be located in the spatial plane.
[0077] Through the above steps S201 to S203, a method for determining sampling points for a plane with holes is provided, which eliminates the abnormal point detection process in conventional processing methods. It can ensure that the target points collected are located on the real surface of the graphic and satisfy any non-self-intersecting graphic and any case with holes. At the same time, it can also efficiently and accurately obtain the corresponding sampling points for "grid" shaped problems and extremely thin annular graphics.
[0078] This method first constructs a ray that starts from the convex corner of the graphic and passes through the graphic. It then finds all the intersection points of the ray with all the edges of the graphic. Finally, it selects the intersection point closest to the starting point of the ray and forms a line segment with the starting point of the ray. It then selects the midpoint of the line segment to obtain the sampling point of the graphic. Based on this sampling point, it performs Boolean operations on different components, such as finding intersection, union, and difference.
[0079] In some embodiments, in order to obtain a ray that can traverse the interior of the graphic, this embodiment can obtain the sampling ray using two direction vectors of any convex corner. Specifically, obtaining the sampling ray corresponding to the target convex corner includes the following steps:
[0080] Step 1: Obtain the initial and final sides of any target convex angle, and the corresponding first and second vectors. Generating the corresponding direction vectors based on the two sides of an angle is a fairly common method, so it will not be explained further in this embodiment.
[0081] Step 2: Determine the ray direction by accumulating the first and second vectors. Based on the vertex coordinates of the target convex angle and the ray direction, determine the sampling ray; the ray is determined by averaging the directions of the two vectors.
[0082] It should be noted that in any graphic corresponding to a component, the direction of the bisector of a certain convex angle must point to the interior of the graphic. Based on this characteristic, this embodiment uses the average vector of the convex angle to determine the ray used for sampling, ensuring that the sampling ray always points to the interior of the graphic to be sampled.
[0083] In some embodiments, after determining the intersection points of each ray with each edge of the pattern to be sampled, for a pattern to be sampled containing holes, determining sampling points in the pattern to be sampled based on the intersection points of the rays includes:
[0084] Step 1: Determine the relative distance between each intersection point and the target convex angle based on the coordinates of the intersection points and the vertex coordinates of the target convex angle.
[0085] Step 2: From multiple sets of relative distances, obtain the target intersection point corresponding to the set with the smallest relative distance;
[0086] Step 3: Determine the sampling line segment based on the intersection of the vertex coordinates and the target point, and select sampling points in the sampling line segment.
[0087] Figure 4 This is a schematic diagram illustrating the determination of sampling points in a perforated space according to an embodiment of this application, such as... Figure 4 As shown, after obtaining all intersection points, since there may be holes in the graphic, it is necessary to avoid the hole areas to select the points that are truly located in the plane. In this embodiment, the preferred method is to select the intersection point closest to the ray and form a line segment with the starting point of the ray. All points inside this line segment must be in the spatial plane, and valid and correct sampling points can be selected within this line segment.
[0088] Similarly, for extremely thin annular shapes to be sampled, the method provided in this embodiment can also efficiently and accurately obtain the correct sampling points. Figure 5 This is a schematic diagram illustrating the determination of sampling points for an extremely thin annular pattern according to an embodiment of this application, such as... Figure 5 As shown, any point can be selected as a sampling point from the line segment formed by the intersection points closest to the endpoint of the sampling ray.
[0089] Furthermore, for complex structures with openings, such as concave polygons, the method provided in this embodiment can also efficiently and accurately obtain the correct sampling points. Figure 6 This is a schematic diagram illustrating the determination of sampling points for a concave polygon shape according to an embodiment of this application, such as... Figure 6 As shown, the method of this application can avoid the high probability that sampling points will fall into the hole area outside the graphic in the traditional method, thus achieving efficient and accurate sampling point acquisition.
[0090] It should also be noted that for problems caused by unavoidable errors in actual engineering, such as the inability to effectively select sampling points within the "grid" shape of a line loop due to non-standard drawing, the sampling point selection method provided in this embodiment can also solve this problem. Specifically:
[0091] Figure 7 This is a schematic diagram of a grid pattern according to an embodiment of this application, such as... Figure 7 As shown, due to inaccurate drawing, a standard rectangle is drawn as a grid, with inaccurate division of the endpoints and significant errors. In this case, if the existing method of "using the midpoint of two points separated by a point as the sampling point" is used for sampling, the inaccurate endpoint delineation will also lead to inaccurate sampling point selection.
[0092] The sampling point selection method in this application, based on the intersection of rays, ensures efficient selection of sampling points. Furthermore, since the endpoints of the rays are the vertices of angles and the direction of the rays is the direction of the angle bisectors, regardless of the drawing quality, for rectangular components, the rays determined in this application will always originate from the vertex of one convex angle and point to the vertex of another convex angle. Therefore, the sampling points selected on this ray are more accurate than those in existing sampling methods.
[0093] In some embodiments, the present application uses the directed area ratio method of similar triangles to obtain the coordinates of the intersection points of all edges of the graphic to be sampled and the sampling ray, specifically including the following steps:
[0094] Determine the directed line segments that can intersect the edge lines on the sampling ray;
[0095] Translate the directed line segment to one of the endpoints of the edge line to obtain the second directed line segment;
[0096] Determine the perpendicular lines of the endpoints of the second directed line segment to the edge line segment to obtain the first perpendicular line segment and the second perpendicular line segment.
[0097] The target ratio is determined based on the first and second vertical line segments, and the intersection coordinates are determined based on the vertex coordinates of the target convex angle, the target ratio, and the sampling direction.
[0098] To facilitate understanding, this embodiment provides an example of how to calculate the coordinates of the intersection point between the sampling ray and any edge line. Specifically, Figure 8 This is a schematic diagram illustrating the calculation of the intersection point of a sampling ray and a graphic edge according to an embodiment of this application, such as... Figure 8 As shown:
[0099] Suppose we select a line segment AB of fixed length on the ray, with any side CD. Given the spatial coordinates of points A, B, C, and D, and considering that line segments AB and CD intersect at point O, we can obtain the coordinates of the intersection point O using the method of the directed area ratio of similar triangles. The specific steps are as follows:
[0100] ① Translate line segment AB so that point A coincides with point C, resulting in a new line segment CE;
[0101] ② Draw a perpendicular line from point A to CD, intersecting at point F, to obtain line segment AF. Similarly, draw a perpendicular line from point E to CD, intersecting at point G, to obtain line segment EG.
[0102] ③ Based on the parallelism, it is obvious that ∠AOF=∠GCE and right angle ∠AFO=right angle ∠CGE. Therefore, triangle AFO is similar to triangle CGE, so AF:GE=AO:CE=AO:AB;
[0103] ④ AO:AB = AF:GE = The ratio of the areas of triangles ACD and DEC = vector AC * vector CD : vector ED * vector EC = dValue;
[0104] ⑤ The coordinates of the intersection point O = A + dValue * vector AB.
[0105] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0106] This embodiment also provides a system for determining sampling points in space. This system is used to implement the above embodiments and preferred embodiments, and details already described will not be repeated. As used below, the terms "module," "unit," "subunit," etc., can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0107] Figure 9 This is a schematic diagram of a system for determining sampling points in space according to an embodiment of this application. The system includes: an acquisition module 90 and a sampling point selection module 91, wherein:
[0108] The acquisition module 90 is used to acquire the sampled graphic corresponding to the building component, determine the target convex corner in the sampled graphic, acquire the sampling ray corresponding to the target convex corner, traverse the edge lines of the sampled graphic, and acquire the coordinates of the intersection points of all edge lines of the sampled graphic and the sampling rays.
[0109] The sampling point selection module 91 is used to determine sampling points in the graphic to be sampled based on the intersection coordinates.
[0110] Using this system, a ray is constructed that starts from the convex corner of the figure and passes through the figure. All intersection points of the ray with all sides of the figure are found. Finally, the intersection point closest to the starting point of the ray is selected, and a line segment is formed with the starting point of the ray. The midpoint of this line segment is then selected. This midpoint must be located in the spatial plane.
[0111] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements a method for determining sampling points in space. The display screen of the computer device may be a liquid crystal display (LCD) or an electronic ink display. The input device of the computer device may be a touch layer covering the display screen, or buttons, a trackball, or a touchpad located on the casing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0112] In one embodiment, Figure 10 This is a schematic diagram of the internal structure of an electronic device according to an embodiment of this application, such as... Figure 10 As shown, an electronic device is provided, which can be a server, and its internal structure diagram can be as follows. Figure 10 As shown, the electronic device includes a processor, a network interface, internal memory, and non-volatile memory connected via an internal bus. The non-volatile memory stores an operating system, computer programs, and a database. The processor provides computing and control capabilities, the network interface communicates with external terminals via a network connection, the internal memory provides an environment for the operation of the operating system and computer programs, the computer programs are executed by the processor to implement a method for determining sampling points in space, and the database stores data.
[0113] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0114] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. 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 various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0115] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0116] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A method of determining sampling points within a space, characterized by, The method includes: Obtain the sampled image corresponding to the building component, and determine the target convex corner in the sampled image; Obtain the sampling ray corresponding to the target convex angle, traverse the edges of the figure to be sampled, and obtain the coordinates of the intersection points of all edges of the figure to be sampled and the sampling ray. The coordinates of the intersection points of all edges of the figure to be sampled and the sampling ray are obtained by the directional area ratio of similar triangles. Based on the intersection coordinates, the sampling point is determined in the image to be sampled. Specifically, for an image to be sampled containing a hole, determining the sampling point based on the intersection of the rays includes: Based on the coordinates of the intersection points and the vertex coordinates of the target convex angle, determine the relative distance between each intersection point and the target convex angle; From multiple sets of relative distances, obtain the target intersection point corresponding to the set with the smallest relative distance; The sampling line segment is determined based on the intersection of the vertex coordinates and the target point, and the sampling point is selected in the sampling line segment.
2. The method of claim 1, wherein, Obtaining the sampling ray corresponding to the target convex angle includes: Obtain the initial and final sides of the target convex angle, and the corresponding first and second vectors; The ray direction is determined by accumulating the first vector and the second vector, and the sampling ray is determined based on the vertex coordinates of the target convex angle and the ray direction.
3. The method of claim 2, wherein, The ray direction is the average vector direction of the first vector and the second vector, and the ray direction points into the interior of the image to be sampled.
4. The method of claim 1, wherein, The step of obtaining the coordinates of the intersection points of all edges of the graphic to be sampled and the sampling ray includes: Determine directed line segments on the sampling ray that can intersect the edge line; The directed line segment is translated to one end of the edge line to obtain a second directed line segment; Determine the perpendicular lines of the endpoints of the second directed line segment to the edge line segment to obtain the first perpendicular line segment and the second perpendicular line segment; The target ratio is determined based on the first vertical line segment and the second vertical line segment, and the intersection coordinates are determined based on the vertex coordinates of the target convex angle, the target ratio, and the sampling direction.
5. The method of claim 1, wherein, Determining the target convex angle in the image to be sampled includes: Traverse all endpoints of the image to be sampled in a clockwise or counterclockwise direction, and determine the normal vector corresponding to the vector formed by any endpoint, its predecessor endpoint, and its successor endpoint. Determine whether the direction of the normal vector is consistent with the traversal order. If so, mark the angle corresponding to the endpoint as a convex angle, and select one convex angle from all convex angles as the target convex angle.
6. A system for determining sample points within a space, the system comprising: The system includes: an acquisition module and a sampling point selection module, wherein: The acquisition module is used to acquire the sampled image corresponding to the building component, determine the target convex angle in the sampled image, and... Obtain the sampling ray corresponding to the target convex angle, traverse the edges of the figure to be sampled, and obtain the coordinates of the intersection points of all edges of the figure to be sampled and the sampling ray. The coordinates of the intersection points of all edges of the figure to be sampled and the sampling ray are obtained by the directional area ratio of similar triangles. The sampling point selection module is used to determine the sampling point in the image to be sampled based on the intersection coordinates. Specifically, for an image to be sampled containing a hole, determining the sampling point in the image based on the intersection of the rays includes: Based on the coordinates of the intersection points and the vertex coordinates of the target convex angle, determine the relative distance between each intersection point and the target convex angle; From multiple sets of relative distances, obtain the target intersection point corresponding to the set with the smallest relative distance; The sampling line segment is determined based on the intersection of the vertex coordinates and the target point, and the sampling point is selected in the sampling line segment.
7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and device for determining coordinates of neighborhood points of three-dimensional model and method and device for constructing three-dimensional model
CN103177474A
Positioning method, positioning system, computer readable storage medium and vehicle
CN111220943A