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 12

Comparison of BoT/B-rep sphere in solid mode

Inconsistent shooting pairs in sphere and hemisphere

Now the normal can be deduced at singular points correctly. But another problem arises. Actually if the ray shoots from a singular point to another singular point, like shooting from top to down in sphere or from side to side in hemisphere, it will still report a miss illustrated as follows.

I also follow the code and find an interesting thing. The program can compute all the hit points at the very beginning, but some hits are pruned by some rules later and cause the inconsistency hitting pairs, so it will report a miss. Now I am working on this...

The normal at two singular points(marked with orange) are correct now, but if the ray shoots from top to down, it will miss. The normal several singular points are correct now. In one case, if the ray shoots from top to down, it will report a successful hit cause the out hit is not a singular point, but the other case, it the ray shoots from side to side as depicted above, it will still give a miss.

Comparison with BoT

Here is a simple comparison with BoT, I create a same sphere(center=(0.0, 0.0, 0.0), radius=1.0, thickness=0.5), the hitting point and los are exactly same with brep_cobb, the only difference obliq_in.

B-rep sphere and hemisphere(solid, not in plate mode)

There is a problem occurred when using sphere and hemisphere as examples. Because they are all revolution surfaces, so they contain singular vertices(orange points) at the end of the reference curve(red curve) as depicted in the follows.

Let us take the sphere(left) as example, if the ray shoots from the direction as depicted in yellow, it will give a miss. After tracking the code step by step, I find that it can not compute the normal at this point correctly(the calculated result show normal=(0.0, 0.0, 0.0)), so on the manifold surface, this point should be considered as a singular point. Same as the hemisphere(right), but more than sphere, it will give a miss when shooting the ray from the side.

But the problem here is how to compute the normal? In the implementation of BRL-CAD, it uses openNURBS built-in functions to compute the normal, but it fails on such singular points. What I think is to use its neighboring information do deduce the missing data.

PROBLEM SOLVED: actually in current implementation, for all surface, it uses ON_Surface::Ev1Der() to compute normal and first derivatives at a point on the surface, but the drawback is that it will fail the computation at simgular points, I use another function called ON_Surface::EvNormal(), it will check the singularity and compute Jacobian to evaluate the normal when necessary.(link)

The result is as follows. If I translate the mode a little bit and avoid the singular points, the ray will hit the model.

Solid Model Top Front Left
Hemisphere
Sphere

Examples of B-rep model(brep_cobb) using *nirt*

Here is an example of *raytrace* and *nirt* of 'brep_cobb'. Because the 'brep_cobb' is a concatenation of six pieces of surface, so it is not a solid model, I can not generate the 'nirt 1' result like the BoT example below, but I have the following *nirt* result for both surface mode(two hit points with LOS equaling to 0 and a purple line indicating a gap between them) and plate mode(two hit points with LOS equaling to 0.5 and blue/yellow line indicating thickness of the surface and a purple line meaning a gap).

By the way, the configuration of the B-rep is: center=(0.0, 0.0, 0.0), radius=1.0, thickness=0.5.

Surface Mode Plate Mode

Using *nirt* to shoot single ray on BoT

Here is an example on how to generate a BoT hemisphere and using *nirt* to do ray tracing in different settings. The table below shows the visualized result of ray tracing. For more details, please refer to the *nirt* manual(Download).

nirt 1 nirt 2 nirt 3 A closeup of nirt 3