User:Clouddrift/GSoC2014/Logs
Contents
Community Bounding Period
Get the commit access
Submit two patches for nmg part of BRL-CAD. URLs as following.
Read the relavant Codes
Read and be familiar with nmg-related codes in BRL-CAD.
Acquired knowledge
- Keep code style consistent is important for Open Source Community.
- Comments greatly helps others to understand the function of routines and structs. Codes should be changed before fully tracking the call order of routines and totally understanding the comments of them.
- That's a really good ideas to submit one or two patch to know the coding convention of the community. As a chinese saying goes, sharpening your axe will not delay your job of cutting wood.
Work Perod
Week 1
Monday, May 19
Read TODO, HACKING, COPYING and other files again. Be ready for formal coding job.
Tuesday, May 20
Find and read some pages about the details in using SVN and CMake.
Wednesday, May 21
Get the commit access for BRL-CAD successfully. What a day to celebrate! Now, I begin my work on a branch for NMG reorganization. Remove model and nmgregion struct, Then ready to fix all compilation errors.
Thursday, May 22
Rewrite nmg struct to fit BRL-CAD better. Remove model and nmgregion struct, Then change shell struct as following.
- remove member: l (bu_list);
- remove member: r_p (nmgregion pointer);
- add member: magic (uint32_t);
- add member: manifolds (char pointer);
- add member: maxindex (long);
Friday, May 23
Fix the rest compilation errors due to fit the new nmg structure.
Acquired knowledge
- Committing without breaking the build is always the best choice. Try to use comment to achieve this point and record such codes in TODO file for fixing later.
Week 2
Monday, May 26
Continue to cleanup the codes.
Tuesday, May 27
Until this afternoon, I finished most of the removing job. But I find some places cannot simply replaced the model/nmgregion with shell. e.g. the routine nmg_merge_shells used in nmg_booltree_evaluate(...) and nmg_boolean(...).
Wednesday, May 28
I discuss my concern with Daniel. He suggest me to use nmg_comb_internal to deal with such situation. And the whole job will be done if NMG part runs good after I do all replacement.
Thursday, May 29
I study carefully about the the function about nmg_comb_internal and related codes. e.g mk_lfcomb(), mk_addmember(), and so on.
Friday, May 30
Many places should be changed again because I missed the nmg_comb_internal. I review the codes in NMG parts one by one.
Week 3
Monday, June 2
Fix all compile errors in librt. There is no 'model' and 'nmgregion' existing in this lib basically.
Tuesday, June 3
Fix rest compile errors in libged and mged. Now mged can run but the result of facetize still remains wrong which will be fixed later.
Wednesday, June 4
Read the file 'Introduce to MGED' again, make clearer about the region usage in BRL-CAD.
Thursday, June 5
Consult Daniel about how to deal with the rt_comb_internal level of nmg operation. There are two sample for reference:
- src/libged/voxelize.c [mk_addmember]
- src/libged/comb.c [_ged_combadd2]
I study the codes but still confused about parts of them. I will take more time being back to understand it later.
Friday, June 6
Organize the declaration and implementation about nmg in librt. Then, Check the comments for nmg files. It must be invalid that most of them are located in *.c file, not in *.h file.
Saturday, June 7
I assign working shell from facetize_tree to working instance directly. Now the facetize routine can deal with single shell.I test rcc and sph, and it works good but still need improving.
Acquired knowledge
- Interface description should be located in *.h, while implementation documentation can live in *.c. As for this kind of question, libbu is a golden example.
Week 4
Monday, June 9
Check the functionality of rt_comb_export5/rt_comb_import5 in comb.c and rt_nmg_export5/rt_nmg_import5 in nmg.c,
- The rountines in nmg.c can deal with single shell, but not combination tree.
- The rountines in comb.c can deal with combination tree, but not nmg structure.
To fit new-nmg structure, I need combine these two functionality.
Tuesday, June 10
Spend some time to understand the export/import principal in BRL-CAD. In old nmg, the model::maxindex is used to count nmg element, e.g. face, edge, vertex. But in new nmg, to deal with the binary tree structure, I write a new routine 'nmg_tree_maxindex_count' to count the sum of all shells.
Wednesday, June 11
Daniel send a test report about facetize functionality. I repeat the process of the test, then see the same result. It seems ASCII (text) representation for nmg is a good way to test relevant routines.
Thursday, June 12
I try to change nmg import/export routines to fit new nmg structure. Make the following change.
- rt_db_internal::idb_ptr points to an instance of rt_comb_internal.
- rt_comb_internal::tree points to an binary tree by using tree.
- In each leaf node of the binary tree, tree::tr_op should be OP_NMG_TESS, tree::tr_d.td_s points to a shell.
- In each non-leaf node of the binary tree, tree::tr_op should be OP_UNION.
Friday, June 13
I devise another thought to make the change of nmg import/export. Write two adapter functions before nmg export/import, thus I needn't change existing codes in nmg.c, just add two function. But the model and nmgregion struct to be retained in rt_nmg_export5/rt_nmg_import5.
It seems a bad idea and be rejected.
Week 5
Monday, June 16
Rewrite nmg_clone_shell routine in nmg_copy.c to fit new nmg structure. Then correct the bugs in unit test for it.
Tuesday, June 17
Rewrite tea_nmg unit test to fit new nmg structure. But It's difficult to check the result since the reorganizaion for nmg export/import hasn't been finished.
Wednesday, June 18
change some tesselation routines for primitives to fit new nmg structure. revert export/import to be avaliable to single shell.
Thursday, June 19
I test the tesselation result of following test case in trunk version:
- hollowed a big sphere with a smaller sphere.
- two sphere in certain distance.
All result just has single nmgmodel and nmgregion tested by function 'nmg_pr_struct_counts'.
Discuss with Daniel and Sean about the reorganization strategy. I make sure the tesselation result is always single shell which seems simpler than expected.
Some research should be done to make sure ANYTHING actually does create - an nmg model with multiple nmgregion with one or more shells per nmgregion. - an nmg model with a single nmgregion with more than one shell.
Friday, June 20
I check the codes of tesselation for 43 primitives according to yesterday's discuss, each just create single region and single shell. The common style is just like:
- *r = nmg_mrsv(m);
- s = BU_LIST_FIRST(shell, &(*r)->s_hd);
Following routines need to be fixed at first:
- nmg_isect_eu_fu
- nmg_isect_fu_jra
- nmg_isect_two_face3p
- nmg_isect_two_generic_faces
- nmg_crackshells