Archive for April, 2002

Ellipse-Ellipse Intersection

Tuesday, April 30th, 2002

Ellipse-Ellipse intersection is now working. The Ellipse object, Circle object, and Intersection object have all been updated to support the new intersection.

Two new examples, Circle-Ellipse and Ellipse-Ellipse, have been added to the 2D Intersections section. Just to reiterate, the UI for the handles on ellipses needs work. I’m saving that for the rewrite.

I need to go back and add in rotation to the ellipse intersection routines. Once that’s complete, then I’ll be able to add support for the elliptical arc in the path element.

Polynomial JavaScript Object

Monday, April 29th, 2002

I decided to pull the polynomial root finding code out of the Intersection object to create a Polynomial object. Polynomial supports the following functionality: represent any degree polynomial, evaluate at x, multiply two polynomials, find derivative, find roots, and convert to text.

Root finding uses the closed form equations for quadratic, cubic, and quartic functions. This last one is needed for solving the ellipse-ellipse intersection problem so I’m a wee bit closer to solving that one. I have a feeling that I’ll be able to use the ellipse-ellipse approach to solve the ellipse-quadratic Bezier and quadratic Bezier-quadratic Bezier intersection problems.

The cubic Bezier intersection problems involve polynomials anywhere from degree 6 to 9. I’m not sure if it’s practical to solve these intersections using polynomials, but I have implemented a bisection routine and I plan to add Newton’s method just in case. There are a bunch of other supporting routines that need to be written to solve higher-order polynomials. Thank goodness for David Eberly’s site and his book “3D Game Engine Design” (ISBN 1-55860-593-2). Without these, I don’t know how I would have figured out as much as I have so far.

2D and GUI Reorganization and Variable Width Strokes

Sunday, April 28th, 2002

The 2D Geometry and GUI sections of the site have been reorganized in anticipation of a rewrite of the code in those sections.

The GUI section has been divided into four broad categories: Math, Shapes, Utilities, and Widgets. Math focuses on intersections and root finding. Shapes holds all of objects for editing SVG shapes. Utilities is a bit of a catch all, but includes AZAP and viewBox. Essentially, if an object doesn’t fall into one of the other categories and it can be used by itself, then it becomes a utility object. Widgets holds the higher level GUI elements like textboxes and buttons.

In the 2D section, I moved the intersection examples into their own section. I’m hoping to add quite a few more examples to that section, so this was in preparation for that.

Doug Shepers proposed the concept of varible width strokes to the W3C last week. His write-up (with examples) can be seen here I created some examples to match his rectangle example. A custom namespace and custom attribute are being used to get a feel of what it might be like to use this idea in SVG. Also on that page is an example using a Bezier to vary the stroke of a single line.