1. Field of the Invention
The present invention relates generally to computer aided design (CAD) applications and, in particular, to intuitively controlling the shape of a boundary patch.
2. Description of the Related Art
Computer aided design systems are traditionally used for creating and editing geometric shapes, such as car body parts or engine components. Various modeling operators have been introduced for specific modeling situations. Most noticeable standard ones include loft, sweep and fillet which are well defined over a rectangular domain.
In practical design applications there are often situations to fill arbitrary regions bounded by multiple sides (typically, greater than four) where standard operators are no longer applicable. This calls for a special operator, the n-sided patch or the boundary patch. A boundary patch is defined by a set of input curves over a relatively flat area. Continuity constraints (G0, G1 and G2) can be specified individually for these curves. The patch to be constructed should pass through all given curves and satisfy the continuity constraints within given tolerances.
It is, however, very challenging to construct a boundary patch that not only meets the boundary constraints but also possesses a fair shape under various geometric configurations. As a result, boundary patch has been a long standing problem in both design and research community and there are a large body of proposed solutions to it.
In general, there are two basic approaches to the n-sided problem: multiple patches and single patch. The multiple patches solution takes an n-sided region and subdivides it into a collection of triangular or 4-sided regions. The regions are then filled with standard surface type. The main difficulty with this approach is ensuring the internal smoothness of the resulting patch network. The single patch solution attempts to create a single patch to fill in an n-sided hole. Different techniques have been developed for very specific patch situations. For example, in one technique, a quadratic function is used to fill in three- or five-sided patches. In another technique, quadratics and cubics functions are used for three-, five- and six-sided patches. The problem with these techniques is that often unusual (non-rectangular, non-planar) parametric domains are used and the lack of possibility to control internal shape of the patch.
Another category of filling an n-sided hole is the subdivision approach. The basic process is to generate a surface by starting with a polygonal approximation and refine the approximation iteratively in each subdivision step. The fundamental problem with the subdivision approach, however, is the lack of a good method to handle the smoothness of extraordinary points and to create high quality surfaces.
Commercial CAD systems prefer the single patch approach since only one face needs to be constructed and thus is easier to be integrated in the modeling (especially solid modeling) environment. As the rectangular scheme of non-uniform ration B-spline (NURBS) has become the de facto standard for industrial applications, NURBS is often chosen to represent n-sided patches. First, a surface with a rectangular domain is created that is large enough to cover the entire n-sided hole. The surface is then trimmed back to the hole boundary. In this sense, the patch is a trimmed NURBS surface. This kind of n-sided patch is, however, locked by the boundary constraints, i.e. there are little possibilities to determine/change its interior shape. One can insert additional interior constraints such as interior curves and points to force the patch to pass through. However, these additional constraints introduce some artifacts in the patch shape so that the patch quality (e.g. curvature flow) may suffer. Certain tension control may be achieved but its influence over the entire patch shape is somewhat subtle and limited.
As the foregoing illustrates, what is needed in the art is a mechanism for modifying the patch shape in a direct and intuitive way.
One or more embodiments of the invention is a computer-implemented method for modifying the shape of a graphics object represented in a computer-aided design (CAD) application. The method includes the steps of generating a surface based on one or more boundaries of the graphics object, wherein the surface has a shape defined by a set of first coordinates, mapping the set of first coordinates to a set of second coordinates that identifies a different tangent for each of the one or more boundary edges, modifying a first tangent for a first boundary edge, and modifying the set of second coordinates based on the modified first tangent to generate a modified shape of the surface.
Advantageously, the technique described herein allows for the modification of a boundary patch by modifying tangent magnitudes along the boundaries.
So that the manner in which the above recited features of the invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.
In the following description, numerous specific details are set forth to provide a more thorough understanding of the invention. However, it will be apparent to one of skill in the art that the invention may be practiced without one or more of these specific details. In other instances, well-known features have not been described in order to avoid obscuring the invention.
One or more embodiments of the invention are implemented by a computer-implemented graphics program 108 (e.g., a CAD program), wherein the graphics program 108 is represented by a window displayed on the display device 102. Generally, the graphics program 108 comprises logic and/or data embodied in or readable from a device, media, carrier, or signal, e.g., one or more fixed and/or removable data storage devices 104 connected directly or indirectly to the computer 100, one or more remote devices coupled to the computer 100 via a data communications device, etc. Further, the graphics/drawing program 108 may utilize a database 110 such as a spatial database.
Computer 100 may also be connected to other computers 100 (e.g., a client or server computer) via network 112 comprising the Internet, LANs (local area network), WANs (wide area network), or the like. Further, database 110 may be integrated within computer 100 or may be located across network 112 on another computer 100 or accessible device.
Those skilled in the art will recognize that the exemplary environment illustrated in
As described above, one or more embodiments of the invention is implemented in a CAD system. The invention provides a technique for intuitively modifying the shape of a boundary patch defined by a set of input curves/edges.
A surface created with the above smoothness tends to distribute curvature over large regions and produces very graceful shapes. If B-spline is used to represent the boundary patch, solving the smoothness functional becomes the discrete matrix minimization problem:
min[(xT]Kx) (2)
xT={Pi,j} is a vector of (m×n) control points and K defines the stiffness matrix and is given by:
where
and ψ={Ni(x)Nj(y)} with i=0, . . . , n, j=0, . . . , m and Ni is the B-spline basis function.
Boundary constraints include G0, G1 and G2 constraints and can be written as linear equations:
Ax=b (4)
where each row of the matrix A represents a linear constraint on x and the vector b are the values of these constraints. The final equations for determining X are determined by minimizing the quadratic functional (2) subject to the constrained equation (4).
Boundary constraints include G0, G1 and G2 constraints and can be written as linear equations. G0 constraint is a position constraint that requires the surface to interpolate a specified position. Thus, b just contains the position coordinates, namely the z coordinates. G1 constraint requires the surface to assume a specified normal vector =(N)(x),N(y),N(z)).
Let =(1,0,Sx) and =(0,1Sy) be the surface partial derivatives, the sufficient G1 conditions are then given by:
which yields:
N(x)+SxN(z)=0
N(y)+SyN(z)=0 (6)
Thus, we obtain the following G1 constraint equation:
From the above equation we can see that both Sx and Sy are fully determined by the surface normal. As a result, there is no degree of freedom to modify them in the presence of G1 constraint.
Two surfaces are said G2 at a touch point if their curvatures at that point agree in all directions. For regular surfaces G2 condition holds if the curvatures of the two surfaces are the same in three independent directions. Therefore, the G2 constrained equations can be derived in a manner similar to that of G1.
Boundary tangents of a surface have great influence over its overall shape. If only position constraints are required, i.e. a boundary patch only needs to interpolate given boundaries, both directions and magnitudes of boundary tangents can be used to adjust the patch shape. However, if G1 or G2 constraints are present, boundary tangents are fully constrained. As shown in the previous section, there is no degree of freedom to modify either their directions or magnitudes in the Cartesian coordinate system. To overcome this limitation, a new coordinate system called the modified spherical coordinate system is defined as described below.
Let O be the origin of the coordinate system and the reference plane is the X-Z plane. Then a point P=(x,y,z) in the Cartesian coordinate system is defined by the coordinate triple (r,u,v) in the modified spherical coordinate system as:
Similarly, r is the radius or radial distance of point P to a point O′ resulted from moving the origin O a distance of ƒ(x,y) along the positive Z-axis. u is the polar angle between the Y-axis and the line segment
From equation (8) it is trivial to derive the formulae of mapping from the modified spherical coordinate system to the Cartesian coordinate system as follows:
In the modified spherical coordinate system, the patch surface is now parametrically defined over the (u,v) domain and the smoothness functional (1) becomes:
The corresponding discrete matrix form is re-written in the same way as in (3).
The boundary constraints can be expressed in the modified spherical coordinate system. For G1 constraints, first the 1st partial derivatives of the surface in u and v are computed:
The 1st partial derivatives of ƒ(x,y) are then derived through the chain rule as:
Finally, the G1 condition (3) is rewritten in the following equation
(r1u=r(sin u sin vN(x)−cos uN(y)+(sin u sin v−ƒ1x sin u sin v+ƒ1y cos u)N(z))/w@r1v=r(−cos u cos v N(x)+cos u sin vN(z)+ƒ1x cos u cos vN(z))/w
where w=cos u sin vN(x)+sin uN(y)+(cos u cos v−ƒx cos u sin v−ƒy sin u)N(z).
From the above equation, the surface tangent is now determined by the constraint normal as well as the unknown function ƒ(x,y). Since the constraint normal is given, ƒ(x,y) is used to modify surface tangents which will be further described in the next section.
To see how the function ƒ(x,y) affects the surface tangent vector, the following assumption is made ƒ(x,y)=C, where C is a constant. Based on this assumption:
ƒu=ƒv=ƒx=ƒy=0 (15)
Both ru and rv are proportional to r. If equation (14) is inserted into the equations (11) and (12), it becomes clear that and are also proportional to r. r is computed by:
r=√{square root over (x2+v2+(z+C)2)} (16)
Therefore, if C increases, then the value r goes up and effectively scales up the magnitudes of surface tangents and . Similarly deceasing C will scale down the tangent magnitudes. Since the change of C equally affects surface tangents along the boundary, we call this kind of change the “uniform” scaling of surface tangent magnitudes, and C the scale factor. Obviously, the relative influence of C over r (consequently the surface tangents) is dependent on the dimension of r and therefore the size of the model.
In practice, the user may want to use variable scale factors along the boundary to achieve the desired surface shape. This calls for the non-uniform scaling which allows the user to specify some seed scale factors on the boundary. A “scaling” curve along the boundary is then created that interpolates the seed scale factors. Finally, the scaling curve is used to fit a surface that is ƒ(x,y). The fitting is, in fact, the same procedure as described in the section “Surface Representation” where the coordinate z is replaced by the scale factor.
The method 700 begins at step 702, where the graphics program 108 generates a surface of the graphics object 202 based on one or more input boundary edges identified by the user of the graphics profram 108. The surface is represented in a Cartesian coordinate system and one or more constraints.
At step 704, the graphics program 108 maps the Cartesian coordinates representing the surface to a modified spherical coordinates. The manner in which the Cartesian coordinates are mapped to spherical coordinates is described in great detail above. At step 706, the graphics program 108 modifies the tangent magnitudes along the input boundary in the spherical coordinate system according to one or more constraints specified by the user.
At step 708, the graphics program creates a surface in the spherical coordinate system according to the modified tangents. At step 710, the graphics program maps the modified spherical coordinates back to Cartesian coordinates that represent the new shape of the surface.
In other embodiments, the coordinates can be represented in coordinate systems other than Cartersian and the modified spherical coordinates. The computations involved with such coordinate systems would be well-known in the art.
One embodiment of the invention may be implemented as a program product for use with a computer system. The program(s) of the program product define functions of the embodiments (including the methods described herein) and can be contained on a variety of computer-readable storage media. Illustrative computer-readable storage media include, but are not limited to: (i) non-writable storage media (e.g., read-only memory devices within a computer such as CD-ROM disks readable by a CD-ROM drive, flash memory, ROM chips or any type of solid-state non-volatile semiconductor memory) on which information is permanently stored; and (ii) writable storage media (e.g., floppy disks within a diskette drive or hard-disk drive or any type of solid-state random-access semiconductor memory) on which alterable information is stored.
The invention has been described above with reference to specific embodiments. Persons skilled in the art, however, will understand that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention as set forth in the appended claims. The foregoing description and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.