# Patent

## Title
Image processing method

## Abstract

A computer-implemented image processing technique for selectively recovering the features of an original CAD model after the original CAD model has been converted to a digitized image and a new CAD model generated from the digitized image. The original boundary representation provides a template to transform the representation through processing under governance of a programmed processor so as to recover accuracy and reintroduce feature edges and feature corners as well as other detailed features to the CAD model obtained from the digitized image, e.g., to enable detailed features to be retained that would otherwise have been lost due to the lossy conversion into image space. The method operates to better ensure that reconstructed boundary vertices lie on original CAD model surfaces and feature edges and corners are recovered.

## Background
The present application claims the benefit of priority under 35 U.S.C. §119 of GB 1311293.3, filed 25 Jun. 2013, which is hereby incorporated by reference in its entirety.
FIELD OF THE INVENTION
The invention relates to computer-assisted methods for the preparation of images for further processing. For example, the prepared images can be for use in subsequent analysis techniques, such as finite element analysis or computational fluid dynamic (CFD) analysis, or as a more robust image for computer-assisted design (CAD) manipulation. In another example, an image can be prepared for use in a manufacturing process, such as three-dimensional printing, CNC machining, injection moulding or the like.
BACKGROUND TO THE INVENTION
CAD models are often constructed in a way that makes certain types of subsequent processing, such as the creation of real physical models (e.g., by three-dimensional printing or rapid prototyping) or volume and surface meshes, not possible without manual intervention. Often this can arise because some applications, such as visualization, have less stringent requirements for the CAD model than other applications. CAD models which do not meet the requirements of a given process are often referred to as having defects or invalid geometries. Correcting the defects in CAD models so that they are suitable for the subsequent processing is sometimes termed “fixing” or “healing” the CAD data.
Herein we use the term “CAD model” to mean any conventional boundary representation of a three-dimensional geometry, either through the use of NURBS, polygons or other surface representations.
Examples of invalid geometries include:
(1) Surface mismatch, where the surface patches or polygons which make up the boundary representation create a small gap or overlap at shared edges in the surface (even though they may visually appear to conform). This can occur even when the vertices of the shared edge are the same if the polynomial order of interpolating function differs from patch to patch. Models with this type of invalid geometry are sometimes referred to as not being watertight or closed.
(2) Holes, where the edges and/or vertices of adjacent surface patches or polygons which make up the boundary representation are not shared. Models with this type of invalid geometry are also sometimes referred to as not being watertight or closed.
(3) Shell surfaces, where the model includes one or more surfaces which do not enclose a finite volume, i.e., they simply define a two-dimensional entity in space, with no solid region or thickness. Whilst such a surface can be clearly visualized, it cannot be used for a number of applications, such as generating a rapid prototyped model or a volume mesh, for which a closed model with a finite volume is required.
Another potential problem can be the complexity of CAD models, e.g., CAD models which include many detailed features such as short edges, fillets, etc. Such highly detailed features can present a challenge to generating a mesh for subsequent Computer Aided Engineering (CAE) analysis techniques such as modelling using finite element analysis (FEA) and computational fluid dynamics (CFD) because they introduce additional complexities, e.g., increased processing time and memory usage, more challenging meshing, etc. In many circumstances, the detailed features are not required for analysis purposes, and therefore a solution is to manually remove them from the CAD model. This process is known as “CAD de-featuring”.
A further problem may arise where a CAD model comprises multiple (two or more) interrelated component parts, where each component part is represented by a separate (independent) CAD model. For example, the component parts may make up an assembly which need to be agglomerated or concatenated to form a single CAD model. In one example, the component parts can be an engine block, inlet and exhaust manifolds, and pistons, which together form a car engine assembly. In other examples one of the interrelated component parts can be subtracted from another, e.g., the interrelated component parts can be a model of a femur bone and a reaming tool, whereby the combined CAD model is obtained by subtracting the reaming tool from the bone. For the purposes of further processing, it can be desirable to generate either a single or several new CAD models in which the component part CAD models are combined, e.g., based on Boolean operations (union, intersection, etc.). For example, it can be desirable to analyse air flow over the complete car engine assembly or to perform finite element analysis on bone after the reaming tool is subtracted.
However, the result of the Boolean operations in CAD space may introduce defects in the resulting CAD model due to differences in geometry of surfaces of the component parts which are intended to interact with one another, e.g., by contact, mating, etc. For example, surface patches or polygons which make up the boundary representation at interfaces between components typically will not be perfectly conforming, thereby creating gaps or overlaps. These defects can be a result of the CAD models for the component parts being generated on separate systems, e.g., different CAD programs or on the same system without direct regard to one another. These defects may need to be manually fixed before processing of the new CAD model can take place.
A number of tools exist for addressing the problems either by operating directly on the CAD model or by creating a new CAD model using for example a “shrink wrapping” process. However these approaches can be difficult to use, may require considerable user interaction and may not give desired results. One example of such a tool is CADfix® by International TechneGroup Incorporated.
SUMMARY OF THE INVENTION
At its most general, the present invention proposes a technique for selectively recovering the features of an original CAD model after the original CAD model has been converted to a digitized image and a new CAD model generated from the digitized image. The method is implemented by a computer using code executing in a processor thereof with reference to the contents of one or more memory devices. The original boundary representation can be effectively used as a template to transform the representation through processing under governance of a programmed processor so as to recover accuracy and reintroduce feature edges and feature corners as well as other detailed features to the CAD model obtained from the digitized image, e.g., to enable detailed features to be retained that would otherwise be lost due to the lossy conversion into image space. The enhanced method implemented in accordance with one or more embodiments of the present invention can better ensure that reconstructed boundary vertices lie on original CAD model surfaces and feature edges and corners are recovered.
Thus, according to one aspect of the invention, there can be provided a computer-implemented method of generating a representation of a virtual three-dimensional object in a computer having a processor and a memory device, the method comprising, through the use of code executing in the processor to configure the processor perform several steps of the method in conjunction with the memory device which can store the representation, the following: obtaining into the memory device a master boundary representation of the virtual three-dimensional object; sampling using code executing in the processor a bounding volume containing the master boundary representation to generate a digitized three-dimensional representation of the object in the memory device; generating using code executing in the processor a slave boundary representation from the digitized three-dimensional representation of the object, the slave boundary representation being in the memory device; modifying using code executing in the processor the slave boundary representation with reference to the master boundary representation to make the slave boundary representation more similar to the master boundary representation. The aim of the modifying step can be to bring the overall geometry of the slave boundary representation closer to that of the master boundary representation, i.e., so that it appears exactly the same as the master boundary representation. Thus, the modifying step can enable the slave boundary representation to more accurately resemble the master boundary representation and/or can reintroduce one or more features of the master boundary representation.
The method can be for preparing a virtual three-dimensional object to be suitable for three-dimensional printing, or for further Computer Aided Engineering (CAE) analysis techniques, such as FEA and CFD.
Herein, the term “boundary representation” means a CAD model in any suitable format, e.g., data representative of a surface in three dimensions, e.g., defined using a NURBS mathematical model, a plurality of polygonal surfaces or a volume mesh.
The process of converting the master boundary representation to image data and then reconstructing a surface from the image data inevitably leads to geometric inaccuracy in the reconstructed surfaces and a loss of feature edges and feature corners. The method of the invention therefore includes modifying the slave boundary representation to reintroduce a feature (or a plurality of features) of the master boundary representation. Thus, by referencing back to the master boundary representation (i.e., the original CAD model), geometric accuracy/fidelity and key features can be recovered. In this context, a feature can be any aspect of the shape or configuration of the master boundary representation, e.g., the position of its surfaces, the nature of its edges or corners, etc.
Modifying the slave boundary representation can be done to align or register a surface on the slave with a corresponding surface on the master boundary representation, and/or to recreate detailed edges or corners that are lost in the sampling process. Thus, embodiments of the present invention include code executing in a processor to configure the processor perform actions, such as modifying, comparing, mapping, and so on, in conjunction with data stored, changed, and generally maintained the memory device. For instance, modifying the slave boundary representation can comprise: comparing using code executing in the processor the slave boundary representation with the master boundary representation; and mapping using code executing in the processor a displaced portion of the slave boundary representation to a modified position to match the corresponding portion of the master boundary representation. Herein, displaced portion means a part of the slave boundary representation that is not in the same position as the corresponding part of the master boundary representation. In practice, the process of generating the slave boundary representation means that the master boundary representation and the slave boundary representation share a common frame of reference. If this is not the case, the comparing step can include co-registering the master boundary representation and the slave boundary representation. As mentioned above, the displaced portion can be a surface, edge, or corner.
Mapping the displaced portion can comprise moving a plurality of points on the slave boundary representation in the memory to respective locations on the co-registered master boundary representation in the memory device using code executing in the processor. This can be a technique for registering a surface or an edge or a corner of the slave boundary representation with the master boundary representation. The method can include selecting one or more features on the master boundary representation to which corresponding portions of the slave boundary representation are to be mapped.
Each of the plurality of points can be moved on to the surface of the master boundary representation that is closest to it in a direction normal to the surface of the master boundary representation. Alternatively, each of the plurality of points can be moved on to the surface of the master boundary representation that is closest to it in a direction normal to the surface of the slave boundary representation. For example, the slave boundary representation can comprise a plurality of contiguous polygons, and wherein each of the plurality of points can be a vertex at the intersection between two or more of the plurality of contiguous polygons.
Alternatively, the slave boundary representation can comprise a volume mesh having a plurality of contiguous cells, and wherein each of the plurality of points is a vertex at the intersection between two or more of the plurality of contiguous cells.
In another embodiment, the slave boundary representation can comprise a NURBS surface, and wherein each of the plurality of points is a grid point on the NURBS surface.
Mapping the displaced portion can comprise spawning a new point on the slave boundary representation, wherein moving the plurality of points comprises moving the new point. For example, where the slave boundary representation can comprise a plurality of contiguous polygons, a new point can be spawned by dividing a polygon in the displaced portion to spawn a new vertex, wherein moving the plurality of points comprises moving the spawned vertex. The technique can be particularly useful for corners and edges, as it can reduce the magnitude of distortion of the polygons in the displaced region.
The displaced portion can be any of a surface, an edge and a corner.
The method can include outputting the modified slave boundary representation, e.g., for display on an output device associated with the computer or further processing by the computer or another machine. For example, the modified slave boundary representation can be communicated to a three-dimensional printer or CNC machine. The modified slave boundary representation can also be suitable for further operations in polygonal (i.e., CAD) space, e.g., adaptive decimation, generating volume meshes, converting to higher order NURBS surfaces, etc.
The step of generating a slave boundary representation from the digitized three-dimensional representation of the object can use any conventional surface reconstruction technique implemented as code executing in the processor to configure the processor to implement such technique, e.g., an isosurfacing technique such as the marching cubes algorithm. The slave boundary representation can thus comprise one or more closed polygonal surfaces, which in turn can be formed from a plurality of contiguous polygons. If the object comprises a plurality of component parts which are intended to conform with one another, generating the slave boundary representation can comprises using the multi-part marching cube algorithm to ensure conformity at all part interfaces.
Alternatively, the step of generating the slave boundary representation can comprise generating a volume mesh of the digitized three-dimensional representation, e.g., using any known technique such as advancing front or Delaunay meshing.
The method can include manipulating the digitized three-dimensional representation before generating the slave boundary representation. Manipulating the digitized three-dimensional representation can include digitally altering or de-featuring a region of the digitized three-dimensional representation of the object.
Herein, digital altering means any technique for changing the image data obtained from the sampling step. For example, the image data can be altered using known image processing techniques implemented using suitable code executing in the processor, such as paint/unpaint, filtering, smoothing, flood filling, etc. Alternatively or additionally, the step of digitally altering can comprise performing a morphological operation.
If the object is an assembly of sub-components, digital altering can comprise joining the sub-components, e.g., by connecting regions (e.g., voxelized volumes) in the digitized three-dimensional representation that are intended to be in contact or joined, again, using code executing in the processor. The surfaces can be joined by filling or morphological closing operations. Alternatively or additionally, if the object is an assembly of sub-components, the digital altering step can comprise performing one or more Boolean operations using code executing in the processor to configure the processor to implement such an operation (or other algorithm), e.g., union or intersection, to effectively merge the sub-components into a single object or to create different new modified components. This technique can be particularly useful if it is desirable to model the interaction between the original CAD model and a separate image. Boolean operations can be used on the digitized three-dimensional representation and the separate image, before converting the result back to form the slave boundary representation. The Boolean operations can act to split the digitized image representation or to amalgamate or concatenate it with the separate image.
Manipulating the digitized three-dimensional representation can be for the purpose of healing defects in the master boundary representation. The method can thus include identifying an invalid portion of the master boundary representation; and selecting a healing technique to be applied based on the identified invalid portion using code executing in the processor, wherein digitally altering a region of the digitized three-dimensional representation comprises code executing in the processor to configure the processor to implement a healing technique or algorithm to heal defects in the master boundary representation in the memory unit.
There can be a number of available healing techniques that can be applied, depending on the type of defect, each implementable using code executing in the processor to configure the processor to apply such technique. The method can therefore include: identifying an invalid portion of the master boundary representation; and selecting the healing technique to be applied based on the identified invalid portion. In some circumstances, explained below, the act of converting the master boundary representation into a digitized image, i.e., the step of sampling the bounding volume containing the master boundary representation, can in itself result in obtaining the healed digitized three-dimensional representation. The sampling process itself is lossy, which means that detail can be lost from the master boundary representation. If the defects exist at the level of detail that is lost, i.e., they have dimensions of the same order of magnitude of the sampling rate or less, they can be healed by the sampling process itself.
The region that is digitally altered can correspond to the identified invalid portion of the master boundary representation.
The digitized three-dimensional representation of the object can comprise a voxelized model of the virtual three-dimensional object, e.g., obtained by a conventional voxelization process using code executing in the processor to configure the processor to implement that process. The step of digitally altering a region of the digitized three-dimensional representation can thus comprise painting the region to add or remove voxels in the digitized three-dimensional representation.
The identified invalid portion can include a gap in the master boundary representation. For such an invalid portion, the selected healing technique can include selecting a sampling spacing that is greater than the magnitude of the gap. As mentioned above, this can result in the healed digitized three-dimensional representation of the object being automatically obtained from the step of sampling the bounding volume to create the digitized representation.
The identified invalid portion can include an overlap of bounding surfaces in the master boundary representation. For such an invalid portion, the selected healing technique includes selecting a sampling spacing that is greater than the magnitude of the overlap, i.e., the distance between the two overlapping surfaces. As mentioned above, this can result in the healed digitized three-dimensional representation of the object being automatically obtained from the step of sampling the bounding volume to create the digitized representation.
The conversion into image data, i.e., the sampling stage, can be performed using any standard technique. For example, the sampling step can include a binary voxelization step, where voxels in the image data are marked, e.g., by code executing to update the contents of the memory device, as either inside or outside the master boundary representation. This technique can be appropriate for closed surfaces or surfaces with gaps smaller than the sampling rate.
Alternatively or additionally, the sampling step can be include code executing in the processor to assign values to the voxels based on a signed distance function, where voxels near the surface of the master boundary representation are assigned values which reflect their distance to that surface. Voxels inside the master boundary representation are given negative values, whereas those outside are given positive values. This technique may also be appropriate (and more accurate) for closed surfaces or surfaces with gaps smaller than the sampling rate. But additional requirement for running this technique successfully is the ability to distinguish whether sampling points lie inside or outside the object. This breaks for shell surfaces because there are then no points ‘inside’ the geometry.
Alternatively or additionally, the sampling step can include code executing in the processor to assign values to the voxels based on an unsigned distance function, where voxels near the surface of the master boundary representation reflect their distance to that surface without any distinction between what is inside and what is outside. Thus, the voxels that are far away from the surface are given low values. This technique may provide a solution to the problem of shell surfaces because it permits extraction of an isosurface at a given distance from the surface of the master boundary representation (i.e., the shell), which is thus effectively given an arbitrary thickness. This technique thus provides an alternative in image space to the step of extruding the shell surface (to create an offset) on the master boundary representation (i.e., in CAD space).
Thus, the identified invalid portion may include a shell. For such an invalid portion, the selected healing technique may include sampling the bounded volume using code executing in the processor to configure the processor to apply an unsigned distance function to a region of the bounding volume that includes the invalid portion. The healing technique can include extracting an isosurface from the digitized three-dimensional representation of the object, the isosurface defining a volume corresponding to (e.g., enclosing or mimicking) the shell. The method can include a step of thinning the isosurface so that it better conforms to the original shell. If the shell is closed, i.e., completely encloses a finite volume, this can be done by flood filling the isosurface in image space and then eroding one of more voxel layers from the isosurface, using code executing in the processor.
The above healing techniques can be applied alone or in any combination. Thus, the healing technique may represent a hybrid of any or all of the techniques mentioned above. For example, different parts of the master boundary representation can be voxelized using different methods. Providing each part is voxelized at the same sample rate or, where spatially distinct, an appropriate transitioning scheme is used, the individual volumes can be unioned to produce a final volume representing the entire model.
The digitized three-dimensional representation of the object is effectively an approximate bitmapped representation of the master boundary representation, wherein the degree of approximation can be controlled by selecting the sampling rate
As explained above, once the object is represented in image space, additional image manipulation (i.e., additional to the sampling process itself) can be performed. In addition to the techniques discussed above, the digitized representation may also be subject to localized smoothing or Boolean operations in order to de-feature (i.e., simplify) a geometry.
The invention may also be expressed as a computer program product comprising a non-transitory computer-readable storage medium having software instructions stored thereon, the software instructions being executable by a computer to perform the steps of any of the methods outlined above.
In a second aspect, the invention can provide a method of manufacturing a physical model, the method comprising: inputting a master boundary representation of the virtual three-dimensional object; sampling a bounding volume containing the master boundary representation to generate a digitized three-dimensional representation of the object; generating a slave boundary representation from the digitized three-dimensional representation of the object; modifying the slave boundary representation with reference to the master boundary representation to make the slave boundary representation more similar to the master boundary representation; outputting the slave boundary representation to a manufacturing unit; and operating the manufacturing unit to create a physical model corresponding to the slave boundary representation. The manufacturing unit can be a three-dimensional printer, CNC machine or the like. Any of the steps of the first aspect can also be applied to the second aspect.
The disclosure herein also defines a computer-implemented method of correcting a defective representation of a virtual three-dimensional object in a computer having a processor and a memory device, the method comprising: either obtaining or inputting into the memory device a master boundary representation of a virtual three-dimensional object; healing defects in the master boundary representation using code executing in the processor to configure the processor to apply a healing technique that comprises: sampling a bounding volume containing the master boundary representation to generate a digitized three-dimensional representation of the object, and obtaining a healed digitized three-dimensional representation of the object; and generating using code executing in the processor a slave boundary representation from the healed digitized three-dimensional representation of the object. This method teaches applying a healing technique which takes the master boundary representation into image space, where a healed version is obtained and then converted back to the slave boundary representation.



