Spline Conversion

From DocR21

Jump to: navigation, search

ACIS contains analytic geometry (geometry defined by explicit classical formulae), procedural geometry (geometry defined implicitly by geometric requirements), and B-spline geometry. ACIS also contains functions to convert among these representations. Some conversions are precise and some are approximations. Conversions that result in approximations require tolerant entities to maintain model integrity.

Analytic curves and surfaces can be converted into B-splines. There are precise NURBS representations for all analytic curves and surfaces, with the exception of helixes. Helices do not have an exact NURBS representation, so spline conversion of helices results in an approximate B-spline representation. Procedural curves and surfaces can be converted into an approximate B-spline representation. In addition, a procedural or B-spline curve or surface that is nearly equivalent to an analytic curve or surface can be simplified using the approximating analytic geometry.

Contents

Converting Analytic Geometry into B-spline Geometry

The ACIS spline conversion algorithms not only convert the analytic geometry of an entity into B-spline form, but they also modify the topology of the entity to make it more usable by applications. There are two signatures to api_convert_to_spline: one is failsafe, one is not.

  • api_convert_to_spline – This is the new signature, which either creates a copy of the input entity or converts the input entity in place. This signature accepts a convert_to_spline_options argument to control the conversion process. This signature behaves in a failsafe manner if the careful option is FALSE. The input entity can be any topological entity.
  • api_convert_to_spline – This is the original signature, which always creates a copy of the input entity. It converts surfaces, but not curves. The input entity is expected to be a BODY, SHELL, or FACE.

The spline conversion algorithms proceed (roughly) as follows:

  1. Optionally, create a copy of the input entity. (Copying is optional with the new signature of api_convert_to_spline. A copy is always created using the original signature of api_convert_to_spline.)
  2. Split faces on periodic surfaces along the seams. (The split_periodic_splines and new_periodic_splitting options control how periodic faces are split.)
  3. Split edges at poles on surfaces with point singularities.
  4. Call sg_rm_pcurves_from_entity to remove pcurves from non-tolerant coedges.
  5. Convert the geometry underlying the faces using bs3_surface_make_sur and other functions.
  6. Use FACE::set_geometry to replace the geometry of the face.
  7. Call sg_add_pcurves_to_entity to create pcurves.
  8. Trim or subset the face's surface to the parameter bounds of the face. (The subsetting option controls the trim versus subset behavior.)
  9. Optionally, convert the geometry underlying the edges using bs3_curve_make_cur and other functions. Then use EDGE::set_geometry to replace the geometry of each edge. (Edge conversion occurs only with the new signature of api_convert_to_spline and can be turned off using the convert_to_spline_options.)

Analytic or procedural geometry underlying an edge also can be converted to a B-spline using api_edge_to_spline. This function will either copy or convert the edge in place.

Spline Interface Functions

The preferred interface for spline conversion is using the API functions described above to convert the geometry underlying topological entities. If an application requires conversions to be performed on a lower level, the following two functions in the Spline Interface can be used. Both of these functions create copies of the input geometry.

Converting Procedural Geometry into B-spline Geometry

Occasionally applications needs to convert a procedural curve or surface into a B-spline. For example, when geometry is converted from an ACIS format into a format for a non-ACIS based application. The result of such a conversion is typically an approximation to the original procedural curve or surface. In ACIS the creation of approximate geometry often necessitates the creation of tolerant entities to properly account for the gaps between entities.

Note: Maintaining precise procedural geometry and non-tolerant entities is preferred for ACIS-based applications.


The recommended API function to convert procedural geometry into B-spline geometry is api_simplify_entity. If the simplify_options is set to convert procedural geometry (that is, call simplify_options::set_do_approximate(TRUE)), this function produces B-spline approximations for procedural curves and surfaces. This function behaves in a failsafe manner if the careful option is FALSE. If any curve or surface is within tolerance of an analytic curve or surface, the procedural geometry will be converted into analytic geometry rather than a B-spline. If necessary, analytic geometry can be converted into B-spline geometry using one of the methods described in the previous section.

There are two other API functions that can be used to convert procedural curves into a B-spline representation.

  • One function to convert a procedural curve under an edge into a B-spline curve is api_edge_to_spline. This function will either make a new edge using the new curve, or change the geometry underlying the given edge.
  • An alternative approach is to use api_approx. This function generates a bs3_curve that approximates the portion of the curve underlying the given edge. The bs3_curve can be used to generate a new intcurve, which can be used to support the existing edge or a new edge.

There is only one other API function that can be used to convert a procedural surface into a B-spline representation.

  • api_make_approx_surface: This function generates a spline that approximates the specified portion of the given surface.

