On Mon, Dec 20, 2010 at 6:14 AM, Koen Deforche <[email protected]> wrote:
> 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?

Not sure, it does loads as PNG in Firefox...
I don't have any browsers that are HTML5 compliant yet...


>> 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!

I believe you're right but it would feel a lot better to remove that
communication if possible.
Some embedded computers might do better without these constant request/replies.

>> 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 !

Pretty much.  I've plugged in a few more C++-style operator
overloading that even allows the given formula to act like a function.
Imagine:
  WMath F = WMath::X  * WMath::X;
  WMath Y = F(42);  //  = 42*42;

Or something like that.  I've used an ancestor of this idea before to
generate formulas in valid LaTeX.

> 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) ?

Well, I have no idea how VML really works and I fully agree with the
idea of the emulation layer or abstract interface, it'll help for
sure.
The math idea is only to help bind the two worlds and not have the
client-side depend on my server because i use the function sin(),
which is natively available in javascript!  What is done with the math
result, in an image, or in text, or as moving things around, is
irrelevant to the math object itself.

I think to program the repaint function in C++ and have the library
translate it into javascript is really cool, but it will probably be
difficult to optimize the given javascript code.  Think of loops and
conditionals for instance.  However, I think we could have a different
breed of widgets that could be included into a VML or SVG image.  Like
a model object and the means to paint a model onto an image widget.

Let me know if you get some other ideas on the topic!

Simon

------------------------------------------------------------------------------
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

Reply via email to