# Difference between revisions of "User:Izak"

IIIzzzaaakkk (talk | contribs) m (→LINKS TO CODE OR ALGORITHMS WHICH YOU INTEND TO USE) |
IIIzzzaaakkk (talk | contribs) m (→DELIVERABLES) |
||

Line 105: | Line 105: | ||

Pre mid term evaluation period | Pre mid term evaluation period | ||

− | * | + | * Ray intersection with heart. |

+ | * Geometric analysis and representation | ||

+ | * Compute heart metrics like surface area and volume of heart. | ||

* Testing of hrt.c. | * Testing of hrt.c. | ||

Post mid term evaluation period | Post mid term evaluation period | ||

− | * | + | * Combinations and regions using booolean operations. |

− | + | * Database interactions. | |

− | * | + | * Intersections with other primitives. |

− | * | + | * Integrating and documenting heart primitive into BRLCAD |

− | * Integrating and documenting heart primitive into BRLCAD | ||

==DEVELOPMENT SCHEDULE AND TIMELINE== | ==DEVELOPMENT SCHEDULE AND TIMELINE== |

## Revision as of 07:08, 3 May 2013

## Contents

# Project Proposal

## PERSONAL INFORMATION

Name: Isaac Kamga.

E-mail: u2isaac@gmail.com.

Internet Relay Chat Username: Izak.

Phone: +237 74 10 62 97.

Brief Background information.

I am a final year Master of Science in Computer Science student at the University of Buea , Cameroon , Africa holding a Bachelor of Science degree in Mathematics.I have worked on various data structuring, algorithmic and compiler-related individual and team projects in the University community which I really enjoyed. By June , I would have rounded up with my thesis and will be available for 40+ hours weekly to implement a heart surface primitive for BRLCAD software.

# PROJECT INFORMATION

PROJECT TITLE: Implementation of a heart primitive.

## PROJECT SUMMARY

We live in a three dimensional world and we frequently have to consider objects which have surfaces - whether these are terrains on planets ,the surface of a gadget, or organs in our internal worlds.In recent times, the need to visualize the surfaces of internal organs such as the heart , liver , brain ,just to name a few, has escalated due to the explosion in cases of heart disease and cancer. There is an imminent need for the BRLCAD software, which aspires to be the best computer assisted design software, to possess a heart primitive which can assist users like medical personnel model the heart and plan the effective treatment of cardiac disease.The implementation of a heart primitive also stands as a great opportunity to provide open source C code for the hacker community which can aid in the implementation of other similar geometries which are based on the sextic equations. I intend to implement a heart primitive for the BRLCAD software simply by writing a set of routines( callback functions).These routines will be stored in three (3) files namely hrt.c , hrt_brep.cpp and hrt_mirror.c as is the naming convention of the BRLCAD software primitives. The hrt.c file will contain routines ( functions ) that execute ray intersection with a heart,a geometric analysis of the heart ,a geometric representation of the heart and constructive solid geometry (C.S.G.) modelling . The hrt_brep.cpp is a piece of source code written in the C++language which executes a boundary representation of a heart. Finally , hrt_mirror.c will provide mirror support for the heart primitive against a particular plane .

## PROJECT DESCRIPTION

In this section of this proposal, I give a detailed description of how I am going to implement the heart primitive. In order to implement a heart primitive for the BRLCAD software, we have to write a set of routines.These routines will be stored in three (3) files namely hrt.c , hrt_brep.cpp and hrt_mirror.c.The hrt.c file will contain routines ( functions ) that help a ray intersect with a heart as well as the combination of regions using boolean operations which assist BRLCAD users in constructive solid geometry (C.S.G.) modelling. The hrt_brep.cpp is a boundary representation of a heart which combines three (3) elliptical paraboloids.Finally , hrt_mirror.c provides mirror support for the heart primitive.

hrt.c

Here, we implement ray intersection , geometric analysis , geometric representation and combine several elliptical paraboloids to form a heart. This hrt.c file is the heart of the heart primitive. We include common.h for portability , system headers like stdio.h, math.h and stddef.h, db.h for database interactions, raytrace.h and rtgeom.h . The heart has vertices V,E1,E2,E3,E4 and E5. We intend to intersect a ray with a heart by solving the sextic equation of the heart given by the formula

