SlideShare a Scribd company logo
Recap
                   Proposed System
                                A
                               L TEX
                           ConTEXt
 Laying out Data Structure Diagrams
            Implementation Example
                          References




Algorithm Animation in PDF Documents

   Manthosh Kumar T, Mukund M, Prakash E
                    Supervisor: R S Milton
                          Professor
                     Department of CSE


                         January 17, 2013


        Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                              Proposed System
                                           A
                                          L TEX
                                      ConTEXt
            Laying out Data Structure Diagrams
                       Implementation Example
                                     References


Table of contents
  1   Recap
  2   Proposed System
         Interface Diagram
         User Classification
         Interface
  3    A
      LTEX
         TikZ Sample Code
         animate.sty Sample Code
  4   ConTEXt
         Metapost Sample Code
         t-animation Sample Code
  5   Laying out Data Structure Diagrams
  6   Implementation Example
  7   References
                   Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                             Proposed System
                                          A
                                         L TEX
                                     ConTEXt
           Laying out Data Structure Diagrams
                      Implementation Example
                                    References


Abstract


     The objective is to incorporate animated diagrams in PDF
     documents for educational use.
     TEXto generate the PDF documents.
     Sequence of layers with capabilities to play, pause, resume and
     rewind.
     To animate algorithms for data structures.
     Automatic layout of diagrams for lists and trees and a module
     for animation in TEXwith LuaTEXand JavaScript.



                  Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                               Proposed System
                                            A
                                           L TEX
                                       ConTEXt
             Laying out Data Structure Diagrams
                        Implementation Example
                                      References


Literature Survey


  Diagrams
      Metapost
      Asymptote
      PGF/Tikz
  Animations
      Animate.sty
      t-animation module



                    Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                             Proposed System
                                          A
                                         L TEX     Interface Diagram
                                     ConTEXt       User Classification
           Laying out Data Structure Diagrams      Interface
                      Implementation Example
                                    References


Proposed System
  Develop an interface for animating data strcutures and algorithms
      TEX, TikZ/PGF, or
      MetaPost and Lua
                                             TEX

                   A
                LuaLTEX                                          ConTEXt



            animate.sty                               t-animation module
       Tikz/PGF or MetaPost                          Tikz/PGF or MetaPost

                           Figure: Interface organization
                  Manthosh, Mukund, Prakash        Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX   Interface Diagram
                                   ConTEXt     User Classification
         Laying out Data Structure Diagrams    Interface
                    Implementation Example
                                  References


Interface Diagram

       Creating animations using a high-level API (in TEX)


                          Higher level API (in Lua)


                         Low level API
          Wraps TEXcommands for animation, drawing
          into Lua functions for use in high level API

                         Figure: Layers in the Interface


                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                             Proposed System
                                          A
                                         L TEX   Interface Diagram
                                     ConTEXt     User Classification
           Laying out Data Structure Diagrams    Interface
                      Implementation Example
                                    References


User Classification
  Interface must follow sound human engineering, and make simple
  things easy and complex things possible


            End User                    uses high level API to create animations

   User
                                           uses low Level API to create algorithms
             Pro User                                       and
                                             package them into a high level API


                       Figure: End users and Expert users

                  Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                              Proposed System
                                           A
                                          L TEX   Interface Diagram
                                      ConTEXt     User Classification
            Laying out Data Structure Diagrams    Interface
                       Implementation Example
                                     References


Interface



  Wrapper Class
      The interface is a set of Lua functions
      Implement necessary new TEX commands
      Pro-user uses the interface to create a high-level API




                   Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                            Proposed System
                                         A
                                        L TEX
                                                TikZ Sample Code
                                    ConTEXt
                                                animate.sty Sample Code
          Laying out Data Structure Diagrams
                     Implementation Example
                                   References

      A
Using LTEX



     TikZ/PGF: drawing
     Easy to place the nodes in diagrams
     Provides a lot of functionalities for positioning and
     customization of diagrams.
                                                    A
     animate.sty package helps create animations in LTEX-
     frames




                 Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                             Proposed System
                                          A
                                         L TEX
                                                 TikZ Sample Code
                                     ConTEXt
                                                 animate.sty Sample Code
           Laying out Data Structure Diagrams
                      Implementation Example
                                    References


