Owner: The Algorithmist URL:http://algorithmist.wordpress.com/ Join Date: Tue, 13 Mar 2007 16:45:20 -0500 Rating:0 Site Description: Applied mathematics in Flash and Flex. Site statistics:Click here
Papervision 3D Wiki 2007-03-13 15:54:41 The P3D Wiki
is now online - check it out here.
For more information on PaperVision 3D - http://www.osflash.org/papervision3d
and the blog is here.
enjoy!
Read more:Papervision
AS 3 Parametric Curve Library 2007-03-12 16:33:30 I’ve released a ‘rough cut’ of the AS 3 Parametric CurveLibrary
. Although the Flex demos (MXML files in the demos folder) exercise most of the methods, the library has yet to be extensively unit tested. There is also no external documentation. Some elements of the library are to be used for skinning in the Rigging classes (currently under development). After the basic Rigging classes are complete, I expect the library to have been pretty extensively tested.
In the mean time, you can find out more about the parametric curve library here. Enjoy!
Referencing stage in a Flex App. 2007-03-11 16:20:05 I’m probably not the first to blog on this, but some repetition is often valuable Most examples illustrating integration of AS 3 with Flex show a function executed on the creationComplete event of the Application. It is helpful to understand the startup order of events in a Flex application.
If your attempts to access the stage in a Flex app. result in a null reference, try executing your script on the applicationComplete event, as shown in the following code segment. This particular segment is taken from a test driver that allows bones to be drawn interactively with mouse clicks, similar to 3ds max. I’ve removed much of the MXML and script that is not relevant to the topic.
<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” applicationComplete=”test()” width=”600″ height=”500″>
.
.
.
<mx:Script>
<![C
Some old downloads 2007-03-10 14:32:36 Following are links to some of the more popular downloads from the old Singularity blog.
AS 3 Priority Queue
AS 2 Prime Factorization
AS 2 Pascal’s Triangle (forward and reverse recursion)
AS 2 Recursive Taylor Series Example [ TechNote reference here ]
AS 2 Timer Class (choreograph events in timed sequence)
AS 2 Pair and Triple classes - STL-style pair and triple used for coordinates. Includes great-circle distance.
AS 2 - The magic of the number 1089.
The XML Portfolio Viewer is at Ultrashock.com (Flash 8 tutorials section).
Hello world! 2007-03-09 15:22:41 First post in a new personal blog. I hope to discuss various topics in applied mathematics and programming in Actionscript 3/Flex.
Read more:Hello
, Hello world
Flex Page-flip component 2007-03-14 14:57:22 Ely Greenfield has developed a wicked Flex page-flip component. You can see it here, complete with tutorial! It also appears that an Apollo version is coming.
EAS3 Preorder 2007-03-15 15:11:33 Moock’s Essential Actionscript 3 is now available for preorder. Use the link below and Colin gets a small piece of the action. Authors do not receive anything close to the value of their time and expertise in royalties, so show your support for Colin’s work.
Preorder
EAS3 here.
Flex geometric primitives 2007-03-16 16:47:03 Need to integrate simple geometric primitives
like polygons, gears, and wedges into your Flex app? The Flex 2 primitive explorer is just what you need.
Check it out here.
AS 3 Biped Rig Coming Soon 2007-03-19 18:48:28 Work is well underway on the AS 3 character rigging classes. The primary rig to be released in late April is a 2D Biped, similar to the 3D rig in Discreet’s Character Studio. I hope to show some sneak previews of the initial rig later this week with follow-on posts as new kinematic features are added.
The rigging classes and supporting math will be discussed at FITC Toronto. You may follow the development here.
Read more:Coming Soon
FITC Toronto Schedule 2007-03-21 14:46:28 The FITC Toronto
schedule is now online. If you are thinking about attending, use the code 2112fx on checkout to receive a 10% discount.
See you in Toronto!
Read more:Schedule
AS 3 Biped Rig 2007-03-22 21:27:36 This image shows the initial construction of the AS 3 Biped Rig, compared to the Character Studio equivalent. The AS 3 Biped is constructed in a similar manner, by dragging a rectangle on the screen. Rectangle dimensions are used to position bounding boxes for all limbs (either Bone Chains or Connectors). The bounding boxes are shown in Red.
Like the Character Studio Biped, the AS 3 Biped has a COM (Center Of Mass) that is selectable and can be translated and rotated. These transformations are passed along the entire limb hierarchy. Each Connector or Bone chain may be independently rotated. The FK architecture allows transformations to be passed along to multiple chains.
All Connectors and individual bones are drawn with externally specified Templates. The Template system allows bones to be used as a skin for a completely segmented character. Templates allow for uniform scaling along the bone’s radial dimension or non-uniform scaling to ensure the skin exactly fits a bou
Papervision 3D Training 2007-03-27 16:00:09 If you’re in the LA area in June and want to move ahead of the pack in Papervision
3D development, then check out this training course from Jedi Master John Grden.
Read more:Training
AS 3 Wedge Class 2007-04-01 22:00:05 Approximating circular arcs with Bezier curves is a relatively simple process and is often a ‘rite of passage’ problem for first-semester computational geometry students. A quad. Bezier can reasonably approximate arcs of up to pi/4 radians. A cubic Bezier can reasonably approximate arcs of up to pi/2 radians. Higher-order curves can approximate semicircles, “Approximation of circular arcs by Bezier curves”, by Joon and Kim, Journal of Computational and Applied Mathematics 81 (1997), pp. 145-163.
I generally prefer to use Flex charting components for pie charts, but sometimes I need to draw a simple pie-shaped wedge and the components are serious overkill. A recent example is a graphic illustration of rotational joint limits for bones. A simple solution was a wedge class that uses a start point and start angle to define the base of a wedge. The wedge arc is broken into a number of equal-arc segments of no more than pi/4 radians. Each segment has a known sta Read more:Wedge
Joint Limits in Bone Chains 2007-04-04 20:54:03
This image illustrates the application of joint rotational limits in a bone chain and across chains. In this case, a single hand connector is linked to a three-bone chain. The second bone in the chain is selected and two pie-shaped wedges illustrate the rotational limits (relative to the parent orientation) for that bone (yes, that’s where the AS 3 Wedge class comes into play). The bone is rotated towards its lower limit and is not allowed to exceed that limit as shown in the leftmost image.
Next, the third bone in the chain is selected and rotated towards, but not past its upper limit. Notice that in all cases, the motion is propagated to the next chain in the hierarchy (the hand connector). Finally, the hand connector is selected. Bones in a chain know their parents, so it’s easy to query the parent orientation. Anything connected to a chain (another chain or connector, for example) must implement the IChain interface. This interface ensures that it is always pos Read more:Chains
, Joint
, Limits
FITC Preview, Simple IK 2007-04-06 06:11:33 Continuing the preview of some of the topics I’ll discuss at FITC Toronto, several IK solvers will be covered. I will start with what is probably the simplest and most intuitive algorithm which was once jokingly called “Reverse Forward Kinematics” by my robotics professor in 1981. It seems RFK dates back to at least 1972, although I have been able to uncover an original attribution.
Some Flashers may recognize RFK as the algorithm discussed in the book Making Things Move. In reality, it is a variant of Cyclic Coordinate Descent [Wang and Chen, “A Combined Optimization Method for Solving the Inverse Kinematics Problem of Mechanical Manipulators,” IEEE Transactions on Robotics and Automation, Vol. 7, No. 4, August 1991, pp. 489-499]. Both RFK and traditional CCD treat the IK problem as a sequence of one-bone optimizations. Start at the end of the chain and perform a one-bone correction. Begin a new IK problem with a chain having one fewer links. Repea Read more:Preview
, Simple
FITC Preview - IK With Joint Limits 2007-04-11 21:39:38 Continuing the preview of my FITC talk, joint limits are an important part of any IK solver. They may be implemented by modifying the math for the solution or post-solution adjustment via angle offsets. The latter approach is less elegant but conceptually simpler. I will illustrate a simple implementation for the two-bone (in-plane) solver with lower joint limits in the range [0,-pi] and upper limits in the range [0,pi]. If the root bone requires more flexibility, it is likely that it will be completely unconstrained. This is more flexibility than would probably be required in most production rigs.
The following screen shot illustrates an example where the root bone is constrained between -3*pi/5 and pi/2. The second bone is constrained between -pi/2 and 3*pi/4. Note that all constraints are relative to the parent orientation. If the root bone is not connected to any other part of a rig, its orientation is relative to the positive x-axis.
The target can not be reach Read more:Joint
, Limits
, Preview
FITC Preview, Improved 2-link IK 2007-04-10 17:24:45 Continuing the preview of my FITC Toronto presentation, I alluded yesterday to a hybrid algebraic/geometric algorithm for solving the in-plane, 2-link IK problem. Other solutions presented in the Flash community tend to use bones of equal length, hiding issues with infeasible solutions. The previous post illustrated one such problem from the code in the book, ‘Making Things Move.’ The following screen shot illustrates the hybrid solver with two bones of different length and a minimal-error orientation for an infeasible solution.
An additional feature of the algorithm is that it produces a solution with less computation. A typical geometric solution (i.e. MTM) involves two inverse cosines and an inverse tangent along with some supplemental computations and sin, cos operations to position the second bone. The hybrid approach requires a single inverse cosine and inverse tangent.
The computational savings are not overwhelming, but in a game engine, every cycle saved in IK Read more:Preview
FITC Preview, Mixed IK and FK 2007-04-13 00:07:45 Continuing the preview of my FITC Toronto presentation, the following screenshot is taken from the AS3/Flex 2-link IK demo. When IK is applied to limbs in a rig, it is generally the case that a bone chain is linked forward of the chain whose IK solution is currently sought.
The leftmost image indicates the default position of the rig, consisting of a two-bone arm chain and a Hand connector. The Hand is linked to the arm chain. The colored wedges illustrate the lower and upper rotational limits of each bone. As the target is moved, the visual representation of the second bone’s limits are updated (the root bone is oriented to the positive x-axis).
Notice that the Hand connector maintains proper orientation throughout the solution. At the end of each solution step, the Chain class invalidate() method is called. This tells the Chain instance that the position and orientation of the end effector has changed, meaning that the position and orientation of all Chains/Connectors li Read more:Mixed
, Preview
FITC Preview, Drawing Bones 2007-04-17 00:29:38 Continuing the preview of my FITC Toronto presentation, bones are generally used in 3D applications to deform character meshes. For characters with segmented limbs, bones themselves may be used to draw the character. This technique is used more often for 2D characters. The current rigging classes use a Template system to draw bones. Templates are symmetric about the bone’s axis and may be uniformly or non-uniformly scaled.
For bones with an assigned Template, the control points may be connected with lines (simple point-to-point drawing) or interpolated with a cubic Bezier spline. For more information on the composite Bezier curve, read this TechNote.
The screen shots above illustrate a bone chain drawn with standard bones and a Template. In the presentation, I will give a demo showing how you may toggle back and forth between different drawing methods for the bones.
For segmented 2D characters, bones may be used as a skeleton rig and a visual representation for the cha Read more:Bones
, Preview
Some Cool Stuff 2007-04-27 21:38:52 In the department of the new and cool, you should check out the videos of John Grden’s FITC presentation (otherwise known as all the justification you ever need to attend a conference where John is one of the speakers).
Keith Peters just released a copy of his presentation on Apollo - it’s the best introduction to Apollo I’ve seen. Excellent work.
Finally, check out this cool scientific graphing calculator done in Flex. Nice stuff.
Character Rigging Classes Available for Download 2007-05-04 17:35:25 The alpha version of the AS 3 rigging classes is now available for download. This is the code base accompanying the FITC Toronto presentation on dynamic skeletal animation. The download includes the entire Singularity package (including the parametric curve library).
Read more here.
Read more:Character
, Classes
, Download
, Rigging
BitmapData.hitTest 2007-05-06 21:43:01 Although it is pretty evident that this method does pixel-level hit testing, the documentation is pretty cryptic when it comes to *exactly* how to use the method to perform a specific test. I guess it’s one of those things that you have to figure out by looking at lots of examples. So, here is another example to throw into the mix.
I recently had to work on some code (AS2/F8) to highlight individual lines in a TextField on rollOver. Since no such method exists to do this directly, I approximated using TextField height and font metrics to create a number of ‘highlight’ boxes. One of the questions I had was how to determine if a highlight box was underneath a blank line of text.
Since I’m not directly computing the exact text in a single line, I had no way of knowing if a highlight box was underneath a ‘blank’ line. One way to find out is to take a bitmap snapshot of the TextField (actually, the MovieClip containing the TextField), a snapshot of t
AS 3 Data Structures for Game Developers 2007-05-14 17:51:44 Michael Baczynski recently released a library of data structures targeting game development. I’m already interested in the BST for some work in bone animation.
Major props to Michael for releasing the library and making game development easier for all of us!
Read more:Developers
, Structures
Colin Moock Interview 2007-05-23 11:38:27 You may have already seen this from Colin
’s blog, but here is a great interview of Colin Moock by Mike Downey at FITC this year. Lots of good discussion of EAS3. Enjoy!
Record Prime Factorization 2007-05-22 11:42:40 Last year, I wrote about prime factorization at the old Singularity blog. The post included an AS 2 implementation of a textbook algorithm along with some pointers to more advanced methods such as the quadratic sieve and GNFS (General Number Field Sieve ).Â
A lot of work has gone into factoring numbers on the RSA Challenge List. Now, a team including members of the University of Bonn, NTT, and Arjen Lenstra has tackled the Mersene number 2^1039 - 1. Read more about their results here.
You may download the simple textbook prime factorization from the Downloads section.
Read more:Record
AS 3 Animation System Beta 2007-06-02 07:49:40 I happen to like animation systems. There are always the cases where a task is too simple to justify the weight of an animation package or too complex for the package. I don’t mind writing those cases myself. For everything else, it’s nice to have a packaged system. Looks like there is a new animation package under development for AS 3 programmers by Ryan Taylor. The description of this package is very interesting and he’s currently looking for beta testers. Check it out here, http://www.boostworthy.com/blog/?p=158 .
Read more:Animation
, System