Editing User:NyahCh3ck20/GSoc2013/Coding Report

From BRL-CAD

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 2: Line 2:
 
Daily log:
 
Daily log:
  
 
=== PROJECT SUMMARY ===
 
 
This year's GSoC was my first and most exciting projects given the fact that I'm working on my first opensource project and contributing for my first time to a great software and organization like BRL-CAD.
 
 
For the past three months I worked on implementing a pull routine which reversed the effects of a push on a CSG tree. This project focused on reversing the effects of the push command available in BRL-CAD and also pulling up and unpushed node. While following my implementation outline as described in my [http://brlcad.org/wiki/User:NyahCh3ck20/GSOC13/Design_Document Design Document], I kept modifying the plan as needed and tried updating my [http://brlcad.org/wiki/User:NyahCh3ck20/GSoc2013/Coding_Report logs] daily especially when I initially had no stable Internet access.
 
 
Before the Mid-term Evaluations, I studied the push and xpush routines seeing how the matrices were pushed down the tree in respective commands and started implementing and finished implementing the pull_comb() routine which pulls the matrix transformations in a combination node. Submitted patches on sourceforge for review. I tested various parts of the routine and made sure routine works perfectly will continue testing and fixing bugs if any post GSoC to make sure command is complete. Also, I wrote tests for the poly.c routines and submitted patches on sourceforge; tested the bn_mat_inverse() routine implemented for BRL-CAD and proposed new routine  which are still awaiting review by mentors.
 
 
Post Mid-term evaluations, I studied the various primitives trying to figure out how to implement the pull_leaf() routine for each primitive which was later disproved by Sean as a bad design choice which led to my implementing of the pull_leaf() using the AABB's of primitives which enabled me to pull translation components successfully. I also developed the pull interface, wrote regression tests, created the man pages and other documentation which will integrate command fully into BRL-CAD.
 
 
During Final Days and Post-GSoC I plan to finish implementing the pull_leaf routine which pulls both the scale and rotation components of primitives for BRL-CAD completing the pull routine and any other new projects as needed.
 
 
This was one of the most exciting summers of my life.
 
 
Cheers!
 
Nyah
 
 
=== Test Results ===
 
 
* Pulling unpushed object pulls matrix transformations up the tree.
 
[http://brlcad.org/wiki/File:Pushed_pulled_object.png pull_unpushed_obj]
 
 
*Pushing object after pull restores original matrix conditions.
 
[http://brlcad.org/wiki/File:Pushed_pulled_object.png push_pulled_obj]
 
  
 
==17 June - 23 June==
 
==17 June - 23 June==
Line 254: Line 229:
  
 
*Tests of pull routine shown[http://brlcad.org/wiki/File:Pulling_non_leaf_objects.png here]
 
*Tests of pull routine shown[http://brlcad.org/wiki/File:Pulling_non_leaf_objects.png here]
 +
=== Original Timeline ===
  
 +
Since i'll have to attend the Google Student Ambassador's summit in the first days of July and exams begin on the early part of July i'll move some of the work overhead to june when coding begins.
  
Thursday July 25, 2013
 
 
*Tested new algorithm for bn_mat_inverse() which used only Uses 100 multiplications and 61 additions or substractions.
 
 
*Tested new algorithm for bn_mat_determinant which requires only 34 multiplications and 20 additions or substractions, saving 6 multiplications
 
and 3 additions or substractions compared to the previous one. Integrated code into brlcad and tested. new passed all benchmark tests.
 
Created patch and uploaded to [https://sourceforge.net/p/brlcad/patches/216/ sf]
 
 
*Wrote Tests to compare runtime of old_determinant against new determinant routine which returned the following results below:
 
 
*Wrote Tests to compare Inverse of Old matrix inverse routine and new_matrix Inverse routine which returned the following results:
 
 
  CPU: Pentium(R) Dual-Core  CPU      E5500  @ 2.80GHz
 
  Compiler used: gcc 4.4.6-3)
 
  Compiler command: gcc -W -Wall -O3 -fomit-frame-pointer
 
  Kernel: Linux localhost.localdomain 2.6.32-220.el6.i686 #1 SMP Sat Dec 10    17:47:51 EST 2011 i686 i686 i386 GNU/Linux
 
 
  ./determinant
 
  My implementation:
 
      98 cycles minimum
 
      112 cycles median
 
  libbn implementation:
 
      84 cycles minimum
 
      84 cycles median
 
  Results (relative differences of calculated determinants):
 
-3.836070396965505e-14 minimum
 
0 median
 
2.152181998793086e-13 maximum
 
 
  ./inverse
 
  Example:
 
  My implementation:
 
[  0.803558  0.065957  -0.31977  0.174422 ]-1  [  1.105838 -0.352959  0.306948 -0.191398 ]
 
[  0.178270  0.764400 -0.477912  0.560214 ]    [ -0.546125  0.959763  0.471464 -0.743848 ]
 
[  0.567903  0.641359  0.602482  0.639353 ]  = [ -0.461005 -0.688994  0.868583 -0.088937 ]
 
[  0.000000  0.000000        0  1.000000 ]    [  0.000000  0.000000        0  1.000000 ]
 
  libbn implementation:
 
[  0.803558  0.065957  -0.31977  0.174422 ]-1  [  1.105838 -0.352959  0.306948 -0.191398 ]
 
[  0.178270  0.764400 -0.477912  0.560214 ]    [ -0.546125  0.959763  0.471464 -0.743848 ]
 
[  0.567903  0.641359  0.602482  0.639353 ]  = [ -0.461005 -0.688994  0.868583 -0.088937 ]
 
[  0.000000  0.000000        0  1.000000 ]    [  0.000000  0.000000        -0  1.000000 ]
 
  My implementation:
 
      462 cycles minimum
 
      490 cycles median
 
  libbn implementation:
 
      434 cycles minimum
 
      546 cycles median
 
 
 
 
Friday July 26, 2013
 
 
*Added -x option to push command. But command fails to read options in mged. Tried (Pd:x) and Pdx as arguments to bu_getopt() but command fails to read options. Continued testing and debugging.
 
 
*Changed the call of pushx(formerly ged_xpush to take as args gedp,dp so as to proceed to xpushing of object. Still testing routine.
 
 
*Debugged push command to support -x option, made [https://sourceforge.net/p/brlcad/patches/217/ patch] and submitted on sourceforge. However command can push only an object at a time so further work needs to be done to added support for multiple objects.
 
 
* Some tests on command [http://brlcad.org/wiki/File:Testing_new_push_routine.png Here]
 
 
 
TOD0: Add support for multiple objects then clean up xpush in BRL-CAD.
 
 
 
Saturday 27 July, 2013
 
 
*Added support to Push routine to push multiple objects. Created patch and modified patch uploaded to sourceforge.
 
 
*To clean up xpush routine from source code and make all new references to new push.
 
 
 
 
== 29 July - 4 August    ==
 
Monday July 29, 2013
 
 
*Started studies on ssh, irssi, and GNU Screen, succeeded in uploading some of my code patches to bz.bzflag.bz.
 
 
*Downloaded code to bzflag and compiled code although there is a small in bug in current code repository.
 
 
* Started working on tests for some of the /src/libbn/mat.c routines using the modified test Sean gave me on bn_mat_inverse and bn_mat_determinant.
 
  
  
Tuesday July 30, 2013
 
  
*Started looking at the BRL-CAD Numerics library for tests and started wrote a unit test for the bn_poly_multiply() routine.
+
===Community Bonding Period ===
 
+
    May 30
* Tested for very large and small values and answer was correct.
 
 
 
*Integrated test into BRL-CAD, created patch and submited code on [https://sourceforge.net/p/brlcad/patches/221/ sf].
 
 
 
 
 
*Filled the Mid-Term Evaluation form for participants.
 
 
 
To continue work on poly.c routines tomorrow.
 
 
 
Wednesday July 31, 2013
 
 
 
*Wrote the unit test for bn_poly_scale(), bn_poly_add(), bn_poly_sub(), bn_poly_synthetic_division() routines and uploaded code patches to source forge.
 
 
 
Will continue writing tests for the other poly.c tomorrow and finish by the end of the week.
 
 
 
Thursday Aug 1, 2013
 
 
 
*Wrote the unit test for bn_poly_quadratic_roots() routine and uploaded patch on [https://sourceforge.net/p/brlcad/patches/226/ sourceforge]
 
 
 
*Spent day debugging test and doing some further extreme test.
 
 
 
Friday Aug 2, 2013
 
 
 
*Wrote and tested the unit tests for the bn_poly_cubic_roots and bn_poly_quartic_roots() routines. Created patches and uploaded to sourceforge.
 
 
 
* To modify patches include source of known test values( Use Octave or maxima) since mathportal.org doesn't give clear math solver.
 
 
 
* Modifying patches to match reference values from Octave.
 
 
 
Saturday Aug 3, 2013
 
 
 
*Spent whole day debugging all unit test patches making sure tests failed when expected and produced the right results and outputs.
 
 
 
*uploaded codes to sourceforge.
 
 
 
== 5 August - 11 August  ==
 
 
 
Monday Aug 5, 2013
 
 
 
*Started working on the pull routine making sure non-leaf objects could be pulled.
 
started by building a linked list. and there is a bug lurking in there somewhere in. Spent whole day here; will continue work on it tomorrow after i finish moving the comments. starseeker talked about.
 
 
 
* will upload latest patch to sf which should apply cleanly
 
 
 
Tuesday Aug 6, 2013
 
 
 
*had to continue debugging pull.c but persistent problems with patches forced me to continue working on the libbn unit test patches I submitted on sourceforge.
 
 
 
*Currently fixing patches with Erik so they can apply cleanly.
 
Will be travelling home tomorrow and resume on Monday next week; So i'm to finish with these patches and get commit access so I could work freely on my project.
 
 
 
== 12 August - 18 August  ==
 
 
 
Monday Aug 12 2013
 
 
 
*Finished correcting indentation errors on libbn unit tests for polynomial routines.
 
 
 
*Continued test of pull routine; since tree fails to build linked list and discoved that the problem actually lied in the fact that I was testing on invalid input so linked list was not built. Trying appropriate objects.
 
 
 
 
 
Tuesday Aug 13 2013
 
 
 
*Continued testing of pull routine on non leaf nodes like regions and combinations and this kept reporting a segmentation fault. To continue debugging
 
 
 
Wednesday Aug 14, 2013
 
 
 
* continued working on the pull or matrix transformations up one level but work halted due to lights out for the rest of day.
 
 
 
Thursday Aug 15, 2013
 
 
 
*Fixed patch on bn_poly_add() test and uploaded code to sourceforge, continued debugging bn_poly_synthetic_division() routine but error kept coming from bn_poly_synthetic routine itself as traced by gdb. Continue working on it.
 
 
 
* Resolved an issue with test but seg fault still lurks somewhere in code; been starting for over an hour and still getting nowhere. Will look at that tomorrow.
 
 
 
Friday Aug 16, 2013
 
 
 
*Fixed the bn_poly_synthetic_division() unit test and uploaded code to sourceforge.
 
 
 
* Started looking at the db_preorder_traverse() routine ( although its not clear what struct db_traverse is since i don't see definition in source code) and how I could use it in implementing pull routine.
 
 
 
* To ask about definition of db_traverse since i don't see in source code.
 
 
 
Saturday Aug 17, 2013
 
 
 
*Reworked the accepted patches and submitted patch on sourceforge.
 
 
 
*Fixed the bn_poly_quadratic_roots() routine and submitted code on sourceforge.
 
 
 
*Started working on plan to implement pull using the db_preorder_traverse() which will need some routines to work with combinations and extract matrix transoformations from primitives
 
 
 
ToDo: To start working on the leaf_mat() routine which extracts matrix transformation from primitive.
 
 
 
== 19 August - 25 August  ==
 
 
 
Monday August 19, 2013
 
 
 
* Started reworking the pull_leaf routine to use db_functree instead of db_preorder_walk but may still use later to extract matrix transformation from primitives and continue walking up the tree. Still to ask on mailing which primitives to support first.
 
 
 
* Wrote the comb_enter_func() which restores the matrix transformations of a combination but is still dependent on pull_leaf() which is to deal with various primitives. To ask sean how to store changes on a combination matrix.
 
 
 
ToDo: Continue implementing pull_leaf() adding support to pull matrix transformation from torus then, spheres, ellipsoids and in that order.
 
Still wondering why commit access is not coming!
 
 
 
Tuesday August 20, 2013
 
 
 
*Finished Writing the pull_comb() routine together with the pull_comb_mat() routines. Discussed with Sean about test driven development. Will start writing unit test for routines tomorrow
 
 
 
*Looked into BRL-CAD source on how to write pull_leaf() routines which will support various primitives in the pull process since they don't have matrix transformation as such. Still to look at pull_leaf to actually see how they dealt with primitives
 
 
 
 
 
Wednesday August 21, 2013
 
 
 
*Started looking at test provided by Sean to use of db_walk_tree so as to be able to create a similar for pull_comb using db_functree() but faced problems calling functions in BRL-CAD's libraries. So i'll continue working on test tomorrow
 
 
 
*Continued adding some functionalities to pull_leaf() routine.(still crude) will continue work on pull_leaf after testing pull_comb() perfectly
 
 
 
Thursday August 22, 2013
 
 
 
*Started and finished writing pull_comb() unit test. But there is actually a seg fault which prevents the cur_mat() pointer from being inverted. Probably NULL.
 
 
 
*Will continue debugging and finish testing pull_comb() tomorrow then move on to pull_leaf()
 
 
 
 
 
Friday August 23, 2013
 
 
 
*Finished debugging pull_comb() and tested routine. Works perfectly.
 
Any way to note changes made on combination. pulled matrix is stored on
 
comb_leaf->tr_l.tl_mat.
 
 
 
*Created patch to stub empty pull routine into brlcad. then continue working on pull_leaf() routine tomorrow.
 
 
 
* Waiting for mentors to apply patch so i could create patch which adds pull_comb() routine into BRL-CAD.
 
 
 
 
 
 
 
== Aug 26 -  Sept 01  ==
 
 
 
Monday 26 August 2013
 
 
 
* Started implementing the pull_leaf routine which extracts the 4x4 matrix transformations for a primitive. Succeeeded in implementing the pull_leaf for an ellipse, sphere, EPH, elliptical parabola, elliptical torus, extrude, hyperbola, and a particle.
 
 
 
* started testing function and will continue debugging tomorrow before continuing with the addition of the superellipse, metaball, arbitrary complex polyhedra, arb8, rhc, rpc, and pipe.
 
 
 
Tuesday 27 August 2013
 
 
 
*Finished debugging pull_leaf() but routine is incomplete since I don't currently support all primitives. Will follow Sean's instructions and start developing pull interface from tomorrow by adding synopsis, docs, full integration and test cases.
 
 
 
*Added support for truncated cones in pull_leaf() but a bug hangs in there. Will take a peek tomorrow or finish this night before going to sleep.
 
 
 
Wednesday August 28, 2013
 
 
 
*Started developing the interface by adding the stubbing the pull to archer  interface.
 
 
 
*Added the pull routine to the tclscripts, libtclcad, and wrote the pull documentation in brlcad/doc/ directories.
 
 
 
Still to finish writing the regresssion tests before moving on to adding  support for pulling primitives on BRL-CAD.
 
 
 
Thursday August 29, 2013
 
 
 
*Started and finished writing the regression tests for the pull command.
 
 
 
*Tested and compiled code but pull does not appear on the command line when regression tests are ran. Will ask on IRC for assistance here.
 
 
 
Todo: When done with developing the pull interface, I'll dive into writing the pull_leaf routine for all primitives.
 
 
 
Friday August 30, 2013
 
 
 
*Tested regression tests for pull and added manual pages and documentation for pull successfully such as in man pages, appropos library for pull
 
 
 
*To create patch and submit on sourceforge, also tried adding pull to archer but found a little problem. To discuss with mentor on how to proceed.
 
 
 
TodO: After approval of man pages, to continue adding support for all primitives into pull command. and fix bn_poly_sub() test patch.
 
 
 
Saturday August 31, 2013
 
 
 
*Finished testing regression tests and uploaded code to sourceforge
 
 
 
* Continued looking at the primitives such as arb8, arbn so as to continue working on primitives for pull.
 
 
 
== Sept 02 - Sept 08  ==
 
 
 
Monday Sept 02
 
 
 
*Started looking at the other primitives; left to complete the pull_leaf() routine. Saw many complications with many primitives. Will need the Assistance of Sean in extracting the matrix transformations from them.
 
 
 
 
 
Tuesday Sept 03
 
 
 
*Fixed bug in bn_poly_sub() unit test; uploaded code to [https://sourceforge.net/p/brlcad/patches/224/ sourceforge].
 
 
 
*Succeeded in pulling the following primitives(TGC, REC, PARTICLE, EPA, EHY, HYP, ETO, EXTRUDE). Still left with about 26 primitives to be pulled in order to complete the pull_leaf() routine.
 
 
 
Will need some directions on how to implement pull_leaf() since using switch case statements is not a good design choice.
 
 
 
Thursday05 - Sunday 08
 
*Took a break so as to recover from malaria.
 
 
 
== Sept 09 - Sept 15  ==
 
 
 
Monday 09 October
 
 
 
*Started looking at AABB bbox routines in BRL-CAD. Still to develop simple algorithm that automatically processes the translation from bbox return vectors to determine original translation.
 
 
 
*Read some online wiki pages on AABB bounding box of objects.
 
ToDO: To start writing routine and unit test tomorrow
 
 
 
 
 
Tuesday 10 October
 
 
 
*Started and finished writing tranlate routine which extracts and sets the translation component from the bounding box minimum and maximum points from the bounding box routine.
 
 
 
*To integrate general bounding box calculating function for every primitive.
 
 
 
 
 
Wednesday 11 October
 
 
 
* Started testing pull_leaf routine using the rt_functab bbox routine and successfully pulled some translations assuming object's centrepoint was translated from the origin(0,0,0). But still waiting on Sean for some clarifications on the math.
 
 
 
*To look at confirmation from sean and perfect the pull_leaf routine, completing the pull routine and running through valgrind.
 
 
 
 
 
Thursday 12 October
 
 
 
*Perfected math on moving bounding box and primitive to origin before extracting translation. But will start testing tomorrow.
 
 
    
 
    
  
  
Friday 13 October
+
June 13
 
+
TODO: combination of push and xpush routine.
*Successfully wrote the pull_leaf routine which pulled the translation components of the primitive.
+
      changed xpush to push -x
 
 
*Tested routine together with the pull_combination routines and successfully moved the matrices right up to the root of the tree. but still unclear with cases where the matrix transformations for the combinations is NAN.
 
 
 
* Submitted [https://sourceforge.net/p/brlcad/patches/215/ patch] on sf and awaiting review before moving on to porting command to archer since i've not been granted commit access.
 
 
 
== Sept 16 - Sept 22  ==
 
 
 
Monday Sept 16,
 
 
 
*Started re-testing the pull routine starting from the pull_leaf which pulled correctly.
 
 
 
*Discovered a bug with the pull_comb() routine which pulls matrices which are not symmetric;so will fix bug tomorrow.
 
 
 
*Started stubbing pull to archer but had an error will try to fix problem tomorrow or post question on mailing list and see what comes up.
 
 
 
 
 
Tuesday Sept 17
 
 
 
*Continued testing the pull_leaf and realised NAN values were being pulled from the primitives which are to be set to zero in such cases.
 
 
 
*Started fixing bug.
 
 
 
Wednesday Sept 18
 
 
 
* Continued fixing pull_leaf routine but realised pull_comb() routine pulled matrix transformations having NAN as values. to ask mentors about this problem if it persists.
 
 
 
* Was in a meeting with the Vice Chancellor as Google Student Ambassador and explained my Vision for the University during my tenure.
 
 
 
Thursday Sept 19
 
* Started preparing for my upcoming exams next week; and had a meeting with the Public relations Officer of the University concerning my recent appointment as Google Student Ambassador and plans for the University community.
 
 
 
 
 
Friday Sept 20
 
* Attended the Interview at the University Media House( Chariot FM) where I explained my GSoC experience and current work as Google Student Ambassador.
 
 
 
Saturday Sept 21
 
*Wrote the Project summary and continued preparing for my exams next week.
 
 
 
== Sept 23 - Sept 28  ==
 
 
 
#Monday Sept 23
 
 
 
Started looking at the BRL-CAD documentation spreadsheet posted by Harmanpreet and summarising all documents on the list. Requested for the script from Harmanpreet that automates the summary of the documents.
 
  
@Will finish summarising documents tomorrow; since I have to prepare for some of my exams coming up from tomorrow.
+
June 14:
 +
    Integration into MGED and tests of new command.

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)