(X^2 + 9/4*Y^2 + Z^2 - 1 )^3 - X^2*Z^3 - 9/200 * Y^2 * Z^3 = 0.

where a^b means a raised to the power b. We create bounding box for the heart. We transform the points on the heart to points on a heart centered at the origin, with a height along the the positive Z axis and a vertex V. We find the point of intersection W of a line with the surface of a heart and the vector normal to the tangent plane at the point of intersection. We write routines to interact with the values of the heart in the database.For example, routine to free the database storage of he heart, change database formats and export the heart from the database. We then write routines to compute the volume, surface area and centroid of the heart. Routines to print the heart , get curve points, plot the heart and write a tesselation. We write routines to return the normal, entry and exit points of a ray .

hrt_brep.cpp

A heart is similar to an epa or seen as an intersection of three elliptic paraboloids (epa). We include some headers like raytrace.h, rtgeom.h and brep.h to support ray tracing , geometry and boundary representation. The first is viewed as a canonical paraboloid with a vertex V with coordinates in the negative Z axis opening towards the positive Z axis.Later, a plane is constructed which cuts through the upward facing paraboloid and forms a flat elliptical face.The points where plane intersects with the parabola are noted as E1 and E2.The midpoint of the line E1,E2 called E3 is located on the Z-axis. The midpoints of the line E1 to Z-axis is calculated and a point from this midpoint upwards in the positive Z direction such that the distance from E4 to plane L is |E1 - Z-axis| / 4. Do same to region between Z axis and E2 to get E5.Elliptic paraboloids opening at E4 and E5 opening in the negative Z direction.The epa opening at E4 passes through E1 and E3 while the other epa passes through E2 and E3. After, we create a nurbs surface passing through the points V,E1,E2,E3,E4 and E5 and get the nurbs form of the surface.

--hrt_mirror.c Based on a pointer to the GED database, this file's code mirrors the heart's values about the given trasformation matrix.We follow the following steps:

1.Perform a mirror down the X axis. 2.Create the rotation matrix and translation matrices and add them to the mirror matrix. 3. Mirror the points V and E1,E2,E3,E4 and E5.

### LINKS TO CODE OR ALGORITHMS WHICH YOU INTEND TO USE

Research papers

1.Taubin, G. "An Accurate Algorithm for Rasterizing Algebraic Curves." In Second ACM/IEEE Symposium on Solid Modeling and Applications Proceedings. 221-230, May 1993.

2.Nordstrand, T. "Heart." http://jalape.no/math/hearttxt.

3."A Generalization of Algebraic Surface drawing" by James F. Blinn.

4.Wolfram mathworld's sextic equation:http://mathworld.wolfram.com/HeartSurface.html

5.Solving sextic equations by division , Raghavendra G. Kulkarni.

6.Solving sextic equations by decomposition , Raghavendra G. Kulkarni.

Pictures

1.Three dimensional heart with sextic equation:

2.Two dimensional heart with sextic equation:

3.Three dimensional heart centered at origin according to Taubin,G:

Code patch

http://sourceforge.net/p/brlcad/patches/174/

## DELIVERABLES

Pre mid term evaluation period

- Ray intersection with heart.
- Geometric analysis and representation
- Compute heart metrics like surface area and volume of heart.
- Testing of hrt.c.

Post mid term evaluation period

- Combinations and regions using booolean operations.
- Database interactions.
- Intersections with other primitives.
- Integrating and documenting heart primitive into BRLCAD

## DEVELOPMENT SCHEDULE AND TIMELINE

May 27th : Community bonding period

(3 weeks)

--Study BRLCAD manuals,tutorials series and documentation concerning hacking.

--Compile BRL-CAD source code ,Study code base and remove bugs.

--Discuss with other developers and BRLCAD mentors to refine mailing-list etiquette.

