Monday, February 22, 2016

Kinect 3D Scanning

After battling with trying to get a Kinect to 3D scan with my Ubuntu laptop, I returned to the struggle armed with two new (old) tools.

First, my friend Jaymes suggested Making Things See as a invaluable guide.

Second, I used my old Mac laptop. The book helped me sort out software versions. The Kinect hardware is a few years old, so using an older version of the Mac OS and the helper drivers proved vital to the success of the project. It took no time to have the Mac displaying Kinect point clouds and RGB data!

The exercises in the book, built in Processing 1.5.1, are excellent, well-documented, and help programmers familiar with Processing build a solid understanding of how the Kinect works with the computer and software.

I worked my way through the exercises and programmed the example Processing 3D scanner software. I made a great scan of myself.

Since the software takes a "snapshot" rather than relying on stitching photographs together to create a model, as in Autodesk 123D Catch, my usual 3D scanner, I was able to capture my wiggly four year old.

The Processing sketch worked well but I ended up using a different piece of software, Kinect Application for OS X, available from Thingiverse. It suits my needs perfectly. It does not scan in full 360°, which is fine. It does capture fantastic point clouds that are slightly lo-definition. Lower resolution is fine for my Thing-O-Matic and adds to the artistic quality of the 3D prints. 

The Kinect 3D scanning workflow serves me very well for capturing snapshots of individuals. I want to try scanning some physical spaces with it and experiment with 3D printed dioramas as well.

Another interesting consideration is that the Processing and OS X Kinect scanners assume you print the models horizontally, which creates interesting patterns in the print that are somewhat distorted. While I remove the included background and reposition the models vertically before I 3D print them, it is interesting to 3D print them horizontally as well.

What if you take advantage of the layered effect and keep the model positioned horizontally as a topographic model that also happens to be a 3D portrait? Below we have a hillside that gently slopes towards a body of water, as well as a peninsula.

Since it is very easy to create distortions when capturing the point cloud by reaching toward the camera, or adjusting the capture depth, one could create fantastic, imaginative topographies that are 3D printed with multiple colors or filament or painted to look like topographic models. Thusly, one could create an alien world composed of the artists' portraits.

Although better, more portable 3D scanners have emerged on the market since the Kinect was hacked to allow others to use the data, it remains an intriguing 3D scanner. The effects one is able to easily produce and the beauty of the 3D models it creates warrant continued exploration.

Sunday, February 21, 2016

Mucking with Angles and Arcs

The Turtle Blocks Club students have impressed me time and time again with their perseverance, their willingness to tackle problems that are beyond their operating knowledge, and the enthusiasm they bring to learning new skills. In particular, Logo programming has sharpened these students' math skills by making the concepts more concrete. Last week's project, in particular, demonstrated remarkable "mucking around" with Logo programming and mathematics, something I think Brian Silverman would appreciate.

Last week I showed one student, using TurtleArt and the "hidden" PicoLogo text area, how he could define a block using text. He started in TurtleBlocks and created a cool design that the turtle would be able to draw. With a little help with syntax and bracket placement he quickly re-wrote the block procedure in text.

We loaded the procedure onto the LogoTurtle and set it drawing.

Hmmm. The drawing was not quite right. Fortunately, the student wanted to put in the time to make it right. We started by running a simple square procedure to make sure the LogoTurtle was calibrated.

Spot on. This led to a conversation about floating points (the Adafruit Metro Mini does not handle floating point math) and how Brian and Erik programmed the robot to turn, friction of the wheels and the pen, and how we might make the design look like the one on the screen. I also told them I had a hypothesis that I wanted to check.

We considered the moves the LogoTurtle made to create the design and decided to muck with the angle and the arc, as the student noticed the drawn circle was not entirely 360°. It took a few iterations and tracking of the changes we made to the procedure to arrive at the correct numbers.

Bravo! We made the LogoTurtle draw a great approximation of the screen design!

Afterwards, I shared my hypothesis. I explained to the students that I noticed the drift in angles and arcs in the LogoTurtle and reported it as a bug shortly after the first release of the software. I was surprised not to hear a response from Brian, but that got me thinking. The LogoTurtle is not as "perfect" as a screen turtle and requires more mucking around to reach the precision of a screen turtle. While some students might dismiss the LogoTurtle when it does not draw exactly what is on the screen, others might take the opportunity to muck with the math and teach the turtle to successfully reproduce a screen turtle's work. In mucking around, the student's understanding of degrees and arcs becomes more concrete, meaningful, and contextualized.

