Methods, devices, and electronic equipment for processing model edge lines

By sampling position points on the model's edge lines and adjusting these points based on adjacency relationships and specified directions, the final edge lines are generated, solving the problems of edge line smoothness and consistency, simplifying the operation, and improving applicability.

CN114998119BActive Publication Date: 2025-11-14NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210511022.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-11
Publication Date
2025-11-14
Estimated Expiration
2042-05-11

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve high smoothness while maintaining consistency between edge lines and existing models, resulting in cumbersome operation and poor applicability.

Method used

By acquiring the initial edge lines of the target model, sampling position points and determining their adjacency relationships, dividing the point set based on the distance relationship in the specified direction, adjusting the position points to make them lie on the same straight line, and generating the final edge lines.

Benefits of technology

It achieves high smoothness of edge lines and high consistency with existing models, simplifies the operation process and improves applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114998119B_ABST
    Figure CN114998119B_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, and electronic device for processing model edge lines. The method includes: acquiring initial edge lines of a target model; sampling position points on the initial edge lines to obtain multiple position points arranged in a specified order; determining multiple target points with adjacent relationships from the multiple position points; dividing the multiple position points into at least one point set based on the distance relationship between the multiple target points with adjacent relationships in a specified direction; adjusting the positions of the position points in the point sets in the specified direction so that the position points in the point sets are on the same straight line; and obtaining the final edge lines of the target model based on the adjusted multiple position points. This method can eliminate many jagged edges in the edge lines, giving the lines better smoothness. Simultaneously, it maintains a high degree of consistency between the edge lines and the edges of existing models. This method is simple to operate and applicable to various edge line processing processes, exhibiting high applicability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of model processing technology, and in particular to a method, apparatus and electronic device for processing model edge lines. Background Technology

[0002] During model making, some models need to be built by attaching them to existing models. In this case, it's necessary to extract the edge information of the existing model and determine the position and shape of the model to be made based on this edge information. For example, when building a wall model along a road model, the edge lines of the road model need to be extracted, and then the position and shape of the wall model are determined based on these edge lines. When the edges of the existing model are complex, the extracted edge lines have many jagged edges, resulting in many uneven and segmented surfaces on the surface of the model built on top of the existing model, affecting the visual effect of the model. Related technologies use sampling and smoothing functions in modeling software to process the edge lines, but the adjustment of these functions' parameters has high randomness and coupling, making it difficult for the processed edge lines to both maintain consistency with the edges of the existing model and have good smoothness. This makes the operation cumbersome and has poor applicability. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a method, apparatus and electronic device for processing model edge lines, so as to eliminate more jagged edges of edge lines, make the lines have better smoothness, and at the same time maintain a high degree of consistency between the edge lines and the edges of existing models.

[0004] In a first aspect, embodiments of the present invention provide a method for processing model edge lines. The method includes: obtaining initial edge lines of a target model; sampling position points on the initial edge lines to obtain multiple position points arranged in a specified order; determining multiple target points with adjacent relationships from the multiple position points; dividing the multiple position points into at least one point set based on the distance relationship between the multiple target points with adjacent relationships in a specified direction; adjusting the positions of the position points in the point set in the specified direction so that the position points in the point set are located on the same straight line; and obtaining the final edge lines of the target model based on the adjusted multiple position points.

[0005] The aforementioned multiple location points include: the endpoints of the initial edge line and the midpoints located between the endpoints; the step of determining multiple target points with adjacent relationships from the multiple location points, and dividing the multiple location points into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction, includes: for the midpoint, determining the neighboring points of the midpoint from the multiple location points; judging whether the midpoint and the neighboring points are located in the same direction according to the distance relationship between the midpoint and the neighboring points in the specified direction, and obtaining the judgment result of the midpoint; and dividing the multiple location points into at least one point set based on the judgment result of the midpoint.

[0006] The aforementioned neighbor points include: a first neighbor point and a second neighbor point; in the specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; the step of determining whether the intermediate point and the neighbor point are located in the same direction based on the distance relationship between the intermediate point and the neighbor point in the specified direction, and obtaining the determination result of the intermediate point, includes: determining a first distance between the intermediate point and the first neighbor point in the first direction, and a second distance in the second direction; determining a third distance between the intermediate point and the second neighbor point in the first direction, and a fourth distance in the second direction; if the first magnitude relationship between the first distance and the second distance, and the second magnitude relationship between the third distance and the fourth distance satisfy the specified conditions, it is determined that the intermediate point and the neighbor point are located in the same direction.

[0007] The specified conditions include: the first distance is greater than the second distance, and the third distance is greater than the fourth distance; or, the first distance is less than the second distance, and the third distance is less than the fourth distance.

[0008] The aforementioned neighbor points include a first neighbor point and a second neighbor point; in the specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; the step of dividing multiple location points into at least one point set based on the determination result of the intermediate point includes: if the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in the same direction, dividing the first neighbor point, the intermediate point, and the second neighbor point into the same point set; if the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in different directions, dividing the first neighbor point and the intermediate point into a first point set, and dividing the second neighbor point into a second point set.

[0009] The step of adjusting the position of the points in the point set in the specified direction so that the points in the point set are on the same straight line includes: obtaining the initial position of the points in the point set in the specified direction; calculating the average value of the initial position of the points in the point set to obtain the average position in the specified direction; and adjusting the points in the point set to the average position so that the points in the point set are on the straight line formed by the average position.

[0010] The aforementioned multiple location points include: the endpoints of the initial edge line and the midpoints located between the endpoints; the steps of determining multiple target points with adjacent relationships from the multiple location points, dividing the multiple location points into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction; and adjusting the positions of the location points in the point set in the specified direction so that the location points in the point set are located on the same straight line include: taking each midpoint as the current point in a specified order, and performing the following first loop operation on the current point: initializing the point set array, starting from the current point, traversing the location points in the reverse order of the specified order until the first location point among the multiple location points is reached, and performing the following second loop operation on each traversed target point: determining the neighbor points of the target point from the multiple location points; judging whether the target point and the neighbor points are located in the same direction based on the distance relationship between the target point and the neighbor points in the specified direction, and obtaining the judgment result of the target point; and determining the location points in the point set array based on the judgment result of the target point, and adjusting the positions of the location points in the point set in the specified direction.

[0011] The steps described above, based on the judgment result of the target point, to determine the position points in the point set array and adjust the positions of the position points in the point set array in the specified direction, include: if the target point and its neighboring points are in the same direction, save the target point to the point set array, update the target point, and continue to execute the second loop operation; if the target point and its neighboring points are in different directions, save the target point to the point set array, calculate the average position of the position points between the target point and the current point in the point set array, and determine the average position as the new position of the position points between the target point and the current point; update the target point and continue to execute the second loop operation; if the first position point is reached, calculate the average position of the position points in the point set array and determine the average position as the new position of the position point in the point set array.

