Difference between revisions of "User:Izak/GSOC 2013 logs"

From BRL-CAD
(July 24)
(July 24)
Line 303: Line 303:
  
 
* Generated and tested the [https://sourceforge.net/p/brlcad/patches/207/ hrt_stub.patch] that it applies cleanly, independently and without any side effects.
 
* Generated and tested the [https://sourceforge.net/p/brlcad/patches/207/ hrt_stub.patch] that it applies cleanly, independently and without any side effects.
 +
 +
==July 25==
 +
 +
 +
==July 26==
 +
 +
 +
==July 27==
 +
 +
==Pre-midterm evaluation summary==
 +
 +
In order to prepare the  BRL-CAD source code for the heart primitive , I hooked the heart primitive into the BRL-CAD source by adding a magic number for the heart in include/magic.h and src/libbu/magic.c, stubbing an empty heart in include/db5.h, include/rtgeom.h, include/raytrace.h, src/librt/db5_types.c and  /src/librt/primitives/table.c and adding typing support for the heart in the mged interface in include/wdb.h, src/libwdb/wdb.c and src/libged/typein.c as can be seen [https://docs.google.com/file/d/0B4kEIUMOBbU-ZUpmcXpxZlFzVXc/edit?usp=sharing here]. As regards the ray tracing callback functions in src/librt/primitives/hrt/hrt.c , I have built the hrt_specific structure, written the rt_hrt_shot() and rt_hrt_prep() functions and I am currently testing these.I intend to continue working on other callback functions like rt_hrt_import(), rt_hrt_print(), etc and finally hook the heart primitive to the mged and archer interfaces with associated clean up and documentation.

Revision as of 16:58, 24 July 2013

PROJECT DETAILS

Project Title : Implementation of a heart primitive.

Name: Isaac Kamga.

IRC Name (Handle): Izak

e-mail: u2isaac@gmail.com

Phone : +237 74 10 62 97

Introduction

This page will contain logs of the work I will be doing during and after the summer of code period.

From June 3rd to June 7th

  • Compiled and ran BRL-CAD from source (in 26 minutes) as well as used mged command interface.
  • Studying /src/librt/primitives/*/*.
  • Revising red-black trees in "Introduction to algorithms",third edition book by Cormen.

From June 10th to June 14th

  • Fixing rb_delete.c to effectively delete nodes.

My Development Pictures

From June 17th to June 21

June 17

  • Finished working on rb_delete.c .

June 18

  • Edited raytrace.h by defining ID_HRT 43 ,incrementing ID_MAXIMUM and ID_MAX_SOLID to 44 as shown in this patch .
  • Added the DB5_MINORTYPE_BRLCAD_HRT 42 define to db5.h as shown here .

June 19

  • Hoped to do this today : Need to look at the "Metaball" paper on using the blobby method , read volume rendering by Drebin et al and edit magic.h and rtgeom.h to include the heart primitive .
  • However, took ill ( of malaria ) so undergoing treatment .

June 20

  • Ill of malaria so undergoing treatment .

June 21

  • Ill of malaria so undergoing treatment .
  • Uploaded some patches here.

June 22

  • Recovering from brief illness....
  • Updated GSoC 2013 Accepted projects page on the wiki .

From June 24th to June 29th

June 24

  • Re-read the Patch submission guidelines in the HACKING file .
  • Read the research paper titled "Volumetric shape description using the blobby model" which was used to implement the metaball primitive ( by the second method). Since the above method is used with two sphere primitives to create a metaball , I am considering using this same method alongside two spheres ( for the heart lobes ) and an elliptical parabola - epa (for the lower portion of the heart ). Need to verify the correctness of this design approach on the mailing list.

June 25

  • Studying the ray tracing geometry header ( rtgeom.h ) to write the heart primitive's internal representation (struct rt_hrt_internal) .
  • Searching for more information on the key properties of the heart .
  • Editing the magic numbers header ( magic.h ) which I have patched here .
  • Currently writing the struct rt_hrt_internal structure which I have kept here .Also wrote the RT_HRT_CK_MAGIC(_p) macro in rtgeom.h for the heart .


June 26

  • Finished Modifying the magic header file here which I earlier on submitted .
  • Looking into the internal representations of the tor and the superell .
  • Reading the rt_???_shot() functions in src/librt/primitives/tor/tor.c and src/librt/primitives/superell/superell.c to understand how they build up and evaluate formulae.
  • Included the internal representation of the heart in the include/rtgeom.h file used by the ray trace geometry library .That is, added the ID_HRT section ( struct rt_hrt_internal ). Please, take a look :)
  • Editing the table.c file in src/librt/primitives .Declared a raytrace interface for the heart by RT_DECLARE_INTERFACE(hrt) . Edited the rt_functab[] array by providing an entry ID_HRT for the heart primitive. That is, add RT_FUNCTAB_MAGIC, "ID_HRT", "hrt",rt_hrt_*, just to name a few. You are welcome to look at my progress.

June 27

  • Early in the morning I Left Buea, my home town to collect Google's welcome package in Douala. Collected some cash from the available ATM . Negotiating for Internet access and cool coding environment.Really tired.

June 28

  • Corrected and submitted the db5 header ( See db5.patch ) based on guidelines given by mentors.
  • Corrected and submitted the magic header ( See newest_magic.patch ) based on guidelines given by mentors. Still to correct the magic.c file to make these changes complete.

June 29

  • Editing the magic.c file to accommodate the heart primitive. Uploaded the patch here.
  • Reworking the ray trace geometry header file (rtgeom.h) so that the internal representation of the heart will be accurate.

From July 1st to July 6th

July 1

  • Working on struct rt_hrt_internal inorder to include the heart primitive into the include/rtgeom.h header. Reading wikipedia and Wolfram pages on heart symbol,Level set,cusps and epicycloids.
  • Combined magic_h.patch and magic_c.patch into single magic.tar.gz compressed file .
  • Combined db5_h.patch and db5_types_c.patch into single db5.tar.gz compressed file.

July 2

  • Still awaiting clarifications which I requested on the mailing list to develope the internal representation of the heart primitive in include/rtgeom.h.
  • Corrected the hrt_magic.patch file based on recommendations given by my mentor.
  • Corrected the hrt_db5.patch file based on recommendations given by my mentor.
  • Awaiting some answers to questions posted on the mailing list in order to proceed with the editing of rtgeom.h and raytrace.h

July 3

  • Getting requisite authorization to connect Workspace at the Faculty of Science building to the Internet. Not easy dealing with a bureaucratic system in which every administrative decision has to be documented in letters.
  • Downloaded subversion packages and source code to install. Need this to submit patches that apply cleanly.
  • The above activities took the whole day. Could not do coding work.

July 4

  • Doing negotiations to get Internet access. This is a prerequisite to submitting perfect patches which are generated from the svn checkout.
  • Pushing through with authorization for Internet access at my workspace .
  • Presented the "Implementation of the heart primitive" proposal and progress reports to lectures and students of the Departments of Computer Science and computer Engineering.
  • Did no coding work today as I was preparing a good environment for coding.

June 5

  • Did detailed mind maps to aid visualization of necessary editing of files to aid submission of logical patches. This will help see exactly how to group file changes like magic numbers , mirror support, mged support, etc.
  • Got equipment ready for installations of Internet but could not install today due to rainy weather. Hoping to get a sunny window tomorrow morning for installation.

July 6

  • Awaiting the arrival of Head of Department from Bamenda. Discussed with him the need for authorization to install Internet at the laboratory by phone. He said we need to officially discuss it during office hours on Monday,July 8.
  • Doing research on how to solve the sextic equation of the heart. Read some papers and observed that the sextic equation of the heart does not meet the conditions presented in the literature.

From July 8th to July 14th

July 8

  • Yoopee:) My Head of Department discusses the need for GSoC students to temporarily install Internet at the laboratory with the Dean of the Faculty of Science.The Dean seconds the idea and writes to the Vice-Chancellor for final authorization. Waiting for the final authorization from the Vice-Chancellor within the week.This is the letter I wrote to the Deputy Vice Chancellor .The Head of Department's letter through the Dean to the Vice-Chancellor can be viewed here.
  • Modified the internal representation of the heart (struct rt_hrt_internal).
  • Including an entry into the rt_functab[] array for the heart.
  • Plan to generate the patches from the work done immediately Internet access is available.

July 9

  • Correcting my M.Sc. thesis in order to submit to supervisor until 13:00 UTC.
  • Finished working on the internal parameters of the heart solid in include/rtgeom.h .It now includes a center point, unit vectors in x,y and z directions and distance from center point to both upper and lower cusps.
  • Added mk_hrt() routine and associated comments to the include/wdb.h header file and src/libwdb/wdb.c file.
  • Added p_hrt[] array and hrt_in() routine to src/libged/typein.c so as to read heart parameters from the keyboard.
  • Waiting for final authorization for temporal installation of Internet access to generate patches which I worked on using svn.My Head of Department says the Dean still awaits response from the Vice-Chancellor's office.
  • Intend to test these edits tomorrow. Couldn't do these today because the Faculty building was very noisy today due to a staff meeting.

June 10

  • Had a two-hour entretien today with my supervisor and head of Department until 10:00 UTC.
  • Created a hrt_magic patch file ( generated from diff -u for now ),the patch applied cleanly and BRL-CAD source compiled.
  • Created a hrt_stub patch file ( also generated from diff -u for now ), patch applied cleanly and BRL-CAD source compiled.Realised that an empty heart primitive has NULL fields in its rt_functab[] array entry.
  • Still Awaiting response to letter of authorization from the Vice-Chancellor :(
  • For tomorrow's work, I intend to create a heart object which can be tested in the mged interface.

June 11

  • Debugged and compiled the int mk_hrt(struct rt_wdb *wdbp, const char *name, const fastf_t *center, const fastf_t *xdir, const fastf_t *ydir, const fastf_t *zdir, const fastf_t d) routine which was previously added to src/libwdb/wdb.c file.
  • Debugged and compliled the p_hrt[] array and the hrt_in(struct ged *gedp, char *cmd_argv[], struct rt_db_internal *intern) function which was previously added to src/libged/typein.c .
  • Tested the compiled code by reading in the coordinates of a heart object using the keyboard on the mged interface as shown here . Feeling great!:)
  • Still awaiting response from the Vice-Chancellor.
  • Intend to finish any hacks of the mged interface and get into the difficult functions like rt_hrt_shot, rt_hrt_prep , etc.

June 12

  • Added case HRT to the solbld function in src/conv/asc/asc2g.c which parses the heart record and determines which libwdb routine to call in order to replicate it. Debugging asc2g.c.....

June 13

  • Started writing rt_hrt_shot() function for src/librt/primitives/hrt/hrt.c

Monthly Summary

Work done

1. Added magic numbers:

  • Defined RT_HRT_INTERNAL_MAGIC Ox6872743f in include/magic.h
  • Included a case RT_HRT_INTERNAL_MAGIC in src/libbu/magic.c
  • I ended up with hrt_magic.patch.

2. Stubbed in an empty heart primitive

  • Defined DB5_MINORTYPE_BRLCAD_HRT in include/db5.h.
  • Incremented ID_MAX_SOLID and ID_MAXIMUM to 44 as well as defined ID_HRT as 43.
  • Added { DB5_MAJORTYPE_BRLCAD, DB5_MINORTYPE_BRLCAD_HRT, 1, "hrt", "Heart" } as entry for the heart primitive in src/librt/db5_types.c.
  • Added struct rt_hrt_internal{} to internally represent the heart and wrote the RT_HRT_CK_MAGIC(_p) macro .
  • Declared RT_DECLARE_INTERFACE(hrt) and edited rtfunctab[] to include an entry for the heart in src/librt/primitives/table.c .This entry had many NULL fields.
  • With this, I generated hrt_stub.patch.

3. Added type in support for the heart (so as to read heart parameters from the keyboard.)

  • Added mk_hrt() routine and associated comments to include/wdb.h and src/libwdb/wdb.c .
  • Added p_hrt[] array and hrt_in() routine to src/libged/typein.c
  • This gave birth to hrt_type.patch, which was compiled, debugged and tested in the mged interface (See July 11 on my Development log).

Future work

  • Start coding and testing the Intersection of a heart with a ray by writing int rt_hrt_shot(), void rt_hrt_norm, void rt_hrt_uv, etc

From July 15th to July 20th

July 15

  • Studying how the quartic equation of the torus is built until the roots of this quartic equation is found by the root finder.
  • Working on int rt_hrt_shot() function whereby a ray intersects with the heart.This yield a sextic polynomial in t with 7 coefficients each with an average of 70 algebraic terms. The coefficient of t^6 has been computed while the coefficient of t^5 is being computed.

July 16

  • Working on the t^5 and t^4 coefficients of the sextic equation in the int rt_hrt_shot() function whereby a ray intersects with the heart.

July 17

  • Finished working on the coefficients of the sextic equation... Pretty tedious.
  • Discussed today with my former mathematics professor who pointed me to the Rouche's theorem to locate complex roots of a polynomial . Researching on this Theorem to locate roots and solve sextic equation.

July 18

  • Following up the letter written to the Vice-Chancellor at the Central Administration. No coding work done today.

July 19

  • Finished writing the rt_hrt_shot() function which has to be debugged and tested.

July 20

  • Had a headache today. Did no coding work. Just did some planning and light observation of toroid and superell primitives in src/librt/primitives/.

From July 22th to July 27th

July 22

  • Wrote the rt_hrt_parse[] array based on the internal properties of the heart.
  • Corrected the hrt_specific structure.
  • Wrote the rt_hrt_prep() function to prepare the heart object for ray shoting.
  • Making sure that my patches compile, although not yet generated from svn diff -u .

July 23

  • Fixed my S.L. 6.2 system today after a crash.
  • Helped install Internet at the laboratory.
  • Discussed on IRC with brlcad on setting up a bzflag account. Accepted the usage policy and rules. Got this account set up.
  • Discussed with brlcad and Erik on IRC about correcting my communication (posting) style. Read the more academic wikipedia page and Erik's recommended link in order to correct this.
  • Checking my patches from A to Z.

July 24

  • Generated and tested the hrt_magic.patch that it applies cleanly, independently and without any side effects.
  • Generated and tested the hrt_stub.patch that it applies cleanly, independently and without any side effects.

July 25

July 26

July 27

Pre-midterm evaluation summary

In order to prepare the BRL-CAD source code for the heart primitive , I hooked the heart primitive into the BRL-CAD source by adding a magic number for the heart in include/magic.h and src/libbu/magic.c, stubbing an empty heart in include/db5.h, include/rtgeom.h, include/raytrace.h, src/librt/db5_types.c and /src/librt/primitives/table.c and adding typing support for the heart in the mged interface in include/wdb.h, src/libwdb/wdb.c and src/libged/typein.c as can be seen here. As regards the ray tracing callback functions in src/librt/primitives/hrt/hrt.c , I have built the hrt_specific structure, written the rt_hrt_shot() and rt_hrt_prep() functions and I am currently testing these.I intend to continue working on other callback functions like rt_hrt_import(), rt_hrt_print(), etc and finally hook the heart primitive to the mged and archer interfaces with associated clean up and documentation.