Parasol Framework
  • Gallery
  • API
  • Wiki
  • GitHub
    • Audio
    • Core
    • Display
    • Fluid
    • Font
    • Network
    • Vector
    • Audio
    • Sound
    • File
    • MetaClass
    • Module
    • StorageDevice
    • Task
    • Thread
    • Time
    • Compression
    • Config
    • Script
    • XML
    • Controller
    • BlurFX
    • ColourFX
    • CompositeFX
    • ConvolveFX
    • DisplacementFX
    • FilterEffect
    • FloodFX
    • ImageFX
    • LightingFX
    • MergeFX
    • MorphologyFX
    • OffsetFX
    • RemapFX
    • SourceFX
    • TurbulenceFX
    • WaveFunctionFX
    • Scintilla
    • ScintillaSearch
    • Bitmap
    • Clipboard
    • Display
    • Document
    • Font
    • Picture
    • Pointer
    • Surface
    • SVG
    • ClientSocket
    • HTTP
    • NetSocket
    • Proxy
    • Vector
    • VectorClip
    • VectorColour
    • VectorEllipse
    • VectorFilter
    • VectorGradient
    • VectorGroup
    • VectorImage
    • VectorPath
    • VectorPattern
    • VectorPolygon
    • VectorRectangle
    • VectorScene
    • VectorShape
    • VectorSpiral
    • VectorText
    • VectorTransition
    • VectorViewport
    • VectorWave

VectorShape Class

Extends the Vector class with support for the Superformula algorithm.

The VectorShape class extends the Vector class with support for generating paths with the Superformula algorithm by Johan Gielis. This feature is not part of the SVG standard and therefore should not be used in cases where SVG compliance is a strict requirement.

The Superformula is documented in detail at Wikipedia: http://en.wikipedia.org/wiki/Superformula

Structure

The VectorShape class consists of the following fields:

Access
NameTypeComment
  ADOUBLEA parameter for the Superformula.

This field sets the Superformula's 'A' parameter value.

  BDOUBLEA parameter for the Superformula.

This field sets the Superformula's 'B' parameter value.

  CenterXDOUBLEThe center of the shape on the x-axis. Expressed as a fixed or scaled coordinate.

The horizontal center of the shape is defined here as either a fixed or scaled value.

  CenterYDOUBLEThe center of the shape on the y-axis. Expressed as a fixed or scaled coordinate.

The vertical center of the shape is defined here as either a fixed or scaled value.

  CloseINTA parameter for the super shape algorithm.

If TRUE, the shape path will be closed between the beginning and end points.

  DimensionsINTDimension flags define whether individual dimension fields contain fixed or scaled values.

The following dimension flags are supported:

NameDescription
FIXED_CENTER_XThe CenterX value is a fixed coordinate.
FIXED_CENTER_YThe CenterY value is a fixed coordinate.
FIXED_RADIUSThe Radius value is a fixed coordinate.
SCALED_CENTER_XThe CenterX value is a scaled coordinate.
SCALED_CENTER_YThe CenterY value is a scaled coordinate.
SCALED_RADIUSThe Radius value is a scaled coordinate.
  MDOUBLEA parameter for the Superformula.

This field sets the Superformula's 'M' parameter value.

  ModINTA special modification parameter that alters the super shape algorithm.

The Mod field alters the super shape algorithm, sometimes in radical ways that allow entirely new shapes to be discovered in the super shape library. The value that is specified will result in a formula being applied to the generated 'r' value. Possible values and their effects are:

NameDescription
0Default
1exp(r)
2log(r)
3atan(r)
4exp(1.0/r)
51+cos(r)^2
6sin(r)^2
71+sin(r)^2
8cos(r)^2
  N1DOUBLEA parameter for the super shape algorithm.

This field sets the Superformula's 'N1' parameter value.

  N2DOUBLEA parameter for the super shape algorithm.

This field sets the Superformula's 'N2' parameter value.

  N3DOUBLEA parameter for the super shape algorithm.

This field sets the Superformula's 'N3' parameter value.

  PhiDOUBLEA parameter for the super shape algorithm.

The Phi value has an impact on the length of the generated path. If the super shape parameters form a circular path (whereby the last vertex meets the first) then the Phi value should not be modified. If the path does not meet itself then the Phi value should be increased until it does. The minimum (and default) value is 2. It is recommended that the Phi value is increased in increments of 2 until the desired effect is achieved.

  RadiusDOUBLEThe radius of the generated shape. Expressed as a fixed or scaled coordinate.

The Radius defines the final size of the generated shape. It can be expressed in fixed or scaled terms.

  RepeatINTRepeat the generated shape multiple times.

If set to a value greater than one, the Repeat field will cause the generated shape to be replicated multiple times at consistent intervals leading to the center point.

The Repeat value cannot be set in conjunction with Spiral.

  SpiralINTAlters the generated super shape so that it forms a spiral.

Setting the Spiral field to a value greater than one will cause the path generator to form spirals, up to the value specified. For instance, a value of 5 will generate five spirals.

  VerticesINTLimits the total number of vertices generated for the super shape.

Setting a value in Vertices will limit the total number of vertices that are generated for the super shape. This feature is useful for generating common convex geometrical shapes such as triangles, polygons, hexagons and so forth; because their vertices will always touch the sides of an elliptical area.

VectorShape class documentation © Paul Manias © 2010-2025