[0012] The specified directions mentioned above include a first direction and a second direction, which are perpendicular to each other; the step of obtaining the final edge lines of the target model based on the adjusted multiple position points includes: connecting the adjusted multiple position points in a specified order to obtain the final edge lines of the target model; wherein the final edge lines include line segments pointing to the first direction and line segments pointing to the second direction.

[0013] Secondly, embodiments of the present invention provide a processing apparatus for model edge lines, the apparatus comprising: a position point acquisition module, configured to acquire initial edge lines of a target model, sample position points on the initial edge lines to obtain a plurality of position points arranged in a specified order; a position point adjustment module, configured to determine a plurality of target points with adjacent relationships from the plurality of position points, divide the plurality of position points into at least one point set based on the distance relationship of the plurality of target points with adjacent relationships in a specified direction; adjust the positions of the position points in the point set in the specified direction so that the position points in the point set are located on the same straight line; and a line generation module, configured to obtain the final edge lines of the target model based on the adjusted plurality of position points.

[0014] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described method for processing model edge lines.

[0015] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above-described method for processing the edge lines of the model.

[0016] The embodiments of the present invention bring the following beneficial effects:

[0017] The above-mentioned method, apparatus, and electronic device for processing model edge lines obtain the initial edge lines of the target model, sample position points on the initial edge lines to obtain multiple position points arranged in a specified order; determine multiple target points with adjacent relationships from the multiple position points, divide the multiple position points into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction; adjust the positions of the position points in the point set in the specified direction so that the position points in the point set are located on the same straight line; and obtain the final edge lines of the target model based on the adjusted multiple position points.

[0018] In this method, a specified direction is predetermined. Based on the distance relationship between adjacent position points in the specified direction, the specified direction to which each position point belongs is determined. Then, the position points on the edge line are divided into point sets. The positions of the position points in the point sets are adjusted so that position points in the same point set lie on the same straight line, thereby eliminating many jagged edges in the edge line and giving the line better smoothness. Simultaneously, the point set division is based on the distance relationship between adjacent position points in the specified direction, ensuring that the trend of each position point is consistent, avoiding obvious distortion after edge line processing, and maintaining a high degree of consistency between the edge line and the edge of the existing model. This method is simple to operate and applicable to various edge line processing processes, exhibiting high applicability.

[0019] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0020] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0021] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0022] Figure 1 A flowchart illustrating a method for processing model edge lines according to an embodiment of the present invention;

[0023] Figure 2 This is a schematic diagram showing the distribution direction of multiple location points provided in an embodiment of the present invention;

[0024] Figure 3 This is a schematic diagram illustrating the adjustment method of multiple position points provided in an embodiment of the present invention;

[0025] Figure 4 This is a schematic diagram illustrating the effect of edge line adjustment in related technologies;

[0026] Figure 5 A schematic diagram illustrating the adjustment effect of edge lines provided in an embodiment of the present invention;

[0027] Figure 6 A schematic diagram of the structure of a device for processing model edge lines provided in an embodiment of the present invention;

[0028] Figure 7 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0029] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0030] In game development, 3D computer graphics software such as Houdini is often used for procedural modeling. This allows for the processing of different input content according to predefined rules and templates, resulting in an ideal output model or effect. In some model-making requirements, the model to be created needs to be built upon an existing model. Therefore, it is necessary to first preprocess the existing model, extract its edge lines, and use the relevant parameters of the edge lines as parameters for creating the new model.

[0031] Taking a road model as an example, when creating a wall model along the road model, it is necessary to first remove irregular small models from the road model, such as small models that are diagonally inserted on both sides of the main road model, small fragment models that do not affect the shape of the road edge, and areas on the surface of non-road models; then, fill the road model as a whole, extract the upper surface of the road model, extract the edge points of the road model, and connect the edge points to obtain the edge lines.

[0032] The above method typically produces an edge line with numerous jagged edges. The main reason for this jagged shape is the abundance of small, intricate details and shapes on the road model's surface. Furthermore, even after small models and areas are removed, the underlying surface may remain, leading to a series of interfering factors and resulting in numerous jagged edges and poor smoothness. If a wall panel is generated based on this edge line, it will have many bump and recessed segments. After importing it into the game engine and assigning wall materials, the visual effect of the wall model will be unsatisfactory.

[0033] In related technologies, edge lines are processed using Houdini's built-in system logic nodes. These nodes include the Resample node and the Facet node. The Resample node resamples all points on the line and numbers them sequentially, for example, starting from 1. Additionally, the Resample node provides an adjustable Length parameter; increasing this parameter reduces the number of sampled points and increases the distance between points, resulting in better line smoothness, but also causing line distortion and failing to maintain the original general edge shape. The Facet node smooths the line segment and provides the Remove Inside Points option and Distance value adjustment. Similarly, different parameters produce different results during adjustment, and there is no overall direction; it is highly random.

[0034] Each time a different model is processed, a significant amount of time is spent adjusting the parameters of the Resample and Facet nodes. The parameter adjustments for the Resample and Facet nodes are highly random, and these two node parameters are also coupled, jointly affecting the shape of the edge segments. Therefore, it is extremely difficult to achieve the desired edge effect, and there is a high probability that it cannot be achieved at all.

[0035] In summary, existing technologies struggle to achieve perfect smoothness of edge lines while maintaining the integrity of edge segments. Therefore, this invention provides a method, apparatus, and electronic device for processing model edge lines. This technology can be applied in model creation scenarios, particularly in scenarios where new models are created based on existing models.

[0036] First, see Figure 1 The method shown here is for processing the edge lines of a model. The method includes the following steps:

[0037] Step S102: Obtain the initial edge lines of the target model, sample position points on the initial edge lines, and obtain multiple position points arranged in a specified order;

[0038] When the target model is a three-dimensional model, it has multiple surfaces. The edge lines extracted from different surfaces may be different. In this case, based on the actual model making requirements, it is necessary to first determine the surface from the multiple surfaces of the target model to extract the edge lines, and then extract the edge lines of that surface to obtain the initial edge lines mentioned above.

[0039] In practice, the initial edge lines can be extracted using model processing software such as Houdini. Typically, some location points at the edges are pre-extracted from a specified surface of the target model, and then these points are connected to obtain the initial edge lines.

[0040] After obtaining the initial edge lines, the process of sampling position points on these lines can be achieved by resampling the initial edge lines using the Resample node. If position points already exist in the initial edge lines, this sampling process can be understood as re-acquiring the existing position points and sequentially numbering them to obtain multiple position points arranged in a specified order. The position point numbers can represent the specified order, for example, from smallest to largest or from largest to smallest. If no position points exist in the initial edge lines, position points can be sampled on the initial edge lines at a preset sampling distance and then numbered.