BRIEF DESCRIPTION OF THE DRAWINGS
Examples of the invention as discussed in detail below with reference to the accompanying drawings, in which:
FIGS. 1A to 1F illustrate the effect of various steps of a method that is an embodiment of the invention on a virtual three-dimensional object;
FIGS. 2A and 2B illustrate the steps of registering an edge on a 2D slave boundary representation with an edge on a 2D master boundary representation;
FIG. 3 illustrates the step of registering a surface on a 3D slave boundary representation with a surface on a 3D master boundary representation;
FIGS. 4A and 4B illustrate the steps of recovering corner features on a 2D slave boundary representation by moving existing vertices;
FIGS. 5A and 5B illustrate the steps of recovering corner features on a 2D slave boundary representation by spawning new vertices;
FIG. 6 illustrates the step of recovering edge and corner features on a 3D slave boundary representation by moving existing vertices and spawning new vertices;
FIG. 7 is a flow chart illustrating a procedure for recovering a surface in a 3D slave boundary representation; and
FIG. 8 is a flow chart illustrating a procedure for recovering edges in a 3D slave boundary representation.



DETAILED DESCRIPTION OF CERTAIN EMBODIMENTS OF THE INVENTION FURTHER OPTIONS AND PREFERENCES
An overview of a method that comprises one an embodiment of the invention is discussed first with reference to FIGS. 1A to 1F. FIG. 1A shows the master boundary representation of a virtual three-dimensional object, also referred to below as the original CAD model. This can be obtained from or created by any conventional CAD software package, and the representation is rendered on a display or other output associated with a computer which includes at least one processor configured by code executing therein to provide the functionality and transformations of data maintained in a non-transitory memory device, as discussed in this specification.
The code utilized by one or more embodiments of the present invention comprise instructions that control the processor of the computer to execute methods, such as detailed in FIGS. 7 and 8 below. The instructions can comprise a program, a single module, or a plurality of modules that operate in cooperation with one another. More generally, the code comprises a portion of an embodiment implemented as software. The module(s) that comprise a software embodiment can include anything that can be executed by a computer such as, for example, compiled code, binary machine level instructions, assembly code, source level code, scripts, function calls, library routines, and the like. In other embodiments, the code can be implemented in firmware or a hardware arrangement.
FIG. 1B shows the result of converting the CAD model into digital image data. Thus, FIG. 1B is a digitized three-dimensional representation of the object, rendered using the digitized data in the memory device. In this example, the original CAD model is voxelized. As can be seen in FIG. 1B, voxelization is a lossy technique, so the process de-features the original CAD model. The amount of de-featuring depends on the chosen sampling rate. For solid objects, as the sampling rate increases, the image representation (and in particular any boundary representation extracted by isosurfacing the image representation) will converge to the original CAD model, but finer digitization can lead to significant computational costs both in terms of CPU time and memory.
In some embodiments, the inherent approximation in the digitization can itself resolve problems with the original model. For example, in the case where there exists poorly conforming surfaces, a sampling rate can be chosen such that invalid portions of the original CAD model are not captured.
CAD models can be converted into images data (voxelized/digitized) using a number of different methods implemented in code and provided to the processor to configure the processor accordingly, each of which is suitable for different kinds of model. The following techniques can be used with one or more embodiments of the invention:
(1) Binary voxelization: voxels in the image data are marked as either inside or outside of the CAD model.
(2) Signed distance function: voxel values reflect their distance to the surface. Those inside are given negative values, those outside are given positive values.
(3) Unsigned distance function: voxel values near the surface of the CAD reflect their distance to the surface. Those far away are given low values. No distinction is made between inside and outside. This technique allows a shell surface to be given a real thickness, e.g., by extracting an isosurface at a given distance.
(4) Unsigned distance function with erosion: as for (3) above, followed by a flood fill and erosion to reduce the thickening effect so that the isosurface lies more closely to the original surface.
(5) Hybrid: some combination of the above. Different parts of a CAD model can be voxelized using different methods. Providing each part is voxelized at the same sample rate or, where spatially distinct, an appropriate transitioning scheme is used, the individual volumes can be unioned to produce a final volume representing the entire model.
FIG. 1C shows a modified (i.e., digitally altered) version of the digitized representation of the object in the memory device as a result of the transformative techniques noted above. The purpose of the modification can be manifold. For example, the modification can be for healing invalid portions of the original CAD model. However, the modification process can also be used on valid CAD models, e.g., to defeature or edit the CAD to remove features that are unwanted or unnecessary for subsequent processing, or to perform Boolean operations with other images. These other images can themselves be digitized version of CAD models or they can be original digital data, e.g., obtained by a scanning a real object or physical volume. The modification step can thus be a technique for healing invalid CAD models, or for combining the original CAD model in some way with other image data, or simply for editing the original CAD model to prepare it for subsequent processing. In this example, the modification comprises removing (e.g., painting out) two small projections on a surface of the object. In other embodiments, other types of known image-based operators can be used, e.g., morphological operators (e.g., dilate, erode, close and open), manual painting, image filtering, etc. Localized smoothing or Boolean operations can be used to de-feature a geometry. Invalid portions of the original CAD model can be corrected in this manner.
FIG. 1D shows a slave boundary representation, i.e., a healthy new CAD model, obtained by converting the healed version of the digitized representation using any known surface reconstruction technique by application of code in a suitably configured processor, e.g., the marching cubes or other algorithm can be used to extract an isosurface from the image data in the memory device. This will result in one or more closed polygonal surfaces being produced. Where several conforming but distinct image models then multi-part marching cube algorithm can be used which will ensure conformity at all part interfaces (i.e., no gaps/overlaps). The slave boundary representation is a near approximation of original surfaces. To bring the slave boundary representation closer to the master boundary representation (original CAD model), further correction techniques are needed. In this embodiment, these further corrections are performed by referring to the surfaces of the original CAD model.
FIG. 1E shows a modified version of the slave boundary representation in which the planar surfaces of the original CAD model are recovered by moving vertices on the slave boundary representation by application of code in a suitably configured processor. Typically, the vertices of the polygons forming the reconstructed surface model will not lie exactly on the polygon(s) in the original CAD model by virtue of the process. How close they lie to original surface will depend on how fine a sampling rate was chosen for digitization. However, for example, by finding the shortest distance from a vertex on the new surface to the original/master surface and moving vertex to that point and repeating this for every polygon vertex will recover surface accuracy.
The objective of surface recovery is to reduce the spatial discrepancy between the original CAD model and the reconstructed surface. The surface recovery algorithm operates through code executing in the processor and involves updating the position of each vertex in the reconstructed surface to an appropriate/suitable position (generally the closest point) on the CAD model. This technique is discussed in more detail with reference to FIGS. 2, 3 and 7 below.
FIG. 1F shows the result of carrying out a similar correction technique to transform the representation in the memory device and thereby recover feature edges and corners of the original CAD model by application of code in a suitably configured processor. The surface recovery technique used to obtain the modified slave boundary representation in FIG. 1E is effective in recovering flat or smooth surfaces, but leaves behind bevelled facets in the slave boundary representation in place of sharp features in the CAD model. By referencing the bevelled edges or corners to corresponding edges or corner in the original CAD model, these detailed features can be recovered by moving existing vertices or spawning new vertices which are then moved to the position of the original edge or corner. This technique is discussed in more detail with reference to FIGS. 4 to 6 and 8 below.
The technique of modifying the slave boundary representation to recover surfaces (e.g., planar surfaces) from the original CAD model is discussed now with reference to FIGS. 2 and 3. The objective of surface recovery is to eliminate the spatial discrepancy between the original CAD model and the surface vertices of the slave boundary representation. The surface recovery technique involves configuring the processor of the computer to compare the slave boundary representation with the original CAD model, and update the position of each vertex in the slave boundary representation to an appropriate point (e.g., the closest point, and generally not an original vertex) on the surface of the original CAD model.
FIGS. 2A and 2B illustrate the surface recovery technique implemented by code executing in the processor, as applied to a 2D mesh. The original CAD model is a regular shape, comprising an outer square and an inner regular octagon. The slave boundary representation is an irregular 2D mesh. By virtue of the process of generating the slave boundary representation, it is spatially co-registered with the master boundary representation, i.e., they have the same frame of reference. This enables direct comparison of corresponding surfaces and other features (e.g., edges and corners). As shown in FIG. 2A, the vertices on the 2D mesh are moved to the closest point on the CAD model edge (in a direction normal to that edge). FIG. 2B shows the result of this process.
FIG. 3 illustrates the same surface recovery technique implemented by code executing in the processor, as applied to a 3D mesh. It can be seen that the surface recovery technique is effective in recovering flat or smooth surfaces (e.g., the outer square of the original CAD model in the FIG. 2 example). However, the algorithm leaves behind bevelled facets in the reconstructed surface in place of sharp features in the CAD model.
The process of digitization/voxelization and isosurfacing means that a priori all feature edges are bevelled. Whilst the process of moving vertices to the closest point on the surface of the original CAD recovers vertex accuracy, edges will remain bevelled as the moved vertices will not necessarily or usually sit along the feature edge. Again by referencing the original CAD, a correction can be applied to the new CAD to recover these feature edges. The technique of modifying the slave boundary representation to recover sharp edges and corners from the original CAD model is discussed now with reference to FIGS. 4, 5 and 6.
The feature edges in the original CAD are identified (they can either be flagged as such by the user or identified in automated fashion using a range of algorithms implemented as code executing in the processor, e.g., based on threshold angle between polygon faces).
Once identified, several approaches are possible for modifying the slave boundary representation to conform to the original CAD model, all of which can be implemented by code executing in the processor. For example, vertices on polygons on either face straddling the feature edge can be moved to the edge thereby recovering the edge. Alternatively polygons straddling the feature edge can be split into several polygons with a new central vertex and this new spawned central vertex can be snapped (e.g., shortest distance) to the feature edge. Similarly, feature corners to be recovered can be identified automatically or flagged by the user. To recover feature corners either a suitable existing vertex or a new vertex created by splitting the closest polygon in the new CAD are moved to the corner vertex position on the surface of the original CAD model.
The procedure for converting smoothed, bevelled or chamfered features edges and corners into sharp ones is complicated because it requires the deduction of the exact location of the sharp feature relative to the existing slave boundary representation and non-trivial modification of mesh topology and/or vertex positions. Previous implementations [1-3] use thresholds on the angle of separation between surface normal for deducing the location where feature edges must be generated. In contrast, the embodiments of the invention make use of information available in the original CAD model as a reference for locating sharp features.
FIGS. 4A and 4B illustrate the feature edge/corner recovery technique applied to the 2D mesh of FIG. 2 utilizing a computer having a processor configured by code to implement the algorithms and techniques discussed next. In FIG. 4A, the vertices closest to the sharp features are identified and moved to match the location of the sharp feature. More specifically, the code operates to change the data in the memory device to move the vertices as described. FIG. 4B shows the result. As in the surface recovery algorithm, the topology of the mesh is preserved in the representation included in the memory device, but some elements of a subsequently generated volume mesh might be highly stretched or skewed.
FIGS. 5A and 5B illustrate an alternative feature edge/corner recovery technique applied to the 2D mesh of FIG. 2. In this example, edges in the mesh closest to the sharp feature are identified and split at the midpoint through processing and changes to the data in the memory device similar to as just described. As shown in FIG. 5A, the triangles connected to these edges are bisected in order to avoid hanging vertices. The new vertices are moved to match the location of sharp features, shown in FIG. 5B.
FIG. 6 illustrates the same feature edge/corner recovery technique applied to a 3D mesh. It is possible to use a combination of the techniques shown in FIGS. 5A and 5B depending on the local topology of the boundary representation and the distance from the feature edge.
FIG. 7 is a flowchart depicting the steps of the surface recovery technique discussed above with reference to FIGS. 2 and 3. The inputs to the method are the slave boundary representation 701 and original CAD model (master boundary representation) 703, both of which are stored in memory (e.g., a non-transitory, computer readable memory device) which is accessible to the processor implementing portions of the embodiment illustrated in FIG. 7. The method includes a loop which repeats the position updating step for each vertex in the slave boundary representation. At a first step 702, a processor configured by code executing therein selects a vertex to be updated. The code can further cause the processor to set a flag for each vertex at this stage so the fact that its position has been updated is recorded. In a second step 704, the processor is configured by code to compare the selected vertex in the slave boundary representation with the original CAD model to identify an optimal position with reference to the original boundary representation. For example, the optimal position can be the closest point to the vertex on the CAD model surface (e.g., along a normal to the original CAD surface). In a third step 706, the processor is configured to cause the selected vertex to move to the optimal position. In a fourth step 708, the processor is configured to assess whether all of the vertices have been updated (e.g., by referring to the state of the flags stored for each vertex). If all the vertices have been updated, the process ends. If not, the method loops back to the first step 702 to select the next vertex.
FIG. 8 is a flowchart depicting the steps of the feature edge recovery technique discussed above with reference to FIG. 4 that can be performed by the processor when executing code to provide that functionality. A similar process can be used to recover corner features. Again, the inputs for this technique are the master boundary representation 801 (original CAD model) and the slave boundary representation 803 (which may have been modified by the process discussed above with reference to FIG. 7). In a first step 802, a processor configured by code executing therein identifies the edges (or corners) in the master boundary representation that are to be designated as “sharp features” for recovery. This step can thus generate a list of feature edges (and/or corners) to be recovered, which list can be stored in the memory device and used by the processor for further steps in the process. In a second step 804, the processor is configured by code executing therein to select one of the identified features. The method includes a loop which repeats the recovery steps for each identified feature. For each feature, there are two alternative recovery processes. The particular process used may depend on the nature of the selected feature. Indeed, the processor can be configured by code executing therein to automatically select which process to utilize, e.g., based on parameters of the feature, or manually selected. Each alternative is implemented using code executing in the processor which is configured by such code to make the identifications, divisions of data, updates, queries, and so on until the process terminates.
The first alternative recovery technique begins with a step 806 of identifying elements in the slave boundary representation which straddle the selected feature. Herein elements may refer to the contiguous polygons which define the surface of the slave boundary representation. In step 808, each of the straddling elements is divided to spawn a new vertex. In step 810, the position of the new vertex is updated to lie on the selected feature edge (or at the feature corner). Following step 810, the process proceeds to a step 812 of querying whether or not all of the identified features have been recovered. If the answer is no, the process loops back to the selection step 804. If the answer is yes, the process terminates.
The second alternative recovery technique begins with a step 814 of identifying vertices in the slave boundary representation which are closest to the selected feature edge (or corner). After the closest vertices are identified, the technique moves to a step 816 of updating the position of the closest vertices so that they lie on the selected feature edge (or at the feature corner). Following the updating step 816, the process proceeds to the step 812 of querying whether or not all of the identified features have been recovered.
The healing techniques listed above can be applied in the following example of invalid CAD models:
1. CAD model with non-conforming patches

    
    
        voxelise CAD model using a signed distance function and a sample rate of 1 mm;
        extract isosurface using marching cubes algorithm;
        store isosurface as a triangulated surface in an STL file.
    
    


