Bojian Wu

ustcbjwu [AT] gmail.com
Chinese Academy of Sciences (CAS)

Google Summer of Code(GSOC 2016) Blog

Daily and Weekly Update

Bonding Period

Week 1

Week 2

Week 3

Week 4

Week 5

Week 6

Week 7

Week 8

Week 9/10/11

Week 12

Week 13

Week 14

Week 14

Summary of What I have done

Please refer to the attached files for more details[Download]. These files are the patches for 'Plate Mode NURBS raytracing' project supported by BRL-CAD in Google Summer of Code 2016. Here is a brief description.

(1) obj-g_memory_leak.patch

When using 'obj-g' to transform '*.obj' 3D model to BRL-CAD built-in '*.g' format, it will report memory leak before(please refer to the link below for more details). It is fixed by disabling some default grouping information and content.[Link]

(2) plate-mode.patch

Almost all the changes are included in this file. For plate mode B-rep, the first thing is about how to integrate *thickness* value into BRL-CAD built-in data structure designed for representing B-rep model, actually, it uses openNURBS API for this purpose recently. Based on this, I have following changes to the original code.

  • import and export of plate mode B-rep
  • In order to be compatible with old format B-rep model, I have a flag indicating what type of the imported B-rep model is including plate-mode B-rep, normal-mode B-rep and old format. Please refer to rt_brep_import5()/rt_brep_export5() for more details.

  • raytracing of plate mode B-rep
  • In my implementation, I only consider to add *thickness* value to non-solid models cause a solid model already has its own volume. When doing ray-tracing, compared with BoT, for plate-mode models, I center the original hit point and offset it along the ray direction/reverse ray direction with half of thickness value to generate two hit points.

    But differently, the BoT supports two modes for plate mode: *plate* and *plate nocos', the former one considers oblique angle of the ray while the latter one does not. For B-rep currently, I only mimic the latter one, it may cause some numerical problems and need to be verified later. Please refer to rt_brep_shot() for more details.

  • raytracing of NURB surface
  • If the surface is revolution surface like (hemi)sphere, generated by revolving a reference curve around an fixed axis, usually, the end points on the curve are singular points, previously in BRL-CAD, it can not compute the normals at these points correctly. I replace the old function with another openNURBS built-in routine to evaluate the normals, it works now. Please refer to utah_newton_solver() for more details.

  • hit points pruning rules
  • Besides, I also change some rules used in pruning the NEAR_MISS/NEAR_HIT/CRACK_HIT hit points. Please refer to rt_brep_shot() for more details.

    (3) brep_brep.cpp

    This is a tool designed for transforming old B-rep representation into new format, to be more specifically, integrating face *thickness* and turing the B-rep into plate mode.

    (4) brep_surf.cpp

    This is a tool designed for generating a piece of B-rep surface with *thickness* given by user. It is used for testing raytracing of plate mode B-rep surface.

    (5) brep_plane_trimmed.cpp/brep_surf_trimmed.cpp

    These are tools designed for generating trimmed surface used for testing raytracing of plate mode B-rep surface.

    Future work

    (1) numerical analysis of plate mode B-rep raytracing

    By assigning a *thickness* value to each surface, it now can have its own volume, so a numerical analysis to evalute the volume is necessary, the tool used for this purpose are 'nirt' and 'gqa'. Now, I have already used 'nirt' to shoot single ray for testing, it can give me satisfactory results with correct hit points and hit distance. But, unfortunately, with 'gqa' test, it can not generate the right result when computing volume of the surface compared with BoT with same configurations of the surface.

    (2) interactive commands

    As we can see, for BoT, we have lots of interactive commands used in MGED to control the configurations of the surface, maybe the next step is to design or modify some commands to enable more utilizations.