[0041] Step S104: Determine multiple target points with adjacent relationships from multiple location points; divide the multiple location points into at least one point set based on the distance relationship between the multiple target points with adjacent relationships in a specified direction; adjust the positions of the location points in the point set in the specified direction so that the location points in the point set are on the same straight line.

[0042] In this embodiment, the aim is to obtain an edge line that both fits the actual edge of the target model and has high smoothness. Therefore, when there are many jagged edges in the initial edge line, most of the jagged edges are eliminated by reasonably adjusting the position points. At the same time, the processed edge line can still fit the target model well.

[0043] To this end, in this embodiment, a specified direction is first set, which is typically multiple. For example, in a two-dimensional plane, the specified direction can be two mutually perpendicular directions, specifically a horizontal direction and a numerical direction. When the fineness of the edge lines is higher, the specified direction in a two-dimensional plane can be three directions, such as a horizontal direction, a vertical direction, and a 45-degree angled direction to the horizontal direction and the numerical direction, respectively. In three-dimensional space, the above-mentioned specified directions can be two mutually perpendicular X-axis directions, Y-axis directions, and Z-axis directions. When the fineness of the edge lines is higher, even more specified directions can be set in three-dimensional space.

[0044] The purpose of setting a specified direction is to use that specified direction as a reference and adjust the position of the position point so that each line segment in the edge line is displayed in the specified direction, thus avoiding the line segments of the edge line pointing in different directions and making the trend of the edge line smoother.

[0045] In the above process, multiple sets of target points with adjacent relationships can be determined from multiple position points of the initial edge line. This process can be implemented by looping and traversing. For example, first, position points 1, 2, and 3 with adjacent relationships can be taken as one set of target points, then position points 2, 3, and 4 with adjacent relationships can be taken as another set of target points, and so on. Of course, multiple target points with adjacent relationships can also be determined in other ways. For example, first, position points 1, 2, and 3 with adjacent relationships can be taken as one set of target points, then position points 4, 5, and 6 with adjacent relationships can be taken as another set of target points.

[0046] The distance relationships between multiple adjacent target points in a specified direction can be used to characterize the trend of these target points. For example, when multiple target points are roughly horizontal, their horizontal distances are not significantly different, or in other words, their distances from the X-axis are not significantly different. Similarly, when multiple target points are roughly vertical, their vertical distances are not significantly different, or in other words, their distances from the Y-axis are not significantly different. In other methods, the distance relationships between multiple adjacent target points in a specified direction can also be characterized by their relative distances in that direction. For example, when multiple target points are roughly horizontal, their relative distances in the horizontal direction are not significantly different.

[0047] Based on the above distance relationship, points that are roughly in the same direction can be grouped into a point set. Then, the position points of the point set are adjusted in the same direction so that the position points of the point set are on the same straight line. At this time, the position points of the point set can be accurately located in a specified direction, and the problem of the position points floating within a certain range in one direction, which causes many jagged lines, will no longer occur.

[0048] If, among the aforementioned multiple target points, the first group of target points is roughly located in the first specified direction, and the second group of target points is roughly located in the second specified direction, then the distance relationship between the second group of target points and the first group of target points in the first specified direction will be significantly different from that of the first group of target points in the first specified direction. Similarly, the distance relationship between the second group of target points and the second specified direction will also be significantly different from that of the first group of target points in the second specified direction. Based on this, target points located in different directions can be distinguished and assigned to different point sets.

[0049] Step S106: Based on the adjusted multiple position points, obtain the final edge lines of the target model.

[0050] By arranging and adjusting multiple position points in the aforementioned specified order, the final edge lines of the target model can be obtained. Since the final edge lines have more straight lines and fewer corners or jagged edges, redundant position points located in the middle of the straight line segments can be deleted from the multiple position points, and position points located at the two ends of the straight line segments can be retained to obtain the aforementioned final edge lines.

[0051] In the above method for processing the edge lines of the model, the initial edge lines of the target model are obtained, and position points are sampled on the initial edge lines to obtain multiple position points arranged in a specified order; multiple target points with adjacent relationships are determined from the multiple position points, and the multiple position points are divided into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction; the positions of the position points in the point set in the specified direction are adjusted so that the position points in the point set are located on the same straight line; and the final edge lines of the target model are obtained based on the adjusted multiple position points.

[0052] In this method, a specified direction is predetermined. Based on the distance relationship between adjacent position points in the specified direction, the specified direction to which each position point belongs is determined. Then, the position points on the edge line are divided into point sets. The positions of the position points in the point sets are adjusted so that position points in the same point set lie on the same straight line, thereby eliminating many jagged edges in the edge line and giving the line better smoothness. Simultaneously, the point set division is based on the distance relationship between adjacent position points in the specified direction, ensuring that the trend of each position point is consistent, avoiding obvious distortion after edge line processing, and maintaining a high degree of consistency between the edge line and the edge of the existing model. This method is simple to operate and applicable to various edge line processing processes, exhibiting high applicability.

[0053] The following embodiment further illustrates the point set partitioning method. Multiple location points sampled from the initial edge line are arranged in a specified order. Therefore, these multiple location points include: the endpoints of the initial edge line and intermediate points located between the endpoints; when the specified order is represented by the location point numbers, the endpoint numbers are the maximum and minimum numbers among the multiple location points. Location points located between the endpoints are intermediate points. This embodiment processes each intermediate point. For an intermediate point, the intermediate point and its neighboring points are considered as a group of multiple target points with an adjacency relationship.

[0054] For an intermediate point, determine its neighboring points from multiple location points; based on the distance relationship between the intermediate point and its neighboring points in a specified direction, determine whether the intermediate point and its neighboring points are located in the same direction, and obtain the determination result of the intermediate point; based on the determination result of the intermediate point, divide the multiple location points into at least one point set.

[0055] In practical implementation, each intermediate point can be processed in the manner described above to obtain the corresponding judgment result. For an intermediate point, its neighboring points can be the points adjacent to it in a specified order. The points are usually arranged sequentially, and the specified order can be from front to back or from back to front. For example, neighboring points can be the point before and after the intermediate point, or the two points closest to the intermediate point before it and the two points closest to the intermediate point after it; or the three points closest to the intermediate point before it and the three points closest to the intermediate point after it, and so on. In short, there is an adjacency relationship between intermediate points and their neighboring points.

[0056] Taking a specified direction comprising two directions as an example, namely the first direction and the second direction. If the distance between the intermediate point and its neighboring points is close in the first direction, it means that both the intermediate point and its neighboring points are located in the first direction; if the distance between the intermediate point and its neighboring points is large in the first direction, it means that some of the intermediate point and its neighboring points are located in the first direction, and others are located in the second direction; there is a corner point between the intermediate point and its neighboring points. Using this corner point as a boundary, the points before and after the corner point are divided into different point sets.

