User:Harman052/GSoc2013/Logs

From BRL-CAD

Proposal Link: http://brlcad.org/wiki/User:Harman052

Daily Progress

June 17 2013

I go through the project flow, checked milestones and time period to do specific tasks. I mentioned various JavaScript libraries in the proposal so was trying to sort out which I should start with. I compared them with each other but later on with some Internet searches, it was found that webGL is not fully supported on all devices and browsers. I already compared webGL and HTML5 during proposal submission but now it is confirmed that I will go with HTML5 canvas for this project. Also learned about its various capabilities and features.

June 18 2013

Tried tutorials of HTML5 to build base for the project implementation.

June 19 2013

I decided to submit a patch and selected a feature request of directing the mged output to journal file. Currently, only user inputs can be written in it. I tried by searching for files that I need to edit but failed. I was searching for bu_log_add_hook() that doesn't pointed me to files that I could start with. Later I got useful and detailed hints from IRC to look into src/mged. I will look into it.

Also discussed about project scope with Sean.

June 20 2013

Conclusion of discussion was that many aspects of project are still unclear to developers. Although it was very painful to know that developers have doubts about my proposal but anyway I started with visualization. Different steps can be visualized as 2D HTML5 entities. The results of intersection can be visualized as not displaying the non-overlapping part as soon as user clicks on 'Intersect' button using javascript's "onclick" event handler. But mathematical visualization will not there.

June 21 2013

Searched for solutions for unclear aspects of project. Searched about wireframes, why wireframes are used? It is just because they are fast to calculate but didn't find any anything useful specific to BRL-CAD for reply.

June 22 2013

I searched and collected lot of information that can be very useful for BRL-CAD. I am compiling it now, and as it completed, will share with developers.

June 23 2013

Found more useful information. Will share on mailing list, once summarized. Took break.

June 24 2013

Worked on patch. Studied the f_journal function, its various components. Some doubts are still not cleared. Will try to finish by tomorrow.

June 25 2013

  • Prepared a detailed email and sent to mailing list about what I found for Sean's questions. Expecting new directions.
  • Designed basic layout of interface.

June 26 2013

  • As told by mentor, I studied WebGL and tried WebGL demos. I would use mixture of HTML5 and WebGL.

June 27 2013

  • As suggested by Charlie Stirk, I reviewed http://shapesmith.net/. I tried it by downloading and installing locally. 3D objects can be easily created and edited. Moreover, it can produce josm files than can be easily parsed and used to make script of MGED commands. It will be wonderful if we use its interface.
  • Got reply from Sean, suggesting to shift from making geometry editor to geometry viewer.

June 28 2013

I was suggested to focus on making online geometry viewer. I just posted on dev-mailing list whatever I did in this context.

June 29 2013

  • Used facetize command to convert implicit primitives into bot format. However it failed to run on brep objects.
  • Searched for web technology that could support NURBS geometry directly.
  • Posted details about today's progress on mailing list.

June 30 2013

  • Explored source files to fix the facetize command. I found code for facetize command in two files, one in src/libged/facetize.c and other in src/libged/wdb_obj.c. Currently facetize.c is working.

July 01 2013

Wasn't able to do much work due to some un-expected urgent work.

July 02 2013

Looking into wdb_obj.c as it controls BRL-CAD database, it may be helpful in reading file from browser.

July 03 2013

  • Completed the task of summarizing the things discussed on mailing list into an wiki article.
  • Working on layout.

July 04 2013

Explored src/libged/facetize.c and src/libged/wdb_obj.c files. From man page, found "t" option of facetize command and for corresponding to this option, found nmg_use_tnurbs flag in src/libged/facetize.c and src/libged/wdb_obj.c files. But I didn't found any relevant code that can be hooked to make the command working in desired way.

July 05 2013

  • Trying to figure out solution. Ask for solution on IRC.

July 06 2013

  • Post problem on mailing list.
  • In the mean time, I worked on patch. Tried to add "-r" option (for response) under f_journal function in history file. Now just need to figure out where to add hook in this file.

July 07 2013

  • Waiting for reply.
  • Found function history_journalize that actually writes data in journal file and where the log hook is required to be added. With the help of grep, I found details about bu_log_add_hook() in bu.h. Need to figure out how to implement.

July 08 2013

Was looking at similar implementation of bu_log_add_hook() in src/libged/log.c and util/pl-dm.c to figure out to redirect data to file. Both these files have same bu_hook_t function. I tried to implement in similar way, but it didn't worked.

July 09 2013

July 10 2013

  • I read about WebGLU. Even they didn't specify the support for visualizing trimmed NURBS.
  • However they have partial .obj parser implemented to load objects. But they said, they support object hierarchies. If I got it correctly then it mean we can show sub components of regions and combinations.
  • Found 'glMatrix', another Javascript Matrix and Vector library.

