You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

kyle

Trainee

  • "kyle" started this thread

Posts: 71

Location: Grand Rapids, Michigan, USA

  • Send private message

1

Friday, December 31st 2010, 8:31pm

Howto: Automatically create point hotspots from polygonal hotspots for krpanojs

I have used polygonal hotspots for my real estate tours. Since krpanojs does not support polygonal hotspots I wanted to automatically create point hotspots when a tour is viewed on iPad/iPhone.

From the formula described in this wikipedia article, I was able to write a function to calculate the centroid (center of mass) of a polygon and use that point for iPad/iPhone.

I wrote it in Python using language features that are not common among most programming languages, so I won't post it here because I would have to explain Python before explaining the function. The formula isn't very difficult though, so an average programmer should be able to easily complete it in under an hour.

The formula is meant for two-dimensional polygons, but seems to work well for krpano pan/tilt polygons. It works across the horizon and at the 0º meridian, but you need to make a few adjustments for the -180º/180º meridian. Also, polygons covering the poles (at tilt -90º/90º), may not be accurate, but it is not likely to have a polygon covering a pole so I did not handle this case.

VN2009

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

2

Friday, December 31st 2010, 9:45pm

this has already been requested and there is a working krpano action to gain this result. If Krpano = The Matrix then Pinsane, Michel and Klaus are all Neo's !

Find polygon center coordinates?

kyle

Trainee

  • "kyle" started this thread

Posts: 71

Location: Grand Rapids, Michigan, USA

  • Send private message

3

Wednesday, January 5th 2011, 12:08am

Ah, thanks. I haven't been on the forums much since May when I got a new job, so I've been missing out on some of the better threads.

Coming back to the forums recently, I was very impressed with pinsane taking the time to thoroughly document variables, parameters, and expansion in krpano. I've struggled through those issues myself and more or less drew the same conclusions, but it is very nice to see it methodically examined and documented.