[0057] In one specific implementation, the aforementioned neighbor points include: a first neighbor point and a second neighbor point; in a specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; the step of determining whether the intermediate point and the neighbor point are located in the same direction based on the distance relationship between the intermediate point and the neighbor point in a specified direction, and obtaining the determination result of the intermediate point, can be implemented by the following steps: determining a first distance between the intermediate point and the first neighbor point in a first direction, and a second distance in a second direction; determining a third distance between the intermediate point and the second neighbor point in a first direction, and a fourth distance in a second direction; if the first magnitude relationship between the first distance and the second distance, and the second magnitude relationship between the third distance and the fourth distance satisfy a specified condition, determining that the intermediate point and the neighbor point are located in the same direction; wherein, the specified condition includes: the first distance is greater than the second distance, and the third distance is greater than the fourth distance; or, the first distance is less than the second distance, and the third distance is less than the fourth distance.

[0058] For ease of understanding, please refer to Figure 2 Examples are described below. Figure 2In the example, the first and second directions are perpendicular to each other. Of course, the first and second directions can also be at other angles. When the intermediate point is point 2, the first neighbor is point 1, and the second neighbor is point 3. The first distance between point 2 and point 1 in the first direction is d1, and the second distance between point 2 and point 1 in the second direction is d2. Since points 1, 2, and 3 are roughly distributed along the first direction, the value of d1 is usually larger, and the value of d2 is usually smaller, i.e., the first distance d1 > the second distance d2. The third distance between point 2 and point 3 in the first direction is d3, and the fourth distance between point 2 and point 3 in the second direction is d4. Since points 1, 2, and 3 are roughly distributed along the first direction, the value of d3 is usually larger, and the value of d4 is usually smaller, i.e., the third distance d3 > the fourth distance d4. In this case, it can be considered that the aforementioned conditions are met, and points 1, 2, and 3 are located in the same direction.

[0059] For example, when point 3 is taken as the intermediate point, the first neighbor point is point 2 and the second neighbor point is point 4. The trend of points 2, 3 and 4 is similar to the trend of points 1, 2 and 3 mentioned above. For the same reason, points 2, 3 and 4 are located in the same direction.

[0060] For point 4, the situation changes. When point 4 is the intermediate point, its first neighbor is point 3, and its second neighbor is point 5. The first distance between point 4 and point 3 in the first direction is d1', and the second distance between them in the second direction is d2'. Points 3 and 4 are roughly distributed along the first direction, therefore, the value of d1 is usually larger, and the value of d2 is usually smaller, i.e., the first distance d1 > the second distance d2. The third distance between point 4 and point 5 in the first direction is d3', and the fourth distance between them in the second direction is d4'. Since points 4 and 5 are roughly distributed along the second direction, the value of d3' is usually smaller, and the value of d4' is usually larger, i.e., the third distance d3 < the fourth distance d4. In this case, it can be considered that the aforementioned conditions are not met. Points 3 and 4 are located in the first direction, and points 4 and 5 are located in the second direction. In this case, point 4 is a corner point.

[0061] In another method for determining whether an intermediate point and its neighboring points are in the same direction, a ray is generated from the first neighboring point to the intermediate point to obtain a first ray. The first angle between the first ray and the first direction is calculated. If the first angle is less than a preset angle threshold, it is determined that the first neighboring point and the intermediate point are in the first direction. A ray is generated from the intermediate point to the second neighboring point to obtain a second ray. The second angle between the second ray and the first direction is calculated. If the second angle is less than a preset angle threshold, it is determined that the intermediate point and the second neighboring point are in the first direction. At this point, it can be determined that the intermediate point and its neighboring points are in the same direction, i.e., the first direction.

[0062] In addition, if the second angle between the second ray and the first direction is greater than the preset angle threshold, it can be determined that the midpoint and the second neighbor point are not located in the first direction, and the midpoint is a corner point.

[0063] Continue to refer to Figure 2 Point 3 is the midpoint. The angle between the ray from point 2 to point 3 and the first direction is relatively small. At the same time, the angle between the ray from point 3 to point 4 and the first direction is also relatively small. This indicates that the trends of points 2, 3 and 4 are the same, and they are all located in the first direction.

[0064] Point 4 is the midpoint. The angle between the ray from point 3 to point 4 and the first direction is small. Meanwhile, the angle between the ray from point 4 to point 5 and the first direction is large, while the angle with the second direction is small. This indicates that the trends of point 5 are different from those of points 3 and 4. Point 5 is located in the second direction, while point 4 is a turning point.

[0065] Based on the above, when dividing multiple location points into at least one point set based on the judgment result of the intermediate point, if the judgment result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in the same direction, the first neighbor point, the intermediate point, and the second neighbor point are assigned to the same point set; if the judgment result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in different directions, the first neighbor point and the intermediate point are assigned to the first point set, and the second neighbor point is assigned to the second point set.

[0066] exist Figure 2 In the example, points 1, 2, 3, and 4 can be considered as the first subset, points 5 and 6 as the second subset, and points 7, 8, and 9 as the third subset.

[0067] Furthermore, after dividing into subsets, for each subset, the initial position of the position points in the point set in the specified direction is obtained; the average value of the initial positions of the position points in the point set is calculated to obtain the average position in the specified direction; the position points in the point set are adjusted to the average position so that the position points in the point set are located on the straight line formed by the average position.

[0068] Specifically, a coordinate system can be established to determine the distance between a point in the point set and the direction axis in the specified direction. This distance is used to characterize the initial position of the point in the specified direction. The average value of the initial positions of the points in the point set is obtained to get the average position in the specified direction. After adjusting the points in the point set to the average position, the distance between each point in the point set and the direction axis in the specified direction is the same, which will form a straight line.

[0069] like Figure 3As shown, the initial positions of points 1, 2, 3, and 4 are represented by hollow dots. After calculating the average value of points 1, 2, 3, and 4 in the first direction, the average position shown by the dashed line is obtained. Then, points 1, 2, 3, and 4 are adjusted to positions along the dashed line, i.e. Figure 3 As shown by the black dots in the image.

[0070] In related technologies, by adjusting the parameters of the Resample and Facet nodes, when the edge lines have a high degree of fit with the target model, the lines have more jagged edges and poor smoothness; when the edge lines are relatively smooth, the edge lines tend to be more deformed and have a lower degree of fit with the target model's edges, such as... Figure 4 As shown.