--Study the src/librt/primitives/*/* and /include libraries.

--Acquaint myself with necessary software like svn.

June 17th to July 26th : Work period (Pre-mid term evaluation)

(2 weeks)

--Writing routines for hrt.c.

--Ray intersection with heart.

--Combinations and regions using boolean operations.

--Database interactions

(2 weeks)

--Geometric analysis and representation.

--Compute heart metrics like surface area and volume of heart.

(2 weeks)

--Testing and debugging of the hrt.c code.

--Submission of hrt.c to mentors for corrections.

June 29th to August 2nd : Mid-term evaluation

(1 week)

--Submission of hrt.c to Google.

Aug 5th to Sept 13th : Work period (Post mid-term evaluation)

(1 week)

--Writing routines for a heart boundary representation.

--Finding necessary cutting planes.

(1 week)

--Creating elliptical paraboloids.

--Creating nurbs surface.

--Getting nurbs form of the heart surface.

(1 week)

--Testing and debugging of hrt_brep.cpp.

--Submit hrt_brep.cpp code to mentors for appraisal.

(1 week)

--Writing mirror support for heart (hrt_mirror.c).

--Mirror along the x-axis.

(1 week)

--Create necessary transformation matrices.

--Add transformation matrices to mirror matrix.

--Mirror the heart vertices.

(1 week)

--Testing and debugging of hrt_mirror.c.

--Submit hrt_mirror.c to mentors for appraisal.

Sep 16th to Sep 27th: Testing and Documentation period

(1 week)

--Integrating heart primitive into BRLCAD.

--Final testing and debugging of src/librt/primitives/hrt/* code.

--Documenting heart primitive in BRL-CAD.

--Submit hrt_* code to Google.

(1 week)

--Final submission of hrt* code to Google.

## TIME AVAILABILITY.

I am at the last phase of my M.Sc. research and will be done with the thesis before June. I will have ample time to code fulltime for 40+ hours weekly till the end of the summer holidays.My thesis defense will take place after the summer holidays . Also, while awaiting defense and graduation in December 2013 after the summer , I will be available for some months to do any polishing and maintainance work given to me by BRLCAD mentors.

## WHY BRL-CAD?

First of all, I really believe that software can change the world by providing new technologies and that software should be free. I choose BRLCAD because it is a not-for-profit technology organization which offers me the opportunity to assist the United States Army Research Laboratory with tools which help them simulate and visualize their combat vehicle systems and war events. Working with BRLCAD also helps me contribute over the long-term and gain status within the hacker community based on my mathematical/Computing background and academic interests. Although I have not contributed before to opensource ,I see implementing a heart surface primitive as a long-awaited opportunity to provide more primitive options (adding a heart to the raytrace library which is the heart of BRLCAD) for the BRLCAD software and a jumpstart to my continued contribution to open source software through BRLCAD.This project will also help BRLCAD users to build three-dimensional models related to the heart and love - a virtue we really need in our world today.

## WHY YOU?

I am a final year M.Sc. student in Computer Science at the University of Buea (www.ubuea.net) , Cameroon , Africa and a holder of a B.Sc. in Mathematics & Computer Science. I am currently rounding up with my research thesis on business process compliance. I have a good background and intuition in Mathematics and algorithms as well as C/C++ programming. In the past , I worked on various data structuring and algorithmic individual and team projects in the University community which I really enjoyed. For example , I built mini-compilers flex/bison to reason about and infer the regulatory compliance in associated business process graphs . Also , I worked within a team to implement red black trees and variants like order statistics trees , interval trees and persistence trees (over 6000 lines of C code). I was enthused collaborating in teams with other bright thinkers . I was the best on some projects and mediocre on some others - but I really learnt the importance of communicating and working in teams with other smart individuals. I was born into an extended family of researchers in Research institutions and Universities under the Cameroonian government.This gave me the passion to become a researcher for not-for-profit organizations and contribute to the open source community. With this upbringing ,background and experience, I think I have the necessary skills to implement a heart surface primitive for the BRLCAD software. I am familiar with various open source software engineering tools like svn, gcc, gdb ,emacs ,etc and switched to Linux distributions ( using Red Hat and Ubuntu ) since 2010. Also, I am at the last phase of my research and will be done with the thesis before June. I will have ample time to code away the summer holidays . Lastly , I will make sure I communicate my progress , problems encountered and further work to my mentors in Weekly reports to fascilitate the supervision and management of the project. I will also discuss with mentors for other needed clarifications on IRC chat.

## ANYTHING ELSE?

I think it would be great for BRLCAD to select me for various reasons. Firstly , it will greatly encourage the programmers around my community and country to come up to hackerdom standard and contribute to open source projects. It will also attract and encourage a lot of young ones in my country and continent towards the computing field as a whole. Also, BRL-CAD will gain the reputation of encouraging equal opportunity and ethnic diversity by helping to groom more hackers from underrepresented minority backgrounds in computing like Africa.