New TGeoShape

Hi,

I’m trying to make an interface between a package called OpenCASCADE (opencascade.org)
and the geometry classes in root. This to be able to import for example STEP or IGES files from
cad-programs. I’ve gotten somewhere but not quite to where I would like to come!!!

First of all, it is clear that I’m working on something that for navigation, ray-tracing etc will be quite slow
so it should only be used for complicated shapes where the coding of the shape takes a lot of time compered
to whatever one would like to do with it (VMC etc)

In short, I got the motheds TGeoOpenCascade::Contains,DistFromInside,DistFromOutside working,
except that Saftey is not yet functional. I’m trying to get the ComputeNormal to work, but I’m not sure
what it should do? Should it compute the normal of the point on my shape where the line made by the
arguments point+dir*t intersects my shape? And if so, how do I define the direction of normal? MY guess is
I’m doing something wrong, see included raytrace of a TGeoTube and a enginepiston read in using my class.
I also include the humble beginning of the interface-class
[attachment=1]c1.png[/attachment]

As a follow-up? Which methods should I implement if I want to be able to view the imported cad-shapes
using openGL?

cheers

Joa Ljungvall
occ.tar.gz (29 KB)


Hi Joa,

Not trying to discourage you, but the speed of OCC for navigation purposes was one of the reasons for going for a new geometry in root some 10 years ago.

Indeed, the normal is computed at the point of intersection of a ray with the shape surface, so always close to the surface (otherwise it does not make sense). In TGeo you should give it back such that its dot product with the current direction is positive.

To have GL visualization you will have to implement the methods: SetPoints, SetSegsAndPols and GetNmeshVertices that are basically defining a mesh for the shape. I guess this would be very hard to do with OCC in the general case…

Good luck,

Hi again,

Yes, I have noticed that the speed of OCC navigation is slow… Initially I thought this was a price to pay with OCC reading different cad file formats thus dealing with “general” geometries, but if you (as in the ROOT team) decided against it some 10 years ago, I think I’ll trust in you and call my try a waste of a couple of hours and abandon ship.

cheers

Joa