This blog desperately needs more posts, but I hardly have any subjects to write at length about. And this is where wonderfl comes to the rescue – some of those codes are so complicated that one could give two hours talk about them. This code is that kind of code, and tonight I am going to explain just one small part of it – drawing numbered billiard balls. Continue reading ‘How to draw numbered billiard balls’
Posts Tagged 'geometry'
Tags: flash, geometry, tutorial, wonderfl
Tags: flash, geometry
As you might know, I have finally tested my idea to use my old drawTriangles() snippet for projector perspective reconstruction from webcam video. The thing is that, unless you duct-tape your webcam to projector, there is significant difference in perspective between projector and webcam that needs to be compensated in one way or another before you could use webcam to do something like this:
So I borrowed this projector from Denis Radin and wrote a wrapper around webcam and math and shit that is now hosted on github. There you get a sprite that waits for Ctrl+Space to show 4 white arrows for a second, and then you mark those arrows in webcam image. When you’re done, Ctrl+Space again to hide it. Using this “calibration” info, your code gets corresponding region of webcam video automatically transformed into rectangle – the way your projector would see it, if it was a webcam itself. What you do with that image next is up to you; I’ve included flashlight “painting” example above as well as basic edge highlighting example.
Tags: 3D, geometry, tutorial
A transformation matrix transforms a vector of point coordinates in given frame of reference into coordinates in another one (e.g. from child to parent in our beloved display lists or scene graphs) – Captain Obvious.
Many people think of transformation matrices as impenetrable black boxes filled with random numbers that are impossible to make sense of while fiddling with your application. So this 1st post of the year is my attempt to help those people, by providing as short and simple explanation for those numbers as possible.
Tags: 3D, alternativa3d, away3d, flash, geometry, minko, wonderfl
So, I have started cross-engine 3D primitives project at github. Just like as3dmod, it plugs seamlessly into your favorite engine to help you out whenever you feel limited by it. Initial commit supports Alternativa3D 8.12, Away3D 4 Alpha, Minko 1 and contains two spheric primitives: UniformSphere and Globe.
UniformSphere is a mesh built from the spiral of vertices uniformly distributed across the sphere. You have two options here: Rakhmanov formula (default, the spiral joins sphere poles) or Bauer formula (the spiral does not contain poles). This primitive was ported from my 3D metaballs code.
Globe is a mesh that minimizes texture distortions for classic plate carré projection. It does so by placing equilateral triangles along the equator and gradually compressing triangles towards each pole (where high triangle density is actually good property in terms of texture distortions). This primitive was ported from my globe component for FP9, which is now also hosted at github.
I plan to add few more primitives over time, both useful and not really, and maybe more engine proxies if there will be any interest.
Tags: flash, geometry, wonderfl
Flash player version 10+ native drawTriangles() method is perfect for programming homography (2D transformation that preserves lines) because of its support for UVT data. In general case, however, homography requires solving 8×8 linear equations system, so noone can be arsed to code that. Instead they implement one of two special cases – mapping rectangle to or from quadrilateral. So far, only 1st case was implemented using drawTriangles, while 2nd case was done using filters. Well, no longer so – it turned out, inverting T values in Zeh code was sufficient to make it work backwards:
One interesting thing about this code is that noone really knows exactly how it works :) I didn’t have to study all the math behind Zeh code in order to “invert” it, and Zeh… well, let me quote:
I was lucky enough to get what I wanted working after a good amount of crazy trial and error (and beer)
Tags: flash, geometry, wonderfl
As you can see, two checkerboard-like patterns are ambiguous, but the algorithm ignores it, causing random deadlocks as a side effect. So I tried to find some solution to this by posting the problem at wonderfl; and then I just couldn’t wait :) Well, my solution uses 2 to 4 pixels out of 2×2 window and seems to work on crazy images, so I’m happy. But if you suddenly find some better way, let me know.
Tags: flash, geometry, pixel bender
Previously on «Hough transform»: brave lone coder decides to explore random line detection algorithm; he splits the experiment in parts roughly corresponding to pixel bender kernels that he needs to write; he writes a post with many words that noone reads, and shares the demo that noone finds impressive.
Well, just so that you know, the experiment continues, and the demo is a bit better now: