Three-dimensional model contour line drawing method and device, equipment and medium
By drawing contour lines in the three-dimensional model space, the inaccurate positioning problem when manually adding support structures is solved based on the screen interactive position and color information, and accurate support structure addition and printing efficiency improvement are achieved.
Patent Information
- Application Number
- CN202510565700.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-15
AI Technical Summary
When manually adding support structures, the surface characteristics of the three-dimensional model are diverse, especially when the model has a large range of high and low undulations, the positioning is inaccurate and the support effect is not ideal.
By obtaining the screen interaction position of the display screen, mapping it into the three-dimensional model space, determining the contour position and color information, drawing the contour picture, providing dynamic interactive feedback, enhancing real-time visualization, and accurately adding support structures.
Help users to understand the surface features of the three-dimensional model more intuitively, provide accurate support structure addition, improve printing efficiency, and save materials.
Smart Images

Figure CN120495554A_ABST
Abstract
Description
Technical field
[0001] The present invention relates to the field of 3D printing technology, and in particular to a method, device, equipment and medium for drawing contour lines of a three-dimensional model. [Background Technology]
[0002] Adding support structures is a crucial step when slicing 3D models. Support structures prevent overhanging parts from collapsing or deforming during printing, providing sufficient support to complete the entire printing process. Support can be added automatically or manually. Manually adding support structures requires the designer to precisely locate the distribution of support points in the 3D view to ensure smooth printing of each layer.
[0003] However, in the process of manually adding supports, due to the diverse surface features of the 3D model, especially in the complex parts of the model with large ups and downs, technical problems such as inaccurate positioning and unsatisfactory support effects are prone to occur. [Summary of the invention]
[0004] In order to solve the technical problem of inaccurate positioning when manually adding support structures, the present invention provides a method, device, equipment and medium for drawing contour lines of a three-dimensional model.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions in the first aspect: a method for drawing contour lines of a three-dimensional model, the method comprising the following steps:
[0006] Acquiring a screen interaction position of a display screen displaying a target model image, and mapping the screen interaction position to the target model in a three-dimensional model space to obtain a target model position;
[0007] Determining contour line position information of a model contour line according to the target model position;
[0008] Determining contour line color information of the model contour line according to the contour line position information and the model color information corresponding to the target model position;
[0009] According to the contour line position information and the contour line color information, a target model picture including the model contour lines is drawn and displayed.
[0010] In a feasible implementation manner, the target model position includes a target coordinate point set representing the position of the target model in the three-dimensional model space, and determining the contour line position information of the model contour line according to the target model position includes:
[0011] For any coordinate point in the target coordinate point set, execute:
[0012] Taking the target model position as a reference coordinate point, judging whether the coordinate point is within the width range of the model contour line corresponding to the target model position according to a preset width value;
[0013] If so, it is determined that the contour line position information of the model contour line includes the coordinate point, the contour line position information includes a plurality of the coordinate points, and the contour line position information includes a width range representing the model contour line.
[0014] In a feasible implementation, the three-dimensional model space includes a three-dimensional coordinate system. Before determining whether the coordinate point is within the width range of the model contour line corresponding to the target model position according to the preset width value, the method further includes:
[0015] Dividing the target model in the three-dimensional coordinate system to form a plurality of continuous model blocks and at least one dimensional interval representing the position of the model block in the three-dimensional space, the dimensional interval including at least one of a length interval, a width interval, and a height interval; determining the target model block based on an inclusion relationship between the target model position and the dimensional interval; and obtaining a coordinate point set corresponding to the target model block as a target coordinate point set;
[0016] or;
[0017] The method of determining the contour color information of the model contour line based on the contour position information and the model color information corresponding to the target model position includes: obtaining the model color information of the area corresponding to the contour position information based on the contour position information of the model contour line corresponding to the target model position; and performing transition processing on the preset contour color information based on the model color information to determine the final color information of the contour color information.
[0018] In a feasible implementation manner, determining the contour color information of the model contour according to the contour position information and the model color information corresponding to the target model position includes: acquiring the model color information of the area corresponding to the contour position information according to the contour position information of the model contour corresponding to the target model position; performing transition processing on the preset contour color information according to the model color information to determine the final color information of the contour color information;
[0019] The step of performing transition processing on the preset contour color information according to the model color information to determine the final color information of the contour color information includes:
[0020] Determining a color mixing parameter corresponding to the coordinate point according to a height range corresponding to the contour position information of the model contour and a height value of the coordinate point, wherein the color mixing parameter corresponds to the target model position;
[0021] Final color information of the contour line color information is determined according to the color mixing parameter, the preset contour line color information, and the model color information.
[0022] In a feasible implementation manner, determining the color mixing parameter corresponding to the coordinate point according to the height range of the model contour line and the height value of the coordinate point includes:
[0023] Determining a smoothing boundary range according to a height value corresponding to the target model position and the preset width value;
[0024] The color mixing parameter corresponding to the coordinate point is determined according to the smoothing boundary range, the height value corresponding to the target model position, the preset width value, and the height value corresponding to the coordinate point.
[0025] In a feasible implementation manner, determining the smoothing boundary range according to the height value corresponding to the target model position and the preset width value includes:
[0026] Determine a normalization parameter corresponding to the coordinate point according to the height value of the target model position, the preset width value, and the height value of the coordinate point;
[0027] The smoothing boundary range is determined according to the normalization parameter, the preset width value, and the height value of the target model position.
[0028] In a feasible implementation manner, obtaining a screen interaction position corresponding to a display screen displaying a target model image, and mapping the screen interaction position to a target model in a three-dimensional model space to obtain a target model position includes:
[0029] Displaying the target model image via the display screen;
[0030] In response to a user's interactive operation on the display screen, acquiring the screen interaction position;
[0031] According to the field of view angle corresponding to the target model screen, the screen interaction position is mapped to the three-dimensional coordinate system, and the target model position corresponding to the screen interaction position in the three-dimensional coordinate system is obtained.
[0032] In order to solve the above technical problems, the present invention provides another technical solution in the second aspect as follows: a three-dimensional model contour drawing device, the device comprising:
[0033] A mapping module is used to obtain a screen interaction position corresponding to a display screen displaying a target model image, and map the screen interaction position to the target model in the three-dimensional model space to obtain a target model position;
[0034] a processing module, configured to determine contour line position information of a model contour line according to the target model position, and further configured to determine contour line color information of the model contour line according to model color information corresponding to the target model position;
[0035] A drawing module is used to draw and display a target model picture including the model contour lines according to the contour line position information and the contour line color information.
[0036] In order to solve the above technical problems, the third aspect of the present invention provides another technical solution as follows: a 3D printing device, comprising: one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps of the aforementioned three-dimensional model contour drawing method.
[0037] In order to solve the above technical problems, the fourth aspect of the present invention provides another technical solution as follows: a computer storage medium storing a computer program, which implements the method steps of the above-mentioned three-dimensional model contour drawing method when executed by a processor.
[0038] Compared with the prior art, the method, device, equipment and medium for drawing contour lines of a three-dimensional model provided by the present invention have the following beneficial effects:
[0039] The present invention provides a three-dimensional model contour line drawing method, which draws contour lines during the process of manually adding supports to the three-dimensional model, helping users to understand the surface features of the three-dimensional model more intuitively and providing dynamic interactive feedback; obtaining the target model position according to the screen interaction position, the user can view and select specific areas of the target model in real time, and dynamically adjust the viewing angle and point to various areas of the target model in combination with the display screen to enhance real-time visualization; determining the contour line position information according to the target model position, and drawing the contour lines in combination with the contour line position information and the contour line color information, the user can clearly see the range of uniform height values of the target model position pointed to by the screen interaction position, thereby accurately adding support structures.
Brief Description of the Drawings
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 It is a flowchart of a method for drawing contour lines of a three-dimensional model provided by the first embodiment of the present invention.
[0042] Figure 2 2 is a flow chart of step S22 of the three-dimensional model contour drawing method provided by the first embodiment of the present invention.
[0043] Figure 3 3D model contour drawing method according to the first embodiment of the present invention.
[0044] Figure 4 1 is a flow chart of step S1 of the method for drawing contour lines of a three-dimensional model provided by the first embodiment of the present invention.
[0045] Figure 5 This is a rendering of the three-dimensional model contour line drawing method provided by the first embodiment of the present invention.
[0046] Figure 6 This is a structural block diagram of a three-dimensional model contour line drawing device provided by the second embodiment of the present invention.
[0047] Figure 7 3D printing device according to the third embodiment of the present invention.
[0048] Figure 8 It is a structural block diagram of a computer storage medium provided by the fourth embodiment of the present invention.
[0049] Description of the accompanying drawings:
[0050] 100. 3D model contour drawing device; 200. 3D printing equipment; 300. Computer storage medium;
[0051] 101. Mapping module; 102. Processing module; 103. Drawing module; 201. Processor; 202. Memory; 203. Application program; 301. Computer program. [Specific implementation method]
[0052] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and implementation examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0053] See also Figure 1 A first embodiment of the present invention provides a method for drawing contour lines of a three-dimensional model, comprising the following steps:
[0054] Step S1, obtaining a screen interaction position of a display screen displaying a target model image, and mapping the screen interaction position to a target model in a three-dimensional model space to obtain a target model position;
[0055] Step S2, determining the contour position information of the model contour according to the target model position;
[0056] Step S3, determining the contour color information of the model contour line according to the contour position information and the model color information corresponding to the target model position;
[0057] Step S4: drawing and displaying a target model image including the model contour lines according to the contour line position information and the contour line color information.
[0058] It can be understood that the present invention provides a method for drawing contour lines of a three-dimensional model. During the process of manually adding supports to a three-dimensional model, in order to ensure that the support structure is accurately aligned with any point in the target model, the height of the target model position where the screen interaction position intersects the target model can be visualized with the help of model contour lines. Drawing contour lines helps users more intuitively understand the surface features of the three-dimensional model and provide dynamic interactive feedback; the screen interaction position is mapped to the target model in the three-dimensional model space to obtain the target model position. The user can view and select specific areas of the model in real time, and the viewing angle is dynamically adjusted in combination with the display screen to point to different heights in the target model. A new model contour line is generated each time the screen interaction position is changed, thereby enhancing real-time visualization; the contour line position information is determined according to the target model position, and the contour line is drawn in combination with the contour line position information and the contour line color information. The contour line can intuitively display the hierarchical structure of the target model. The user can clearly see the range of uniform height values of the target model position pointed to by the screen interaction position, more accurately locate the area requiring support, help the user better understand the height information of the target model, assist in the design of the support structure, thereby accurately adding the support structure, saving materials and improving printing efficiency.
[0059] Among them, in step S1, the display screen refers to the device or interface used to display the target model picture, which can be a physical display screen, such as a computer monitor, a smart phone screen, a tablet screen, a virtual reality headset and other devices, or it can be a virtual display interface. The display screen serves as a medium for the user to interact with the target model picture. The screen interaction position refers to the specific location where the user interacts with the display screen, which is a two-dimensional coordinate point. When the user clicks, touches or hovers on the screen, the system will record the coordinates of the position for further processing.
[0060] As a non-limiting specific implementation scheme, the screen interaction position can be any position on the touch screen display screen that the user clicks with his finger, or any position selected by the user on the display screen of a desktop or laptop computer by manipulating the screen interaction position.
[0061] Furthermore, in step S1, the three-dimensional model space is a virtual environment. In actual applications, the three-dimensional model space can be created and managed by various 3D graphics libraries, such as OpenGL, DirectX or various 3D engines; the target model is a display object in the three-dimensional model space. In step S1, the target model is read before being displayed. The process of reading the target model includes loading the target model file, parsing the geometric data of the target model, such as vertices, edges, and faces, and loading this data into the three-dimensional model space; in the three-dimensional model space, the user interacts with the target model in the three-dimensional model space through the target model position.
[0062] It should be noted that the obtained target model position is the coordinate mapped from the two-dimensional screen coordinates to the three-dimensional model space. The actual application of the target model in the three-dimensional model space can be created and managed through various 3D graphics libraries, such as OpenGL, DirectX or various 3D engines. In the three-dimensional model space, all vertices of the target model have corresponding X, Y, and Z coordinates, which represent the positions of each vertex of the target model in the three-dimensional space.
[0063] Furthermore, the target model position includes a target coordinate point set representing the position of the target model in the three-dimensional model space.
[0064] It can be understood that the position of the target model in the three-dimensional model space is represented by a set of target coordinate point sets, which can be specifically expressed in the form of three-dimensional coordinates (x, y, z). The target coordinate point set defines the geometric position and shape of the target model in the three-dimensional model space.
[0065] See also Figure 2 , wherein step S2 includes: step S22: executing, for any coordinate point in the target coordinate point set:
[0066] Step S221: Taking the target model position as the reference coordinate point, determine whether the coordinate point is within the width range of the model contour line corresponding to the target model position according to a preset width value;
[0067] Step S222: If yes, determine that the contour line position information of the model contour line includes coordinate points, the contour line position information includes multiple coordinate points, and the contour line position information includes a width range representing the model contour line.
[0068] It can be understood that the three-dimensional model space is a three-dimensional reference frame, and a coordinate point is a specific point in the three-dimensional model space. The position of a coordinate point can be specifically represented by three coordinate values (x, y, z). For any coordinate point in the target coordinate point set, a judgment process is performed with the target model position as the reference point, and whether the coordinate point is within the model contour line width range corresponding to the target model position is judged according to the preset width value. The coordinate points in the target model that are in the model contour line corresponding to the target model position at this time are screened out, so that the model color information contained in the coordinate point can be optimized and analyzed. Through range planning judgment, the model contour line width range reflects the model characteristics and data standardization with a high degree, which is convenient for integration and sharing with other data information, and provides support for further analysis and decision-making.
[0069] It should be noted that the model contour lines of different width ranges can provide different visual effect comparisons for the user's set values or the default parameters in the system. The width range of the contour lines can be freely set by the user to provide accurate height information data, guide the visual focus, and facilitate analysis and comparison.
[0070] It should be noted that the model contour line is a horizontal cross-sectional outline displayed at a certain height of the target model, with a certain line width, that is, a preset width value. The preset width value can be a user-set value or a default parameter in the system. The preset width value can be adjusted as needed to achieve model contour line effects of different thicknesses. Model contour lines of different width ranges provide different visual effect comparisons, provide accurate height information data, guide visual focus, and facilitate analysis and comparison.
[0071] Among them, the line width range affects the visual beauty of the model contour lines in the target model. The larger the preset width value, the more obvious the jagged display effect will be on the edges of the model contour lines after rendering.
[0072] Furthermore, the contour line position information represents the position information of the model contour line in the three-dimensional model space, further including the height value and coordinate position of the coordinate point within the width range of the model contour line, and also including the height range of the model contour line obtained by expanding in the Z-axis direction according to the preset width value with the target model position as the reference coordinate point.
[0073] Specifically, the target model position is a specific coordinate point obtained by mapping the screen interaction position into the three-dimensional model space. It is a three-dimensional vector (x, y, z). Taking the target model position as the reference coordinate point and the starting point of reference, according to the preset width value, the display of the model contour line within a certain line width range can be determined, indicating the expansion of the model contour line in a certain direction. In a method for drawing a three-dimensional model contour line provided by the present invention, taking the target model position as the reference coordinate point, expanding in the Z-axis direction according to the preset width value, the height range corresponding to the contour line position information of the model contour line is obtained.
[0074] Specifically, in step S221, the target model position is a determined point. Combining with the preset width value, as a reference for judging the positions of other coordinate points, it is judged whether a certain coordinate point is within the width range of the model contour line, and it is determined that the model contour line includes this coordinate point. That is, the contour line position information of the model contour line includes this coordinate point and the remaining coordinate points judged to be within the width range of the model contour line, so as to perform subsequent processing and analysis on the coordinate points within the width range of the model contour line.
[0075] Exemplarily, based on the height value of the coordinate point in the three-dimensional model space, taking the target model position as the reference coordinate point, it is judged whether the current coordinate point is within the width range of the model contour line according to the preset width value;
[0076] That is: in.vertex.z < height + width and in.vertex.z > height - width;
[0077] Wherein, in.vertex.z is the height value of the current coordinate point in the three-dimensional model space, height is the height value of the target model position in the three-dimensional model space, and width is the preset width value;
[0078] If the height value of the current coordinate point in the three-dimensional model space is greater than the difference between the height value of the target model position in the three-dimensional model space and the preset width value and less than the sum of the height value of the target model position in the three-dimensional model space and the preset width value, it is determined that the current coordinate point is within the width range of the model contour line; if the height value of the current coordinate point in the three-dimensional model space is less than the difference between the height value of the target model position in the three-dimensional model space and the preset width value, or the height value of the current coordinate point in the three-dimensional model space is greater than the sum of the height value of the target model position in the three-dimensional model space and the preset width value, it is judged that the current coordinate point is not within the range of the model contour line drawing.
[0079] As a non-restrictive specific implementation scheme display, the target model position can be used as the middle position of the model contour line, so that the model contour line is symmetrically distributed on both sides of the target model position. At this time, the target model position is aligned with the center point of the model contour line.
[0080] In a variant implementation of the same principle, the target model position can be used as the upper edge position of the model contour line, so that the target model position coincides with the upper boundary of the model contour line, and the rest of the model contour line is located below the target model position.
[0081] Furthermore, a specific implementation scheme shows that the target model position can be used as the lower edge position of the model contour line, so that the target model position coincides with the lower boundary of the model contour line, and the rest of the model contour line is located above the target model position.
[0082] Specifically, the invention does not limit the specific position of the target model on the model contour line.
[0083] Furthermore, the three-dimensional model space includes a three-dimensional coordinate system. Before determining in step S221 whether the coordinate point is within the width range of the model contour line corresponding to the target model position, the method further includes:
[0084] Step S20: Dividing the target model in the three-dimensional coordinate system to form a plurality of continuous model blocks and at least one dimensional interval representing the position of the model block in the three-dimensional model space, where the dimensional interval includes at least one of a length interval, a width interval, and a height interval;
[0085] Step S21: Determine the target model block according to the inclusion relationship between the target model position and the dimension interval, and obtain the coordinate point set corresponding to the target model block as the target coordinate point set.
[0086] In a non-limiting embodiment, step S20: divides the target model in the three-dimensional coordinate system to form multiple continuous model blocks, and at least one dimensional interval representing the position of the model block in the three-dimensional model space, the dimensional interval includes at least one of a length interval, a width interval, and a height interval. It can also be a prerequisite step before step S1: obtaining the screen interaction position of the display screen that displays the target model picture.
[0087] It can be understood that a complete target model in the three-dimensional model space is divided into multiple smaller model blocks. Through division, it is more convenient to analyze, process or find the target model position corresponding to the screen interaction position on the target model. A dimensional interval of the position of the model block in the three-dimensional model space describes the position of each model block in the three-dimensional model space, which is used to obtain the target coordinate point set corresponding to the subsequent target model block for preliminary positioning, so as to facilitate independent analysis of different model blocks of the target model. Compared with processing all the coordinate point sets of the target model in the three-dimensional model space, it is more flexible, faster and more convenient to divide the model blocks first, which improves the search efficiency.
[0088] Specifically, in step S20, an image processing simulation detection algorithm is used to optimize the image processing and display process by utilizing the coherence of regions, that is, the attributes of pixels in adjacent regions are similar. First, a larger region or model is divided into smaller parts. By dividing, the amount of data processed each time can be reduced and the processing speed can be improved. The position of each model block in the three-dimensional model space is described by at least one dimensional interval such as a length interval, a width interval or a height interval.
[0089] Among them, the inclusion relationship between the target model position and the dimensional interval refers to judging whether a target model position is within a certain dimensional interval, such as judging whether the height value of the target model position is within the range of 100-200 mm. If the height of the target model position is within the range, the model block containing the target model position is the target model block, thereby determining which model blocks are the target model blocks, and extracting the coordinate point set of the target model block for further processing or analysis.
[0090] For further information, see Figure 3 In step S3, determining the contour color information of the model contour according to the contour position information and the model color information corresponding to the target model position includes:
[0091] Step S31: acquiring model color information of an area corresponding to the contour line position information according to the contour line position information of the model corresponding to the target model position;
[0092] Step S32: performing transition processing on the preset contour line color information according to the model color information to determine the final color information of the contour line color information.
[0093] It can be understood that the display screen is composed of a limited number of pixels. During the rendering process, the three-dimensional model needs to undergo operations such as projection transformation to be converted into a two-dimensional image and displayed on the display screen. The model contour lines are displayed on the target model based on the target model position. The model contour line segments may be divided into discontinuous pixel segments during the rendering process. When the slope of the model contour line segment is large or the length is short, the discontinuity between the pixel segments will cause jagged edges.
[0094] Specifically, in three-dimensional slicing software, model contour lines are generally drawn directly in the graphics rendering pipeline supported by the GPU, and contour lines are dynamically generated and drawn in the rendering program. However, during the rendering process, each pixel or fragment of the contour line is directly rendered by the program, which easily leads to jagged model contour lines. The present invention provides a three-dimensional model contour line drawing method, which draws and displays a target model screen including model contour lines based on contour line position information and contour line color information. The color information of the coordinate points within the model contour line width range can be processed in combination with the model color information corresponding to the target model position to achieve an anti-aliasing effect of the model contour line, thereby effectively improving the display effect.
[0095] It should be noted that the model contour is displayed on the target model based on the target model position, and the model color information of the target model in the area corresponding to the target model position is found. The model color information comes from the target model itself, and the model contour itself has preset contour color information. The preset contour color information and the obtained model color information are transitioned so that the two color information are transition calculated at a unified scale. The transition processing effectively eliminates the mutation and discontinuity of the two color information in the display of line segments with a certain width, making the rendering effect of the model contour more natural and smooth, thereby weakening the jagged visual effect caused by color discontinuity, and making the model contour look smoother.
[0096] The preset contour color information is transitionally processed to determine the final color information of the contour color information, eliminating the short jagged parts and making the model contour lines more regular in the view.
[0097] Furthermore, in step S32, the preset contour line color information is subjected to transition processing to determine the final color information of the contour line color information, including:
[0098] Step S321, determining the color mixing parameter corresponding to the coordinate point according to the height range corresponding to the contour position information of the model contour line and the height value of the coordinate point;
[0099] Step S322 : determining the final color information of the contour color information according to the color mixing parameter, the preset contour color information, and the model color information.
[0100] Understandably, the process is performed based on the height range corresponding to the position information of the model contour line and the height value of the coordinate point, and the color mixing parameters are calculated for each coordinate point. The color mixing parameters are associated with the height value of the coordinate point. Each change of the coordinate point will recalculate a new color mixing parameter to ensure that each change of the coordinate point can obtain the color mixing parameters corresponding to the position of the coordinate point. At the same time, the value of the color mixing parameter is also related to the distance between the coordinate point and the target model position. The transition processing effectively reduces the sudden change of pixel segments within the same height value of the model contour line, making the color transition of the same model contour line more natural, thereby visually reducing the sharpness of the jagged lines of the model contour line segments. The final contour line color information is obtained based on the color mixing parameters, the preset contour line color information and the model color information, showing a model contour line with clear and smooth edges and continuous and smooth segments.
[0101] Specifically, in step S322, the final color information of the contour color information is determined based on the color mixing parameters, the preset contour color information and the model color information. In a non-limiting embodiment, the color mixing parameters can be obtained using a smooth step function, the height value of the coordinate point is used as an input parameter, and the target model position is used as a reference position. The color mixing parameters of the model contour lines corresponding to different target model positions are dynamically calculated according to different target model positions. In the previous step S221, the coordinate points within the width range of the corresponding model contour lines have been screened out, and then the color mixing parameters corresponding to the coordinate points are determined based on the height value of the coordinate points and the height range corresponding to the contour position information.
[0102] Exemplarily, the contour color information includes preset contour color information and final color information, and the color information includes color values. In step S322, determining the final color information of the contour color information according to the color mixing parameter, the preset contour color information, and the model color information further includes the following steps:
[0103] The final color information of the contour line color information is determined as follows: C=C1*a+C2*(1-a).
[0104] Among them, the preset contour color value is C1, the model color information value corresponding to the target model is C2, a is the color mixing parameter a; the final color value is C.
[0105] It can be understood that the final color information is determined at the coordinate point based on the color information corresponding to the target model and the preset contour color information of the model contour, so as to achieve a more natural color change of the model contour, and produce an anti-aliasing effect in different areas of the model contour, so that the color of the contour line is smoother and more delicate, and the edge effect is smoother. When processing complex target models, it can also efficiently and reasonably generate model contour lines with clear edges, thereby enhancing the visualization effect when users manually add support structures.
[0106] Specifically, the model color information corresponding to the target model is the background color.
[0107] Specifically, the color mixing parameter a determines the degree of color mixing. If the color mixing parameter a is 0, the user can only see the background color, and the color value of the model contour is completely covered by the background color; if the color mixing parameter a is 1, the background color will be completely covered, and the contour color information will be highlighted; if the α parameter is between 0 and 1, the model contour color will be mixed with the background color, forming an edge transition color effect, which suppresses the jagged effect of the model contour edge.
[0108] In a non-limiting embodiment, the model color information corresponding to the target model may be transparent, so that the mixed colors appear clearer.
[0109] like Figure 5 The renderings (a)-(b) shown in the figure show the model contour lines after transition processing by a three-dimensional model contour drawing method provided by the present invention. The anti-aliasing effect is achieved by using the final contour line color information and the model color information corresponding to the target model. Without consuming too much calculation, the display effect of the model contour lines is effectively improved.
[0110] Furthermore, determining the final color information of the contour color information based on the color blending parameter, the preset contour color information, and the model color information in step S322 also includes the following steps: obtaining all coordinate points and the height values of the coordinate points within the model contour width range, forming a collective distance field between the z-axis positions of all coordinate points in the three-dimensional model space and the z-axis position of the target model position in the three-dimensional model space, and obtaining the color blending parameter a of all coordinate points within the model contour width range based on this collective distance field.
[0111] In the distance field, the distance between the coordinate point and the target model position gradually increases from 0 until it is equal to or greater than the preset width of the model contour line. The value of the color mixing parameter also changes with the change of distance, and different color mixing parameters are obtained for coordinate points with different height values. Therefore, the model contour line can obtain a more natural and beautiful visual effect after transition processing.
[0112] Furthermore, in step S321, according to the height range of the model contour line and the height value of the coordinate point, determining the color mixing parameter corresponding to the coordinate point includes:
[0113] Step S3211: Determine a smoothing boundary range based on a height value corresponding to the target model position and a preset width value;
[0114] Step S3212: Determine the color mixing parameter corresponding to the coordinate point according to the smoothing boundary range, the height value corresponding to the target model position, the preset width value, and the height value corresponding to the coordinate point.
[0115] Specifically, the smooth boundary range refers to the area where the color of the model contour lines in the three-dimensional model space smoothly transitions. It is calculated based on the height value corresponding to the target model position and the preset width value, helping to achieve a smooth transition of the model contour line boundary color.
[0116] It can be understood that the smooth boundary range is obtained through boundary calculation. The smooth boundary range is the smooth boundary for processing the model contour line, which is not completely equal to the width boundary of the model contour line. The smooth boundary range is controlled within the width range boundary of the model contour line. The color mixing parameters obtained based on the smooth boundary range processing help reduce the range of the model contour line producing the jagged effect, making the edge of the model contour line more rounded, smoother and natural, which is convenient for analysis and visualization.
[0117] Furthermore, determining the smoothing boundary range in step S3211 includes the following steps: step S32111, determining a normalization parameter corresponding to the coordinate point according to the height value of the target model position, the preset width value, and the height value of the coordinate point;
[0118] Step S32112: Determine the smoothing boundary range according to the normalization parameter, the preset width value, and the height value of the target model position.
[0119] It can be understood that the normalization parameter standardizes the height values of the coordinate points within the width range of the model contour lines, making them easier to process in the subsequent smoothing process, and ensuring that the height values of the coordinate points are within the effective processing range. If the height values of the coordinate points exceed the range, they will be clipped to the boundary values 0 or 1. The boundary values are clipped or ignored during the smoothing process, reducing the calculation of outliers, improving data quality, making the processing boundaries more regular, and facilitating subsequent analysis.
[0120] As a non-limiting embodiment, the normalization parameter is calculated as follows:
[0121]
[0122] Where t is a normalization parameter, height is the height of the target model position in the 3D model space; width is the preset width of the model contour line, and i n.vertex.z is the height of the current coordinate point in the 3D model space;
[0123] Specifically, t is a local variable that maps the height value of the coordinate point in.vertex.z to the interval [0,1].
[0124] Furthermore, the smoothing boundary range is determined by a normalization parameter, a preset width value, and the height value of the target model position. The normalization parameter is a parameter value between 0 and 1, which limits the smoothing boundary range to the maximum and minimum height values of the model contour line. The normalization parameter helps determine the degree to which the boundaries of the model contour line need to be smoothed, and more accurately controls the range and intensity of smoothing.
[0125] Exemplarily, the smoothing boundary range is specifically expressed as follows: [height-width*t, height+width*t].
[0126] Specifically, height+width and height-width represent the upper and lower boundaries of the model contour, respectively. Height+width and height-width are multiplied by a normalization parameter to calibrate the edge range of the model contour.
[0127] Among them, height is the height value of the target model position in the three-dimensional model space; width is the preset width value of the model contour line, and t is the normalization parameter.
[0128] Furthermore, in combination with the smooth boundary range and normalization parameters calculated above, in step S3212, the color mixing parameters corresponding to the coordinate point are determined based on the smooth boundary range, the height value corresponding to the target model position and the preset width value, and the height value corresponding to the coordinate point.
[0129] For example, as an implementation method, the color mixing parameter a can be obtained by subtracting two smooth step functions, with the height value of the current coordinate point, the height value of the target model position in the three-dimensional model space, and the preset width value of the model contour line as input values. The specific formula is as follows:
[0130] s1=smoothstep(height-width,height-width*t,in.vertex.z)
[0131] s2=smoothstep(height+width*t,height+width,in.vertex.z)
[0132] a=s1-s2;
[0133] Among them, smoothstep is a smooth step function; a is a color blending parameter; height is the height value of the target model position in the three-dimensional model space; width is the preset width value of the model contour line; t is a normalization parameter; in.vertex.z is the height value of the current coordinate point in the three-dimensional model space.
[0134] The smooth step function shown in this embodiment is the smoothstep function, which smoothly maps the input value from one interval to another, that is, maps the height value of the coordinate point to the interval corresponding to the contour color information based on the upper and lower boundary ranges of the model contour line and the smooth boundary range.
[0135] For further information, see Figure 4 In step S1, the screen interaction position corresponding to the display screen displaying the target model image is obtained, and the screen interaction position is mapped to the target model in the three-dimensional model space to obtain the target model position, including the following steps:
[0136] Step S11, displaying the target model image on the display screen;
[0137] Step S12, in response to the user's interactive operation on the display screen, obtaining the screen interaction position;
[0138] Step S13: Mapping the screen interaction position to a three-dimensional coordinate system according to the field of view angle corresponding to the target model screen, and obtaining the target model position corresponding to the screen interaction position in the three-dimensional coordinate system.
[0139] It can be understood that the target model screen is displayed on the display screen. The target model screen is a two-dimensional screen. In response to the user's interaction with the display screen, the user can use input devices such as a mouse, touch screen, and keyboard to interact with the screen, and map the screen interaction position to a three-dimensional coordinate system according to the field of view angle of the target model screen.
[0140] Specifically, the field of view is the range of the scene that a camera or projection system can observe. In a three-dimensional coordinate system, the field of view and other parameters can be used to convert the two-dimensional screen interaction position into a coordinate point in three-dimensional space, helping to analyze the relationship between each coordinate point in the three-dimensional model space and the target model position, making the interaction more realistic and natural, and mapping the user's input to the three-dimensional model space, thereby achieving a more intuitive and efficient interactive experience.
[0141] The following is a detailed explanation of the principle of mapping the screen interaction position to the three-dimensional coordinate system:
[0142] When projecting a 3D model onto 2D screen coordinates for display, a projection transformation is usually performed. To convert the 2D screen coordinates back to 3D coordinates, an inverse projection transformation is required. That is, the coordinate points in 3D space are calculated in reverse. The process of accurately mapping the 2D screen interaction positions, such as mouse clicks, to the 3D model space is called reverse projection.
[0143] First, the pixel coordinates in the display screen space include the x, y positions and the corresponding depth values. The pixel coordinates in the display screen space are first converted to normalized device coordinates using the inverse viewport transformation. The normalized device coordinates are in the range [-1, 1]. Subsequently, the normalized device coordinates are restored to three-dimensional points in the camera coordinate system using the inverse projection transformation. The camera coordinate system is an object in the world coordinate system that is converted to a new coordinate system centered on the virtual camera through the view transformation. The camera coordinate system is constructed by the position, viewing direction, and up vector of the virtual camera. The three-dimensional point in the camera coordinate system is converted to the world coordinate system using the inverse matrix of the view matrix, thereby determining its global position in the three-dimensional scene.
[0144] Secondly, if it is necessary to associate it with a local coordinate system at a specific position, the inverse transformation of the model matrix must also be applied. In a three-dimensional model contour drawing method provided by the present invention, in response to the user's interactive operation on the display screen, the screen interaction position obtained is a specific position. In order to achieve accurate selection of the interactive object, the existing technology generally adopts two methods: first, directly using the depth value stored in the depth buffer to map it to the visible surface; second, generating a spatial ray starting from the camera and passing through the screen interaction position through ray projection, and determining the intersection of the ray and the three-dimensional model through geometric collision detection, such as intersection test with the triangle face.
[0145] In a non-limiting embodiment, the target model includes a triangular mesh, starting from the position of the virtual camera, emitting rays through the screen interaction position, and performing an intersection test with the target model to determine the intersection position of the ray and the three-dimensional model, and the intersection position is the target model position.
[0146] Specifically, the two-dimensional coordinate system contains two-dimensional screen coordinate elements, namely, the element information of the x-axis and y-axis. The two-dimensional coordinates of the screen interaction position corresponding to the two-dimensional coordinate system only provide two-dimensional information and cannot directly determine the depth coordinates, that is, it is transformed into a three-dimensional global world coordinate system through the projection of the view matrix and the projection matrix. It lacks the z-axis coordinate. A ray is constructed from the camera position to the screen interaction position, and the target model position of the ray and the target model is calculated. The target model position coordinates containing the z-axis information are the mapping results of the screen interaction position in the three-dimensional model space, thereby realizing the interaction between the screen interaction position and the three-dimensional model.
[0147] Furthermore, in the three-dimensional model contour drawing method provided by the first embodiment of the present invention, the model contour lines can be further optimized, and a target model screen including the model contour lines and the supporting structure can be drawn, and the supporting structure can be created while drawing the model contour lines.
[0148] See Figure 6 The second embodiment of the present invention provides a three-dimensional model contour drawing device 100, comprising:
[0149] A mapping module 101 is configured to obtain a screen interaction position corresponding to a display screen displaying a target model image, and map the screen interaction position to a target model in a three-dimensional model space to obtain a target model position;
[0150] The processing module 102 is used to determine the contour position information of the model contour according to the target model position. The processing module 102 is also used to determine the contour color information of the model contour according to the model color information corresponding to the target model position.
[0151] The drawing module 103 is used to draw and display the target model image including the model contour lines according to the contour line position information and the contour line color information.
[0152] Specifically, the three-dimensional model contour line drawing device 100 has the same beneficial effects as the above-mentioned three-dimensional model contour line drawing method, which will not be described in detail here.
[0153] See Figure 7 To achieve the above-mentioned objectives, a third embodiment of the present invention provides a 3D printing device 200, comprising: one or more processors 201; a memory 202; and one or more application programs 203, wherein the one or more application programs 203 are stored in the memory 202 and configured to be executed by the processor 201 to implement the method steps of the aforementioned three-dimensional model contour drawing method.
[0154] Specifically, a 3D printing device 200 can be a fixed device such as a desktop computer or workstation, or a mobile device such as a laptop or smart phone, or a cloud computing platform or a virtual display device, which is not specifically limited in the present invention.
[0155] It is understandable that the 3D printing device 200 has the same beneficial effects as the above-mentioned three-dimensional model contour drawing method, which will not be described in detail here.
[0156] See also Figure 8 In order to achieve the above-mentioned purpose, the fourth embodiment of the present invention provides a computer storage medium 300 on which a computer program 301 is stored. When the computer program 301 is executed by a processor, the method steps of the above-mentioned three-dimensional model contour drawing method are implemented.
[0157] Specifically, a computer storage medium 300 stores a computer program 301 thereon. When executed by a processor, the computer program 301 implements the method steps of the aforementioned method for drawing contour lines of a three-dimensional model. The method has the same beneficial effects as the aforementioned method for drawing contour lines of a three-dimensional model, and thus is not further described here.
[0158] The present invention also provides the following embodiments:
[0159] Reference numeral 1, a method for drawing contour lines of a three-dimensional model, the method comprising the following steps:
[0160] Obtaining a screen interaction position corresponding to a display screen displaying a target model image, and mapping the screen interaction position to the target model in the three-dimensional model space to obtain a target model position;
[0161] Determine the contour line position information of the model contour line according to the target model position;
[0162] Determining contour line color information of the model contour line according to the contour line position information and the model color information corresponding to the target model position;
[0163] According to the contour line position information and the contour line color information, a target model screen including the model contour lines is drawn and displayed.
[0164] Reference numeral 2, based on reference numeral 1, the target model position includes a target coordinate point set representing the position of the target model in the three-dimensional model space, and the contour line position information of the model contour line determined according to the target model position includes:
[0165] For any coordinate point in the target coordinate point set, execute:
[0166] Taking the target model position as a reference coordinate point, judging whether the coordinate point is within the width range of the model contour line corresponding to the target model position according to a preset width value;
[0167] If so, it is determined that the contour line position information of the model contour line includes the coordinate point, the contour line position information includes a plurality of the coordinate points, and the contour line position information includes a width range representing the model contour line.
[0168] Reference numeral 3, based on reference numeral 2, the three-dimensional model space includes a three-dimensional coordinate system, and before determining whether the coordinate point is within a width range of the model contour line corresponding to the target model position according to the preset width value, the method further includes:
[0169] The target model in the three-dimensional coordinate system is divided to form a plurality of continuous model blocks and at least one dimensional interval representing the position of the model block in the three-dimensional model space, wherein the dimensional interval includes at least one of a length interval, a width interval, and a height interval; the target model block is determined according to the inclusion relationship between the target model position and the dimensional interval, and a coordinate point set corresponding to the target model block is obtained as a target coordinate point set.
[0170] Reference numeral 4, based on reference numeral 2, determining the contour color information of the model contour according to the contour position information and the model color information corresponding to the target model position, including:
[0171] According to the contour line position information of the model contour line corresponding to the target model position, acquiring the model color information of the area corresponding to the contour line position information;
[0172] According to the model color information, the preset contour line color information is subjected to transition processing to determine the final color information of the contour line color information.
[0173] Reference numeral 5, based on reference numeral 4, performing transition processing on the preset contour line color information to determine the final color information of the contour line color information, including:
[0174] Determining a color mixing parameter corresponding to the coordinate point according to a height range corresponding to the contour line position information of the model contour line and a height value of the coordinate point;
[0175] Final color information of the contour line color information is determined according to the color mixing parameter, the preset contour line color information, and the model color information.
[0176] Reference numeral 6, based on reference numeral 5, determining the color mixing parameter corresponding to the coordinate point according to the height range of the model contour line and the height value of the coordinate point, including:
[0177] Determining a smoothing boundary range according to a height value corresponding to the target model position and the preset width value;
[0178] The color mixing parameter corresponding to the coordinate point is determined according to the smoothing boundary range, the height value corresponding to the target model position, the preset width value, and the height value corresponding to the coordinate point.
[0179] Reference numeral 7, based on reference numeral 6, determining the smoothing boundary range according to the height value corresponding to the target model position and the preset width value, including:
[0180] Determine a normalization parameter corresponding to the coordinate point according to the height value of the target model position, the preset width value, and the height value of the coordinate point;
[0181] The smoothing boundary range is determined according to the normalization parameter, the preset width value, and the height value of the target model position.
[0182] Reference numeral 8, based on reference numeral 3, obtaining a screen interaction position corresponding to a display screen displaying a target model image, and mapping the screen interaction position to a target model in a three-dimensional model space to obtain a target model position, including:
[0183] Displaying the target model image via the display screen;
[0184] In response to a user's interactive operation on the display screen, acquiring the screen interaction position;
[0185] According to the field of view angle corresponding to the target model screen, the screen interaction position is mapped to the three-dimensional coordinate system, and the target model position corresponding to the screen interaction position in the three-dimensional coordinate system is obtained.
[0186] In the embodiments provided herein, it should be understood that "B corresponding to A" means that B is associated with A and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B based solely on A; B can also be determined based on A and / or other information.
[0187] It should be understood that references to "one embodiment" or "an embodiment" throughout this specification mean that specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present invention. Therefore, the phrases "in one embodiment" or "in an embodiment" appearing throughout this specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Those skilled in the art should also be aware that the embodiments described in this specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present invention.
[0188] In various embodiments of the present invention, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0189] The flow charts and block diagrams in the accompanying drawings of the present invention illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementation schemes, the functions marked in the box can also occur in a different order than those marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, which is determined based on the functions involved. It should be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0190] Compared with the prior art, the method, device, equipment and medium for drawing contour lines of a three-dimensional model provided by the present invention have the following beneficial effects:
[0191] 1. The present invention provides a method for drawing contour lines of a three-dimensional model. During the process of manually adding supports to a three-dimensional model, drawing contour lines helps users understand the surface features of the three-dimensional model more intuitively and provides dynamic interactive feedback. The target model position is obtained according to the screen interaction position, and the user can view and select specific areas of the model in real time, and dynamically adjust the viewing angle and point to various areas of the model in combination with the display screen to enhance real-time visualization. The contour line position information is determined according to the target model position, and the contour lines are drawn in combination with the contour line position information and the contour line color information. The contour lines can intuitively display the hierarchical structure of the target model, and the user can clearly see the range of uniform height values of the target model position pointed to by the screen interaction position, and more accurately locate the area requiring support, thereby accurately adding support structures, saving materials and improving printing efficiency.
[0192] 2. The present invention provides a three-dimensional model contour drawing method, in which the target model position includes a target coordinate point set representing the position of the target model in the three-dimensional model space, the coordinate point set is the position of the target model in the three-dimensional model space, the three-dimensional model space is a three-dimensional reference frame, the coordinate point is a specific point in the three-dimensional model space, and the position of a coordinate point can be specifically represented by three coordinate values (x, y, z). The following steps are performed for any coordinate point in the target coordinate point set: taking the target model position as the reference point, judging whether the coordinate point is within the model contour line width range corresponding to the target model position according to a preset width value, the model contour line can accurately describe the model morphology of the target model, outline the contours of the model surface at different heights, enable the user to grasp the model shape structure, and provide an analysis basis for adding and modifying support results; the contour line position information of the model contour line includes multiple coordinate points, and the model contour line width range reflects the model characteristics and data standardization degree with a high degree, which is convenient for integration and sharing with other data information, and provides support for further analysis and decision-making.
[0193] 3. The present invention provides a three-dimensional model contour drawing method. Before obtaining the screen interaction position of the display screen that displays the target model image, a complete target model in the three-dimensional model space is divided into multiple smaller model blocks. Through division, it is more convenient to analyze, process or find the target model position corresponding to the screen interaction position on the target model. A dimensional interval of the position of the model block in the three-dimensional model space describes the position of each model block in the three-dimensional model space. The position of each model block can be described from at least one of the length interval, width interval or height interval. The position and range of the model block are more accurately located and analyzed, and preliminary positioning is performed for obtaining the target coordinate point set corresponding to the subsequent target model block, which facilitates independent analysis of different model blocks of the target model. Compared with processing all the coordinate point sets of the target model in the three-dimensional model space, dividing the model blocks first is more flexible, faster and more convenient, and improves the search efficiency.
[0194] 4. The present invention provides a method for drawing contour lines of a three-dimensional model. The display screen is composed of a limited number of pixels. When drawing contour line segments of the model in the three-dimensional model space, if the line segments do not match the pixel boundaries, aliasing may occur. During the rendering process, the three-dimensional model needs to be converted into a two-dimensional image through operations such as projection transformation. When the image is displayed on the display screen, the model is discretized into pixels, and the model contour line segments may be divided into discontinuous pixel segments. When the slope of the model contour line segment is large or the length is short, the discontinuity between the pixel segments will cause aliasing. At the target model position of the target model, the model contour line is displayed on the target model according to the model contour line corresponding to the target model position. There is contour position information of the model contour line, and the model color information corresponding to the area corresponding to the contour position information is found. The model color information comes from the target model itself, and the model contour line itself has preset contour color information. The preset contour color information and the obtained model color information are transition-processed so that the two color information are transition-calculated under a unified scale. The transition processing effectively eliminates the mutation and discontinuity of the two color information in the pixel segment display, so that the color of the model contour line is mixed and transitioned with the color of the target model itself, making the rendering effect of the model contour line more natural and smooth, thereby weakening the jagged visual effect caused by color discontinuity and making the model contour line look smoother.
[0195] 5. The present invention provides a three-dimensional model contour drawing method, in which transition processing is performed according to the height range corresponding to the position information of the model contour line and the height value of the coordinate point, and a weighted average value, namely the color mixing parameter, is calculated for each coordinate point. The color mixing parameter is associated with the height value of the coordinate point. A new color mixing parameter will be recalculated for each change of the coordinate point to ensure that the color mixing parameter corresponding to the position of the coordinate point can be obtained each time the coordinate point is changed. At the same time, the value of the color mixing parameter is also related to the distance between the coordinate point and the target model position. The transition processing effectively reduces the sudden change of pixel segments of the model contour line at the same height value, making the color transition of the same model contour line more natural, thereby visually reducing the sharpness of the jagged lines of the model contour line segments; the final contour line color information is obtained based on the color mixing parameter, the preset contour line color information and the model color information, showing a model contour line with clear and smooth edges and continuous and smooth segments.
[0196] 6. The present invention provides a three-dimensional model contour drawing method, which determines the color mixing parameters corresponding to the coordinate points, and obtains a smooth boundary range through boundary calculation based on the height value corresponding to the target model position and the preset width value. The smooth boundary range is the smooth boundary for processing the model contour line, which is different from the rigid width range of the model contour line. The smooth boundary range is controlled within the width range boundary of the model contour line. The color mixing parameters obtained based on the smooth boundary range processing help reduce the range of the model contour line producing a jagged effect, making the edge of the model contour line more rounded, smoother and more natural, which is convenient for analysis and visualization.
[0197] 7. The present invention provides a three-dimensional model contour drawing method, in which a normalization parameter standardizes the height values of coordinate points within the width range of the model contour line, making it easier to process in subsequent smoothing processing, and ensuring that the height values of the coordinate points are within the effective processing range. If the height value of the coordinate point exceeds the range, it is clipped to the boundary value 0 or 1. The boundary value is clipped or ignored during smoothing processing, reducing the calculation of abnormal values, improving data quality, making the processing boundary more regular, and facilitating subsequent analysis; the smoothing boundary range is determined by the normalization parameter and the preset width value and the height value of the target model position. The normalization parameter is a parameter value between 0 and 1, which limits the smoothing boundary range to the maximum height value and the minimum height value of the model contour line. The normalization parameter helps determine the degree to which the boundary of the model contour line needs to be smoothed, and more accurately controls the range and intensity of smoothing.
[0198] 8. The present invention provides a method for drawing contour lines of a three-dimensional model, which displays a target model screen on a display screen. The target model screen is a two-dimensional screen. In response to the user's interaction with the display screen, the user can use input devices such as a mouse, touch screen, and keyboard to interact with the screen. According to the field of view angle of the target model screen, the position where the user interacts with the screen is converted into a position in a three-dimensional coordinate system. The field of view angle is the scene range that can be observed by a camera or projection system. In the three-dimensional coordinate system, the two-dimensional screen interaction position can be converted into a coordinate point in three-dimensional space through the field of view angle and other parameters, and the screen interaction position is determined to correspond to the target model position in the target model. The conversion of the two-dimensional display screen to the three-dimensional coordinate system helps analyze the relationship between each coordinate point in the three-dimensional model space and the target model position, making the interaction more real and natural, and mapping the user's input to the three-dimensional model space, thereby achieving a more intuitive and efficient interactive experience.
[0199] 9. An embodiment of the present invention further provides a three-dimensional model contour line drawing device, which has the same beneficial effects as the above-mentioned three-dimensional model contour line drawing method, and will not be described in detail here.
[0200] 10. An embodiment of the present invention further provides a 3D printing device, which has the same beneficial effects as the above-mentioned three-dimensional model contour drawing method, and will not be described in detail here.
[0201] 11. The present invention also provides a computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-mentioned method for drawing contour lines of a three-dimensional model. The above-mentioned method has the same beneficial effects as the above-mentioned method for drawing contour lines of a three-dimensional model, and will not be described in detail here.
[0202] The above is a detailed introduction to a three-dimensional model contour drawing method, device, equipment and medium disclosed in an embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention. Any modifications, equivalent replacements and improvements made within the principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for drawing contour lines of a three-dimensional model, characterized in that: The method comprises the following steps: Acquiring a screen interaction position of a display screen displaying a target model image, and mapping the screen interaction position to the target model in a three-dimensional model space to obtain a target model position; Determining contour line position information of a model contour line according to the target model position; Determining contour line color information of the model contour line according to the contour line position information and the model color information corresponding to the target model position; According to the contour line position information and the contour line color information, a target model picture including the model contour lines is drawn and displayed.
2. The three-dimensional model contour drawing method according to claim 1, characterized in that: The target model position includes a target coordinate point set representing the position of the target model in the three-dimensional model space, and determining the contour line position information of the model contour line according to the target model position includes: For any coordinate point in the target coordinate point set, execute: Taking the target model position as a reference coordinate point, judging whether the coordinate point is within the width range of the model contour line corresponding to the target model position according to a preset width value; If so, it is determined that the contour line position information of the model contour line includes the coordinate point, the contour line position information includes a plurality of the coordinate points, and the contour line position information includes a width range representing the model contour line.
3. The method for drawing contour lines of a three-dimensional model according to claim 2, wherein: The three-dimensional model space includes a three-dimensional coordinate system. Before determining whether the coordinate point is within the width range of the model contour line corresponding to the target model position according to a preset width value, the method further includes: dividing the target model in the three-dimensional coordinate system to form a plurality of continuous model blocks and at least one dimensional interval representing the position of the model block in the three-dimensional model space, the dimensional interval including at least one of a length interval, a width interval, and a height interval; determining the target model block according to the inclusion relationship between the target model position and the dimensional interval, and obtaining a coordinate point set corresponding to the target model block as a target coordinate point set; or; The method of determining the contour color information of the model contour line based on the contour position information and the model color information corresponding to the target model position includes: obtaining the model color information of the area corresponding to the contour position information based on the contour position information of the model contour line corresponding to the target model position; and performing transition processing on the preset contour color information based on the model color information to determine the final color information of the contour color information.
4. The method for drawing contour lines of a three-dimensional model according to claim 3, wherein: Determining the contour color information of the model contour according to the contour position information and the model color information corresponding to the target model position includes: acquiring the model color information of the area corresponding to the contour position information according to the contour position information of the model contour corresponding to the target model position; performing transition processing on the preset contour color information according to the model color information to determine the final color information of the contour color information; The step of performing transition processing on the preset contour color information according to the model color information to determine the final color information of the contour color information includes: Determining a color mixing parameter corresponding to the coordinate point according to a height range corresponding to the contour line position information of the model contour line and a height value of the coordinate point; Final color information of the contour line color information is determined according to the color mixing parameter, the preset contour line color information, and the model color information.
5. The three-dimensional model contour drawing method according to claim 4, characterized in that: The determining, based on the height range of the model contour line and the height value of the coordinate point, a color mixing parameter corresponding to the coordinate point includes: Determining a smoothing boundary range according to a height value corresponding to the target model position and the preset width value; The color mixing parameter corresponding to the coordinate point is determined according to the smoothing boundary range, the height value corresponding to the target model position, the preset width value, and the height value corresponding to the coordinate point.
6. The method for drawing contour lines of a three-dimensional model according to claim 5, wherein: The determining the smoothing boundary range according to the height value corresponding to the target model position and the preset width value includes: Determine a normalization parameter corresponding to the coordinate point according to the height value of the target model position, the preset width value, and the height value of the coordinate point; The smoothing boundary range is determined according to the normalization parameter, the preset width value, and the height value of the target model position.
7. The method for drawing contour lines of a three-dimensional model according to claim 3, wherein: The acquiring of a screen interaction position corresponding to a display screen displaying a target model image, and mapping the screen interaction position to a target model in a three-dimensional model space to obtain a target model position includes: Displaying the target model image via the display screen; In response to a user's interactive operation on the display screen, acquiring the screen interaction position; According to the field of view angle corresponding to the target model screen, the screen interaction position is mapped to the three-dimensional coordinate system, and the target model position corresponding to the screen interaction position in the three-dimensional coordinate system is obtained.
8. A device for drawing contour lines of a three-dimensional model, characterized in that: The device comprises: A mapping module is used to obtain a screen interaction position corresponding to a display screen displaying a target model image, and map the screen interaction position to the target model in the three-dimensional model space to obtain a target model position; a processing module, configured to determine contour line position information of a model contour line according to the target model position, and further configured to determine contour line color information of the model contour line according to model color information corresponding to the target model position; A drawing module is used to draw and display a target model picture including the model contour lines according to the contour line position information and the contour line color information.
9. A 3D printing device, characterized in that: include: one or more processors; Memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the steps of the three-dimensional model contour drawing method according to any one of claims 1 to 7.
10. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method steps of the three-dimensional model contour drawing method according to any one of claims 1 to 7 are implemented.