2. CAD model composed of shells:

    
    
        voxelise CAD model using an unsigned distance function and a sample rate of 1 mm;
        extract isosurface using marching cubes algorithm;
        store isosurface as a triangulated surface in an STL file.
    
    


3. CAD model with holes:

    
    
        voxelise CAD model using an unsigned distance function and a sample rate of 1 mm;
        paint closed holes in the surface;
        perform inverted floodfill to solidify the model;
        extract isosurface using marching cubes algorithm;
        store isosurface as a triangulated surface in an STL file.
    
    


4. CAD model composed of shells and closed surfaces

    
    
        identify and separate shells and closed surfaces;
        voxelise shells using an unsigned distance function and a sample rate of 1 mm;
        voxelise closed surfaces using a signed distance function and a sample rate of 1 mm;
        union voxelized shells and closed surfaces to produce final volume;
        extract isosurface using the marching cubes algorithm (isosurface for voxelized shells chosen to achieve a pre-defined thickness);
        store isosurface as a triangulated surface in an STL file.
    
    


5. An assembly of closed surface parts with poor conformity (between parts):

    
    
        merge parts into a single, intersecting, part.
        voxelise single part using a signed distance function;
        perform a morphological close operation to close the cavities between parts;
        extract an isosurface using the marching cubes algorithm;
        store the isosurface is stored as a triangulated surface in an STL file.
    
    


