webvmt / community-group

WebVMT Community Group
Other
6 stars 1 forks source link

Deforming region support #5

Open rjksmith opened 3 years ago

rjksmith commented 3 years ago

A deforming region is one whose boundary includes vertices that change location over time relative to each other. An oil slick is a real world example of this.

Such features can be represented using WebVMT with the interpolation enhancement proposed at TPAC 2020. As a simple example:

WEBVMT

NOTE Start with isosceles triangle at t = 1
     Deform to right-angled triangle at t = 5
     First two points remain static, third point changes

00:00:01.000 —> 00:00:05.000
{"polygon": {"points": [
  {"lat": 50.0, "lng": 0.1},
  {"lat": 50.0, "lng": 0.5},
  {"lat": 50.4, "lng": 0.3}
]}}
{"interp": {"to": {"points": [
  {"lat": 50.0, "lng": 0.1},
  {"lat": 50.0, "lng": 0.5},
  {"lat": 50.4, "lng": 0.1}
]}}}

cc @mahmsakr

mahmsakr commented 3 years ago

This solves a special case of deforming regions, where it is guaranteed that the number and the ordering of the region vertices remains the same across snapshots.
A "general" deforming region would change location, shape, number of vertices, and even number of faces and holes. For example an oil spill may be decomposed into multiple smaller spills.

rjksmith commented 3 years ago

I agree - the number and order of vertices must be the same. However, this special case can be generalised as follows.

Generalised Deforming Region Without Holes

Consider two consecutive observations of a deforming region at times A and B. For simplicity, assume there are no holes, though this method can be extended to include them too.

  1. To deform the region smoothly, a one-to-one mapping must be created between the vertices at time A and those at time B.
  2. By definition, vertices are ordered consecutively around each region's perimeter.
  3. In the special case where both observations have an equal number of vertices, the same start vertex can be chosen at times A and B without loss of generalisation. Hence, the vertices are in the same order and can be successfully deformed by interpolation.
  4. If the observations have different numbers of vertices, the best one-to-one mapping can be chosen from a subset and then extra 'redundant' vertices, i.e. concurrent with the face between two vertices, can be inserted so both observations have an equal number of vertices and proceed as above.
    
    WEBVMT

NOTE Start with isosceles triangle at t = 1 Deform to square at t = 5 Include redundant second point at t = 1 for deforming region First & third points change, second & fourth remain static

00:00:01.000 —> 00:00:05.000 {"polygon": {"points": [ {"lat": 50.0, "lng": 0.1}, {"lat": 50.0, "lng": 0.3}, {"lat": 50.0, "lng": 0.5}, {"lat": 50.4, "lng": 0.3} ]}} {"interp": {"to": {"points": [ {"lat": 50.2, "lng": 0.1}, {"lat": 50.0, "lng": 0.3}, {"lat": 50.2, "lng": 0.5}, {"lat": 50.4, "lng": 0.3} ]}}}



**Generalised Deforming Region With Holes**

WebVMT does not currently support holes in regions, but this feature would be simple to add and could support deforming regions using a similar method to that above. In this case, both regions must have the same number of holes though 'redundant' holes, i.e. a hole where all vertices are concurrent, could be inserted to support events when existing holes close or new holes open.