[0071] This embodiment allows lines to be adjusted to a specified direction, eliminating many jagged edges. Simultaneously, the edge lines closely match the target model with minimal deformation. Figure 5 As shown, the subsequent model built based on this edge line matches the target model well, improving the model's visual effect.

[0072] The method for processing the model edge lines in this embodiment needs to be implemented programmatically. Since there are many point locations to process, a loop-based approach is typically required. Furthermore, this embodiment also involves adjusting the positions of these points. A point may have an old position and a new position. If a single loop is used to process the point locations, it may cause position reading errors; for example, when reading the position of a neighboring point, the old position of that neighboring point might be read, when the new position of that neighboring point actually needs to be read.

[0073] To avoid the aforementioned data reading chaos, this embodiment uses a double-loop program. In the specific implementation, the multiple position points include: the endpoints of the initial edge line and the midpoints located between the endpoints; following a specified order, each midpoint is taken as the current point, and the following first loop operation is performed on the current point:

[0074] Initialize the point set array. Starting from the current point, traverse the position points in reverse order according to the specified order until the first position point among the multiple position points is reached. For each target point traversed, perform the following second loop operation: determine the neighbor points of the target point from the multiple position points; based on the distance relationship between the target point and the neighbor points in the specified direction, determine whether the target point and the neighbor points are located in the same direction, and obtain the judgment result of the target point.

[0075] Based on the judgment result of the target point, determine the position points in the point set array, and adjust the position of the position points in the point set in the specified direction.

[0076] The first loop operation described above can be understood as performing a first loop operation for each intermediate point. The input parameters for this first loop operation can be the number of the first intermediate point, the stop condition of the loop, and the update condition of the loop. For example, if the initial edge line includes n+1 points, numbered from 0 to n, then the first intermediate point is numbered 1, and the last intermediate point is numbered n-1. The update condition of the loop is that the number is incremented by 1 with each loop iteration; the stop condition of the loop is that the loop number reaches n-1.

[0077] In each first loop operation, the intermediate point being processed is taken as the current point. First, a point set array is initialized, and the initialized point set array is empty. Then, the current point is taken as a parameter of the second loop operation to start the second loop operation.

[0078] In the second loop operation, starting from the current point, the position points are traversed in reverse order according to the specified sequence until the first position point among multiple position points is reached. That is, the current point and all position points before the current point are traversed in reverse order according to the specified sequence. For the target point traversed in the second loop operation, the neighboring points of the target point are determined from the multiple position points; based on the distance relationship between the target point and the neighboring points in the specified direction, it is determined whether the target point and the neighboring points are located in the same direction, and the determination result of the target point is obtained.

[0079] In one specific implementation, as described in the foregoing embodiment, the neighboring points include: a first neighboring point and a second neighboring point; in a specified order, the first neighboring point is located before the target point, and the second neighboring point is located after the target point; the step of determining whether the intermediate point and the neighboring point are located in the same direction based on the distance relationship between the target point and the neighboring points in a specified direction, and obtaining the determination result of the intermediate point, can be implemented by the following steps: determining a first distance between the target point and the first neighboring point in a first direction, and a second distance in a second direction; determining a third distance between the target point and the second neighboring point in a first direction, and a fourth distance in a second direction; if the first magnitude relationship between the first distance and the second distance, and the second magnitude relationship between the third distance and the fourth distance satisfy a specified condition, determining that the intermediate point and the neighboring point are located in the same direction; wherein, the specified condition includes: the first distance is greater than the second distance, and the third distance is greater than the fourth distance; or, the first distance is less than the second distance, and the third distance is less than the fourth distance.

[0080] Each time the second loop operation is executed, the judgment result corresponding to the target point currently being traversed can be obtained. Based on the judgment result, the point set array set in the first loop operation is updated, thereby triggering the position adjustment operation of the points in the point set.

[0081] Specifically, the steps of determining the position points in the point set array and adjusting the positions of the position points in the point set in a specified direction can be implemented in the following way:

[0082] If the target point and its neighboring points are in the same direction, save the target point to the point set array, update the target point, and continue to execute the second loop operation; specifically, updating the target point here can be done by taking the previous position of the target point as the new target point;

[0083] If the target point and its neighboring points are in different directions, save the target point to a point set array. Calculate the average position of the points between the target point and the current point in the point set array, and use this average position as the new position between the target point and the current point. Update the target point and continue with the second loop operation. When a neighboring point and the target point are in different directions, it can be understood that the target point is a corner point. In this case, the adjustment process for the points in the point set is triggered. In this method, when continuing with the second loop operation, the position between the target point and the first point is calculated. The average position has already been calculated in the first loop operation, and this is calculated again, but the result is the same.

[0084] In another implementation, after calculating the average position of the points between the target point and the current point in the point set array and determining the new position of the points between the target point and the current point based on the average position, the second loop operation can be skipped directly, and the subsequent first loop operation can continue. Therefore, in this case, the average position of the points between the target point and the current point in the point set is calculated. The average position of the points between the target point and the first point has already been calculated in the previous first loop operation, so there is no need to calculate it again, thereby improving computational efficiency.

[0085] If the traversal reaches the first position point, calculate the average position of the positions in the point set array, and determine the new position of the positions in the point set array based on the average position. When the traversal reaches the first position point, it means that the second loop operation has been completed from the target point. All positions between the target point and the first position point are located in the same direction. At this time, calculate the average position of the positions in the point set, and adjust the new position of the positions in the point set based on the average position.

[0086] The positions of the location points are adjusted using the above method. Then, based on the adjusted location points, the final edge lines of the target model are obtained. In a specific application scenario, the specified directions include a first direction and a second direction, which are perpendicular to each other. The adjusted location points are connected in a specified order to obtain the final edge lines of the target model. The final edge lines include line segments pointing to the first direction and line segments pointing to the second direction. Since the first and second directions are perpendicular, the resulting final edge lines only include horizontal and vertical line segments, achieving right-angled lines. Simultaneously, the line segments have high smoothness, facilitating subsequent model creation based on the edge lines. For example, generating facets based on the edge lines ultimately yields the model effect.

[0087] The above-mentioned method for processing model edge lines provides a more standardized, templated, and general logical algorithm. After extracting the initial edge lines of the target model, the model edge lines are further processed to make the edge lines a line that closely fits the target model, has a right-angle turning effect, and removes redundant curves.

[0088] The above method for processing model edge lines can be implemented using Houdini. When processing model edge enclosing line segments using Houdini, a custom VEX script algorithm can be used to process the line segments with a single click. Furthermore, it can be combined with other simple operation steps to reuse the nodes of this solution, achieving a more complete effect. It eliminates the need for highly random methods such as adjusting parameters to process line segments. Simultaneously, it decouples the mutual influence between nodes, making the processing method more universal, concise, easy to edit, and easy to maintain.