Triangulated surfaces, generated from CAD models, are often used to define the input geometry for rapid prototyping. The methods described above can therefore be applied directly to a triangulated surface to produce a valid STL file (i.e., a robust closed surface).
REFERENCES


    [1] M. Attene, B. Falcidieno, J. Rossignac and M. Spagnuolo, Sharpen&Bend: Recovering curved sharp edges in triangle meshes produced by feature-insensitive sampling. IEEE Transactions on Visualization and Computer Graphics, 2005.
    [2] Marco Attene, Bianca Falcidieno, Jarek Rossignac, Michela Spagnuolo, Edge-sharpener: recovering sharp features in triangulations of non-adaptively re-meshed surfaces, Proceedings of the 2003 Eurographics/ACM SIGGRAPH symposium on Geometry processing, June 2003.
    [3] Charlie C. L. Wang, Incremental Reconstruction of Sharp Edges on Mesh Surfaces. Computer-Aided Design, Volume 38, Issue 6, June 2006

## Claims

1. A computer-implemented method of generating a representation of a virtual three-dimensional object in a computer having a processor and a memory device in order to improve conformance of a slave boundary representation to a master boundary representation, the method comprising:
obtaining into the memory device the master boundary representation of the virtual three-dimensional object;
sampling by the processor a bounding volume containing the master boundary representation to generate a digitized three-dimensional representation of the object in the memory device;
generating by the processor the slave boundary representation from the digitized three-dimensional representation of the object, the slave boundary representation being in the memory device; and
modifying by the processor the slave boundary representation with reference to the master boundary representation, wherein modifying the slave boundary representation comprises:
comparing the slave boundary representation with the master boundary representation to identify a displaced portion on the slave boundary representation having a displacement relative to a corresponding portion of the master boundary representation; and
mapping the displaced portion of the slave boundary representation to a modified position to reduce the displacement relative to the corresponding portion of the master boundary representation.

