GeoMop / bapprox

Python tool for approximate 3d points using Bspline surface
3 stars 1 forks source link

Create volume object and export it to brep file #6

Open jirihnidek opened 8 years ago

jirihnidek commented 8 years ago
jirihnidek commented 8 years ago

Example of "extruded" B-Spline surface:

bspline_extrude

Example of mesh (GMSH):

bspline-solid-mesh

jirihnidek commented 8 years ago

The code is part of bapprox. Some screenshots:

occ_surface_extruded

gmsh_surface_extruded

jirihnidek commented 8 years ago

Surface can be cropped:

croped_surface

jbrezmorf commented 8 years ago

Seems good, what about cropping by ~1000 side polygon. Timing appreciated.

jirihnidek commented 8 years ago

OCC boolean operations are not realible. :-1: When area is not convex or terrain has high resolution, then it produce strange results:

crop_surface_non_convex_area

wrong_surface_cut

jirihnidek commented 8 years ago

It seams that this code can fix the problem:

my_lib = OCC.BRepLib.breplib()
my_lib.OrientClosedSolid(solid)

Good hint was from this forum post: http://www.opencascade.com/content/problem-surface-normal-0

jirihnidek commented 8 years ago

I did some measurement an it seams that boolean operations between volume objects have linear dependence. The volume of terrain volume was the same for all measurements. The number of poles was 15x15. I only increased number of border area points.

figure_boolean_volume_operations

Data from measurement:

N t [s]
6 2.05
12 3.46
24 7.05
48 14.89
96 28.79
192 51.73
384 112.55

Example of fractal border area (3 iterations - 48 border edges):

figure_fractal_border_area_3-48

jirihnidek commented 8 years ago

It seams that increasing of poles does not have linear dependency (N is number of poles in both directions). The number of border area points was 6 in all cases.

N t [s]
15 1.51
30 4.00
45 9.82
60 15.76

BTW: I tested extreme situation, when surface with 60x60 poles was computed and it was cutted using polygon with 384 points/edges. It took 918.22 seconds (15 minutes).

jirihnidek commented 8 years ago

It will be possible to make extruded surface smother using and test using different B-Spline surface for generating volume:

RemoveUKnot(index, new_multiplicity, tolerance)
RemoveVKnot(index, new_multiplicity, tolerance)

When new_multiplicity=0, then knots (poles) with given index are removed.

jirihnidek commented 8 years ago

Results of benchmark tests: boolean operations between area and surface (not surface extruded to volume) are similar to boolean operations between two volumes.

N t[s]
6 1.05
12 1.89
24 4.02
48 8.08
96 15.14
192 32.42
384 62.59