<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="id3155852">
  <name>Implementation: Detecting a Hit</name>
  <metadata>
  <md:version>1.1</md:version>
  <md:created>2007/12/19 20:58:09.604 US/Central</md:created>
  <md:revised>2007/12/19 21:04:41.485 US/Central</md:revised>
  <md:authorlist>
      <md:author id="jchow">
      <md:firstname>Janice</md:firstname>
      
      <md:surname>Chow</md:surname>
      <md:email>jchow@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="jchow">
      <md:firstname>Janice</md:firstname>
      
      <md:surname>Chow</md:surname>
      <md:email>jchow@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>drum kit</md:keyword>
    <md:keyword>drums</md:keyword>
    <md:keyword>velocity</md:keyword>
    <md:keyword>virtual</md:keyword>
  </md:keywordlist>

  <md:abstract>This detects when and which drum the user has hit.</md:abstract>
</metadata>
  <content>
    <section id="id-76416364864">
      <name>Hitting the Drums: A Velocity Computational Approach</name>
      <para id="id3607246">You now have the positions of the LEDs in every frame. Our goal here is to detect when and which drums were hit so that the corresponding drums can produce their sounds. </para>
      <section id="id-62435095905">
        <name>Determining when a drum was hit</name>
        <para id="id5661710">There are various innovative ways of tracking when the drums are hit. We chose to use a velocity computational approach due to its speed. Using this approach, you can look at the displacement of the LEDs in consecutive frames and calculate the velocity. Using basic physics, if the velocity changes from positive to negative (note that our coordinate system has the positive side of the y-axis pointing downwards) it implies a change in direction of the drumstick, or that a drum was hit. You should be able to figure out approximately which frame the drum was hit in. Since the hit point is returned in terms of two-dimensional coordinates, you can figure out which drum(s) are hit. </para>
        <figure id="id3374006"><name>Variation in velocity with the movement of the LEDs</name>
          <media type="image/jpg" src="graphics1.jpg">
            <param name="height" value="387"/>
            <param name="width" value="600"/>
          </media>
        <caption>See if you can guess when drums were hit.</caption></figure>
        
        
      </section>
      <section id="id-00387431682295">
        <name>Determining which drum was hit</name>
        <figure id="id4708694"><name>Position of the Drums</name>
          <media type="image/jpg" src="graphics2.jpg">
            <param name="height" value="383"/>
            <param name="width" value="493"/>
          </media>
        <caption>[1: Cymbal; 2: BigTom; 3: Small Tom; 4: Floor Tom; 4: Snare]</caption></figure>
        
        <para id="id3239895">The frame should be broken down into rectangles with assigned x and y coordinates where the drums are positioned. Our drum kit consists of the Crash Cymbal, the Big Tom, the Small Tom, the Floor Tom and the Snare. We check to see if the hit-point falls in the space assigned for any of the drums, and if it does, we move on to producing the sound and displaying the image on the computer screen. However, if the hit point is outside the frame, it is taken as a missed hit.</para>
      </section>
    </section>
  </content>
</document>
