TSNLib  Introduction


Getting Started

This section contains some basic how to information to get you up and running. If you know C++ and something about curves, surfaces, trimmed surfaces, and solids you should not have too much trouble using this package. If you have had previous experience with solid modeling, you probably realize that there are often problems (reliability, accuracy, performance) associated trimmed surfaces and solids.

Freeform sculptured surface representations are often a source of great difficulty because of the inability to find precise solutions to many of the operations required. We have done a lot of work to try to reduce the frequency of these problems. However, we can not claim that we have been able to eliminate these problems. The next step from only dealing with curves and surfaces is to to deal with a compound representation of a surface and bounding curves which form a trimmed surface.

In addition to the increased complexity of the representation is the increased complexity of the software used to process the trimmed surface representation. The bottom line is that you should expect to find a few problems, both bugs and cases the software is unable to process. However, we believe that if you create your trimmed surface properly, the reliability of the library should be on-a-par or better than most systems which deal with these representations. The key here is to set up the initial trimmed surface properly.

The remainder of the Quick Start should help you to get a basic understanding of what is required to get the best out of the Trimmed Surface Library. We also suggest that you consult us prior to creating the interface between your Trimmed Surface Repository and TSLib. We may be able to help you with some tips depending upon where and how your trimmed surfaces were generated.

Validity of Trimmed Surfaces

What constitutes a valid trimmed surface ?

  • The definition of a trimmed surface corresponds to the equivalent definition found in STEP and IGES.
  • The curves and surfaces must conform to the validity criteria defined in the Geometry Introduction
  • The surfaces must have continuity of C0 (smooth) or better.
  • The individual trimming curves must have continuity of G1 or better. Please note that polyline trimming curves are not supported.
  • The trimming loops must be closed to within a given model or parameter space tolerance.
  • There may be only one outer loop which is oriented counter-clockwise relative to the surface normal.
  • There may be zero, one or more inner loops which are oriented clockwise relative to the surface normal.
  • The curves of the trim boundary must not have self-intersections (except for closed curves which intersect at their start/end points).
  • The curves of the trim boundary must not intersect each other except where they join the loop at their ends.
  • The curves of one loop must not intersect or touch the curves of another loop.
  • When 3-D model space trimming curves are specified, they must lie on toe surface (to within the current model space tolerance of the trimmed surface).
  • When 3-D model space trimming curves are specified, the corresponding ends of the curves in a loop must be within tolerance of each other.
  • When 2-D parameter space and 3-D model space curves are specified, their parameterization must match within the tolerance of the trimmed surface. In other words the point created by mapping a given parameter value of the 2D curve through the surface evaluator must be within the tolerance of the same parameter value as applied to the 3-D curve.


Please review the discussion on tolerances in the Geometry Introduction.

Creating Trimmed Surfaces

This section of the quick start is intended to help you to understand how to create trimmed surfaces such that the subsequent operations performed on them are very reliable. SMLib is designed to enable it to handle trimmed surfaces which are generated from a variety of different CAD and graphics systems. SMLib allows the creation of trimmed surfaces from either parameter space or model space curves. The operational tolerances can be adjusted to match those of the system which originally produced the trimmed surface.

In general, setting up the creation of trimmed surfaces which have been generated in some other modeling system will not be a trivial task. It will often require some level of experimentation to produce an optimal solution. The user will have to make several critical decisions along the way which will effect not only the performance of SMLib but the reliability of the downstream trimmed surface operations. Many of these decisions revolve around issues dealing with tolerances. When we refer to tolerances, we are not talking about the type of tolerances used in dimensioning. We are referring to the numerical value(s) used by most CAD and Graphics systems to determine when two Euclidean points are the same.

The use of Tolerances in geometric modeling systems is required for two reasons. First because the mathematical operations performed on computers is typically done using a fixed point arithmetic. What that means is that there are round-off errors which may accumulate during even the most precise mathematical operations. The second reason tolerances are required is that numerical techniques are often used to generate approximate answers to geometric operations. For example, the intersection of two NURBS surfaces will produce curves which approximate the answer to a certain accuracy (usually between 1.0e-3 and 1.0e-7 of the size of the model). Another example that causes problems is the generation of freeform fillet or blending surfaces. Many of the problems come to light when dealing with more then one trimmed surface. For example, the sectioning of two trimmed surfaces with plane. In this case, one might expect that the curves produced would exactly match at the ends where the surfaces join. This, however, would be more of a rarity than the normal situation when dealing with NURBS surfaces. The actual distance between the ends of the section curves depends on many factors including where and how the trimmed surfaces were created and the position and orientation of the sectioning plane.

