­
2008-12 - Open CASCADE notes

Extreme fight with Extrema. Part 3

18:02 / BY Roman Lygin
(continued)However this did not fully solve the problem of caching results. As I mentioned earlier, B-Splines are split into C2 intervals which are processed individually. For example, on one B-Spline there were 20 C2 intervals, so caching only worked within each of them but every time a new subrange of the another edge's range was called, all data were recalculated. So, I extended...

Continue Reading

Extreme fight with Extrema. Part 2

17:16 / BY Roman Lygin
(continued)*sqrt()*The first one of such was sqrt(), which was among top 5 hotspots. As it is a system function, I did not notice it until pressed a button on the Amplifier toolbar (the matter of fact is that by default Amplifier attributes system functions time to its callers).After unwinding its stacks I found the reason. Extrema used gp_Pnt::Distance() (or sometimes gp_Vec::Magnitude()) everywhere both...

Continue Reading

Extreme fight with Extrema. Part 1

13:59 / BY Roman Lygin
Those who regularly follow my blog likely remember that after recent speed up of Boolean Operations (see Why are Boolean Operations so slooo...ooow?) there remained a test case from Pawel K that almost was not affected. So I accepted a challenge and spent more time on this. Many thanks to Pawel for providing these models. Though they appeared to be very peculiar (such...

Continue Reading

Sexy background

21:54 / BY Roman Lygin
If you want to add a special touch to your application, here are a couple of hints on ‘personalizing’ your 3D view.*Adding an image as background*Use V3d_View::SetBackgroundImage() that accepts a filename to gif, bmp or xwd image and a placement option (center, stretched or tiled) defined by the Aspect_FillMethod enumeration. Calling its with Aspect_FM_NONE erases the image.Here’s an original image and its use...

Continue Reading

License to kill. License to use

14:01 / BY Roman Lygin
Famous James Bond 007 had a license to kill; the "00" designation in his code number meant he had a sanction to apply a deadly force. In order to use any software you also need a license. Let me repeat, *any* software, even one which you can download free of charge with a couple of mouse clicks.When accepting a license you become bounded...

Continue Reading

Why are Boolean Operations so slooo...ooow ? Part 3

17:28 / BY Roman Lygin
(continued)For my experiments I used my own patched version of Open CASCADE 6.3.0 that accumulated all the modifications for prototyping multi-threading I mentioned earlier on the forum. One set of the modifications in it are thread-safe versions of BSplSlib, BSplCLib and PLib. Original 6.3.0 uses static array which are re-used by further calls to ::D0(), D1(), etc what is obviously not thread-safe (or...

Continue Reading

Why are Boolean Operations so slooo...ooow ? Part 2

17:19 / BY Roman Lygin
(continued)So, I dove into the code and found out that the constructors were plain initializers of internal fields (e.g. double, integer, pointer). All three constructors look similar. Unwinding stacks revealed the root-cause – objects were created using new[] operator (e.g. ptr = (void*) (new IntPolyh_Triangle [N]) ) which was called on *huge* amount of copies. Look at this:Each IntPolyh_MaillagaAffinage constructor creates arrays of...

Continue Reading

Why are Boolean Operations so slooo...ooow ? Part 1

15:47 / BY Roman Lygin
Open CASCADE Boolean Operations (BOPs) have frequently been claimed to be slow. Have anyone tried to find out why ?As you probably remember, I recently mentioned in another post that at Intel we have decided to integrate Open CASCADE into our application testing database. So I took on a challenge to create a few test cases to regularly check Intel Parallel Amplifier and...

Continue Reading

Adding colors and names to your application. Part 3

20:13 / BY Roman Lygin
(continued)* Visualization of the shapes*The XDE framework provides functionality to display contents in 3D viewer with the help of XCAFPrs_AISObject, which eventually inherits AIS_InteractiveObject and thus can be used in a usual manner.Since XDE is OCAF-based you should couple it with AIS in OCAF-specific way, i.e. associating a driver (TPrsStd_Driver descendant) that creates an interactive object. In this case the driver is XCAFPrs_Driver...

Continue Reading

Adding colors and names to your application. Part 2

20:00 / BY Roman Lygin
(continued)OCC_UT_MyXDEApp could have inherited XCAFApp_Application and redefinition of Formats() and ResourcesName() would not have been required. But XCAFApp_Application’s constructor has been declared private (instead of protected) what disables inheritance :-(. Perhaps, OCC folks could correct that.The document is created in a straightforward way:Handle(TDocStd_Application) anApp = OCC_UT_MyXDEApp::GetApplication(); Handle(TDocStd_Document) aDoc; anApp->NewDocument ("XmlXCAF", aDoc); The screenshot below shows the structure of a new document created with...

Continue Reading

Adding colors and names to your application. Part 1

12:41 / BY Roman Lygin
If you have to exchange data with other applications via IGES or STEP (or perhaps other formats, if you are a commercial client of the Open CASCADE company), you might want to enrich your application with meta data in addition to geometry. We will consider names and colors which are often asked about on the Open CASCADE forum.OCC provides a ready-to-use framework –...

Continue Reading