A method for extracting a center line of a rod based on internal dot array information of a three-dimensional model
By generating an initial dot matrix and calculating the center coordinates of each point in the dot matrix subset, curve fitting is performed, which solves the problem of low efficiency in extracting the center line of non-straight rods in the existing technology and achieves fast and accurate center line extraction.
Patent Information
- Application Number
- CN202310492483.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-05
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2043-05-05
AI Technical Summary
Existing 3D modeling software suffers from problems such as high workload, long time consumption, high repetition rate, and low efficiency when extracting the center line of a non-straight rod 3D model.
By generating an initial point matrix, the nearest point on the outer surface of the rod model is extracted, the center coordinates of each point in the point matrix subset are calculated, and curve fitting is performed to obtain the centerline of the rod model.
It enables rapid extraction of the centerline of non-straight rods with an error less than the default tolerance of 3D modeling software, meeting actual design requirements.
Smart Images

Figure CN116563365B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of mechanical design, and specifically relates to a method for extracting the centerline of a rod based on the lattice information inside a three-dimensional model. Background Technology
[0002] Many 3D modeling software programs, including UG (Unigraphics NX), cannot effectively extract the centerline skeleton of non-straight bar 3D models. When extracting the skeleton of a non-straight bar 3D model, it is necessary to decompose the model into separate straight segments (cylindrical segments) and non-straight segments. For straight segments (cylindrical segments), their centerlines can be extracted quickly. For non-straight bar segments, the centerline extraction requires first extracting the coordinates of the center points of both end faces of the bar and the normal vector passing through the center points. The arc passing through the two center points and tangent to the normal vector is the centerline of the non-straight bar segment. This process is repeated to extract the centerlines of each segment of the bar, ultimately yielding the complete centerline of the bar. However, this method is labor-intensive, time-consuming, has a high repetition rate, and is inefficient. Summary of the Invention
[0003] To address the aforementioned technical problems, the purpose of this invention is to provide a method for extracting the centerline of a rod based on the internal lattice information of a three-dimensional model. This method enables the rapid extraction of the centerline of a non-straight rod from a three-dimensional model and is particularly suitable for applications involving rods with complex shapes.
[0004] To achieve the above objectives, the present invention provides the following technical solution:
[0005] A method for extracting the centerline of a rod model based on the internal lattice information of a 3D model includes the following steps:
[0006] S1. Extract the outer surface and bounding box information of the rod model with a cross-sectional radius of R;
[0007] S1.1 Extract the non-planar surface features of radius R on the rod model, that is, obtain the outer surface of the rod model;
[0008] S1.2 Using AABB bounding boxes, construct a minimum cuboid that can completely enclose the rod model along the X-axis, Y-axis, and Z-axis of the absolute coordinate system where the rod model is located, and record them as xmin, ymin, zmin, xmax, ymax, zmax.
[0009] S2. Generate an initial point matrix within the bounding box;
[0010] Create an initial point matrix within the bounding box region from xmin, ymin, zmin to xmax, ymax, zmax, with the spacing between each point set to n×R; n is a coefficient, n≤0.5; R is the radius of the rod model;
[0011] S3. Extract the points inside the rod model and the points closest to the outer surface of the rod model;
[0012] Traverse all points in the initial point matrix generated in step S2. Draw a perpendicular line from each point in the initial point matrix to the outer surface of the rod model. If the line containing the perpendicular line from the point intersects the outer surface of the rod model at two other points, and the distances between the point and the other two points are not equal but the sum of the distances is equal to the diameter of the rod, then extract the point and establish a subset of the point matrix. At the same time, extract the point with the shortest distance from the point among the other two points, that is, the point with the shortest distance between the point in the subset of points and the outer surface of the rod model.
[0013] S4. Calculate the coordinates of the center O of the rod cross section corresponding to each point in the lattice set extracted in step S3;
[0014] x0 = x2 - k(x2 - x1)
[0015] y0 = y2 - k(y2 - y1)
[0016] z0 = z2 - k(z2 - z1)
[0017] In the formula, x0, y0, and z0 are the spatial coordinates of the center O, k is a constant, x1, y1, and z1 are the coordinates of the lattice sub-concentration points, and x2, y2, and z2 are the coordinates of the closest point between the lattice sub-concentration points and the outer surface of the rod model.
[0018] S5. Perform curve fitting on all points O to obtain the center line of the rod model.
[0019] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0020] The method for extracting the centerline of a rod based on the internal point lattice information of a 3D model, as described in this invention, can effectively extract points on the centerline of a rod, especially non-straight rods. The error between these points and the original centerline of the rod is much smaller than the default tolerance of the 3D modeling software. Curve fitting of the calculated points shows that the tolerance between the fitted curve and the original curve is also smaller than the default tolerance, thus meeting practical design requirements. Attached Figure Description
[0021] Figure 1 A schematic diagram of the AABB bounding box of the rod model constructed for an embodiment of the present invention;
[0022] Figure 2 This is a schematic diagram illustrating the creation of an initial dot matrix within the bounding box region according to an embodiment of the present invention;
[0023] Figure 3 This is a schematic diagram illustrating the extraction of points inside the rod model according to an embodiment of the present invention;
[0024] Figure 4This is the spatial coordinate system of the rod cross-section of the present invention. Detailed Implementation
[0025] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0026] A method for extracting the centerline of a rod model based on the internal lattice information of a 3D model includes the following steps:
[0027] S1. Extract the outer surface and bounding box information of the rod model with a cross-sectional radius of R;
[0028] S1.1 Extract the non-planar surface features of radius R on the rod model, that is, obtain the outer surface of the rod model;
[0029] S1.2. Using an AABB bounding box, construct a minimum cuboid that completely encloses the rod model along the X, Y, and Z axes of the absolute coordinate system (e.g., ...). Figure 1 As shown in the figure, the values are recorded as xmin, ymin, zmin, xmax, ymax, zmax;
[0030] In this embodiment of the invention, the UF_MODL_ask_bounding_box function of UG software is used to record the minimum and maximum values of the bounding box in the three directions of X-axis, Y-axis and Z-axis.
[0031] S2. Generate an initial point matrix within the bounding box;
[0032] Create an initial point matrix within the bounding box region from xmin, ymin, zmin to xmax, ymax, zmax, with the spacing between each point set to n×R; n is a coefficient, n≤0.5; R is the radius of the rod model;
[0033] This invention utilizes the UF_CURVE_create_point command in UG software to create an initial point matrix within the bounding box region, such as... Figure 2 As shown.
[0034] S3. Extract the points inside the rod model and the points closest to the outer surface of the rod model;
[0035] Traverse all points in the initial point matrix generated in step S2. Draw a perpendicular line from each point in the initial point matrix to the outer surface of the rod model. If the line containing the perpendicular line from the point intersects the outer surface of the rod model at two other points, and the distances between the point and the other two points are not equal but the sum of the distances is equal to the diameter of the rod, then extract the point and establish a subset of the point matrix. At the same time, extract the point with the shortest distance from the point among the other two points, that is, the point with the shortest distance between the point in the subset of points and the outer surface of the rod model.
[0036] For example, draw a perpendicular line from point A in the initial lattice to the outer surface of the rod model. If the line containing the perpendicular line from point A intersects the outer surface of the rod model at points B and D, and |AB|≠|AD| and |AB|+|AD|=2R, then extract point A; at the same time, extract point B or point D, which is the shortest between |AB| and |AD|.
[0037] This invention utilizes the UF_MODL_ask_minimum_dist_3 function in UG software to calculate the perpendicular distance between each point and the outer surface of the rod model; points with unequal distances but whose sum equals the diameter are extracted, which are the points inside the rod model. The results are as follows. Figure 3 As shown.
[0038] S4. Calculate the coordinates of the center O of the rod cross section corresponding to each point in the lattice set extracted in step S3;
[0039] For example, point B is the closest point between the lattice sub-convergence point A and the outer surface of the rod model, such as... Figure 4 As shown, based on the spatial coordinate system, a straight line parallel to the z-axis is drawn through the nearest point B, intersecting the xoy plane at point C. A straight line is drawn through point A, intersecting OC and BC at points A′ and B′ respectively, and AA′ and AB′ are perpendicular to OC and BC respectively; therefore, △OBC, △ABB′, and △OAA′ are similar.
[0040] Then we have:
[0041]
[0042]
[0043] The spatial coordinates of the center O can be derived as follows:
[0044] x0 = x2 - k(x2 - x1)
[0045] y0 = y2 - k(y2 - y1)
[0046] z0 = z2 - k(z2 - z1)
[0047] In the formula, x0, y0, and z0 are the spatial coordinates of the center O, k is a constant, x1, y1, and z1 are the coordinates of the lattice sub-concentration points, and x2, y2, and z2 are the coordinates of the closest point between the lattice sub-concentration points and the outer surface of the rod model.
[0048] S5. Perform curve fitting on all points O to obtain the center line of the rod model.
Claims
1. A method for extracting the centerline of a rod model based on the lattice information inside a 3D model, characterized in that, The method includes the following steps: S1. Extract the outer surface and bounding box information of the rod model with a cross-sectional radius of R; S1.1 Extract the non-planar surface features of radius R on the rod model, that is, obtain the outer surface of the rod model; S1.2 Using AABB bounding boxes, construct a minimum cuboid that can completely enclose the rod model along the X-axis, Y-axis, and Z-axis of the absolute coordinate system where the rod model is located, and record them as xmin, ymin, zmin, xmax, ymax, zmax. S2. Generate an initial point matrix within the bounding box; Create an initial point matrix within the bounding box region from xmin, ymin, zmin to xmax, ymax, zmax, with the spacing between each point set to n×R; n is a coefficient, n≤0.5; R is the radius of the rod model; S3. Extract points inside the rod model and the points closest to the outer surface of the rod model; Traverse all points in the initial point matrix generated in step S2. Draw a perpendicular line from each point in the initial point matrix to the outer surface of the rod model. If the line containing the perpendicular line from the point intersects the outer surface of the rod model at two other points, and the distances between the point and the other two points are not equal but the sum of the distances is equal to the diameter of the rod, then extract the point and establish a subset of the point matrix. At the same time, extract the point with the shortest distance from the point among the other two points, that is, the point with the shortest distance between the point in the subset of points and the outer surface of the rod model. S4. Calculate the coordinates of the center O of the rod cross section corresponding to each point in the lattice set extracted in step S3; x0 = x2 - k(x2 - x1) y0 = y2 - k(y2 - y1) z0 = z2 - k(z2 - z1) In the formula, x0, y0, and z0 are the spatial coordinates of the center O, k is a constant, x1, y1, and z1 are the coordinates of the lattice sub-concentration points, and x2, y2, and z2 are the coordinates of the closest point between the lattice sub-concentration points and the outer surface of the rod model. S5. Perform curve fitting on all points O to obtain the center line of the rod model.
Citation Information
Patent Citations
Point cloud data processing method and device for rod-shaped object, electronic equipment and storage medium
CN115423835A
Method, device and equipment for extracting center line of three-dimensional model based on three-dimensional engine
CN116012437A