Namespace JXG.Math.Tiling
↳ JXG.Math.Tiling
Defined in: tiling.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
The JXG.Math.Tiling namespace.
|
| Field Attributes | Field Name and Description |
|---|---|
| <static> |
JXG.Math.Tiling.rectangulation
Rectangulate (partition it into rectangles) a given two dimensional domain.
|
| <static> |
JXG.Math.Tiling.triangulation
Triangulate (partition it into triangles) a given two dimensional domain.
|
Field Detail
<static>
JXG.Math.Tiling.rectangulation
Rectangulate (partition it into rectangles) a given two dimensional domain.
The number of rectangles the original rectangle is divided into depends on the parameters stepsU and stepsV.
Input are the ranges of u and v, as well as stepsU and stepsV which are static.
var rg = board.create('slider', [[-7, -7], [3, -7], [1, 4, 5]], { name: 'rg' });
var box = [-5, 5];
var view = board.create('view3d',
[[-5, -3], [8, 8],
[box, box, box]],
{
projection: 'central',
// axesPosition: 'center',
xPlaneRear: { visible: false },
yPlaneRear: { visible: false },
zPlaneRear: { visible: false }
});
var range = [() => -rg.Value(), () => rg.Value()],
stepsU = 15,
stepsV = 5,
F = (x, y) => [x, y, 3 * Math.sin(Math.sqrt(x ** 2 + y ** 2))];
view.setView(0, Math.PI / 2); // Set view from above
var el = { F: F }; // Fake surface3d element
var surface = JXG.Math.Tiling.rectangulation(el, range, range, stepsU, stepsV);
var pol = view.create('polyhedron3d', surface, {
shader: {
enabled: true,
light: {
dir: 0
}
},
fillColorArray: ['white'],
fillOpacity: 0.9,
strokeWidth: 0.2
});
<static>
JXG.Math.Tiling.triangulation
Triangulate (partition it into triangles) a given two dimensional domain.
The number of triangles the original rectangle is divided into depends on the parameters stepsU and stepsV.
Input are the ranges of u and v, as well as stepsU and stepsV which are static.
If the optional parameter stepsV is not given or is equal to 0, the rectangle is partitioned into
nearly equilateral triangles.
Otherwise, the shape of the triangles depends on the ratio of stepsU / stepsV.
var rg = board.create('slider', [[-7, -7], [3, -7], [1, 4, 5]], { name: 'rg' }); // range
var box = [-5, 5];
var view = board.create('view3d',
[[-5, -3], [8, 8],
[box, box, box]],
{
projection: 'central',
xPlaneRear: { visible: false },
yPlaneRear: { visible: false },
zPlaneRear: { visible: false }
});
var range = [() => -rg.Value(), () => rg.Value()],
stepsU = 25,
// stepsV = 25,
F = (x, y) => [x, y, 3 * Math.sin(Math.sqrt(x ** 2 + y ** 2))];
view.setView(0, Math.PI / 2); // Set view from above
var el = { F: F }; // Fake surface3d element
// stepsV not supplied -> approx. equilater triangles
var surface = JXG.Math.Tiling.triangulation(el, range, range, stepsU);
var pol = view.create('polyhedron3d', surface, {
shader: {
enabled: true,
light: {
dir: 0
}
},
fillColorArray: ['white'],
fillOpacity: 0.9,
strokeWidth: 0.2
});