An empty IwBrep is created which will eventually contain one or more trimmed surfaces. Prior to adding faces to the brep ( IwBrep::MakeFaceWithCurves ) you should set the tolerance of the IwBrep with an appropriate value ( IwBrep::SetTolerance ). The tolerance you utilize should correspond to the tolerance used in the modeling system where they were originally created. If you do not know what tolerance to use, we suggest a value which is between 1/1000th of the model size and 1/100000th of the model size.

The next major decision to make is what to use for trimming curves, 3-D model space or 2-D parameter space. In cases where only one set of trimming curves are available or one set is clearly the master representation your decision is not a difficult one. However if you have both sets of trimming curves and neither of them is the master representation, than you may have decisions to make. In this case is important to know what happens in each of your three options:

2-D Trimming Curves are used to create Trimmed Surfaces

  • Approximate 3-D Curves are created using the mapping of the 2-D Curves through the surface.
  • The 3-D Curves are approximated to within the IwBrep tolerance ( IwBrep::GetTolerance ) of the corresponding 2-D curves.
  • The 3-D Curves are synchronized in terms of their parameter space and orientation.
  • The 2-D Curves have their end points "joined" through a process which does extension and intersection.
3-D Trimming Curves are used to create Trimmed Surfaces
  • 2-D curves are created using the IwSurface::DropCurve method.
  • The tolerances of the corresponding edges are adjusted relative to the distance between the 3-D curve and its 2-D image.
  • The 2-D Curves have their end points "joined" through a process which does extension and intersection.
Both 2-D and 3-D Curves are used to create Trimmed Surfaces
  • The distance between the 3-D curve and the 3-D image of the 2-D curve is measured and an appropriate tolerance is chosen for the edge.
  • The 2-D Curves have their end points "joined" through a process which does extension and intersection.

Of the three possibilities, #2 is by far the slowest and #3 is somewhat faster than #1. If you are doing primarily 2-D operations, #1 or #3 are probably a little better than #2. If you are doing primarily 3-D operations, #2 or #3 might give you some advantages. We have found that #1 seems to be the best option when we are reading and testing IGES trimmed surfaces generated by the RHINO NURBS Modeler.


This section contains information about the solids functionality using Trimmed Surfaces. The first thing that you should know right away is that solids are not only one of the most powerful representations, they are also the most prone to failure. This goes double for solids which are "imported" as opposed to those which are built within a given system. We are often at the mercy of "imported" data. The reliability of SMLib in dealing with Solid Models is dependent upon getting good data into the model. SMLib does a lot of work on its own to try to measure the gaps between adjacent edges, vertices and faces and to adjust the tolerances to close the gaps. Although the problem is a difficult one, we have designed SMLib to try to handle many of the problems and to fail gracefully when it can not.

SMLib is also highly dependent upon the initial tolerance set for the IwBrep prior to creation. If the tolerance is too large, it will invalidate small features. If the tolerance is too small you will get warnings when we increase the tolerances to fill the gaps. As a general guideline, a tolerance of 1.0e-3 to 1.0e-6 of the size of the Brep should work the best. The higher the quality (smaller the gaps) of the original Brep the smaller the tolerance should be.

There are two ways to get Solids from trimmed surfaces. The first is to create a solid from a set of trimmed surfaces by "sewing" them together. The second way is through an indexed tabulated representation of our topology. The tabulated representation can be found in the IwBrepData include and source files. We have a non-production IGES reader which demonstrates how load up the IwBrepData object from an IGES solid and create a IwBrep (see IwIgesReader.h and IwIgesReader.cpp). We have also added a section to our tutorial which demonstrates creation of a solid box using the IwBrepData object.

A word about m_bEditingEnabled. There is a flag in IwBrep which enables editing. There are many of the creation and a few editing operations which require the m_bEditingEnabled flag to be turned on. An example is sewing. This flag needs to be turned off to make many of the evaluation functions work.

Legal Stuff

All of the software and documentation received with this release is copyrighted by Solid Modeling Solutions, Inc. You may not distribute source code or documentation for this software outside of the company and the site which owns the license. The standard license agreement allows you to freely distribute object code in any application which does not contain a programmatic interface. All software and documentation is considered proprietary information and the intellectual property of Solid Modeling Solutions, Inc. This document contains trade secret information which is deemed proprietary.

Copyright 1998-2010 Solid Modeling Solutions All rights reserved.
Information in this document is subject to change without notice.