Hi Sean!
So here is my progress in terms of understanding how would I apply plate
mode raytracing to the B-Reps :
1. To assign an implicit thickness to the surface, I don't need to actually
sample and find an offset surface - rather I can just assign that implicit
thickness at a point F(s, t) of the surface whenever required, by adding an
offset in the direction of (and opposite as well) the normal at (s, t).
2. Instead of building the BVH (which is highly inefficient right now) from
the surfaceTree, I will find the bounding boxes of all the faces in the
faceList of the B-Rep and find the final Bounding Box.This will be the prep
step for the plate-mode raytracing.
3. Once the prep is completed, the shot function will be called, and the
Newton's method will be used for intersecting the ray with each face in the
faceList. We now sort the hitList so that we have the nearest hit first and
farthest hit last.
4. To handle the cases of intersection with corners, they will be
intersected separately (as in and out won't be obtained in cases of the
corners).
5. Now, there can be duplicate hits in the hitList as we are simply
iterating the faceList of the B-Rep rather than using a hierarchy which
avoids overlap. Once we have the histList ready, we call the a function
that creates segments (I will have to write a new one here!). It evaluates
the hits, removes the duplicate hits, checks if a ray is grazing the
surface and if so, uses the FILO approach to evaluate the hits (in and
out) as there will be multiple entries and exits. Once done, we return
the seghead filled.
This approach is almost similar to the approach used in BoT besides the
fact that the intersection was fairly trivial there as it was an
intersection with a triangle and here it is an intersection with a surface
and hence it is rather complex than triangles.
The only thing I believe that could be remaining now is thinking about any
limitations that B-Reps might pose to Plate-mode raytracing. Other than
that, I believe I have put in my earnest efforts to find a reasonable
enough a solution to propose for the project.
Waiting to listen from you. Eagerly.
With Regards,
Kalpit Thakkar
PS : I am having lots of fun in learning this stuff and I'm really excited.
Please reply when you get time, I'm waiting. :)
On Tue, Mar 24, 2015 at 7:49 PM, Kalpit Thakkar ceasy...@gmail.com wrote:
Hello Sean!
So I tried to understand plate-mode implementation for triangle meshes
through BoT primitive as mentioned in the project description page. The
file bot.c includes g_bot_include.c (Is it a good practice to include a
.c file?), which has all the required functions to raytrace a BoT according
to the precision required (float or double). Now, I observed the following
things after studying it :
Function rt_bot_prep_pieces_ :
Routine to find the bounding RPPs of the pieces of the BoT. It starts with
assigning a thickness value to a variable los, by performing some sort of
bit test using (BU_BITTEST(bot-bot_facemode, surfno)), which makes it
assign either full thickness on both sides of the plate, or a thickness
centered about the plate (1/2 on both sides). After that an offset is
found using this thickness value assigned to los in the direction of the
unit normal at each vertex and the face is offset by that amount, to
provide it a thickness (on both sides). Finally, this is assigned to the
min and max vectors of structure representing the solid (struct soltab).
Return type : void
Function rt_bot_prep_ :
As usual, it checks the validity of the database record being the required
primitive (here, BoT) and then finds the bounding RPPs required for
raytracing if the validity test passes (Uses the rt_bot_pieces_prep_
function). In this case, it also finds the approximate sphere and a
bounding sphere for the BoT.
Return type : int (-1 on failure, 0 on success)
Function rt_bot_plate_segs_ :
Given an array of hits, it provides us the segments of the BoT is the bot
mode is RT_BOT_PLATE / RT_BOT_PLATE_NOCOS. Now, each segment has it's hit
structure, which tells what is the surface number that the ray has hit and
what is the in and out distances of the ray for this purticular
segment. So, this hit distance for in and out points depends on that
bit test we performed in rt_bot_prep_pieces_, ofcourse it's performed here
again.
Return type : int (returns the numberOfHits * 2)
Function rt_bot_unoriented_segs_ :
Same functionality as function above, for an unoriented BoT Solid. Makes
the final number of hits even.
Return type : int (return final numberOfHits)
Funciton rt_bot_makesegs_ :
Make segments of the BoT given the array of hits. This function is called
in rt_bot_shot_ and rt_bot_pieces_shot_. Gives us the segments for the hits
array given. The interesting thing in this function is the FILO algorithm
used for evaluating the in and out hit points for a ray that grazes a
surface and it's comparison with LIFO. The visual diagram