2. The method according to claim 1, wherein mapping the displaced portion comprises moving each of a plurality of points on the slave boundary representation in the memory device to a respective location on the master boundary representation in the memory device by the processor.

3. The method according to claim 2, wherein each of the plurality of points is moved on to the surface of the master boundary representation that is closest to it in a direction normal to the surface of the master boundary representation.

4. The method according to claim 2, wherein each of the plurality of points is moved on to the surface of the master boundary representation that is closest to it in a direction normal to the surface of the slave boundary representation.

5. The method according to claim 2, wherein the slave boundary representation in the memory device comprises a plurality of contiguous polygons, and wherein each of the plurality of points is a vertex at the intersection between two or more of the plurality of contiguous polygons.

6. The method according to claim 2, wherein the slave boundary representation in the memory device comprises a volume mesh having a plurality of contiguous cells, and wherein each of the plurality of points is a vertex at the intersection between two or more of the plurality of contiguous cells at the surface of the object.

7. The method according to claim 2, wherein the slave boundary representation comprises a NURBS surface, and wherein each of the plurality of points is a control point on the NURBS surface.

8. The method according to claim 2, further comprising spawning a new point on the slave boundary representation, wherein moving the plurality of points comprises moving the new point.

9. The method according to claim 1, wherein the displaced portion is any of a surface, an edge and a corner.