[0089] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 6 The diagram shows a structural schematic of a device for processing the edge lines of a model. The device includes:

[0090] The position point acquisition module 60 is used to acquire the initial edge lines of the target model, sample position points on the initial edge lines, and obtain multiple position points arranged in a specified order;

[0091] The position point adjustment module 62 is used to determine multiple target points with adjacent relationships from multiple position points, divide the multiple position points into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction, and adjust the position of the position points in the point set in the specified direction so that the position points in the point set are on the same straight line.

[0092] The line generation module 64 is used to obtain the final edge lines of the target model based on the adjusted multiple position points.

[0093] In the aforementioned processing device for model edge lines, the initial edge lines of the target model are obtained, and position points are sampled on the initial edge lines to obtain multiple position points arranged in a specified order; multiple target points with adjacent relationships are determined from the multiple position points, and the multiple position points are divided into at least one point set based on the distance relationship between the multiple target points with adjacent relationships in a specified direction; the positions of the position points in the point set in the specified direction are adjusted so that the position points in the point set are located on the same straight line; and the final edge lines of the target model are obtained based on the adjusted multiple position points.

[0094] In this method, a specified direction is predetermined. Based on the distance relationship between adjacent position points in the specified direction, the specified direction to which each position point belongs is determined. Then, the position points on the edge line are divided into point sets. The positions of the position points in the point sets are adjusted so that position points in the same point set lie on the same straight line, thereby eliminating many jagged edges in the edge line and giving the line better smoothness. Simultaneously, the point set division is based on the distance relationship between adjacent position points in the specified direction, ensuring that the trend of each position point is consistent, avoiding obvious distortion after edge line processing, and maintaining a high degree of consistency between the edge line and the edge of the existing model. This method is simple to operate and applicable to various edge line processing processes, exhibiting high applicability.

[0095] The aforementioned multiple location points include: the endpoints of the initial edge line and the midpoints located between the endpoints; the aforementioned location point adjustment module is further configured to: determine the neighboring points of the midpoint from the multiple location points; determine whether the midpoint and the neighboring points are located in the same direction based on the distance relationship between the midpoint and the neighboring points in a specified direction, and obtain the determination result of the midpoint; and divide the multiple location points into at least one point set based on the determination result of the midpoint.

[0096] The aforementioned neighbor points include: a first neighbor point and a second neighbor point; in a specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; the aforementioned position point adjustment module is further configured to: determine a first distance between the intermediate point and the first neighbor point in a first direction, and a second distance in a second direction; determine a third distance between the intermediate point and the second neighbor point in a first direction, and a fourth distance in a second direction; if the first magnitude relationship between the first distance and the second distance, and the second magnitude relationship between the third distance and the fourth distance satisfy specified conditions, determine that the intermediate point and the neighbor point are located in the same direction.

[0097] The specified conditions include: the first distance is greater than the second distance, and the third distance is greater than the fourth distance; or, the first distance is less than the second distance, and the third distance is less than the fourth distance.

[0098] The aforementioned neighbor points include a first neighbor point and a second neighbor point; in the specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; the aforementioned position point adjustment module is further configured to: if the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in the same direction, assign the first neighbor point, the intermediate point, and the second neighbor point to the same point set; if the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in different directions, assign the first neighbor point and the intermediate point to the first point set, and assign the second neighbor point to the second point set.

[0099] The line generation module described above is also used to: obtain the initial position of the position points in the point set in a specified direction; calculate the average value of the initial positions of the position points in the point set to obtain the average position in the specified direction; and adjust the position points in the point set to the average position so that the position points in the point set are located on the straight line formed by the average position.

[0100] The aforementioned multiple location points include: the endpoints of the initial edge lines and the midpoints located between the endpoints; the aforementioned location point adjustment module is further configured to: sequentially take each midpoint as the current point according to a specified order, and perform the following first loop operation on the current point: initialize the point set array, starting from the current point, traverse the location points in reverse order according to the specified order until the first location point among the multiple location points is reached, and perform the following second loop operation on each traversed target point: determine the neighbor points of the target point from the multiple location points; determine whether the target point and the neighbor points are located in the same direction according to the distance relationship between the target point and the neighbor points in a specified direction, and obtain the judgment result of the target point; based on the judgment result of the target point, determine the location points in the point set array, and adjust the positions of the location points in the point set array in the specified direction.

[0101] The aforementioned position adjustment module is further configured to: if the target point and its neighboring points are in the same direction, save the target point to the point set array, update the target point, and continue executing the second loop operation; if the target point and its neighboring points are in different directions, save the target point to the point set array, calculate the average position of the position points between the target point and the current point in the point set array, and determine the average position as the new position of the position points between the target point and the current point; update the target point, and continue executing the second loop operation; if the first position point is reached, calculate the average position of the position points in the point set array, and determine the average position as the new position of the position points in the point set array.

[0102] The specified directions include a first direction and a second direction, which are perpendicular to each other; the line generation module is also used to: connect multiple adjusted position points in a specified order to obtain the final edge lines of the target model; wherein the final edge lines include line segments pointing to the first direction and line segments pointing to the second direction.

[0103] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-described method for processing the edge lines of the model. This electronic device can be a server or a terminal device.

[0104] See Figure 7 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the above-described method for processing the edge lines of the model.

[0105] Furthermore, Figure 7 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0106] The memory 101 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 7 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0107] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. Processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be 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, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0108] The processor in the aforementioned electronic device, by executing machine-executable instructions, can perform the following operations in the above-mentioned method for processing the edge lines of the model:

[0109] Obtain the initial edge lines of the target model, sample position points on the initial edge lines to obtain multiple position points arranged in a specified order; determine multiple target points with adjacent relationships from the multiple position points, and divide the multiple position points into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction; adjust the positions of the position points in the point set in the specified direction so that the position points in the point set are on the same straight line; obtain the final edge lines of the target model based on the adjusted multiple position points.

[0110] The aforementioned multiple location points include: the endpoints of the initial edge line and the midpoints located between the endpoints; the aforementioned multiple target points with adjacent relationships are determined from the multiple location points; for the midpoint, the neighboring points of the midpoint are determined from the multiple location points; based on the distance relationship between the midpoint and the neighboring points in a specified direction, it is determined whether the midpoint and the neighboring points are located in the same direction, and the determination result of the midpoint is obtained; based on the determination result of the midpoint, the multiple location points are divided into at least one point set.

[0111] The aforementioned neighbor points include: a first neighbor point and a second neighbor point; in a specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; a first distance between the intermediate point and the first neighbor point in a first direction, and a second distance in a second direction are determined; a third distance between the intermediate point and the second neighbor point in a first direction, and a fourth distance in a second direction are determined; if a first relationship between the first distance and the second distance, and a second relationship between the third distance and the fourth distance satisfy a specified condition, the intermediate point and the neighbor point are determined to be located in the same direction.

