Electronic device and method for analyzing adjoining parts of a product

A scanner obtains point-cloud data of adjoining parts of a product. A computing device reads two point-clouds from the point-cloud data, fits two or more lines according to the two point-clouds, selects two lines that have the same ascending direction from the two or more lines, and creates a two-dimensional coordinates system base on the two selected lines. The computing device determines a highest point in each of the two point-clouds based on distances from each point in either of the point-clouds to a corresponding selected line, and determines two nearest points in the two point-clouds. A difference between Y coordinates of the two highest points is determined as a gap-height of two adjoining parts of the product, and a difference between X coordinates of the two nearest points is determined as a gap-width between two adjoining parts.

BACKGROUND

1. Technical Field

Embodiments of the present disclosure relates to computer aided design (CAD) technology, and more particularly, to an electronic device and a method for analyzing adjoining parts of a product.

2. Description of Related Art

An electronic device, such as a cell phone, is assembled from a plurality of parts. After assembly, gaps may exist between adjoining parts of the cell phone, which may be caused by lack of precision in production of the parts. To ensure precision of the product, the gaps between adjoining parts should be measured. However, at present, the measurement is done manually, which is time-consuming and leads to other potential errors.

DETAILED DESCRIPTION

The disclosure, including the accompanying drawings in which like references indicate similar elements, is illustrated by way of examples and not by way of limitation. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least one.

FIG. 1is a block diagram of one embodiment of a computing device1comprising an analysis unit10. In one embodiment, the computing device1is electronically connected to a laser scanner2. The laser scanner2is used to scan adjoining parts of a product3which is known as point-cloud data21, which can be representative of three-dimensional coordinates of points of the adjoining parts. The electronic device1further includes a storage device20, a processor30, and a display40. The storage device20stores the point-cloud data21. The analysis unit10analyzes the point-cloud data, to determine any gap between adjoining parts and a height difference (or width difference) between two adjoining parts. The analysis unit10, the storage device20, the processor30, and the display40communicate via a system or other bus.

As shown inFIG. 1, the analysis10includes a point reading module11, a distance computation module12, a line fitting module13, and a coordinate system creation module14. The modules11-14may comprise computerized code in the form of one or more programs (computer-readable program code) that are stored in the storage device20. The computerized code includes instructions that are executed by the processor30to provide the functions of the modules11-14illustrated inFIG. 2aandFIG. 2b. The storage system20may be a cache or an independent or a dedicated memory. The computing device1may be a computer, or any other type of electronic device having a data processing function.

FIG. 2AandFIG. 2Bare a flowchart of one embodiment of a method for analyzing adjoining parts of the product3. Depending on the embodiment, additional steps may be added, others removed, and the ordering of the steps may be changed.

In step S201, the laser scanner2obtains point-cloud data21of the product3by scanning two or more adjoining parts of the product3, and sends the point-cloud data21to the computing device1. The computing device1displays the point-cloud data21on the display40, and stores the point-cloud data21in the storage device20. In one embodiment, the point-cloud data21may be shown as the point-clouds illustrated inFIG. 3.

In step202, the point reading module11filters discrete points from the point-cloud data21, to leave two or more point-clouds consisting of consecutive points. In one embodiment, the point reading module11determines the discrete points by determining whether a difference between X coordinates, or between Y coordinates, or between Z coordinates of each two adjoining points exceeds a threshold value. For example, the point-cloud data21may include a number N of points labeled from P1(X1, Y1, Z1)-Pn(Xn, Yn, Zn) in sequence. Then, a threshold value Tx of an X coordinate of the point Pn may be defined as an average value AX of X coordinates of the prior (n−1) points, a threshold value Ty of a Y coordinate of the point Pn may be defined as an average value AY of Y coordinates of the prior (n−1) points, and a threshold value Tz of a Z coordinate of the point Pn may be defined as an average value AZ of Z coordinates of the prior (n−1) points. If a difference in X coordinates, or in Y coordinates, or in Z coordinates of the point Pn and the point Pn−1 is more than the threshold value AX, or AY, or AZ, then the point Pn is determined as a discrete point. As shown inFIGS. 3, Q1and Q2represents two point-clouds consisting of consecutive points, and the other points are discrete points to be filtered.