10. The method according to claim 1, further comprising outputting the modified slave boundary representation to an output device or machine associated with the computer.

11. The method according to claim 1, wherein generating the slave boundary representation comprises isosurfacing the digitized three-dimensional representation by the processor to configure the processor to implement a marching cubes algorithm.

12. The method according to claim 1, wherein generating the slave boundary representation comprises generating a volume mesh of the digitized three-dimensional representation.

13. The method according to claim 1, further comprising digitally altering a region of the digitized three-dimensional representation of the object before generating the slave boundary representation.

14. A method according to claim 13, wherein the digitized three-dimensional representation of the object comprises a voxelized model of the virtual three-dimensional object, and wherein digitally altering a region of the digitized three-dimensional representation comprises painting the region by the processor to add or remove voxels in the digitized three-dimensional representation.

15. The method according to claim 13, wherein digitally altering a region of the digitized three-dimensional representation comprises performing a morphological operation on the region by the processor.

16. The method according to claim 13, further comprising:
identifying an invalid portion of the master boundary representation by the processor; and
selecting a healing technique to be applied based on the identified invalid portion by the processor,
wherein digitally altering a region of the digitized three-dimensional representation comprises code executing in the processor to configure the processor to implement a healing technique algorithm to heal defects in the master boundary representation in the memory unit.

