Create a domain.
⇒
Array
dims
: dimensions[dx, dy, dz, ...]
.
Array
dx
: intervals[start_x, end_x]
Number
start_x
: x minNumber
end_x
: x max
Array
dy
: intervals[start_y, end_y]
Number
start_y
: y minNumber
end_y
: y max
Array
dz
: intervals[start_z, end_z]
Number
start_z
: z minNumber
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.
var domain1 = DOMAIN([[0, PI])([32]);
DRAW(domain1);
var domain2 = DOMAIN([[0, PI], [0,1]])([32, 2]);
DRAW(domain2);
var domain3 = DOMAIN([[0, PI], [0,1], [0, 0.5]])([32, 2, 5]);
DRAW(domain3);
Map a domain by a mapping function.
⇒
Function
orArray<Function>
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.
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);
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);
var domain = DOMAIN([[0, 5]])([10]);
var mapping = function (v) { return [v[0], v[0]] };
var model = MAP(mapping)(domain);
DRAW(model);
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);
var domain = DOMAIN([[0, 2*PI]])([36]);
var mapping = function (v) { return [v[0], SIN(V[0])]; };
var model = MAP(mapping)(domain);
DRAW(model1);
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);
var domain = DOMAIN([[0, 2*PI]])([36]);
var mapping = function (v) { return [v[0], COS(V[0])]; };
var model = MAP(mapping)(domain);
DRAW(model1);
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);
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);
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);
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);
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);
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);