Hey Simon,
2010/12/19 Simon <[email protected]>:
> Check out my compiled demo here: http://www.n32.ca/sin.cgi
> When you click the vector image, the spiral redraws. This sin.cgi
> currently use VML to draw vector graphic in IE and PNG for others.
I think that should read "HTML5 canvas" for others?
> My concerns is that while IE can take advantage of VML to draw the
> image, all implementation will have to query the server for the X,Y
> positions of the lines.
> The formula for the positions is this C code:
>
> for(double k=0; k<=n; k++){
> double p = (1-cos(1*M_PI*k/n))/2;
> double a = r*2.0*M_PI*p;
> double d = p + 0.075*sin(q*2*M_PI*p+t);
> double newX = d*cos(a);
> double newY = d*sin(a);
> if(k>0) painter.drawLine(lastX,lastY,newX,newY);
> [...] }
>
> So the problem here is that the whole position algo is written in C.
> And to be optimized, it would need to be written in javascript. I
> could do that, but if in some other project the server needs to
> calculate stuff using the same algo as the client, I would have to
> write the formulas in both code. But maintenance would easily become
> a nightmare.
>
> Does Wt provide a solution for this?
Wt currently has no solution for portable graphics, client-side.
Rendering requires a round-trip.
Note however that a round-trip is typically less than 130ms
inter-continental and a few 10ms intra-continental. Round-trip times
are usually not the reason why a website feels sluggish!
> If not, I was already programming a C++ math abstraction class
> hierarchy that allows to build formulas and custom math functions...
> I had left it in the freezer for the past month or so but I thought I
> could modify it to yield valid javascript code for the computation.
> The result would be the same code as above, but using another type
> than double (like, say, WMath).
> Is this something of interest to you guys? I'd like to work on
> something like this, but I'd rather avoid rebuilding the wheel...! =)
I I understand correctly it creates an abstract syntax tree from the
expression which can be serailized to JavaScript ? That is certainly
something novel and not rebuilding the wheel, ASFAIK !
Unless I am not understanding it completely though, the problem with
that approach is still that VML rendering is still very different from
SVG or Canvas, so to convert the positions into a drawing will still
remain a problem ? The solution to this would be to use the VML canvas
emulation layer (ie_canvas) ?
Regards,
koen
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest