Marching Squares¶
Dependencies¶
This node requires SkImage library to work.
Functionality¶
This node uses Marching Squares algorithm to find iso-lines of a scalar field, i.e. lines in some plane, for which the scalar field has constant specified value. The lines are generated as mesh - vertices and edges. You can use one of interpolation nodes to build Curve objects from them.
See also¶
Fields-> Scalar Field Graph
Inputs¶
This node has the following inputs:
Field. Scalar field to build iso-curves for. This input can consume a list of scalar fields, or a list of lists of scalar fields. Nesting level of outputs will correspond to nesting level of data in this input. This input is mandatory.
Value. The value, for which the iso-curves should be built. The default value is 1.0.
Samples. Number of samples along X and Y axes. This defines the resolution of curves: the bigger is value, the more vertices will the node generate, and the more precise the curves will be. But higher resolution requires more computation time. The default value is 50.
MinX, MaxX, MinY, MaxY. Minimum and maximum values of X and Y coordinates to find the iso-curves in. Default values define the square
[-1; +1] x [-1; +1]
.Z. The value of Z coordinate to generate the curves at. The default value is 0. So, by default, the node will use the section of scalar field by XOY plane to draw the iso-curves for.
https://gist.github.com/9699442f326876f6af21d8c305a0170c
Matrix. Reference frame to be used. X, Y and Z axes, which are used to section the scalar field, are defined by this matrix. By default, identity matrix is used, which means the global axes will be used.
https://gist.github.com/e5951d94d21dcb16193b985eb139b7da
Parameters¶
This node has the following parameters:
Flat output. If checked, the node will generate a single flat list of objects (iso-curves) for all provided iso-values. Otherwise, the node will generate a separate list of objects for each iso-value. Checked by default.
Make faces. If checked, the node will generate Faces for iso-curves that are closed within specified X/Y bounds. Unchecked by default.
Good results on a single value:
On several values faces are overlapped:
Connect boundary. If checked, the node will connect pieces of the same curve, that was split because it was cut by specified X/Y bounds. Otherwise, several separate pieces will be generated in such case. Checked by default.
Example of usage¶
Build five planes parallel to XOY, and draw iso-lines of scalar field for seven different values:
Fields-> Attractor Field
Number-> Number Range
Number-> List Input
List->List Main-> List Match
Viz-> Viewer Draw
It is hard to colorize values:
https://gist.github.com/96a7575ff899466965d5158bfe5e7301
Generator-> NGon
Generator-> Box
Fields-> Attractor Field
Analyzers-> Bounding Box
Number-> Number Range
Matrix-> Matrix In
Matrix-> Matrix Apply to Mesh
Color-> Color Ramp
List->List Struct-> List First & Last
List-> Filter Empty Objects
List->List Main-> List Length
List->List Struct-> List Repeater
List->List Struct-> List Levels
Scene-> Frame Info
Viz-> Viewer Draw
Text-> Stethoscope