]> gitweb.factorcode.org Git - factor.git/blob - extra/math/affine-transforms/affine-transforms-docs.factor
c5ca61d67bf4e67e43d71e581df43d1751be9765
[factor.git] / extra / math / affine-transforms / affine-transforms-docs.factor
1 ! Copyright (C) 2018 Björn Lindqvist
2 ! See https://factorcode.org/license.txt for BSD license
3 USING: help.markup help.syntax kernel literals system ;
4 IN: math.affine-transforms
5
6 ARTICLE: "math.affine-transforms" "Affine Transformations of 2d Vectors"
7 "This vocab provides words for affine transformations of 2d vectors. It can sometimes be more suitable to use the words in this vocab, than setting up the affine transformation matrices manually."
8 { $examples
9   "Creates a 45 degree counter clock-wise rotation matrix and applies it to a vector:"
10   { $example
11     "USING: math.affine-transforms math.functions prettyprint ;\n45 deg>rad <rotation> { 0 4 } a.v ."
12     ! XXX: investigate this windows vs mac/linux difference
13     $[ os windows?
14     "{ -2.8284271247461903 2.8284271247461903 }"
15     "{ -2.82842712474619 2.8284271247461903 }" ? ]
16   }
17   "Applies a combined scaling and translation transform to a vector:"
18   { $example
19     "USING: math.affine-transforms math.functions prettyprint ;\n{ 0 -5 } <translation> 1 2  <scale>  a. { 4 3 } a.v ."
20     "{ 4.0 1.0 }"
21   }
22 } ;
23
24 ABOUT: "math.affine-transforms"