Converting Procedural or B-Spline Geometry into Analytic Geometry

The inverse of converting analytic geometry into B-spline geometry is converting the B-spline geometry back into analytic geometry. Note that only B-spline geometry that is nearly equivalent to (that is, within a specified tolerance of) an analytic curve or surface can be converted. The geometry simplification algorithm will convert either procedural or B-spline geometry into analytic geometry. This algorithm does not simplify the topology of the simplified entity.

The API function to convert procedural or B-spline geometry into analytic geometry is api_simplify_entity. This function accepts as input a BODY, LUMP, SHELL, FACE, WIRE, or EDGE. This function behaves in a failsafe manner if the careful option is FALSE. The behavior of this function (for instance, whether it converts edges and/or faces) is controlled by an instance of the simplify_options class. C++ examples of the use of api_simplify_entity are provided in Geometry Simplification.

Scheme Examples

Example 1

The first Scheme example demonstrates how analytic curves and surfaces can be converted into B-spline curves and surfaces, and how the B-spline curves and surfaces can be converted back into analytic curves and surfaces. The initial model contains one cylindrical face, two spherical faces, and two circular edges. The spline conversion process splits the periodic faces and produces three periodic B-spline faces and seven B-spline edges. (The splitting of periodic faces is controlled by the new_periodic_splitting option. If this option had retained its default value, each periodic face would have been split by two edges, creating open faces instead of periodic faces.) The simplification process converts the three B-spline faces into one cylindrical face and two spherical faces. The seven B-spline edges are converted into six circular edges and one straight edge.

; Create a solid body
(define cyl (solid:cylinder (position 0 0 -10)  (position 0 0 10) 10))
;; cyl
(define sph1 (solid:sphere (position 0 0 -10) 10))
;; sph1
(define sph2 (solid:sphere (position 0 0 10) 10))
;; sph2
(define ent (solid:unite cyl sph1 sph2))
;; ent
 
(map face:type (entity:faces ent))
;; ("Sphere" "Sphere" "Cylinder")
(map edge:type (entity:edges ent))
;; ("ellipse" "ellipse")
 
; Convert the surfaces and curves into B-Splines
(option:set "new_periodic_splitting" 3)
;; #f
(entity:convert-to-spline ent)
;; #[entity 1 1]
 
(map face:type (entity:faces ent))
;; ("Spline surface (exactsur-spline)" "Spline surface (exactsur-spline)" 
;;  "Spline surface (exactsur-spline)")
(map edge:type (entity:edges ent))
;; ("exactcur-intcurve" "exactcur-intcurve" "exactcur-intcurve" "exactcur-intcurve" 
;;  "exactcur-intcurve" "exactcur-intcurve" "exactcur-intcurve")
 
; Convert the B-spline surfaces and curves back into analytics
(entity:simplify-face-edge ent)
;; (#[entity 1 1])
 
(map face:type (entity:faces ent))
;; ("Sphere" "Sphere" "Cylinder")
(map edge:type (entity:edges ent))
;; ("ellipse" "ellipse" "ellipse" "ellipse" "ellipse" "ellipse" "straight")
Initial Model
Spline Converted Model
Simplified Model

Example 2

The second Scheme example demonstrates how procedural curves and surfaces can be converted into B-spline curves and surfaces. The initial model contains a procedural surface and four procedural curves. (The procedural surface is quadratic in one direction and a cosine function in the other.) The simplification process converts the procedural surface into a B-spline surface and the four procedural curves are converted into four B-spline curves.

; Create a sheet body with procedural geometry
(define f (face:law "vec(x, y, 0.25*x*x + 0.25*cos(pi*y))" -2 2 -2 2))
;; f
(define ent (sheet:2d (sheet:face f)))
;; ent
(map face:type (entity:faces ent))
;; ("Spline surface (lawsur-spline)")
(map edge:type (entity:edges ent))
;; ("parcur-intcurve" "parcur-intcurve" "parcur-intcurve" "parcur-intcurve")
 
; Convert the geometry into B-splines
(define simp_opts (entity:simplify-options "do_approximate" 1))
;; simp_opts
(entity:simplify-face-edge ent simp_opts)
;; (#[entity 2 1])
(map face:type (entity:faces ent))
;; ("Spline surface (exactsur-spline)")
(map edge:type (entity:edges ent))
;; ("exactcur-intcurve" "exactcur-intcurve" "exactcur-intcurve" "exactcur-intcurve")
Initial Model
Simplified Model

See Also

Personal tools
Live