<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/geo.regionAffineTransform.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>geo.regionAffineTransform</api:function-name><api:suggest>geo.regionaffinetransform</api:suggest><api:suggest>geo</api:suggest><api:suggest>regionaffinetransform</api:suggest><api:function-link mode="xquery" fullname="geo:region-affine-transform">/apidoc/8.0/geo:region-affine-transform.xml</api:function-link><api:function mode="javascript" name="regionAffineTransform" type="builtin" lib="geo" category="SearchBuiltins" subcategory="Geospatial Operations" hidden="false" bucket="MarkLogic Built-In Functions" prefix="geo" namespace="http://marklogic.com/geospatial" fullname="geo.regionAffineTransform"><api:summary>
Perform an affine transformation on a geospatial region. The transformation is always applied in the raw coordinate system (Cartesian). 
</api:summary><api:params><api:param name="region" type="cts:region"><api:param-description>
  </api:param-description><api:param-name>region</api:param-name><api:param-type>cts.region</api:param-type></api:param><api:param name="transform" type="map:map*"><api:param-description>
  A sequence of maps that specify the transformation to apply. Each map 
  should contain at least one of the following transform specifications:
  <dl xmlns="http://www.w3.org/1999/xhtml">
  <dt><code>translation</code></dt>
  <dd>Translate the points of the region by the given amount in the x and y
  coordinates. The value is a map with the following keys:
    <dl>
    <dt><code>tx</code></dt><dd>Amount to shift the points in the x direction. (Required.)</dd>
    <dt><code>ty</code></dt><dd>Amount to shift the points in the y direction. (Required.)</dd>
    </dl>
  </dd>
  <dt><code>scaling</code></dt>
  <dd>Scale the points of the region by the given amount of the x and y
  coordinates. The value is a map with the following keys:
    <dl>
    <dt><code>sx</code></dt><dd>Amount to scale the points in the x direction. (Required.)</dd>
    <dt><code>sy</code></dt><dd>Amount to scale the points in the y direction. (Required.)</dd>
    <dt><code>psc</code></dt><dd>Point to scale relative to. (Optional. Default is the origin.)</dd>
    </dl>
  </dd>
  <dt><code>rotation</code></dt>
  <dd>Rotate the points of the region by the given angle.
  The value is a map with the following keys:
    <dl>
    <dt><code>angle</code></dt><dd>Amount to rotate the points (radians). (Required.)</dd>
    <dt><code>prot</code></dt><dd>Point to rotate relative to. (Optional. Default is the origin.)</dd>
    </dl>
  </dd>
  <dt><code>shearing</code></dt>
  <dd>Shear the points of the region by the given amounts.
  The value is a map with the following keys:
    <dl>
    <dt><code>shxy</code></dt><dd>Amount of shearing due to x in y direction. (Required.)</dd>
    <dt><code>shyx</code></dt><dd>Amount of shearing due to y in x direction. (Required.)</dd>
    </dl>
  </dd>
  <dt><code>reflection</code></dt>
  <dd>Reflect the points of the region around a line or a point.
  The value is a map with the following keys:
    <dl>
    <dt><code>lineR</code></dt><dd>Line of reflection.</dd>
    <dt><code>pref</code></dt><dd>Point to reflect points around. The value 
    is a map with the following keys:
      <dl>
      <dt><code>start</code></dt><dd>The starting point of the line.</dd>
      <dt><code>end</code></dt><dd>The ending point of the line.</dd>
      </dl>
    </dd>
    </dl>
    Exactly of <code>lineR</code> or <code>pref</code> must be specified.
  </dd>
  </dl>
  If no transform specifications are provided, the points are transformed by the identity transform. That is, they remain unchanged.
  </api:param-description><api:param-name>transform</api:param-name><api:param-type>Object[]</api:param-type></api:param><api:param name="options" type="xs:string*" optional="true"><api:param-description>
  Geospatial options that affect the transformation. Currently there are no 
  relevant options.
  </api:param-description><api:param-name>options</api:param-name><api:param-type>String[]</api:param-type></api:param></api:params><api:return>cts.region</api:return><api:usage>
<p xmlns="http://www.w3.org/1999/xhtml">The ordering of transformations applied makes a difference. For example,
scaling the point (1,1) by x=2 and y=3 and then translating it by x=1 and y=1 
gives us the point (4,4). But translating it by x=1 and y=1 and then scaling
it by x=2 and y=3 gives us (4,5). When multiple transformation are mentioned 
in a single map, the ordering is: translation, scaling, rotation, shearing,
and then reflection. In general it is better to put separate transformations 
in separate maps in the sequence so there is no confusion. Transforms in the
sequence are applied in order.
</p>
</api:usage><api:example>
(: Reflection about the line from point (2.5,0) to point (2.5,2.0) :)
geo:region-affine-transform(
  cts:polygon((
    cts:point(1.5,0),cts:point(2.5,1),cts:point(1.5,2),
    cts:point(0.5,2),cts:point(0.5,0),cts:point(1.5,0))),
  xdmp:from-json-string('
    {reflection: { lineR: {start: [2.5,0], end:[2.5,2.0]} }
  }')) =&gt;
3.5,0 2.5,1 3.5,2 4.5,2 4.5,0 3.5,0

</api:example></api:function></api:function-page>