### Translate
### `T(axis)(values)(model)`
Clone `model` and translate the cloned model by `values` along `axis`
#### I/O
> **⇒** `Array` `axis`: an array of `Number` specifying which dimensions translate
>
> **⇐** `Function`: anonymous function
>
> > **⇒** `Array` `values`: an array of `Number` specifying translation quantity for every dimension in `dims`
> >
> > **⇐** `Function`: anonymous function
> >
> > > **⇒** `plasm.Model` or `plasm.Struct` `object`: the object to translate
> > >
> > > **⇐** `plasm.Model` or `plasm.Struct`: the translated object
#### Example
```js
c = CUBE(3)
DRAW(c)
```
```js
c1 = T([1,2])([2,3])(c)
DRAW(c1)
```
### Rotate
### `R(axis)(angle)(model)`
Clone `model` and rotate the cloned model by `angle` on the plane described by `axis`
#### I/O
> **⇒** `Array` `axis`: rotational plane axis (in 3D `[1,2]`, `[1,3]` or `[2,3]`)
>
> **⇐** `Funciton`: an anonymous function
>
> > **⇒** `Number` `angle`: rotational angle (in radiant, from `0` to `2π`)
> >
> > **⇐** `Function`: an anonymous function
> >
> > > **⇒** `plasm.Model` or `plasm.Struct` `object`: the object to rotate
> > >
> > > **⇐** `plasm.Model` or `plasm.Struct`: the rotated object
#### Example
```js
c = CUBE(3)
DRAW(c)
```
```js
c1 = R([1,2])(PI/4)(c)
DRAW(c1)
```
### Scale
### `S(axis)(values)(model)`
Clone `model` and scale the cloned model by `values` along `axis`
#### I/O
> **⇒** `Array` `axis`: axis to scale along
>
> **⇐** `Function`: an anonymous function
>
> > **⇒** `Array` `values`: scaling factors
> >
> > **⇐** `Function`: an anonymous function
> >
> > > **⇒** `plasm.Model` or `plasm.Struct` `object`: the object to scale
> > >
> > > **⇐** `plasm.Model` or `plasm.Struct`: the scaled object
#### Example
```js
c = CUBE(3)
DRAW(c)
```
```js
c1 = S([1,2])([10,15])(c)
DRAW(c1)
```
### Struct
#### `STRUCT(items)`
Create a struct of items.
If a transformation is encountered in items,
it is applied to all of the following items.
#### I/O
> **⇒** `Array` `items`: an array of `Model` or `Struct` or `Function`
>
> **⇐** `Struct`: the struct.
#### Example
```js
var cube1 = CUBE(3);
var t = T([0])([1.5]);
var cube2 = t(cube1);
var struct1 = STRUCT([cube1, cube2]);
DRAW(struct1);
```
```js
var cube1 = CUBE(3);
var t = T([0])([1.5]);
var struct1 = STRUCT([cube1, t, cube1]);
DRAW(struct1);
```
### Extrude
#### `EXTRUDE(quotes)(object)`
Extrude an object
#### I/O
> **⇒** `Array` `quotes`: a list of quotes of extrusion
>
> **⇐** `Function`: an anonimous function
>
> > **⇒** `Model` or `Struct` `object`: the object to extrude
> >
> > **⇐** `Model` or `Struct` the object extruded
#### Example
```js
var model = SIMPLEX(1);
var extruded = EXTRUDE([1])(model);
DRAW(extruded);
```
### Domain
### `DOMAIN(dims)(divs)`
Create a domain.
#### I/O
> **⇒** `Array` `dims`: dimensions `[dx, dy, dz, ...]`.
>
> > `Array` `dx`: intervals `[start_x, end_x]`
> > > `Number` `start_x`: *x* min
> > > `Number` `end_x`: *x* max
> >
> > `Array` `dy`: intervals `[start_y, end_y]`
> > > `Number` `start_y`: *y* min
> > > `Number` `end_y`: *y* max
> >
> > `Array` `dz`: intervals `[start_z, end_z]`
> > > `Number` `start_z`: *z* min
> > > `Number` `end_z`: *z* max
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `divs`: divisions `[nx, ny, nz, ...]`.
> >
> > > `Number` `nx`: division along x axes.
> > > `Number` `ny`: division along y axes.
> > > `Number` `nz`: division along z axes.
> >
> > **⇐** `plasm.Model`: a domain.
#### Example
```js
var domain1 = DOMAIN([[0, PI])([32]);
DRAW(domain1);
```
```js
var domain2 = DOMAIN([[0, PI], [0,1]])([32, 2]);
DRAW(domain2);
```
```js
var domain3 = DOMAIN([[0, PI], [0,1], [0, 0.5]])([32, 2, 5]);
DRAW(domain3);
```
### Map
#### MAP(mapping)(domain)
Map a domain by a mapping function.
#### I/O
> **⇒** `Function` or `Array` mapping: the mapping function or an array of mapping functions
>
> > **⇒** `Array` `v`: point of the domain to map
> >
> > **⇐** `Array`: the mapped point.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `plasm.Model` `domain`: the domain to map.
> >
> > **⇒** `plasm.Model`: the mapped domain.
#### Example
```js
var domain = DOMAIN([[0, 2*PI]])([32]);
var mapping = function (v) { return [SIN(v[0]), COS(v[1])]; });
var model = MAP(mapping)(domain);
DRAW(model);
```
```js
var domain = DOMAIN([[0, 2*PI]])([32]);
var mapping = [
function (v) { return [SIN(v[0])]; },
function (v) { return [COS(v[1])]; }
];
var model = MAP(mapping)(domain);
DRAW(model);
```
- - -
#### Example - Bisector
```js
var domain = DOMAIN([[0, 5]])([10]);
var mapping = function (v) { return [v[0], v[0]] };
var model = MAP(mapping)(domain);
DRAW(model);
```
```js
var domain = DOMAIN([[0, 5]])([10]);
var fx = function (v) { return [v[0]]; };
var fy = function (v) { return [v[0]]; };
mappings = [fx, fy];
var model = MAP(mappings)(domain);
DRAW(model);
```
- - -
#### Example - Sin
```js
var domain = DOMAIN([[0, 2*PI]])([36]);
var mapping = function (v) { return [v[0], SIN(V[0])]; };
var model = MAP(mapping)(domain);
DRAW(model1);
```
```js
var fx = function (v) { return [v[0]]; };
var fy = function (v) { return [SIN(V[0])]; };
var mappings = [fx, fy];
var model = MAP(mappings)(domain);
DRAW(model);
```
- - -
#### Example - Cos
```js
var domain = DOMAIN([[0, 2*PI]])([36]);
var mapping = function (v) { return [v[0], COS(V[0])]; };
var model = MAP(mapping)(domain);
DRAW(model1);
```
```js
var fx = function (v) { return [v[0]]; };
var fy = function (v) { return [COS(V[0])]; };
var mappings = [fx, fy];
var model = MAP(mappings)(domain);
DRAW(model);
```
#### Example - Circle
```js
var domain = DOMAIN([[0, 2*PI]])([36]);
var mapping = function (v) { return [COS(V[0]), SIN(V[0])]; };
var model = MAP(mapping)(domain);
DRAW(model);
```
```js
var domain = DOMAIN([[0, 2*PI]])([36]);
var circle = function (r) {
return function (v) {
return [r * COS(V[0]), r * SIN(V[0])];
};
};
var mapping = circle(3);
var model = MAP(mapping)(domain);
DRAW(model);
```
- - -
#### Example - Sphere
```js
var domain = DOMAIN([[0, PI], [0, 2*PI]])([24,36]);
var mapping = function (v) {
var a = v[0];
var b = v[1];
return [SIN(a)*COS(b), SIN(a)*SIN(b), COS(a)];
};
var model = MAP(mapping)(domain);
DRAW(model);
```
```js
var domain = DOMAIN([[0, PI], [0, 2*PI]])([24,36]);
var sphere = function (r) {
return function (v) {
var a = v[0];
var b = v[1];
return [r*SIN(a)*COS(b), r*SIN(a)*SIN(b), r*COS(a)];
};
};
var mapping = sphere(2);
var model = MAP(mapping)(domain);
DRAW(model);
```
- - -
#### Example - Torus
```js
var domain = DOMAIN([[0, 2*PI],[0, 2*PI]])([36,72]);
var torus = function (R, r) {
return function (v) {
var a = v[0];
var b = v[1];
var u = (r * COS(a) + R) * COS(b);
var v = (r * COS(a) + R) * SIN(b);
var w = (r * SIN(a));
return [u,v,w];
};
};
var mapping = torus(3,1);
var model = MAP(mapping)(domain);
DRAW(model);
```
### Bezier
### `BEZIER(sel)(controlpoints)`
Transfinite mapping function of genric degree Bezier curve.
#### I/O
> **⇒** `Function` `selector`: domain coordinate selector function.
>
> > **⇒** `Array` `v`: point of the `domain`.
> >
> > **⇐** `Number`: the selected coordinate.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `controlpoints`: an array of points and curve mapping functions describing curve control points.
> >
> > **⇐** `Function`: an anonymous mapping function.
#### Example
```js
var domain = INTERVALS(1)(32);
var controls = [[-0,0],[1,0],[1,1],[2,1],[3,1]];
var mapping = BEZIER(S0)(controls);
var curve = MAP(mapping)(domain);
DRAW(curve);
```
```js
var domain = PROD1x1([INTERVALS(1)(16),INTERVALS(1)(16)]);
var c0 = BEZIER(S0)([[0,0,0],[10,0,0]]);
var c1 = BEZIER(S0)([[0,2,0],[8,3,0],[9,2,0]]);
var c2 = BEZIER(S0)([[0,4,1],[7,5,-1],[8,5,1],[12,4,0]]);
var c3 = BEZIER(S0)([[0,6,0],[9,6,3],[10,6,-1]]);
var surface = MAP(BEZIER(S1)([c0,c1,c2,c3]))(domain);
DRAW(surface);
```
### Cubic Hermite
### `CUBIC_HERMITE(selector)(controlpoints)`
Transfinite mapping function of cubic Hermite curve.
#### I/O
> **⇒** `Function` `selector`: domain coordinate selector function.
>
> > **⇒** `Array` `v`: point of the `domain`.
> >
> > **⇐** `Number`: the selected coordinate.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `controlpoints`: an array of points and curve mapping functions describing curve control points.
> >
> > **⇐** `Function`: an anonymous mapping function.
#### Example
```js
var domain = INTERVALS(1)(20);
var controls = [[1,0],[1,1],[ -1, 1],[ 1,0]];
var mapping = CUBIC_HERMITE(S0)(controls);
var curve = MAP(mapping)(domain);
DRAW(curve);
```
```js
var domain = PROD1x1([INTERVALS(1)(14),INTERVALS(1)(14)]);
var c1 = CUBIC_HERMITE(S0)([[1,0,0],[0,1,0],[0,3,0],[-3,0,0]]);
var c2 = CUBIC_HERMITE(S0)([[0.5,0,0],[0,0.5,0],[0,1,0],[-1,0,0]]);
var mapping = CUBIC_HERMITE(S1)([c1,c2,[1,1,1],[-1,-1,-1]]);
var surface = MAP(sur3)(domain);
DRAW(surface);
```
### NUBSpline
### `NUBSLINE(degree)(knots)(controls)`
Non-uniform B-Spline.
#### I/O
> **⇒** `Number` `degree`: spline degree.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `knots`: Array of integer describing spline's knots.
> >
> > **⇐** `Function`: an anonymous function.
> >
> > > **⇒** `Array` `controls`: Array of integer describing spline's control points.
> > >
> > > **⇐** `plasm.Model`: non uniform spline.
#### Example
```js
var controls = [[0,0],[-1,2],[1,4],[2,3],[1,1],[1,2],[2.5,1],[2.5,3],[4,4],[5,0]];
var knots = [0,0,0,0,1,2,3,4,5,6,7,7,7,7];
var nubspline = NUBSPLINE(3)(knots)(controls);
DRAW(nubspline);
```
### NUBS
### `NUBS(sel)(degree)(knots)(controls)`
Transfinite Non-uniform B-Spline.
#### I/O
> **⇒** `Function` `sel`: selctor function.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Number` `degree`: spline degree.
> >
> > **⇐** `Function`: an anonymous function.
> >
> > > **⇒** `Array` `knots`: Array of integer describing spline's knots.
> > >
> > > **⇐** `Function`: an anonymous function.
> > >
> > > > **⇒** `Array` `controls`: Array of integer describing spline's control points.
> > > >
> > > > **⇐** `plasm.Model`: non uniform spline.
#### Example
```js
var domain = INTERVALS(1)(20);
var controls = [[0,0],[-1,2],[1,4],[2,3],[1,1],[1,2],[2.5,1],[2.5,3],[4,4],[5,0]];
var nubs = NUBS(S0)(3)([0,0,0,0,1,2,3,4,5,6,7,7,7,7])(controls);
var model = MAP(nubs)(domain);
DRAW(model);
```
```js
var domain = DOMAIN([[0,1],[0,1]])([30,30]);
var b0 = BEZIER(S0)([[0,0,0],[5,-10,0],[10,0,0]]);
var b1 = BEZIER(S0)([[0,2,0],[8,3,0],[9,2,0]]);
var b2 = BEZIER(S0)([[0,4,1],[7,5,-1],[8,5,1],[12,4,0]]);
var b3 = BEZIER(S0)([[0,6,0],[9,6,3],[10,6,-1]]);
var controls = [b0,b1,b2,b3];
var nubs = NUBS(S1)(3)([0,0,0,0,7,7,7,7])(controls);
var model = MAP(nubs)(domain);
DRAW(model);
```
### NURBSline
### `NURBSLINE(degree)(knots)(controls)`
Non-uniform Rational B-Spline.
#### I/O
> **⇒** `Number` `degree`: spline degree.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `knots`: Array of integer describing spline's knots.
> >
> > **⇐** `Function`: an anonymous function.
> >
> > > **⇒** `Array` `controls`: Array of integer describing spline's control points.
> > >
> > > **⇐** `plasm.Model`: non uniform rational spline.
#### Example
```js
var p = SQRT(2)/2.0;
var controls = [[-1,0,1], [-p,p,p], [0,1,1], [p,p,p], [1,0,1], [p,-p,p], [0,-1,1], [-p,-p,p], [-1,0,1]];
var knots = [0,0,0,1,1,2,2,3,3,4,4,4];
var nurbs = NURBSPLINE(2)(knots)(controls);
DRAW(nurbs);
```
### Spline
### `SPLINE(curve)(controlpoints)`
Create spline curve.
#### I/O
> **⇒** `Function` `curve`: spline curve generator function, such as the result of application of `CUBIC_UBSPLINE` or `CUBIC_CARDINAL` to a domain.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `controlpoints`: an array of points and curve mapping functions describing curve control points.
> >
> > **⇐** `plasm.Struct`: the spline.
#### Example
```js
var domain = INTERVALS(1)(20);
var controlpoints = [[-3,6],[-4,2],[-3,-1],[-1,1],[1.5,1.5],[3,4],[5,5],[7,2],[6,-2],[2,-3]];
var splineCardinal = COLOR([1,0,0])(SPLINE(CUBIC_CARDINAL(domain))(controlpoints));
var splineCubic = COLOR([0,1,0])(SPLINE(CUBIC_UBSPLINE(domain))(controlpoints));
var points = SIMPLICIAL_COMPLEX(controlpoints)([[0],[1],[2],[3],[4],[5],[6],[7],[8],[9]]);
var out = STRUCT([splineCardinal,splineCubic,points]);
DRAW(out);
```
### Cubic Cardinal
### `CUBIC_CARDINAL(domain)`
Tranfinite Cubic cardinal splines curve generator function on `domain`.
#### I/O
> **⇒** `plasm.Model` `domain`: domain of the generator function.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `controlpoints`: an array of points and curve mapping functions describing curve control points.
> >
> > **⇐** `plasm.Model`: a spline segment.
#### Example
```js
var domain = INTERVALS(1)(20);
var controls = [[-3,6],[-4,2],[-3,-1],[-1,1],[1.5,1.5],[3,4],[5,5],[7,2],[6,-2],[2,-3]];
var spline = SPLINE(CUBIC_CARDINAL(domain))(controlpoints);
DRAW(spline);
```
### Cubic UBSpline
### `CUBIC_UBSPLINE(domain)`
Tranfinite cubic uniform B-splines curve generator function on `domain`.
#### I/O
> **⇒** `plasm.Model` `domain`: domain of the generator function.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `controlpoints`: an array of points and curve mapping functions describing curve control points.
> >
> > **⇐** `plasm.Model`: a spline segment.
#### Example
```js
var domain = INTERVALS(1)(20);
var controls = [[-3,6],[-4,2],[-3,-1],[-1,1],[1.5,1.5],[3,4],[5,5],[7,2],[6,-2],[2,-3]];
var spline = SPLINE(CUBIC_UBSPLINE(domain))(controlpoints);
DRAW(spline);
```
### Bezier (surface)
### `BEZIER(sel)(controlpoints)`
Transfinite mapping function of genric degree Bezier surface.
#### I/O
> **⇒** `Function` `selector`: domain coordinate selector function.
>
> > **⇒** `Array` `v`: point of the `domain`.
> >
> > **⇐** `Number`: the selected coordinate.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `controlpoints`: an array of points and curve mapping functions describing curve control points.
> >
> > **⇐** `Function`: an anonymous mapping function.
#### Example
```js
var domain = PROD1x1([INTERVALS(1)(16),INTERVALS(1)(16)]);
var c0 = BEZIER(S0)([[0,0,0],[10,0,0]]);
var c1 = BEZIER(S0)([[0,2,0],[8,3,0],[9,2,0]]);
var c2 = BEZIER(S0)([[0,4,1],[7,5,-1],[8,5,1],[12,4,0]]);
var c3 = BEZIER(S0)([[0,6,0],[9,6,3],[10,6,-1]]);
var surface = MAP(BEZIER(S1)([c0,c1,c2,c3]))(domain);
DRAW(surface);
```
### Cubic Hermite (surface)
### `CUBIC_HERMITE(selector)(controlpoints)`
Transfinite mapping function of cubic Hermite surface.
#### I/O
> **⇒** `Function` `selector`: domain coordinate selector function.
>
> > **⇒** `Array` `v`: point of the `domain`.
> >
> > **⇐** `Number`: the selected coordinate.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `controlpoints`: an array of points and curve mapping functions describing curve control points.
> >
> > **⇐** `Function`: an anonymous mapping function.
#### Example
```js
var domain = PROD1x1([INTERVALS(1)(14),INTERVALS(1)(14)]);
var c1 = CUBIC_HERMITE(S0)([[1,0,0],[0,1,0],[0,3,0],[-3,0,0]]);
var c2 = CUBIC_HERMITE(S0)([[0.5,0,0],[0,0.5,0],[0,1,0],[-1,0,0]]);
var mapping = CUBIC_HERMITE(S1)([c1,c2,[1,1,1],[-1,-1,-1]]);
var surface = MAP(sur3)(domain);
DRAW(surface);
```
### NUBS (surface)
### `NUBS(sel)(degree)(knots)(controls)`
Transfinite Non-uniform B-Spline surface.
#### I/O
> **⇒** `Function` `sel`: selctor function.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Number` `degree`: spline degree.
> >
> > **⇐** `Function`: an anonymous function.
> >
> > > **⇒** `Array` `knots`: Array of integer describing spline's knots.
> > >
> > > **⇐** `Function`: an anonymous function.
> > >
> > > > **⇒** `Array` `controls`: Array of integer describing spline's control points.
> > > >
> > > > **⇐** `plasm.Model`: non uniform spline.
#### Example
```js
var domain = DOMAIN([[0,1],[0,1]])([30,30]);
var b0 = BEZIER(S0)([[0,0,0],[5,-10,0],[10,0,0]]);
var b1 = BEZIER(S0)([[0,2,0],[8,3,0],[9,2,0]]);
var b2 = BEZIER(S0)([[0,4,1],[7,5,-1],[8,5,1],[12,4,0]]);
var b3 = BEZIER(S0)([[0,6,0],[9,6,3],[10,6,-1]]);
var controls = [b0,b1,b2,b3];
var nubs = NUBS(S1)(3)([0,0,0,0,7,7,7,7])(controls);
var model = MAP(nubs)(domain);
DRAW(model);
```
### Ruled surface
### `RULED_SURFACE(profiles)`
Create a ruled surface S mapping between two profile curves A and B (in `profiles`).
The curves can either be a known profile function, like `BEZIER`, or a custom one (see examples).
#### I/O
> **⇒** `Array` `functions`: mapping `Function` of the two curves.
>
> **⇐** `Function`: mapping of the profile ruled surface
#### Example
```js
// Hyperbolic paraboloid
var dom2D = T([0,1])([-1,-1])( PROD1x1([INTERVALS(2)(10),INTERVALS(2)(10)]) );
var funAlfa = function(pt) { return [ pt[0], pt[0], 0 ]; };
var funBeta = function(pt) { return [ 1, -1, pt[0] ]; };
var out = MAP(RULED_SURFACE([funAlfa,funBeta]))(dom2D);
DRAW(out);
```
```js
// Linear interpolation of curves: surface connecting a Bézier curve and a portion of a circle
var dom2D = PROD1x1([INTERVALS(1)(50),INTERVALS(1)(50)]);
var funAlfa = BEZIER(S0)([[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0]]);
var funBeta = function(curveFun) {
return function(pt) {
var pAlfa = curveFun(pt);
return [
COS( PI * (3/2) * pt[0] ) - pAlfa[0],
SIN( PI * (3/2) * pt[0] ) - pAlfa[1],
1 - pAlfa[2]
];
};
};
var mapping = RULED_SURFACE([funAlfa,funBeta(funAlfa)]);
var out = MAP(mapping)(dom2D);
DRAW(out);
```
### Cylindrical surface
### `CYLINDRICAL_SURFACE(profile)(vector)`
Create a specific ruled surface where
`vector` is the direction of the lines
`profile` is the non-complanar section curve
that can be a known profile function (e.g. `BEZIER`, ...)
#### I/O
> **⇒** `Function` `profile`: mapping `Function` of the profile curve.
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Array` `vector`: an array of vector costant components.
> >
> > **⇐** `Function`: mapping of the profile of the cylindrical surface.
#### Example
```js
var domain = PROD1x1([INTERVALS(1)(20),INTERVALS(1)(6)]);
var ncpVector = [0,0,1];
var funProfile = BEZIER(S0)([[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0]]);
var out = MAP(CYLINDRICAL_SURFACE(funProfile)(ncpVector))(domain);
DRAW(out);
```
### Conical surface
### `CONICAL_SURFACE(apex)(profile)`
Create a conical surface between a vertex (`apex`) and a `profile` curve.
The curve can be a known profile function, like `BEZIER`, or a custom one.
#### I/O
> **⇒** `Array` `apex`: the cone's vertex (an array of coordinates).
>
> **⇐** `Function`: an anonymous function.
>
> > **⇒** `Function` `profile`: mapping `Function` of the profile curve.
> >
> > **⇐** `Function`: mapping of the profile of the conical surface.
#### Example
```js
var domain = PROD1x1([INTERVALS(1)(20),INTERVALS(1)(6)]);
var apex = [0,0,1];
var funProfile = BEZIER(S0)([[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0]]);
var out = MAP(CONICAL_SURFACE(apex)(funProfile))(domain);
DRAW(out);
```
## Rotational surface
### `ROTATIONAL_SURFACE(profile)`
Create a rotational surface mapping given the mapping of the profile to rotate.
#### I/O
> **⇒** `Function` `profile`: mapping of the profile to rotate.
>
> **⇐** `Function`: mapping of the rotational surface
#### Example
```js
var domain = DOMAIN([[0,1],[0,2*PI]])([20,20]);
var profile = BEZIER(S0)([[0,0,0],[3,0,3],[3,0,5],[0,0,7]]);
var mapping = ROTATIONAL_SURFACE(profile);
var surface = MAP(mapping)(domain);
```
### Profileprod surface
### `PROFILEPROD_SURFACE(profiles)`
Create a surface S mapping as profile product between two plane curves A and B (in `profiles`)
#### I/O
> **⇒** `Array` `profiles`: mapping `Function` of the two plane curves profile to product.
>
> **⇐** `Function`: mapping of the profile product surface
#### Example
```js
var domain_1 = INTERVALS(1)(32);
var domain_2 = PROD1x1([INTERVALS(1)(16),INTERVALS(1)(16)]); // DOMAIN([[0,1],[0,1]])([20,20]);
var controls_a = [[0,0,0],[2,0,0],[0,0,4],[1,0,5]];
var mapping_a = BEZIER(S0)(controls_a);
var curve_a = MAP(mapping_a)(domain1);
DRAW(COLOR([1,0,1])(curve0));
var controls_b = [[0,0,0],[3,-0.5,0],[3,3.5,0],[0,3,0]];
var mapping_b = BEZIER(S1)(controls_b);
var curve_b = MAP(mapping_b)(domain_1);
DRAW(COLOR([1,1,0])(curve_b));
var mapping_b0 = BEZIER(S0)(controls_b);
var curve_b0 = MAP(mapping_b0)(domain_1);
DRAW(COLOR([1,1,0])(curve_b));
var mapping_c = PROFILEPROD_SURFACE([mapping_a,mapping_b]);
var surface = MAP(mapping_c)(domain_2);
DRAW(surface);
```
### Coons patch
### `COONS_PATCH(controlpoints)`
Mapping function of a Coons Patch.
#### I/O
> **⇒** `Array` `controlcurves`: an array of curves mapping functions describing surface's boundaries
>
> **⇐** `Function`: an anonymous mapping function.
#### Example
```js
var dom1D = INTERVALS(1)(32);
var dom2D = PROD1x1([INTERVALS(1)(16),INTERVALS(1)(16)]);
var Su0 = BEZIER(S0)([[0,0,0],[10,0,0]]);
var curve0 = MAP(Su0)(dom1D);
DRAW(curve0);
var Su1 = BEZIER(S0)([[0,10,0],[2.5,10,3],[5,10,-3],[7.5,10,3],[10,10,0]]);
var curve1 = MAP(Su1)(dom1D);
DRAW(curve1);
var control2 = [[0,0,0],[0,0,3],[0,10,3],[0,10,0]];
var Sv0 = BEZIER(S1)(control2);
var curve2 = MAP(BEZIER(S0)(control2))(dom1D);
DRAW(curve2);
var control3 = [[10,0,0],[10,5,3],[10,10,0]];
var Sv1 = BEZIER(S1)(control3);
var curve3 = MAP( BEZIER(S0)(control3))(dom1D);
DRAW(curve3);
var out = MAP(COONS_PATCH([Su0,Su1,Sv0,Sv1]))(dom2D);
DRAW(out);
```
### Triangle domain
### `TRIANGLE_DOMAIN(n, points)`
Create a triangle domain using three points as vertices. Every edge is subdivided in n parts.
#### I/O
> **⇒** `Number` `n`: number of subdivisions for every edge
> **⇒** `Array` `points`: an array of points, represented as arrays of coordinates.
>
> **⇐** `plasm.Model`: a triangle domain.
#### Example
```js
var domTRI = TRIANGLE_DOMAIN(32, [[1,0,0],[0,1,0],[0,0,1]]);
DRAW(domTRI);
DRAW(SKELETON(1)(domTRI));
```
### Triangular Coons patch
### `TRIANGULAR_COONS_PATCH(controlcurves)`
Create a triangular Coons patch interpolating three control curves
#### I/O
> **⇒** `Array` `curves`: an array of three curves
>
> **⇐** instance of `plasm.Model`: a triangular Coons patch.
#### Example
```js
var dom1D = INTERVALS(1)(32);
var dom2D = TRIANGLE_DOMAIN(32, [[1,0,0],[0,1,0],[0,0,1]]);
var Cab0 = BEZIER(S0)([[10,0,0],[6,0,3],[3,0,3],[0,0,0]]);
DRAW(MAP(Cab0)(dom1D));
var Cbc0 = BEZIER(S0)([[10,0,0],[10,2,4],[8,8,-4],[2,10,4],[0,10,0]]);
var Cbc1 = BEZIER(S1)([[10,0,0],[10,2,4],[8,8,-4],[2,10,4],[0,10,0]]);
DRAW(MAP(Cbc0)(dom1D));
var Cca0 = BEZIER(S0)([[0,10,0],[0,6,-5],[0,3,5],[0,0,0]]);
DRAW(MAP(Cca0)(dom1D));
var out = MAP(TRIANGULAR_COONS_PATCH([Cab0,Cbc1,Cca0]))(dom2D);
DRAW(out);
DRAW(SKELETON(1)(out));
```
```js
var dom1D = INTERVALS(1)(32);
var dom2D = TRIANGLE_DOMAIN(32, [[1,0,0],[0,1,0],[0,0,1]]);
var Cab0 = BEZIER(S0)([[0,2,0],[-2,2,0],[-2,0,0],[-2,-2,0],[0,-2,0]]);
DRAW(MAP(Cab0)(dom1D));
var Cbc0 = BEZIER(S0)([[0,2,0],[-1,2,0],[-1,1,1],[-1,0,2],[0,0,2]]);
var Cbc1 = BEZIER(S1)([[0,2,0],[-1,2,0],[-1,1,1],[-1,0,2],[0,0,2]]);
DRAW(MAP(Cbc0)(dom1D));
var Cca0 = BEZIER(S0)([[0,0,2],[-1,0,2],[-1,-1,1],[-1,-2,0],[0,-2,0]]);
DRAW(MAP(Cca0)(dom1D));
var out1 = MAP(TRIANGULAR_COONS_PATCH([Cab0,Cbc1,Cca0]))(dom2D);
DRAW(out1);
DRAW(SKELETON(1)(out1));
var Cab0 = BEZIER(S0)([[0,-2,0],[2,-2,0],[2,0,0],[2,2,0],[0,2,0]]);
DRAW(MAP(Cab0)(dom1D));
var Cbc0 = BEZIER(S0)([[0,-2,0],[1,-2,0],[1,-1,1],[1,0,2],[0,0,2]]);
var Cbc1 = BEZIER(S1)([[0,-2,0],[1,-2,0],[1,-1,1],[1,0,2],[0,0,2]]);
DRAW(MAP(Cbc0)(dom1D));
var Cca0 = BEZIER(S0)([[0,0,2],[1,0,2],[1,1,1],[1,2,0],[0,2,0]]);
DRAW(MAP(Cca0)(dom1D));
var out2 = MAP(TRIANGULAR_COONS_PATCH([Cab0,Cbc1,Cca0]))(dom2D);
DRAW(out2);
DRAW(SKELETON(1)(out2));
```