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.
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]
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.
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.
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.
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.
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.
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.
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.
These are tools designed for generating trimmed surface used for testing raytracing of plate mode B-rep surface.
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.
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.