[0112] The specified conditions include: the first distance is greater than the second distance, and the third distance is greater than the fourth distance; or, the first distance is less than the second distance, and the third distance is less than the fourth distance.

[0113] The aforementioned neighbor points include the first neighbor point and the second neighbor point; in the specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; if the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in the same direction, the first neighbor point, the intermediate point, and the second neighbor point are assigned to the same point set; if the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in different directions, the first neighbor point and the intermediate point are assigned to the first point set, and the second neighbor point is assigned to the second point set.

[0114] Obtain the initial position of the points in the point set in the specified direction; calculate the average position in the specified direction by averaging the initial positions of the points in the point set; adjust the points in the point set to the average position so that the points in the point set are located on the straight line formed by the average position.

[0115] The aforementioned multiple location points include: the endpoints of the initial edge lines and the midpoints located between the endpoints; following a specified order, each midpoint is taken as the current point, and the following first loop operation is performed on the current point: initialize the point set array, starting from the current point, traverse the location points in reverse order according to the specified order until the first location point among the multiple location points is reached, and perform the following second loop operation on each traversed target point: determine the neighboring points of the target point from the multiple location points; based on the distance relationship between the target point and the neighboring points in the specified direction, determine whether the target point and the neighboring points are located in the same direction, and obtain the judgment result of the target point; based on the judgment result of the target point, determine the location points in the point set array, and adjust the positions of the location points in the point set array in the specified direction.

[0116] If the target point and its neighboring points are in the same direction, save the target point to the point set array, update the target point, and continue executing the second loop operation; if the target point and its neighboring points are in different directions, save the target point to the point set array, calculate the average position of the points between the target point and the current point in the point set array, and determine the average position as the new position of the points between the target point and the current point; update the target point, and continue executing the second loop operation; if the first position point is reached, calculate the average position of the points in the point set array, and determine the average position as the new position of the point point in the point set array.

[0117] The specified directions include a first direction and a second direction, which are perpendicular to each other; multiple adjusted position points are connected in a specified order to obtain the final edge lines of the target model; wherein, the final edge lines include line segments pointing to the first direction and line segments pointing to the second direction.

[0118] In this method, a specified direction is predetermined. Based on the distance relationship between adjacent position points in the specified direction, the specified direction to which each position point belongs is determined. Then, the position points on the edge line are divided into point sets. The positions of the position points in the point sets are adjusted so that position points in the same point set lie on the same straight line, thereby eliminating many jagged edges in the edge line and giving the line better smoothness. Simultaneously, the point set division is based on the distance relationship between adjacent position points in the specified direction, ensuring that the trend of each position point is consistent, avoiding obvious distortion after edge line processing, and maintaining a high degree of consistency between the edge line and the edge of the existing model. This method is simple to operate and applicable to various edge line processing processes, exhibiting high applicability.

[0119] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above-described method for processing the edge lines of the model.

[0120] The machine-executable instructions stored in the aforementioned machine-readable storage medium can be executed to perform the following operations in the above-mentioned method for processing the edge lines of the model:

[0121] Obtain the initial edge lines of the target model, sample position points on the initial edge lines to obtain multiple position points arranged in a specified order; determine multiple target points with adjacent relationships from the multiple position points, and divide the multiple position points into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction; adjust the positions of the position points in the point set in the specified direction so that the position points in the point set are on the same straight line; obtain the final edge lines of the target model based on the adjusted multiple position points.

[0122] The aforementioned multiple location points include: the endpoints of the initial edge line and the midpoints located between the endpoints; the aforementioned multiple target points with adjacent relationships are determined from the multiple location points; for the midpoint, the neighboring points of the midpoint are determined from the multiple location points; based on the distance relationship between the midpoint and the neighboring points in a specified direction, it is determined whether the midpoint and the neighboring points are located in the same direction, and the determination result of the midpoint is obtained; based on the determination result of the midpoint, the multiple location points are divided into at least one point set.

[0123] The aforementioned neighbor points include: a first neighbor point and a second neighbor point; in a specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; a first distance between the intermediate point and the first neighbor point in a first direction, and a second distance in a second direction are determined; a third distance between the intermediate point and the second neighbor point in a first direction, and a fourth distance in a second direction are determined; if a first relationship between the first distance and the second distance, and a second relationship between the third distance and the fourth distance satisfy a specified condition, the intermediate point and the neighbor point are determined to be located in the same direction.

[0124] The specified conditions include: the first distance is greater than the second distance, and the third distance is greater than the fourth distance; or, the first distance is less than the second distance, and the third distance is less than the fourth distance.

[0125] The aforementioned neighbor points include the first neighbor point and the second neighbor point; in the specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; if the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in the same direction, the first neighbor point, the intermediate point, and the second neighbor point are assigned to the same point set; if the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in different directions, the first neighbor point and the intermediate point are assigned to the first point set, and the second neighbor point is assigned to the second point set.

[0126] Obtain the initial position of the points in the point set in the specified direction; calculate the average position in the specified direction by averaging the initial positions of the points in the point set; adjust the points in the point set to the average position so that the points in the point set are located on the straight line formed by the average position.

[0127] The aforementioned multiple location points include: the endpoints of the initial edge lines and the midpoints located between the endpoints; following a specified order, each midpoint is taken as the current point, and the following first loop operation is performed on the current point: initialize the point set array, starting from the current point, traverse the location points in reverse order according to the specified order until the first location point among the multiple location points is reached, and perform the following second loop operation on each traversed target point: determine the neighboring points of the target point from the multiple location points; based on the distance relationship between the target point and the neighboring points in the specified direction, determine whether the target point and the neighboring points are located in the same direction, and obtain the judgment result of the target point; based on the judgment result of the target point, determine the location points in the point set array, and adjust the positions of the location points in the point set array in the specified direction.

[0128] If the target point and its neighboring points are in the same direction, save the target point to the point set array, update the target point, and continue executing the second loop operation; if the target point and its neighboring points are in different directions, save the target point to the point set array, calculate the average position of the points between the target point and the current point in the point set array, and determine the average position as the new position of the points between the target point and the current point; update the target point, and continue executing the second loop operation; if the first position point is reached, calculate the average position of the points in the point set array, and determine the average position as the new position of the point point in the point set array.

[0129] The specified directions include a first direction and a second direction, which are perpendicular to each other; multiple adjusted position points are connected in a specified order to obtain the final edge lines of the target model; wherein, the final edge lines include line segments pointing to the first direction and line segments pointing to the second direction.