Tikz Sample Code

  newcommand{drawElement}[4]{
      draw (#2,0) node[draw,rectangle,color=#3,
                               minimum width=#4] {#1};
  }
  function beginPicture()
       tex.sprint([[noexpandbegin{tikzpicture}]])
  end
  function drawElement(val,pos,color,spacing)
       tex.sprint([[noexpanddrawElement{]],val,"
                                 }{",pos,"}{",color,"}{",spacing,"};")
  end
  function endPicture()
       tex.sprint([[noexpandend{tikzpicture}]])
  end         Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX
                                               TikZ Sample Code
                                   ConTEXt
                                               animate.sty Sample Code
         Laying out Data Structure Diagrams
                    Implementation Example
                                  References


Sample Code - Explained




     beginPicture() wraps the begin Picture TEXcommand
     drawElement() takes necessary arguments and draws array
     element
     endPicture() wraps the end Picture TEXcommand




                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX
                                               TikZ Sample Code
                                   ConTEXt
                                               animate.sty Sample Code
         Laying out Data Structure Diagrams
                    Implementation Example
                                  References


animate.sty Sample Code

  function beginAnimation()
      tex.sprint([[noexpandbegin{animateinline}[controls,wid
  end

  function newFrame()
      tex.sprint([[noexpandnewframe]])
  end

  function endAnimation()
      tex.sprint([[noexpandend{animateinline}]])
  end

                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX
                                               TikZ Sample Code
                                   ConTEXt
                                               animate.sty Sample Code
         Laying out Data Structure Diagrams
                    Implementation Example
                                  References


Sample Code - Explained




     beginAnimation() wraps the TEX code for animation
     newFrame() creates a new frame
     endAnimation() ends the animation




                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX
                                               Metapost Sample Code
                                   ConTEXt
                                               t-animation Sample Code
         Laying out Data Structure Diagrams
                    Implementation Example
                                  References


Using ConTEXt



     Metapost: mainline syntax and hence can be programmed
     easily
     ConTEXt can use it directly with PDF
     With t-animation module easy to use interface for creating
     animations




                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX
                                               Metapost Sample Code
                                   ConTEXt
                                               t-animation Sample Code
         Laying out Data Structure Diagrams
                    Implementation Example
                                  References


Metapost Sample Code

  defdrawElement[#1][#2]{
    draw unitsquare scaled 1cm with color #2;
    dotlabel.bot(#1, origin);
  }
  function beginPicture()
    tex.sprint([[noexpandstartMPcode]])
  end
  function drawElement(val,pos,color,spacing)
    tex.sprint([[noexpanddrawElement{]],val,"}{",color,"};")
  end
  function endPicture()
    tex.sprint([[noexpandstopMPcode]])
  end
                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX
                                               Metapost Sample Code
                                   ConTEXt
                                               t-animation Sample Code
         Laying out Data Structure Diagrams
                    Implementation Example
                                  References


Sample Code - Explained



     beginPicture() wraps the startMPcode conTEXt
     command
     drawElement() takes necessary arguments and draws array
     element
     endPicture() wraps the stopMPcode conTEXt command




                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX
                                               Metapost Sample Code
                                   ConTEXt
                                               t-animation Sample Code
         Laying out Data Structure Diagrams
                    Implementation Example
                                  References


t-animation Sample Code

  function beginAnimation()
      tex.sprint([[noexpand{startanimation[menu=yes]]])
  end

  function newFrame()
      tex.sprint([[noexpandframe]])
  end

  function endAnimation()
      tex.sprint([[noexpandstopanimation}]])
  end

                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                           Proposed System
                                        A
                                       L TEX
                                               Metapost Sample Code
                                   ConTEXt
                                               t-animation Sample Code
         Laying out Data Structure Diagrams
                    Implementation Example
                                  References


Sample Code Explained



     startanimation[menu=yes] analogous to
     begin{animateinline} in animate.sty package.
     frame analogous to begin{newframe in animate.sty
     package.
     stopanimation analogous to end{animateinline} in
     animate.sty package.




                Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                            Proposed System
                                         A
                                        L TEX
                                    ConTEXt
          Laying out Data Structure Diagrams
                     Implementation Example
                                   References


Laying out Data Structure Diagrams




     Higher level API implemented using the Interface
     Algorithms for an illustrative set of data structures




                 Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                              Proposed System
                                           A
                                          L TEX
                                      ConTEXt
            Laying out Data Structure Diagrams
                       Implementation Example
                                     References


Linear Array Search

  Function call :
  linearArraySearch{21,42,24,76,46,81,69,72,83,93,14,97}{69}

  Element to be Found : 69
  Linear Search Animation :

    21 42 24 76 46 81 69 72 83 93 14 97
        0   1      2       3        4       5     6      7       8      9      10        11
  j=0




                   Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents
Recap
                                  Proposed System
                                               A
                                              L TEX
                                          ConTEXt
                Laying out Data Structure Diagrams
                           Implementation Example
                                         References


0s and 1s Separation



  Function call : digitSep{0,1,0,1,0,0,0,1,1,1,1,1}

    0 1 0 1 0 0 0 1 1 1 1 1
        0   1    2     3     4     5     6     7      8    9    10    11
  j=0




                       Manthosh, Mukund, Prakash          Algorithm Animation in PDF Documents
Recap
                       Proposed System
                                    A
                                   L TEX
                               ConTEXt
     Laying out Data Structure Diagrams
                Implementation Example
                              References


Alexander Grahn. The animate Package.
http://www.ctan.org/tex-archive/macros/latex/
contrib/animate/
Jannis Pohlmann. Configurable Graph Drawing Algorithms for
the TikZ Graphics Description Language. IInstitute for
Theoretical computer science, University of lbeck
Konstantin Skodinis. Construction of linear tree-layouts which
are optimal with respect to vertex separation in linear time.
Journal of Algorithms, Volume 47, Issue 1, April 2003
John D. Hobby. Drawing Graphs with MetaPost. AT&T Bell
Laboratories, 1992.
ConTEXt Wiki
http://wiki.contextgarden.net
            Manthosh, Mukund, Prakash      Algorithm Animation in PDF Documents

More Related Content

PDF
SCALING THE HTM SPATIAL POOLER
PPT
HPPS - Final - 06/14/2007
PDF
Wireless Communication Network Communication
PDF
Tensor flow white paper
PDF
A simulation model of ieee 802.15.4 in om ne t++
PPTX
CloudMC: A cloud computing map-reduce implementation for radiotherapy. RUBEN ...
PPTX
Microsoft HPC User Group
PDF
Artificial Neural Network Implementation on FPGA – a Modular Approach
SCALING THE HTM SPATIAL POOLER
HPPS - Final - 06/14/2007
Wireless Communication Network Communication
Tensor flow white paper
A simulation model of ieee 802.15.4 in om ne t++
CloudMC: A cloud computing map-reduce implementation for radiotherapy. RUBEN ...
Microsoft HPC User Group
Artificial Neural Network Implementation on FPGA – a Modular Approach

What's hot (20)

PDF
Implementation of Feed Forward Neural Network for Classification by Education...
PDF
Calibration of Deployment Simulation Models - A Multi-Paradigm Modelling Appr...
PDF
Ak04605259264
PPT
UIC Panella Thesis
PDF
SoC-2012-pres-2
PDF
Accelerating Real Time Applications on Heterogeneous Platforms
PDF
Pretzel: optimized Machine Learning framework for low-latency and high throu...
PDF
NETWORK-AWARE DATA PREFETCHING OPTIMIZATION OF COMPUTATIONS IN A HETEROGENEOU...
DOC
Xs path navigation on xml schemas made easy
PDF
Et25897899
DOCX
11 construction productivity and cost estimation using artificial
PDF
International Journal of Engineering Research and Development (IJERD)
DOC
EEL4851writeup.doc
PDF
Hidden Layer Leraning Vector Quantizatio
PDF
Fundamental, An Introduction to Neural Networks
PPTX
20111115 e trice eclipse demo camp munich
PDF
Digital Implementation of Artificial Neural Network for Function Approximatio...
PDF
Fpga based artificial neural network
PDF
DSP IEEE paper
PDF
Neural Architecture Search: Learning How to Learn
Implementation of Feed Forward Neural Network for Classification by Education...
Calibration of Deployment Simulation Models - A Multi-Paradigm Modelling Appr...
Ak04605259264
UIC Panella Thesis
SoC-2012-pres-2
Accelerating Real Time Applications on Heterogeneous Platforms
Pretzel: optimized Machine Learning framework for low-latency and high throu...
NETWORK-AWARE DATA PREFETCHING OPTIMIZATION OF COMPUTATIONS IN A HETEROGENEOU...
Xs path navigation on xml schemas made easy
Et25897899
11 construction productivity and cost estimation using artificial
International Journal of Engineering Research and Development (IJERD)
EEL4851writeup.doc
Hidden Layer Leraning Vector Quantizatio
Fundamental, An Introduction to Neural Networks
20111115 e trice eclipse demo camp munich
Digital Implementation of Artificial Neural Network for Function Approximatio...
Fpga based artificial neural network
DSP IEEE paper
Neural Architecture Search: Learning How to Learn
Ad

Similar to Animations On PDF Using Lua and LaTeX (20)

PDF
Planning-Based Approach for Automating Sequence Diagram Generation
PPTX
An Automatic Approach to Translate Use Cases to Sequence Diagrams
PPTX
Introduction to UML
PPT
CS 354 Interaction
PDF
Devnology Back to School: Empirical Evidence on Modeling in Software Development
PDF
Bab 11 component diagram 2010
PPTX
PDF
212101 Object Oriented Analysis Design Through Uml
PDF
212101 Object Oriented Analysis Design Through Uml
PPTX
SAD11 - Sequence Diagrams
DOCX
Algorithms and Data Structures~hmftj
KEY
DelveNYC: Flash Catalyst
PPTX
SE - Lecture 6 - Software Design n Construction.pptx
PPTX
Data Structures_Introduction to algorithms.pptx
PDF
Fdp kavita pandey_automata
PPT
Uml sequence diagrams
PPTX
Object oriented methodology & unified modeling language
KEY
ARTDM 170, Week 14: Introduction to Processing
PDF
Unified Modeling Language
Planning-Based Approach for Automating Sequence Diagram Generation
An Automatic Approach to Translate Use Cases to Sequence Diagrams
Introduction to UML
CS 354 Interaction
Devnology Back to School: Empirical Evidence on Modeling in Software Development
Bab 11 component diagram 2010
212101 Object Oriented Analysis Design Through Uml
212101 Object Oriented Analysis Design Through Uml
SAD11 - Sequence Diagrams
Algorithms and Data Structures~hmftj
DelveNYC: Flash Catalyst
SE - Lecture 6 - Software Design n Construction.pptx
Data Structures_Introduction to algorithms.pptx
Fdp kavita pandey_automata
Uml sequence diagrams
Object oriented methodology & unified modeling language
ARTDM 170, Week 14: Introduction to Processing
Unified Modeling Language
Ad

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Empathic Computing: Creating Shared Understanding
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Teaching material agriculture food technology
Advanced methodologies resolving dimensionality complications for autism neur...
20250228 LYD VKU AI Blended-Learning.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
Spectral efficient network and resource selection model in 5G networks
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Assigned Numbers - 2025 - Bluetooth® Document
“AI and Expert System Decision Support & Business Intelligence Systems”
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Diabetes mellitus diagnosis method based random forest with bat algorithm
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Empathic Computing: Creating Shared Understanding
MYSQL Presentation for SQL database connectivity
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
sap open course for s4hana steps from ECC to s4
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

Animations On PDF Using Lua and LaTeX

  • 1. Recap Proposed System A L TEX ConTEXt Laying out Data Structure Diagrams Implementation Example References Algorithm Animation in PDF Documents Manthosh Kumar T, Mukund M, Prakash E Supervisor: R S Milton Professor Department of CSE January 17, 2013 Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 2. Recap Proposed System A L TEX ConTEXt Laying out Data Structure Diagrams Implementation Example References Table of contents 1 Recap 2 Proposed System Interface Diagram User Classification Interface 3 A LTEX TikZ Sample Code animate.sty Sample Code 4 ConTEXt Metapost Sample Code t-animation Sample Code 5 Laying out Data Structure Diagrams 6 Implementation Example 7 References Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 3. Recap Proposed System A L TEX ConTEXt Laying out Data Structure Diagrams Implementation Example References Abstract The objective is to incorporate animated diagrams in PDF documents for educational use. TEXto generate the PDF documents. Sequence of layers with capabilities to play, pause, resume and rewind. To animate algorithms for data structures. Automatic layout of diagrams for lists and trees and a module for animation in TEXwith LuaTEXand JavaScript. Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 4. Recap Proposed System A L TEX ConTEXt Laying out Data Structure Diagrams Implementation Example References Literature Survey Diagrams Metapost Asymptote PGF/Tikz Animations Animate.sty t-animation module Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 5. Recap Proposed System A L TEX Interface Diagram ConTEXt User Classification Laying out Data Structure Diagrams Interface Implementation Example References Proposed System Develop an interface for animating data strcutures and algorithms TEX, TikZ/PGF, or MetaPost and Lua TEX A LuaLTEX ConTEXt animate.sty t-animation module Tikz/PGF or MetaPost Tikz/PGF or MetaPost Figure: Interface organization Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 6. Recap Proposed System A L TEX Interface Diagram ConTEXt User Classification Laying out Data Structure Diagrams Interface Implementation Example References Interface Diagram Creating animations using a high-level API (in TEX) Higher level API (in Lua) Low level API Wraps TEXcommands for animation, drawing into Lua functions for use in high level API Figure: Layers in the Interface Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 7. Recap Proposed System A L TEX Interface Diagram ConTEXt User Classification Laying out Data Structure Diagrams Interface Implementation Example References User Classification Interface must follow sound human engineering, and make simple things easy and complex things possible End User uses high level API to create animations User uses low Level API to create algorithms Pro User and package them into a high level API Figure: End users and Expert users Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 8. Recap Proposed System A L TEX Interface Diagram ConTEXt User Classification Laying out Data Structure Diagrams Interface Implementation Example References Interface Wrapper Class The interface is a set of Lua functions Implement necessary new TEX commands Pro-user uses the interface to create a high-level API Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 9. Recap Proposed System A L TEX TikZ Sample Code ConTEXt animate.sty Sample Code Laying out Data Structure Diagrams Implementation Example References A Using LTEX TikZ/PGF: drawing Easy to place the nodes in diagrams Provides a lot of functionalities for positioning and customization of diagrams. A animate.sty package helps create animations in LTEX- frames Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 10. Recap Proposed System A L TEX TikZ Sample Code ConTEXt animate.sty Sample Code Laying out Data Structure Diagrams Implementation Example References Tikz Sample Code newcommand{drawElement}[4]{ draw (#2,0) node[draw,rectangle,color=#3, minimum width=#4] {#1}; } function beginPicture() tex.sprint([[noexpandbegin{tikzpicture}]]) end function drawElement(val,pos,color,spacing) tex.sprint([[noexpanddrawElement{]],val," }{",pos,"}{",color,"}{",spacing,"};") end function endPicture() tex.sprint([[noexpandend{tikzpicture}]]) end Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 11. Recap Proposed System A L TEX TikZ Sample Code ConTEXt animate.sty Sample Code Laying out Data Structure Diagrams Implementation Example References Sample Code - Explained beginPicture() wraps the begin Picture TEXcommand drawElement() takes necessary arguments and draws array element endPicture() wraps the end Picture TEXcommand Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 12. Recap Proposed System A L TEX TikZ Sample Code ConTEXt animate.sty Sample Code Laying out Data Structure Diagrams Implementation Example References animate.sty Sample Code function beginAnimation() tex.sprint([[noexpandbegin{animateinline}[controls,wid end function newFrame() tex.sprint([[noexpandnewframe]]) end function endAnimation() tex.sprint([[noexpandend{animateinline}]]) end Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 13. Recap Proposed System A L TEX TikZ Sample Code ConTEXt animate.sty Sample Code Laying out Data Structure Diagrams Implementation Example References Sample Code - Explained beginAnimation() wraps the TEX code for animation newFrame() creates a new frame endAnimation() ends the animation Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 14. Recap Proposed System A L TEX Metapost Sample Code ConTEXt t-animation Sample Code Laying out Data Structure Diagrams Implementation Example References Using ConTEXt Metapost: mainline syntax and hence can be programmed easily ConTEXt can use it directly with PDF With t-animation module easy to use interface for creating animations Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 15. Recap Proposed System A L TEX Metapost Sample Code ConTEXt t-animation Sample Code Laying out Data Structure Diagrams Implementation Example References Metapost Sample Code defdrawElement[#1][#2]{ draw unitsquare scaled 1cm with color #2; dotlabel.bot(#1, origin); } function beginPicture() tex.sprint([[noexpandstartMPcode]]) end function drawElement(val,pos,color,spacing) tex.sprint([[noexpanddrawElement{]],val,"}{",color,"};") end function endPicture() tex.sprint([[noexpandstopMPcode]]) end Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 16. Recap Proposed System A L TEX Metapost Sample Code ConTEXt t-animation Sample Code Laying out Data Structure Diagrams Implementation Example References Sample Code - Explained beginPicture() wraps the startMPcode conTEXt command drawElement() takes necessary arguments and draws array element endPicture() wraps the stopMPcode conTEXt command Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 17. Recap Proposed System A L TEX Metapost Sample Code ConTEXt t-animation Sample Code Laying out Data Structure Diagrams Implementation Example References t-animation Sample Code function beginAnimation() tex.sprint([[noexpand{startanimation[menu=yes]]]) end function newFrame() tex.sprint([[noexpandframe]]) end function endAnimation() tex.sprint([[noexpandstopanimation}]]) end Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 18. Recap Proposed System A L TEX Metapost Sample Code ConTEXt t-animation Sample Code Laying out Data Structure Diagrams Implementation Example References Sample Code Explained startanimation[menu=yes] analogous to begin{animateinline} in animate.sty package. frame analogous to begin{newframe in animate.sty package. stopanimation analogous to end{animateinline} in animate.sty package. Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 19. Recap Proposed System A L TEX ConTEXt Laying out Data Structure Diagrams Implementation Example References Laying out Data Structure Diagrams Higher level API implemented using the Interface Algorithms for an illustrative set of data structures Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 20. Recap Proposed System A L TEX ConTEXt Laying out Data Structure Diagrams Implementation Example References Linear Array Search Function call : linearArraySearch{21,42,24,76,46,81,69,72,83,93,14,97}{69} Element to be Found : 69 Linear Search Animation : 21 42 24 76 46 81 69 72 83 93 14 97 0 1 2 3 4 5 6 7 8 9 10 11 j=0 Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 21. Recap Proposed System A L TEX ConTEXt Laying out Data Structure Diagrams Implementation Example References 0s and 1s Separation Function call : digitSep{0,1,0,1,0,0,0,1,1,1,1,1} 0 1 0 1 0 0 0 1 1 1 1 1 0 1 2 3 4 5 6 7 8 9 10 11 j=0 Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents
  • 22. Recap Proposed System A L TEX ConTEXt Laying out Data Structure Diagrams Implementation Example References Alexander Grahn. The animate Package. http://www.ctan.org/tex-archive/macros/latex/ contrib/animate/ Jannis Pohlmann. Configurable Graph Drawing Algorithms for the TikZ Graphics Description Language. IInstitute for Theoretical computer science, University of lbeck Konstantin Skodinis. Construction of linear tree-layouts which are optimal with respect to vertex separation in linear time. Journal of Algorithms, Volume 47, Issue 1, April 2003 John D. Hobby. Drawing Graphs with MetaPost. AT&T Bell Laboratories, 1992. ConTEXt Wiki http://wiki.contextgarden.net Manthosh, Mukund, Prakash Algorithm Animation in PDF Documents