1. Technical Field
Embodiments of the present disclosure relates to computer aided design systems and methods, and more particularly, to a curved surface area calculation device and method.
2. Description of Related Art
In computer aided designs, length information and area information are basic attributes of graphs. For two dimensional graphs and regular three-dimensional (3D) graphs, the length information and area information can be obtained through four arithmetic operations. However, for irregular 3D graphs, such as curved surfaces, which are defined by control points and border points, the area information cannot be obtained through common arithmetic operations.
The disclosure is illustrated by way of examples and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. 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.
In general, the word “module,” as used hereinafter, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, for example, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware. It will be appreciated that modules may comprised connected logic units, such as gates and flip-flops, and may comprise programmable units, such as programmable gate arrays or processors. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of computer-readable medium or other computer storage device.
In one embodiment, the storage device 20 may be a magnetic or an optical storage device, such as a hard disk drive, an optical drive, or a tape drive. The storage device 20 also stores information of the curved surface, such as border points, control points, and parametric equations of the curved surface. The display device 40 may be a display screen, such as a liquid crystal display (LCD) or a cathode-ray tube (CRT) display.
In one embodiment, as shown in
The border processing module 11 generates a contour curve consisting of border points of the curved surface, and determines an approximate poly-line of the contour curve in a parametric plane. A detailed description is given in
The meshing module 13 sets sample points in the parametric plane, determines an approximate polygon of the contour curve according to the sample points, vertices of the approximate poly-line, and intersection points of vertical lines (or horizontal lines) and the approximate poly-line, and meshes the approximate polygon by a plurality of triangles. A detailed description is given in
The calculation module 15 calculates the area of the curved surface according to areas of the plurality of triangles. A detailed description is given in
The display module 17 displays the curved surface, all the triangles in the parametric plane, and the calculated area of the curved surface on the display device 40.
In block S201, the border processing module 11 generates a contour curve consisting of border points of the curved surface, and determines an approximate poly-line of the contour curve in a parametric plane (a detailed description is given in
In block S203, the meshing module 13 sets sample points in the parametric plane, determines an approximate polygon of the contour curve according to the sample points, vertices of the poly-line, and intersection points of vertical lines (or horizontal lines) and the poly-line, and meshes the approximate polygon by a plurality of triangles (a detailed description is given in
In block S205, the calculation module 15 calculates the area of the curved surface according to areas of the plurality of triangles (a detailed description is given in
In block S301, the border processing module 11 reads the curved surface from the storage device 20.
In block S303, the border processing module 11 generates the contour curve consisting of a plurality of curve segments by connecting the border points of the curved surface.
In block S305, the border processing module 11 reads a curve segment of the contour curve.
In block S307, the border processing module 11 checks if the read curve segment is a rational curve. If the read curve segment is a rational curve, the procedure directly goes to block S321. Otherwise, if the read curve segment is not a rational curve, the procedure goes to block S309. It is understood that the plurality of curve segments of the contour curve may include lines, arcs, elliptic arcs, and rational curves, where the rational curves approaches the contour curve of the curved surface.
In block S309, the border processing module 11 checks if the read curve segment is an elliptic arc. If the read curve segment is an elliptic arc, in block S311, the border processing module 11 converts the elliptic arc to a rational curve. Otherwise, if the read curve segment is not an elliptic arc, the procedure goes to block S313.
In block S313, the border processing module 11 checks if the read curve is a line. If the read curve segment is a line, in block S315, the processing module 11 converts the line to a rational curve. Otherwise, if the read curve segment is not a line, the procedure goes to block S317.
In block S317, the border processing module 11 checks if the read curve segment is an arc. If the read curve segment is an arc, in block S319, the processing module 11 converts the arc segment to a rational curve. Otherwise, if the read curve segment is not an arc, the procedure goes to block S321.
In block S321, the border processing module 11 checks if there is any curve segment of the contour curve has not been read. If there is any curve segment of the contour curve has not been read, the procedure repeats from block S305, until all curve segments of the contour curve have been read and converted to rational curves, the procedure goes to block S323.
In block S323, the border processing module 11 generates a closed boundary curve consisting of all the rational curves. It is understood that converting other types of curves to rational curves can not only make the generated closed boundary curve approach the contour line, but also improve following processing speeds since there is only one type of curve (i.e., the rational curve) to be processed.
In block S325, the border processing module 11 determines control points of the rational curves according to parametric equations of the rational curves, and determines the approximate poly-line of the closed boundary curve according to the control points. It is understood that each rational curve has a corresponding parametric equation represented by parameters such as “U” and “V,” where a value of U or V falls in an interval (0, 1), and control points of each rational curve can be determined according to the corresponding parametric equation.
In block S327, the border processing module 11 determines vertices of the approximate poly-line in the parametric plane using a mathematical method (e.g., an interpolation method). In one embodiment, a horizontal direction of the parametric plane is represented by “U,” a vertical direction of the parametric plane is represented by “V,” and each point in the parametric plane can be represented by (U, V), which corresponds to 2D coordinates (X, Y), where the value of U or V falls in the interval (0, 1). For example, supposing the circle is the closed boundary curve, the border processing module 11 connects four points A, B, C, and D on the circle to generate a poly-line. However, the poly-line is far from the circle, that is, the poly-line has a bad approach precision with the circle. To improve the approach precision, more vertices should be determined. For example, if the interpolation method is applied, midpoints between each two vertices of the poly-line can be obtained as new vertices of the poly-line. The more vertices of the poly-line are determined, the higher approach precision the poly-line has. It should be understood that, the poly-lines illustrated in
In block S401, the meshing module 13 sets sample points in the parametric plane. For example, as shown in
In block S403, the meshing module 13 reads vertices of the approximate poly-line, sample points that fall in the approximate poly-line, and intersection points of the poly-line and the U-lines or V-lines that pass the sample points. For example, as shown in
In block S405, the meshing module 13 generates an approximate polygon of the approximate poly-line in the parametric plane according to the read vertices, sample points, and intersection points.
In block S407, the meshing module 13 divides the approximate polygon to obtain the plurality of triangles by connecting the read vertices, sample points, and intersection points according to a determination rule. In this embodiment, the determination rule is that there is no vertices of the polygon falls in a circumcircle of each obtained triangle.
In block S409, the meshing module 13 deletes the triangles that fall out of the approximate poly-line. For example, if the four vertices “Q1,” “Q2,” “Q3” and “Q4” construct two triangles which fall out of the poly-line L, the two triangles are regarded as ineffective triangles and deleted by the meshing module 13.
In block S411, the meshing module 13 stores all triangles that fall in the approximate poly-line into a data structure stored in the storage device 20.
In block S501, the calculation module 15 reads a triangle from the data structure stored in the storage device 20.
In block S503, the calculation module 15 calculates a length of each side of the triangle according to coordinates of three vertices of the triangle.
In block S505, the calculation module 15 calculates an area of the triangle according to the length of each side.
In block S507, the calculation module 15 determines if there is any triangles stored in the data structure has not been read. If there is any triangles stored in the data structure has not been read, the procedure repeats from block S501, until all triangles stored in the data structure have been read, the procedure goes to block S509.
In block S509, the calculation module 15 calculates the area of the curved surface according to areas of all triangles.
Although certain inventive embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
200910312349.8 | Dec 2009 | CN | national |