Maplat Tin library
This is part of Maplat project.
The easiest way to install maplat_tin is with
npm install @maplat/tin
How to use (node.js case)
var Tin = ;var tin =wh: 500 500yaxisMode: TinYAXIS_FOLLOW;tin;tin;
wh (method: setWh)
Set width and height of the first coordinate system.
NOTE: If setWh was called, TIN network is reset. So need to call updateTinAsync() again.
Set Tin.YAXIS_FOLLOW if the y coordinate of the first coordinate system is the same as the direction of the y axis of the second coordinate system, and set Tin.YAXIS_INVERT if it is in the opposite direction.
Default value is Tin.YAXIS_INVERT.
points (method: setPoints)
A set of corresponding points in the first coordinate system and the second coordinate system is specified as an array. Minimum 3 points required. Also, if the alignment of points is too linear, TIN can not be calculated at updateTinAsync and an error occurs.
NOTE: If setPoints was called, TIN network is reset. So need to call updateTinAsync() again.
Return value is Promise. Calcurate TIN asynchronously. Before calling transform, this method needs to be completed.
Convert the coordinates. If the value of inverse is false, the direction of conversion is from the first coordinate system to the second one, if it is true, the direction of conversion is reverse direction.
Confirm after completion of updateTinAsync(). When the value is Tin.STATUS_STRICT, bijection conversion is guaranteed. In the case of Tin.STATUS_LOOSE it is not guaranteed.