Andrew Que
Sites list
Photos
Computers
Projects
Contact
Main
Next week Previous week
 Jan 31 to Jan 25  -  Jan 24 to Jan 18  -  Jan 17 to Jan 11  -  Jan 10 to Jan 4 -  Jan 3 to Dec 28 
April - March - February - January - December '07 - November - October
2010 - 2009 - 2008 - 2007 - 2006
Current week

+ Add a comment
(600x600) (900x900) (1800x1800)
Show all photos from 2008-01-08
    Pictured is Amber.  The lighting and cropping of this image where done to detract from the character and draw more attention to the shapes.
No comments have been added
- Fun with trigonometry + Add a comment

   I've been in a math mood lately and decided to have some fun with trigonometry. I coded a galvanometer in PHP and made a quick Javascript interface to control it. The position coordinates of the needle on a galvanometer are not exactly trivial--at least, doing it correctly.


   First, in order to determine the location of the needle, we need to think of the range of the needle. For our needle, we used a swing of 90°, represented by the shaded red area. This is π/2 radians (for you non-math types, a full circle is 2π radians). This span starts 135° counter-clockwise from the standard 0 location. So to determine the needle position, we simple scale the needle position (in this case, 0-100) to radians 0 to π/2.


Where P is the position of the needle, 0 to 100

   From there, the X and Y positions are pretty simple:


Where L is the length of the needle

   We now have the coordinates for the top of the needle, but not the bottom. If the entire needle is drawn, those coordinates are simple. Y is the bottom of the chart, and X is the middle. But I wasn't going for simple and decided to hide the bottom of the needle.

   What we have turns our to be a geometry problem--similar triangles. Proportionally, the two triangles the same. We know the coordinates of point A, point B and the Y-coordinate of point C. What we don't know is the X-coordinate of point C.

 

   Now we have the full coordinates for the needle. For division marks, we can simply recycle the equation used to determine the top of the needle's location and run it twice. For the top, we extended the needle length by some amount (5 pixels in the example case) and for the bottom, decrease the needle length by the same amount. This will result in top and bottom coordinates for the divisions.

   I thought about trying to come up with some sort of automatic scaling so that the chart would determine a needle length needed to fit the full 90° to the window. But I didn't like what I came up with. Instead, I simply made the needle length 3 times with height of the meter window.

Here are the results:


-
+

   For testing, I made the javascript automatically update the position ever 1/2 second and redraw the image. This worked fine, but Firefox never freed the memory for any of images. I left my computer for a time and returned to find Firefox consuming over 650 MB of RAM. It took a few minutes to get Firefox to close and the system was crawling. I've herd good things about FF3 having fixed memory leaks. Let's hope that's true.

No comments have been added
+ Add a comment
(600x600) (900x900) (1800x1800)
Show all photos from 2008-01-05
    Noah
No comments have been added
- Banded Inverse Root Nonuniform Scatter + Add a comment
    Last week I wrote an article about nonuniform scatted on a line function.  Today I'd like to refine the algorithm so that there is a cap on the scatter.  My previous algorithm had a theoretical limit of infinity for the range of scatter.  However, due to the limits of a random number generator, that range was lower.  Modifying the algorithm slightly, the boundaries can be modified such that the limits of the scatter can be controlled. 
    Here is the modified line function:
    Note that the inverse root function is still very similar, with the addition of the variable S.  This is the "scatted coefficient", which defines how scatted the graph will become.  As S becomes larger, the graph will be more and more concentrated toward the actual line function.  This makes sense because as S becomes larges, the inverse root value becomes smaller.
    This is the core of the inverse root function:
Inverse root function
    The range of y is:
Inverse root range
   The desired range is -1 to +1, so the end of the function divides (inverse multiplies) by range to normalize the output.  Once normalized, the magnitude M will scale the output of the function to whatever boundaries need to be.
    Here is an interactive example of this algorithm at work:

Slope (m)
Y-intercept (b)
Scatter coefficient (s)
Scatter magnitude (M)

The top chart is a graph of the function and the bottom graph a histogram to show the data spread.

 
No comments have been added
- The Loft 2--"Sister Storage" + Add a comment
(600x600) (900x900) (1800x1800)
Show all photos from 2008-01-05
    At the end of December, Liz and Amber began moving in.  Since they will are sharing the bedroom, I needed to design something for assist sleeping.  My first idea was to a get bunk bed, but that wasn't going to work out too well.  The bunk bed I had access to wouldn't have been large enough to hold two twin mattresses on top.  The solution was pretty clear--we needed an other loft.
    The construction of this loft was a little different from the one we build in the living room.  The span was much shorter--just under 8 feet vs the just over 12 feet.  This meant I could get away with using smaller floor joists--2x6" at 12" spacing would achieve a load rating of 30 lbs/sq. ft.  There was, however, one interesting obstacle: in order to fit two twin mattresses, the beds would have to be placed length wise.  This would mean the loft would have to extend 6 1/2 feet across the room.  The problem: there is a door right around 6 feet.  The floor joists would have to be above the frame.  The ceiling height varies since the ceiling is vaulted, but starts at 8 feet.  Placing the loft above the door frame wouldn't leave much room on the low side.  My solution: place the last joist above the door frame and all the others underneath.  That would mean the floor would be suspended from the this first joist to the first underside joist.  That span isn't far and I knew this would work.
    Construction went pretty quick--just a few hours.  Part of the reason this loft took less time was not having to rearrange the room first--it was empty.  The following day, I had planned on constructing a ladder, but it snowed heavily and the temperature dropped significantly.  So, I put off that part of the project.
    Today, the temperature became reasonable again and it was time to build a ladder as well as desk and some shelfs.  The setup turned out pretty nice.  Pictured is Liz after moving into her new area.  The loft has been nick-named "Sister Storage"--because it's where I store my new adopted sister, Liz.
1 comment has been made
From Liz (http://liz-photography.livejournal.com/)
WI84
January 20th, 2008 at 11:04PM
   I still don't understand why my mother is so ticked with these photos. =P I'm bored visiting her at the moment. I want to come home.
- State of drive prices + Add a comment
(600x600) (900x900) (1800x1800)
Show all photos from 2008-01-03
    Now that the holidays are over, I've been checking on hard drive prices--and it's bad news.  Everything went up and seems to have stayed.  In the past two months, 750 GB drives have gone from under $165 to over $176.  Over 3 months 500 GB drives went from an average of around $95 to over $110.  Terabyte drives are the only good news, dropping most of the holiday season to around $255 now.  I'll post updates as things change, but for now, it's not the time to upgrade drive storage.
    Amber and Olli playing video games
No comments have been added
- X/Y Plot class + Add a comment
    I've released a brand new project called X/Y Plot.  This project has been in the work for the past month and is now ready for the world.  It is a full object-oriented PHP class for drawing X/Y graphs/carts.  I tried to design this library to be simple and setup and easy to drop into any project that needs a graph.  It's quite small--around 2,000 lines--half of which are comments.
    I worked with Javadoc in my programming class and wanted to try working with automated documentation a bit more.  PHP had a project I've written about before called PHPDoc and I used this for the creation of the API documentation.  I hope someone will try the system out and see if it works for them or not.  Documentation has been one of my weaker points, but I'm working on improving that.
 
No comments have been added


Designed and maintained by Andrew Que
(C) Copyright 2001-2012