Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Implementation Of A Heart Shaped Primitive

Isaac Kamga
September 28, 2015

Implementation Of A Heart Shaped Primitive

During My M.Sc. Thesis Defense, I presented the work I implementing a heart-shaped primitive in the United States Army Research Laboratory's BRL-CAD Software package.

Isaac Kamga

September 28, 2015
Tweet

More Decks by Isaac Kamga

Other Decks in Research

Transcript

  1. Implementation Of A Heart-Shaped Primitive Isaac Kamga Mkounga University of

    Buea SC09B676 September 28 2015 Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 1 / 36
  2. Overview of Presentation 1 Introduction 2 Literature Review Of Geometric

    Modeling Overview Wireframe Modeling Surface Modeling Solid Modeling Non-manifold Modeling 3 Analysis & Design 4 Results & Discussion Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 2 / 36
  3. What is a Primitive? A primitive is a basic shape

    in three-dimensional Euclidean space used for geometric modeling. Examples include a sphere, an ellipse, a box and in this case a heart-shape. BRL-CAD is an abbreviation for Ballistic Research Laboratory Computer Aided Design. It is a software package used for geometric modeling and developed primarily for the United States Army. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 3 / 36
  4. Objective of This Work This work was aimed at designing,

    developing and testing a heart-shaped primitive within the BRL-CAD package. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 4 / 36
  5. Wireframe modeling Wireframes are used for sketching and previewing complex

    objects during the modeling process. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 5 / 36
  6. Implicit Representation A surface in three-dimensional space can be represented

    as a set of points satisfying an irreducible polynomial equation g(x,y,z) = 0. An irreducible polynomial f(x,y,z) over a field F is a polynomial with a positive degree which has only two factors c and cf(x,y,z), where c is in F. Surfaces represented by irreducible polynomial cannot be decomposed into separate surfaces, each represented by implicit equations. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 6 / 36
  7. Parametric Representation Some surfaces posses a parametric representation usually given

    by x = h1(u, v) y = h2(u, v) z = h3(u, v) (1) where hi are rational functions and, u and v are restricted to particular closed intervals in R. For example, the unit sphere given implicitly by x2 + y2 + z2 − 1 = 0 can be parameterized by the equation where t ∈ [0, 1]; x = (1 − s2 − t2) (1 + s2 + t2) y = 2s (1 + s2 + t2) z = 2t (1 + s2 + t2) (2) Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 7 / 36
  8. Implicitization & Parameterization Implicitization is the process of converting a

    parametric representation into an implicit representation. A polynomial basis usually the Gr¨ øbner basis is used to express an arbitrary polynomial in implicit form. Parameterization is the process of converting an implicit representation into a parametric representation, if it exists. According to Noether’s theorem, only implicit representations of genus zero possess a parametric equivalent. An implicit representation is said to have genus zero if it cannot be cut along non-intersecting closed curve without disconnecting the resultant manifold. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 8 / 36
  9. Boundary Representation A boundary representation describes a solid as a

    set of surfaces which separate an object’s interior from its exterior. Tree data structures such as winged edge, face edge, bridge edge and the Boundary Representation index ( B-rep index ) have been used for boundary representation of objects. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 9 / 36
  10. Contructive Solid Geometry Boolean operations viz union, intersection and difference

    are used to gradually build complex objects from primitives. A Contructive Solid Geometry (CSG) tree has primitives as leaves and its root as a desired complex object. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 10 / 36
  11. Spacial Subdivision An object is represented as a collection of

    minute cells in three-dimensional space. Tree data structures such as the quadtree, DF-expression and PMR quadtree were used to represent solids. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 11 / 36
  12. Non-manifold Modeling Non-manifold objects are objects which have points with

    neighbourhoods which are not homeomorphic to three-dimensional space. Non-manifold representations allows volume, manifold and non-manifold curves, surfaces and points in a single environment. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 12 / 36
  13. Analysis & Design To develop the heart-shaped primitive, we wrote

    a number of procedures (rt hrt xxx()) that implement geometrically useful properties such as; Type-in support Formatted description Database importation & exportation Bounding box Wireframe representation Surface representation & Raytracing Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 13 / 36
  14. Tagging the heart-shape Given that BRL-CAD models several primitives, the

    incoming heart-shaped primitive was tagged with a unique number, Ox6872743f, the hexadecimal equivalent of ”?hrt?” and increment the constant representing the total number of primitives in BRL-CAD. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 14 / 36
  15. Data structure of the heart-shape The heart-shape’s data structures or

    internal format consists of the following members; A magic number, hrt magic A center point, v A vector in the X-axis direction, v dir A vector in the Y-axis direction, y dir A vector in the Z-axis direction, z dir Distance from center to cusps, d Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 15 / 36
  16. Figure: Annotated Diagram of the heart-shaped primitive Isaac Kamga Mkounga

    (UB) CSC 698:Thesis Defense September 28 2015 16 / 36
  17. Type-in support for the heart-shape In order for designers to

    key in values for the above heart-shape parameters, we constructed a p hrt[] array, wrote a hrt in() function in src/libged/typein.c and mk hrt() to the include/wdb.h and src/libwdb/wdb.c Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 17 / 36
  18. Formatted Description of the heart-shape It often arises that designers

    would want to know the exact values of the objects being modelled. In order to know the heart-shapes type and the values of its key parameters, we wrote the rt hrt describe() function which simply prints the heart-shapes parameters in human readable format. The radial vectors viz xdir, ydir and zdir in the X, Y and Z directions respectively are printed alongside their magnitudes and the distance from the heart-shapes center to either of its cusps. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 18 / 36
  19. Database importation and Exportation In order to import a heart-shape

    from database format into internal format and vice-versa, we wrote the rt hrt import() and rt hrt export() functions respectively. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 19 / 36
  20. Bounding Box of the Heart-shape A box with the smallest

    volume within which the model lies the least upper bound of the set of all enclosing volumes. To compute the bounding box of any object, it suffices to find the X, Y and Z components of it’s minimal point and maximal points. We computed the X, Y and Z components of the minimal and maximal points of the heart-shape. The X component of Minimal point and Maximal point is v - (2 * xdir)/3 and v + (2 * xdir)/3 respectively. The Y component of Minimal point and Maximal point is v - ydir and v + ydir respectively. The Z component of Minimal point and Maximal point is v - zdir and v + (5 * xdir)/4 respectively. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 20 / 36
  21. The wireframe of the Heart-shape The wireframe of the heart-shape

    consists of several elliptical polygons aligned along the Z-axis each of which has 24 edges. The rt hrt 24pts() function draws an elliptical polygon made up of 24 points with an angle of 15 apart. The rt hrt plot() places elliptical polygons along the Z-axis from the lower cusp right through to the highest point of each lobe. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 21 / 36
  22. Surface Representation & Ray-tracing The heart-shape was raytraced by shooting

    millions of light rays towards the heart-shape’s surface and coloring the intersection points.Four functions were written viz rt hrt prep(),rt hrt norm(), rt hrt shot() and rt hrt print() functions. rt hrt prep() prepares the heart-shape for raytracing by making sure that all of its parameters are within appropriate limits. rt hrt print() prints the position vector of the heart-shapes center and the two (2) matrices for transposing, rotating and scaling just to make sure that are correct. rt hrt shot() finds the intersection points of the light rays and the heart-shape’s surface. rt hrt norm() computes the normal to the heart-shape’s surface at the intersection point. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 22 / 36
  23. A light ray For Raytracing purposes, an arbitrary light ray

    was modelled as a line in E3 as seen in Equation (1) below. x = at+x0 y = bt+y0 z = ct+z0 (1) Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 23 / 36
  24. The sextic equation of the Heart Equation (1) was substituted

    in the sextic equation (2) below; f (x, y, z) = (x2 + 9 4 y2 + z2 − 1) 3 − z3(x2 + 9 80 y2) (2) Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 24 / 36
  25. The Laguerre-based rootfinder This yielded a new sextic equation (3)

    in t shown below S(t) = C6t6 + C5t5 + C4t4 + C3t3 + C2t2 + C1t + C0 = 0 (3) where Ci,i = 0÷6 are the coefficients of equation (3). Equation (3) was solved by BRL-CAD’s Laguerre-based rootfinding function rt poly findroot(). Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 25 / 36
  26. Results & Discussions Inorder to test the different geometric properties

    of the heart-shape, we used BRL-CAD’s commands an object called amour centered at origin (0,0,0), with 3 radial vectors (5,0,0),(0,5,0),(0,0,5) and distance to cusps of 4. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 26 / 36
  27. Type-in support for amour Inorder to test type-in support and

    Database importation, we used BRL-CAD’s in to key in the type and parameters of the amour object. The amour text at the bottom of the figure signifies that it has been indeed stored in BRL-CAD’s GED database. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 27 / 36
  28. Formatted Description of amour Inorder to test the formatted description

    and Database exportation of amour, we used BRL-CAD’s l to do a terse and verbose listing of amour’s parameters by exporting it from BRL-CAD’s GED database. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 28 / 36
  29. Bounding Box of amour Inorder to test the bounding box

    of the amour object, we ran the bb command on amour. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 29 / 36
  30. Wireframe of amour Inorder to test the wireframe of the

    amour object, we ran the draw command on amour. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 30 / 36
  31. Surface representation & Raytracing of amour Inorder to ray-trace the

    amour object, we ran the rt command on amour. Isaac Kamga Mkounga (UB) CSC 698:Thesis Defense September 28 2015 33 / 36