<?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="id3768162">
  <name>Implementation: Detecting a hit</name>
  <metadata>
  <md:version>1.1</md:version>
  <md:created>2007/12/19 18:42:17.749 US/Central</md:created>
  <md:revised>2007/12/19 20:18:01.720 US/Central</md:revised>
  <md:authorlist>
      <md:author id="kriti">
      <md:firstname>Kriti</md:firstname>
      
      <md:surname>Charan</md:surname>
      <md:email>kriti@rice.edu</md:email>
    </md:author>
      <md:author id="tanwee">
      <md:firstname>Tanwee</md:firstname>
      
      <md:surname>Misra</md:surname>
      <md:email>tanwee.misra@rice.edu</md:email>
    </md:author>
      <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="kriti">
      <md:firstname>Kriti</md:firstname>
      
      <md:surname>Charan</md:surname>
      <md:email>kriti@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="tanwee">
      <md:firstname>Tanwee</md:firstname>
      
      <md:surname>Misra</md:surname>
      <md:email>tanwee.misra@rice.edu</md:email>
    </md:maintainer>
    <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 module describes how we determined when the user hit a drum and which drum s/he hit.</md:abstract>
</metadata>
  <content>
    <section id="id-428214165847">
      <name>Hitting the Drums: A Velocity Computational Approach</name>
      <para id="id3912210">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-910587675718">
        <name>Determining when a drum was hit</name>
        <para id="id3261224">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="id3341421"><name> A plot of the variation in velocity with the movement of the LEDs. See if you can guess when drums were hit </name>
<media type="image/gif" src="velocity.gif">
            <param name="height" value="325"/>
            <param name="width" value="450"/>
          </media>
        </figure>
        
      </section>
      <section id="id-806774611611">
        <name>Determining which drum was hit</name>
        <para id="id5644025"><figure id="id8000072"><name> The positions of the drums [1: Cymbal; 2: BigTom; 3: Small Tom; 4: Floor Tom; 4: Snare]</name>
<media type="image/jpg" src="window.jpg"><param name="height" value="223"/><param name="width" value="287"/></media></figure></para>
        
        <para id="id4236670">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>
