Well, you could do what most implementations of sine and cosine would do,
series expansion:

sin(x) = x - x^3/3! + x^5/5! - x^7/7! ...

cos(x) = 1 - x^2/2! + x^4/4! - x^6/6! ...

I haven't tried it, but if you avoid small angles (not a bad idea with pie
charts, anyway) the expansion shouldn't have to include more than three
terms, I suspect.


Mark wrote:

> Hi folks,
> sorry for this slightly off topic post but i was hoping someone could
> help me.
> I thought i should be able to produce a very simple xml schema for
> generating pie charts. the idea was that I could use XSLT to transform
> from the pie-chart schema to SVG (and then to import the SVG into FOP).
> It would be preferable to express the size of the pie chart segments as
> percentages, but the SVG Path object requires coordinates on the
> circumferance of a circle.
> The problem is that there don't seem to be any functions in XSLT or
> XPath that let me find the sin() or cosine() of an angle. Am I missing
> something? I thought I could possibly use a transform but I can't seem
> to perform a transform in the middle of a Path.
> I finally decided that maybe if I created a table of degree-to-sin/cos
> mappings I could somehow use the document() function to import this into
> the stylesheet and use an index to search it (ergh) but that doesn't
> seem to work either.
> There's little point in having a pie-chart schema if you have to do the
> calculations yourself anyway.
> So if anyone has any suggestions .. ? I'd certainly be pleased to share
> a pie-chart-XSLT transform if I can get it going.
> As an aside, does anyone know why SVG paths are so (IMHO) brain dead? I
> can't believe that the elements in a path aren't XML elements, it seems
> very strange. (Generating the paths in XSLT is going to be a bit
> painful, even if I can get the sin() of an angle. I dont really see how
> "M300,200 h-150 a150,150 0 1,0 150,-150 z" qualifies as XML).
> Cheers
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to