twak / chordatlas

data driven urban procedural modeling

Home Page:http://www.twak.co.uk/2018/09/frankengan-guided-detail-synthesis-for.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling Dataset - in tweed.xml, what is toOrigin and fromOrigin?

leekkww opened this issue · comments

I'm currently trying to compile my own dataset, which is not too well documented, so this is sort of a clarification issue.

I'm trying to understand how tweed.xml came to be from the GML file. From the glasgow dataset, I deleted all the files other than the gis.gml file, and then I created a new "world" with File -> New and then choosing the GML file. I didn't see anything show up in chordatlas (black screen with no complaints), and if I hit Save, the tweed.xml file is fairly empty. In order to understand what I need, I started to slowly copy things over from the tweed.xml provided in the dataset.

It seems that a few things are needed in the tweed.xml file in order for the scene to properly show up:

  • a <trans> tag, which I'm guessing is the transformation of the map with respect to lat and long. This value can sort of inferred from the boundedBy tag of the GML file. (I can just take the average value of the boundedBy tags and that seems to be close enough.)

  • a <gmlCoordSystem> tag, specifying what version of the GML coordinate system we are using. This is also inferable from the GML file.

  • a <genList>, where inside is a <org.twak.tweed.gen.GISGen> object that specifies where the GML file is. This is easily doable.

  • finally, a set of two 4x4 matrices <fromOrigin> and <toOrigin>. This is where I'm getting confused - what exactly are these matrices? A quick check shows that they are inverses of each other, but I was wondering if there is a way that they are computed.

The GML should show up - but the system does have to guess how to position it in space (it searches for a hard-coded String in the GML file). Perhaps there's a bug. Can you send the GML file?

The tweed.xml is a serialized version of the org.twak.tweed.TweedSettings class. toOrigin is the inverse of fromOrigin, and contains a transform to move the GML data to the origin in a DefaultGeocentricCRS.CARTESIAN coordinate system. Details here.

<genList> is the list of layers (gml, minimesh etc...). The GML one of these GISGen.

It is generally best to try and build a tweed.xml by adding layers using the + button in the user interface.

Woah! I didn't realize that you can add a GML layer with the + button. I've just been adding it with File->New->selecting the GML file, and that doesn't make the GML file show up. The GML file is loaded now that I used +, thank you!

I see that the system guesses the position of the GML in space using info in the GML file. Just wondering, how does that work with obj meshes that you import? Are the obj meshes imported in arbitrary locations?

Also, how does the system link the GML data with minimesh? Is there a mapping from GML polygon -> all related meshes somewhere in the Glasgow dataset?

Obj meshes are imported in their "native" coordinate systems. Usually (unlike GML CRSes) these are near the origin.

There is no direct link between the GML data and the minimesh because the mesh is typically in an arbitrary CRS. You have to align the mesh using the align tool:

  • select the minimesh in the list of layers (Gens)
  • select the align tool
  • right-click in the 3d view 4 times: twice on the map/GML data and twice on the mesh. The tool will align these two points
  • remember to save alignment (this writes out the new coordinate system to the minimesh's index.xml file. This ensures the transform exists after you re-load the project