In step203, the line fitting module13reads a first point-cloud (such as the point-cloud Q1) and a second point-cloud (such as the point-cloud Q2) from the filtered point-cloud data21, and fits two lines according to the two point-clouds. For example, as shown inFIG. 4, the line fitting module13fits a line L1according to the point-cloud Q1, and fits a line L2according to the point-cloud Q2.

In step S204, the distance computation module14computes a distance from each point in the two point-clouds to a corresponding fitted line. For example, a distance from each point in the point-cloud Q1to the fitted line L1is computed, and a distance from each point in the point-cloud Q2to the fitted line L2is computed.

In step S205, the distance computation module14determines if a corner point exists in either of the two point-clouds according to the computed distances. The corner point is determined as a point in a point-cloud that has a maximum distance to the fitted line of the point-cloud, and is between intersection points of the point-cloud and the fitted line of the point-cloud. For example, as shown inFIG. 4, a point P0in the point-cloud Q2has the maximum distance to the fitted line L2, and the point P0is between the intersection points A1and A2of the point-cloud Q2and the fitted line L2, therefore, the point P0is determined as the corner point in the point-cloud Q2. If a point-cloud (such as the point-cloud Q1) has no corner point, the point-cloud does not need to be divided into sub-point-clouds, and step S207is implemented. Otherwise, if a point-cloud (such as the point-cloud Q2) is determined to have the corner point, step S206implemented for further dividing the point-cloud.

In step S206, the line fitting module13divides the point-cloud into two sub-point-clouds by reference to the corner point, and fits two new lines according to the two sub-point-clouds. For example, inFIG. 4, the point-cloud Q2is divided into two sub-point-clouds Q21and Q22by the corner point P1, and two new lines are fitted according to the sub-point-clouds Q21and Q22. Steps S204-S206may be implemented to determine the corner points in the sub-point-clouds and further divide the sub-point-clouds for the fitting of new lines according to the sub-point-clouds, step S206continues or is repeated until no corner point exists in all sub-point-clouds. Step S207is implemented when step S206terminates.

In step S207, the coordinate system creation module14selects two lines that have the same ascending direction from the fitted lines of the two point-clouds (including sub-point-clouds of the two point-clouds). Two lines which intersect may have four included angles. In one embodiment, if the minimum included angle of the two lines is less than a predetermined angle (e.g., 5 degrees), the two lines are determined as having the same ascending direction. The two lines L1and L21shown inFIG. 4may be determined as having the same direction.

In step S208, the coordinate system creation module14determines two angular bisectors of the included angles of the two lines, and creates a two-dimensional (2D) coordinate system by taking the two angular bisectors as an X-axis and a Y-axis of the 2D coordinate system. For example, as shown inFIG. 5, the 2D coordinate system is created according to the two angular bisectors of the included angles of the two lines L1and L21.

In step S209, the distance computation module12determines a highest point in each of the two point-clouds. The highest point is defined as a point in the first point-cloud (or in the second point-cloud) that has the maximum distance to the corresponding selected line (such as the fitted line L1or L21) compared to other points in the first point-cloud (or in the second point-cloud). For example, a first point P1(x1, y1) is determined as the highest point in the first point-cloud Q1, and a second point P2(x2, y2) is determined as the highest point in the sub-point-cloud Q21of the second point-cloud Q2. The distance computation module12further determines two nearest points from the two point-clouds based on the two selected lines, such as a third point P3(x3, y3) in the first point-cloud Q1and a fourth point P4(x4, y4) in the sub-point-cloud Q21.

In step S210, the distance computation module12determines a difference between Y coordinates of the two highest points as a gap-height of two adjoining parts of the product3, and determines a difference between the X coordinates of the two nearest points as a gap-width between the two adjoining parts. For example, the difference of the Y coordinates of the two highest points P1and P2is |y2−y1|, and the difference of the X coordinates of the two nearest points P3and P4is |x4−x3|. Therefore, the two adjoining parts, respectively represented by the first and the second point-clouds, have a gap-height of |y2−y1| and a gap-width of |x4−x3|. The gap-height and the gap-width of the two adjoining parts of the product3are stored into the storage device20, and may be displayed on the display40.