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 provided is just
> awesome for understanding.
> Return type : int (return final numberOfHits)
>
> Function rt_bot_shot_ :
> Intersects a ray on the BoT and finds the hits. Sorts the hits from near
> to far and then finds the segment using rt_bot_makesegs_.
> Return type : int (return final numberOfHits)
>
> Function rt_bot_pieces_shot_ :
> Intersects a ray with a list of pieces of BoT. Same as above in the
> intersecting algorithm.
> Return type : int (return final numberOfHits)
>
> I have understood what is plate mode through these functions. If there is
> anything that these functions might have missed explaining me, please tell
> me where should I learn it from. I would now proceed to understanding NURBS
> and how to apply this method to them. I hope to finish understanding things
> by tonight so that I can start the proposal tomorrow and submit it for
> review.
>
> With Regards,
> Kalpit Thakkar
>
> PS : Can you explain to me what does BITTEST do?
>
> PPS : Can you please review my proposal on Object Oriented C++ Geometry
> API? I have submitted it on Melange :)
>
>
> On Tue, Mar 24, 2015 at 12:25 AM, Christopher Sean Morrison <
> brl...@mac.com> wrote:
>
>>
>> On Mar 23, 2015, at 2:05 PM, Kalpit Thakkar <ceasy...@gmail.com> wrote:
>>
>> > Hello Sean!
>> > I was thinking of proposing another project and I would like to work on
>> this project. I checked past 3-4 years' projects, but there hasn't been any
>> efforts in this direction.
>>
>> Indeed.  It’s not a hard project, algorithmically speaking, but nobody
>> has yet put forth a quality proposal to work this area.
>>
>> > So, according to the description there, BoT has a raytracing routine
>> that, when finds an "in" point for a ray, due to extremely thin surface,
>> assigns the "out" point as the "in" point + the implicit thickness added to
>> each coordinate of "in" point and I would have to implement the same
>> methodology for NURBS surfaces now.
>> >
>> > To analyze the problems that I would face in implementing the plate
>> mode raytracing for NURBS, I would have to understand exactly how
>> raytracing NURBS works. So, is there any specific resource that might help
>> me understand this aspect quickly?
>>
>> Nope.  Understanding how NURBS ray tracing works is not something that
>> can be achieved quickly.
>>
>> But you don’t really need to understand it.  You need to understand what
>> plate-mode means — and more specifically you need to understand BRL-CAD’s
>> existing plate-mode implementation for triangle meshes.  If you understand
>> that, you’ll know exactly what is needed for NURBS plate mode, even without
>> understanding NURBS ray tracing.  This requires a lot of reading of code
>> and playing with sample geometry.
>>
>> Cheers!
>> Sean
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website,
>> sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub
>> for all
>> things parallel software development, from weekly thought leadership
>> blogs to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/
>> _______________________________________________
>> BRL-CAD Developer mailing list
>> brlcad-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/brlcad-devel
>>
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to