17. The method according to claim 16, wherein the identified invalid portion includes a shell, and wherein the selected healing technique algorithm includes sampling the bounded volume by the processor to configure the processor to apply an unsigned distance function to a region of the bounding volume that includes the invalid portion.

18. The method according to claim 13, wherein digitally altering a region of the digitized three-dimensional representation comprises configuring the processor to perform a Boolean operation.

19. A computer program product comprising a non-transitory computer-readable storage medium having software instructions stored thereon, the software instructions being executable by a computer to perform the steps claim 1.

20. A computer-implemented method of manufacturing a physical model in a computer having a processor and a memory device in order to improve conformance of a slave boundary representation to a master boundary representation, the method comprising:
inputting into the memory device the master boundary representation of the virtual three-dimensional object;
sampling by the processor a bounding volume containing the master boundary representation to generate a digitized three-dimensional representation of the object in the memory device;
generating by the processor the slave boundary representation from the digitized three-dimensional representation of the object, the slave boundary representation being in the memory device;
modifying by the processor the slave boundary representation with reference to the master boundary representation, wherein modifying the slave boundary representation comprises:
comparing the slave boundary representation with the master boundary representation to identify a displaced portion on the slave boundary representation having a displacement relative to a corresponding portion of the master boundary representation; and
mapping the displaced portion of the slave boundary representation to a modified position to reduce the displacement relative to the corresponding portion of the master boundary representation;

outputting the slave boundary representation to a manufacturing unit; and
operating the manufacturing unit to create a physical model corresponding to the slave boundary representation.

21. The method according to claim 20, wherein the manufacturing unit is a three-dimensional printer or a CNC machine.