[0130] In this method, a specified direction is predetermined. Based on the distance relationship between adjacent position points in the specified direction, the specified direction to which each position point belongs is determined. Then, the position points on the edge line are divided into point sets. The positions of the position points in the point sets are adjusted so that position points in the same point set lie on the same straight line, thereby eliminating many jagged edges in the edge line and giving the line better smoothness. Simultaneously, the point set division is based on the distance relationship between adjacent position points in the specified direction, ensuring that the trend of each position point is consistent, avoiding obvious distortion after edge line processing, and maintaining a high degree of consistency between the edge line and the edge of the existing model. This method is simple to operate and applicable to various edge line processing processes, exhibiting high applicability.

[0131] The computer program product of the model edge line processing method, apparatus, electronic device and storage medium provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0132] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0133] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0134] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0135] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0136] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for processing the edge lines of a model, characterized in that, The method includes: Obtain the initial edge lines of the target model, sample position points on the initial edge lines, and obtain multiple position points arranged in a specified order; From the plurality of location points, determine a plurality of target points that are adjacent to each other; based on the distance relationship between the plurality of target points that are adjacent to each other in a specified direction, divide the plurality of location points into at least one point set; adjust the positions of the location points in the point set in the specified direction so that the location points in the point set are on the same straight line; the specified direction includes a first direction and a second direction, the first direction and the second direction being perpendicular to each other; Based on the adjusted multiple location points, the final edge lines of the target model are obtained; The step of obtaining the final edge lines of the target model based on the adjusted plurality of position points includes: The adjusted multiple position points are connected in the specified order to obtain the final edge lines of the target model; wherein the final edge lines include line segments pointing to the first direction and line segments pointing to the second direction.

2. The method according to claim 1, characterized in that, The plurality of location points include: the endpoints of the initial edge line and the midpoint located between the endpoints; The step of determining multiple target points with adjacent relationships from the multiple location points, and dividing the multiple location points into at least one point set based on the distance relationship between the multiple target points with adjacent relationships in a specified direction, includes: For the intermediate point, determine the neighboring points of the intermediate point from the plurality of location points; Based on the distance relationship between the intermediate point and the neighboring point in a specified direction, determine whether the intermediate point and the neighboring point are located in the same direction, and obtain the determination result of the intermediate point; Based on the determination result of the intermediate point, the multiple location points are divided into at least one point set.

3. The method according to claim 2, characterized in that, The neighbor points include: a first neighbor point and a second neighbor point; in the specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; The step of determining whether the intermediate point and the neighboring point are located in the same direction based on the distance relationship between the intermediate point and the neighboring point in a specified direction, and obtaining the determination result of the intermediate point, includes: Determine a first distance between the intermediate point and the first neighboring point in a first direction, and a second distance in a second direction; determine a third distance between the intermediate point and the second neighboring point in the first direction, and a fourth distance in the second direction; If the first size relationship between the first distance and the second distance, and the second size relationship between the third distance and the fourth distance satisfy a specified condition, it is determined that the intermediate point and the neighboring point are located in the same direction.

4. The method according to claim 3, characterized in that, The specified conditions include: the first distance is greater than the second distance, and the third distance is greater than the fourth distance; or, the first distance is less than the second distance, and the third distance is less than the fourth distance.

5. The method according to claim 2, characterized in that, The neighbor points include a first neighbor point and a second neighbor point; in the specified order, the first neighbor point is located before the intermediate point, and the second neighbor point is located after the intermediate point; The step of dividing the plurality of location points into at least one point set based on the determination result of the intermediate point includes: If the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in the same direction, the first neighbor point, the intermediate point, and the second neighbor point are assigned to the same point set; If the determination result of the intermediate point indicates that the first neighbor point, the intermediate point, and the second neighbor point are located in different directions, the first neighbor point and the intermediate point are assigned to the first point set, and the second neighbor point is assigned to the second point set.

6. The method according to claim 1, characterized in that, The step of adjusting the positions of the points in the point set in a specified direction so that the points in the point set are aligned on a straight line includes: Obtain the initial position of the points in the point set in the specified direction; The average position in the specified direction is obtained by averaging the initial positions of the points in the point set; the points in the point set are then adjusted to the average position so that the points in the point set are located on the straight line formed by the average position.

7. The method according to claim 1, characterized in that, The plurality of location points include: the endpoints of the initial edge line and the midpoint located between the endpoints; The step of determining multiple target points with adjacent relationships from the multiple location points, dividing the multiple location points into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction, and adjusting the positions of the location points in the point set in the specified direction so that the location points in the point set are on the same straight line includes: Following the specified order, each intermediate point is taken as the current point, and the following first loop operation is performed on the current point: Initialize the point set array. Starting from the current point, traverse the position points in reverse order according to the specified order until the first position point among the plurality of position points is reached. For each target point traversed, perform the following second loop operation: The neighboring points of the target point are determined from the plurality of location points; based on the distance relationship between the target point and the neighboring points in a specified direction, it is determined whether the target point and the neighboring points are located in the same direction, and the determination result of the target point is obtained; Based on the judgment result of the target point, the position point in the point set array is determined, and the position of the position point in the point set is adjusted in the specified direction.

8. The method according to claim 7, characterized in that, Based on the judgment result of the target point, the steps of determining the position points in the point set array and adjusting the positions of the position points in the point set in the specified direction include: If the target point and the neighboring point are in the same direction, save the target point to the point set array, update the target point, and continue to execute the second loop operation; If the target point and the neighboring point are located in different directions, save the target point to the point set array, calculate the average position of the points between the target point and the current point in the point set array, determine the average position as the new position of the points between the target point and the current point; update the target point, and continue to execute the second loop operation; If the traversal reaches the first position point, calculate the average position of the position points in the point set array, and determine the average position as the new position of the position point in the point set array.

9. A device for processing the edge lines of a model, characterized in that, The device includes: The location point acquisition module is used to acquire the initial edge lines of the target model, sample location points on the initial edge lines, and obtain multiple location points arranged in a specified order; A position point adjustment module is used to determine multiple target points with adjacent relationships from the plurality of position points, divide the plurality of position points into at least one point set based on the distance relationship of the multiple target points with adjacent relationships in a specified direction, and adjust the positions of the position points in the point set in the specified direction so that the position points in the point set are located on the same straight line; the specified direction includes a first direction and a second direction, wherein the first direction and the second direction are perpendicular to each other; The line generation module is used to obtain the final edge lines of the target model based on the adjusted multiple position points; The line generation module is further configured to connect the adjusted plurality of position points in the specified order to obtain the final edge lines of the target model; wherein the final edge lines include line segments pointing to the first direction and line segments pointing to the second direction.

10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the model edge line processing method according to any one of claims 1-8.

11. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the method for processing model edge lines as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Image-based straight line detection method and apparatus, and electronic device

    CN111047615A