I was extremely proud of the effort the student put into solving this problem and excited by the learning adventure the LogoTurtle led us on.

Wednesday, February 17, 2016

Geometry Everywhere: Hexagons

One of my favorite things about programming in Logo is exploring geometry. Once you start thinking about geometry you can find inspiration in the most mundane places.

One of my son's favorite breakfasts is a bowl of "hexagons," as my wife and I have always called them, and he calls them. When I bought a box I thought, "That's a fun idea!"
I programmed the LogoTurtle to draw hexagons of random sizes within a range of values. After it draws a hexagon it picks up its pen, turns somewhere between 1 and 360 degrees, and moves a little or a little more forward. It continues working on those drawings until the batteries wear out.

I finished the piece by programming a 180 degree arc with a big radius for the bowl. I ran the bowl procedure four times. I call the finished piece "Hexagon Cereal."

Find some geometric inspiration around you. You can use TurtleArt, Turtle Blocks, Scratch, or many other programming environments to explore complexity built from simple designs.

Tuesday, February 9, 2016

Programming Valentines Day Cards

Instead of buying Valentines Day cards for my four year old's classmates, he and I decided to program the LogoTurtle to help make designs for cards that we would create. I checked with one of his teachers to make sure this did not come as being cheapskate: she said she loved the LogoTurtle and still had one of the pieces I created with it with some of my son's classmates.

I oftentimes use TurtleArt to plan my LogoTurtle procedures: it helps to be able to visualize the design before I type the procedure. I asked him what he wanted on the cards. He chose a heart. My son watched me snap the blocks together and made suggestions about how long the lines needed to be and how they needed to meet the arcs at the top.

Designs do not always transfer perfectly from TurtleArt to the LogoTurtle: the Metro Mini does not handle floating point math, so some tricky math was employed for the arcs, for example, and the friction of the pen, wheels, and ball bearing on the paper all affect the drawing. Regardless, it did not take too many changes to the TurtleArt procedure for it to run well on the LogoTurtle.

Using a 5 inch by 8 inch index card, the LogoTurtle drew two hearts per page. 

When my son returned from school he got coloring!

The variety is lovely!

This project is another example of going from bits to atoms with Logo programming. Additionally, it is another chance for me to instill in my son the belief that creating, not consuming, produces more memorable, personal, and beautiful work.

Sunday, February 7, 2016

Another Wind Tube Bird Design

When I play with the Wind Tube I quickly challenge myself to some type of goal, typically sustained flight in the Wind Tube. My four year old appreciates things shooting out of the top of the tube, with the exception of a long ribbon, which he has figured out how to hook to the base so it flutters in the tube.

We mucked around with our own designs and challenges this weekend. I was inspired by Todd Burleson's work with his students using ping pong balls and practice golf balls. While too heavy to achieve flight on their own, they can be incorporated into models to act as ballast.

Here is another bird design I quickly put together.

I added a second "leg" to increase the weight a bit to keep it flying in the wind tube.

I left the room and came back several minutes later and this bird was still happily circling in the wind tube! A successful design!

LogoTurtle Trees

I was so taken by the earlier tree design that I adapted another of Michael Friendly's Logo procedures to the LogoTurtle, this time one that uses some randomness to create a much more organic looking tree that renders differently each time the turtle draws it.
to random.tree :l :a :depth
if :depth = 0 [stop]
let [len random 0 :l]

let [ang random 0 :a]
fd :len
lt :ang fd :len
random.tree :l :a (:depth - 1)
bk :len rt 2 * :ang fd :len
random.tree :l :a (:depth - 1)
bk :len lt :ang
bk :len
I created trees and their roots for each season. The spring buds, summer foliage, and fall plumage all are different procedures. I adapted Erik Nauman's awesome generative arcs procedure for the fall leaves.

 Tree 1 (Winter)

Tree 2 (Spring)

Tree 3 (Summer)

Tree 4 (Fall)

I am really happy with the way the series turned out. There is a beautiful level of abstraction in how the trees are drawn, and I love the variety of foliage procedures I programmed. 

Contact me if you are interested in purchasing your own version of one of the trees: Seymour the floor turtle would be happy to draw you one.