Archive for September 2009

The math behind MultiScaleImage.ZoomAboutLogicalPoint

Developing a Silverlight DeepZoom app, I needed to reimplement MultiScaleImage.ZoomAboutLogicalPoint method in terms of changing ViewportWidth and ViewportOrigin, and this is what code I’ve ended with:

public void ZoomAboutPoint(double newScale, Point scalePoint)
{
 double newViewportWidth = _currentViewportWidth / newScale;
 Point centerPoint = new Point(scalePoint.X / this.ActualWidth, scalePoint.Y / this.ActualHeight);
 double aboutLogicalPointFactor = _currentViewportWidth - newViewportWidth;
 Point newViewportOrigin = new Point(
   _currentViewportOrigin.X + aboutLogicalPointFactor * centerPoint.X,
   _currentViewportOrigin.Y + aboutLogicalPointFactor * centerPoint.Y / ControlAspectRatio);
 ...
}

You pass a scale factor (the same as you would for ZoomAboutLogicalPoint) and the scalePoint, which is in coordinate system of your control (for example, retrieved with GetPosition() from a mouse event handler).

UPD.: Added control aspect ration to the last line. Thanks, Benny!

Fireworks

A little more impressions from the Pyronale in Berlin.

This was my first time I saw fireworks live. Well, of course I saw and even did myself the ordinary New Year fireworks. And I’ve also seen some professional fireworks, but from a greater distance.

But this time, I was so close.  And it was WOW. I’ve realized, I was missing a MUST HAVE experience in my life.

Continue reading ‘Fireworks’ »

Yeah. Life.

I like the saying of my close friend that goes “Жизнь не удалась, но попытку засчитали”. It is hard for me to translate, but it is something along the lines “I’ve wasted [one more] try to live by spoiling it from the very beginning”.

On the other hand, they say “Жизнь дерьмо, но мы с лопатой”, meaning “Life is full of shit, but we have a big shovel”. A slight shift of the perspective, but with big consequences. In the former sentence, there is no hope any more. In the latter, there is.

So, may be, I’m doing not so bad. May be, some time later I will think about these days and decide I was in fact happy. After all, there is no war and me and the people I love are all alive and relatively healthy. Although, there is another saying “There is no healthy people, but just those, who can postpone the visit to the doctor”.

Oh well. Let’s drink some tea and see what happens next.

This week in Twitter

  1. The dentist couldn’t help but laugh out loudly looking at me trying my usual smile after a huge dose of anesthesia http://j.mp/RFDjd
  2. Intel has implemented Smooth Streaming for netbooks http://j.mp/13DCIq
  3. http://gizmodo.com/5366263 via @XaocCPS: interesting. Sharp has always been my favorite trademark in consumer electronics.

  4. Developing DRM solutions at work, isn’t it ironic that the Pirate Party represents my interests best in the current Bundestag elections?

  5. http://twitpic.com/iumtm – 22 Centigree and sunny today – not bad for September 23 in Germany
  6. What a cool gadget http://j.mp/q3KRw
  7. translationparty.com is fun. Tried it with “If I make use of the tongues of men and of angels, and have not love, I am like sounding brass”

Reorg

Originally, I intended to mix personal and public posts in this blog. After all, I am a single person, and my personal feelings are more or less geeky, and my geek posts are more or less personal.

But I was reflecting about a huge imbalance of personal posts I did recently, so I’ve decided to reorganize categories you see on the sidebar. Now you can split my personality, if you want to.

This Week in Twitter

  • Some day, all social networks will merge into the single Peoplenet. Until there, we need profile pages like http://hi.im/fridental. #
  • Does NYC smog consist from marijuana? ;) http://j.mp/iu99r (via @rands) And seriously: I envy people whose craziness looks so noble. #
  • In Web2.0, even the bank account balance is shared to friends: http://whf.me/fridental #
  • HANA-BI läuft jetzt bei @ARTEtv_de #
  • Summer'09 is warmly kissing good bye. So long! You were a mixed bag, Summer, but your sweet candies will help me to wait till we meet again. #
  • Learned 去在店对不起有没有再见。The learning speed reveals my secret plan: to spend next 40 years learning Chinese, and then rule the world. #

Powered by Twitter Tools

This Week in Twitter

Powered by Twitter Tools

This Week in Twitter

Powered by Twitter Tools

This Week in Twitter

Powered by Twitter Tools