This application claims priority to Chinese Patent Application No. 201410737415.7 filed on Dec. 5, 2014, the contents of which are incorporated by reference herein.
The subject matter herein generally relates to simulation technology, and particularly to a computing device and a method for simulating a process of scanning an object.
A scanner (for example, a laser scanner) is commonly used to scan a surface of various objects (for example, a shell of a mobile phone). However, the scanner may fail after a large number of uses. For example, a lens of the scanner may need to be periodically changed.
Many aspects of the disclosure can be better understood with reference to the following drawings. The components in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the disclosure. Moreover, in the drawings, like reference numerals designate corresponding parts throughout the several views.
It will be appreciated that for simplicity and clarity of illustration, where appropriate, reference numerals have been repeated among the different figures to indicate corresponding or analogous elements. In addition, numerous specific details are set forth in order to provide a thorough understanding of the embodiments described herein. However, it will be understood by those of ordinary skill in the art that the embodiments described herein can be practiced without these specific details. In other instances, methods, procedures, and components have not been described in detail so as not to obscure the related relevant feature being described. The drawings are not necessarily to scale and the proportions of certain parts may be exaggerated to better illustrate details and features. The description is not to be considered as limiting the scope of the embodiments described herein.
Several definitions that apply throughout this disclosure will now be presented. The term “module” refers to logic embodied in computing or firmware, or to a collection of software instructions, written in a programming language, such as, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware, such as in an erasable programmable read only memory (EPROM). The modules described herein may be implemented as either software and/or computing modules and may be stored in any type of non-transitory computer-readable medium or other storage device. Some non-limiting examples of non-transitory computer-readable media include CDs, DVDs, BLU-RAY™, flash memory, and hard disk drives. The term “comprising” means “including, but not necessarily limited to”; it specifically indicates open-ended inclusion or membership in a so-described combination, group, series and the like.
In at least one embodiment, the storage device 12 can be an internal storage device, such as a flash memory, a random access memory (RAM) for temporary storage of information, and/or a read-only memory (ROM) for permanent storage of information. The storage device 12 can also be an external storage device, such as an external hard disk, a storage card, or a data storage medium. The at least one processor 14 can be a central processing unit (CPU), a microprocessor, or other data processor chip that performs functions of the computing device 1.
Referring to
At block 301, the triangulation module triangulates the drawing of the 3D object using a plurality of 3D triangles. In at least one embodiment, the drawing of the 3D object can be represented by the plurality of the 3D triangles after triangulation. Each of the 3D triangles is assigned to a serial number after the drawing of the 3D object has been triangulated. The detail description of triangulating the drawing of the 3D object using a plurality of 3D triangles is described in
At block 302, the simulation module generates a two-dimensional (2D) image of light and defines an origin point and a normal vector. In at least one embodiment, the 2D image of light can be, but is not limited to, be formed by specified patterns or images, such as, black stripes and white stripes as shown in
At block 303, the simulation module generates a projection area according to the origin point and the normal vector. The projection area encloses a cubic area as shown in
At block 304, the projection module projects the 2D image of the light into the projection area and obtains a 2D projection surface. The 2D projection surface may be, but is not limited to, a quadrilateral plane as shown in
At block 305, the projection module projects the 2D projection surface onto the drawing of the triangulated 3D object and obtain a drawing of a 2D object. As shown in
At block 306, the displaying module obtains the 2D triangles from the drawing of the 2D object and displays the 2D triangles onto the drawing of the 3D object.
In at least one embodiment, the 2D triangles of the drawing of the 2D object is shown in
At block 307, the outputting module generates a scanning program which includes programmed computerized code of the modules 100-108. The scanning program repeatedly executes from the module 100 to the module 108 in order when a user starts the scanning program. The scanning program includes functions of the modules 100-108. The outputting module outputs the origin point and the normal vector when the scanning program is generated. Furthermore, the scanning program also includes the origin point and the normal vector, and the user does not need to define the origin point and the normal vector when starting the scanning program. That is, the simulated scanner moves to the position which is determined by the origin point and the normal vector when the scanning program is started. Additionally, the outputting module displays the scanning program on the display device, and stores the scanning program into the storage system.
At block 3010, the triangulation module reads the drawing of the 3D object from the storage device.
At block 3011, the triangulation module determines that if the drawing of the 3D object consists of 3D triangles. If the drawing of the 3D object consists of 3D triangles, the procedure directly goes to 3017. Otherwise, if the drawing of the 3D object does not consist of 3D triangles, the procedure goes to block 3012.
At block 3012, the triangulation module converts the drawing of the 3D object to a B-spline curved surface, determines a closed boundary curve of the B-spline curved surface in a parametric plane, and divides the closed boundary curve by a plurality of horizontal lines (hereinafter referred to “U-lines”) and vertical lines (hereinafter referred to “V-lines”), to obtain a plurality of grids (as shown in
At block 3013, if a grid has no intersection point with the closed boundary curve, the triangulation module generates two triangles by connecting four vertices of the grid anti-clockwise.
At block 3014, if a grid has one or more intersection points with the closed boundary curve, the triangulation module adds the one or more intersection points, one or more vertices of the grid which fall in the closed boundary curve, and boundary points of the closed boundary line into a 2D data structure Q1.
At block 3015, the triangulation module reads a first point p1 and a second point p2 nearest to the point p1 from the 2D data structure Q1, where p1 and p2 construct one side of a triangle A. The triangulation module further determines a third point p3 of the triangle A according to a determination rule that there is no 2D point of the 2D data structure Q1 in a circumcircle of the triangle A consisted by the points p1, p2, and p3.
At block 3016, the triangulation module determines vertices of other triangles in the 2D data structure Q1 according to the determination rule, to generate the plurality of triangles of the drawing of the 3D object.
At block 3017, the triangulation module stores the information of each triangle into a record list T according to a sequence of generating the triangles.
The embodiments shown and described above are only examples. Even though numerous characteristics and advantages of the present technology have been set forth in the foregoing description, together with details of the structure and function of the present disclosure, the disclosure is illustrative only, and changes may be made in the detail, including in particular the matters of shape, size and arrangement of parts within the principles of the present disclosure, up to and including the full extent established by the broad general meaning of the terms used in the claims.
Number | Date | Country | Kind |
---|---|---|---|
201410737415.7 | Dec 2014 | CN | national |