July 11 2013

July 12 2013

  • Did some experiments with B-rep objects. My motive was to see how B-rep objects are represented in database file. First I made an implicit object and convert .g file to .asc then from .asc back to .g and it was successful. Then in new database file, made another object and made its brep object and converted file to .asc. In asc file I got message, "a Tcl output routine for this type of object has not yet been implemented" which means brep object was not described in .asc file. When this file converted back to g, all entities (one Implicit and one brep) were lost.
  • Not much work done.

July 13 2013

  • Reviewed glMatrix and WebGLU matrix library to see if they can satisfy our requirements.

July 14 2013

  • Asked questions on webGL IRC about various matrix libraries.
  • Prepared summary as told my Sean of his last email.
  • After seeing reply, many things got cleared which I took other way earlier.

July 15 2013

Understanding the basics of various geometry representation forms to know more how they are used in graphics.

July 16 2013

Learned concepts behind Bezier curve and other basic things like control points, degree, basis function.

July 17 2013

Explored about NURBS and maths part behind its working. How control points and their weights played their part in making curve, purpose of knot vector. However, it need sufficient time to grasp all that completely. But now I have basic understanding to NURBS geometry.

July 18 2013

  • Tried a basic NURBS specific example in OpenGL to see what basic functions are required to be ported to JavaSctipt(WebGLU).
  • Tried example in SWIG to convert C code int Python but later came to know it does not support JavaScript. :-(
  • Looking into GLU's source code and looking for some other converter.

July 19 2013

July 20 2013

  • Received mail from my mentor on mailing list having instructions about how to proceed further in project. So finally I will visualize polygonal OBJ files on browser, no need to use Emscripten.
  • Started reading about how to read data from g file.

July 21 2013

Took break.

July 22 2013

  • Successfully retrieve name of database file, title, version, units from g file using pointer to db_i struct.
  • Working out to retrieve names of entities from g file.

July 23 2013

  • Made wire frame of layout.
  • Prepared flow and implementation summary of project.
  • Nothing found. Still working on same task of retrieving names of objects.

July 24 2013

  • Making a small prototype of web models. Searched the Internet and found good examples of displaying OBJ files using ThreeJS.
  • Basic scene is setup but getting problem with loading OBJ file.
  • Tried to get solutions from IRC and Stack OverFlow, but not succeeded.

July 25 2013

July 26 2013

  • After little struggle, applied materials to models.
  • But models are not rendering on Sean's browser in the same way as on mine. He is getting problem in viewing models after I assigned materials. Following are screenshots from my system:

http://screencloud.net/v/4lpO

http://screencloud.net/v/2sOA

July 27 2013

  • I checked models on different browsers and systems. They are viewed differently on different machines but the browser version is same. Some are getting lines (tessellation lines) and some not.
  • In the mean time, I successfully retrieve names of objects from database file.

July 28 2013

  • I started moving towards making web interface. I found a ready made editor in ThreeJS source code.
  • Reviewed the editor, used it to see what tasks similar to what I purposed in mock ups it can perform. It seems promising.
  • Send email to BRL-CAD dev mailing list, expressing my interest in using this editor as base for project.

July 29 2013

No work done, due to some college related work.

July 30 2013

  • Looked for different method of file uploading. I wanted to start with Drag n Drop support, but later I choose simpler method of browsing the files just to complete the overall flow. Made file upload feature. Drag n Drop support will be added at the time of actual interface implementation.
  • Made and share future plans and ask for suggestions on mailing list.

July 31 2013

  • Started with adding file upload option. I was planning to make this feature as drag n drop, but later I decided to first go with simple solutions.
  • Added entity list display on browser.

August 01 2013

  • Following mentor Rai's suggestions, added feature of generating OBJ files of first five entities as the file uploads.
  • Now I need to pass value from PHP to JavaScript so as to finally display OBJ file on browser. I suspect Ajax can be the solution.

August 02 2013

  • I used PHP redirection to redirect to model display page.
  • Now as the file upload finishes, model displayed on browser (although only first entity at the moment). So, at least the flow has been completed.
  • Tested with all models that shipped with BRL-CAD source code. It worked perfectly with all files except those who have modeling errors. However, it look lot of time for files that have large number of entities (2000+) such as havoc.g but once OBJ files created model displayed successfully. I will recheck and discuss in detail on mailing list once I finished with setting up demo.

August 03 2013

  • Added CSS to first page.
  • Adjusted camera position and added additional directional light to light up the scene.

August 04 2013

  • If file already exists, then it will directly display the models rather than uploading the same file and making OBJ files again.
  • Removed unnecessary files and created repository on GitHub and pushed all the code.