Skip to main content

vScriptValSuperellipse

Generate points on a superellipse with separate X and Y amplitudes, an exponent, rotation and scale.

BeginnerMograph / ScriptValScriptValArrayJSON
vScriptValSuperellipse node

vScriptValSuperellipse has no input and outputs an array of XY points on a closed curve in the Z = 0 plane. The exponent moves the shape between a diamond, an ellipse and a rounded rectangle.

Parameters​

ParameterTypeDefaultDescription
Amplitude XFloat0.25Half width of the shape before scale. Minimum 0.001, default 0.25.
Amplitude YFloat0.25Half height of the shape before scale. Minimum 0.001, default 0.25.
ExponentFloat2Shape exponent. 2 gives an ellipse, 1 gives a diamond, larger values approach a rectangle. Clamped to 0.001 or more, default 2.
Sample CountInteger360Number of points sampled over the curve. Clamped to 8 or more, default 360.
RotationFloat0Angle the finished shape is turned around the origin, in degrees. Default 0.
+1 more parameters
ParameterTypeDefaultDescription
ScaleFloat1Multiplier applied to X and Y before rotation. Minimum 0.001, default 1.
Read the full description

The node samples t from 0 to 2 * pi in Sample Count points, including both ends. With p = 2 / Exponent, each point is X = Amplitude X * sign(cos t) * |cos t|^p * Scale and Y = Amplitude Y * sign(sin t) * |sin t|^p * Scale. The point is then rotated around the origin by Rotation and written with Z = 0.

The points satisfy |x / Amplitude X|^Exponent + |y / Amplitude Y|^Exponent = 1 before scale and rotation. An Exponent of 2 gives an ellipse, 1 gives a diamond with straight edges, and larger values move the curve toward a rectangle.

With the defaults (Amplitude X and Y 0.25, Exponent 2, 360 samples, Rotation 0, Scale 1) the output is a circle of radius 0.25. The first and last points are the same point.

Exponent is clamped to 0.001 or more and Sample Count to 8 or more. Points are spaced evenly in the angle t, so they bunch up near the corners when the Exponent is large.

Example Connections​

vScriptValSuperellipse.Output -> vScriptValCameraProjection.ArrayA
vScriptValCameraProjection.Output -> vScriptValShapeRender.ArrayPoint
Background.Output -> vScriptValShapeRender.Input