Shape Functions

Home • Gallery • Tutorials • Download • Purchase • Site Map
 

Shape Functions Support

The Fractal Science Kit fractal generator Shape functions are used to define geometric shapes and/or transformations.

Complex Shape.Value(type, z)

Shape.Value(type,z) returns a real value for the shape given by type, and the point z. type is one of the values from the ShapeTypes enum. Shape.Value is used internally by the CurveTrap Functions to support shape related processing.

You can access the list of types by including the following statement in your properties section:

#include ShapeTypes

The ShapeTypes enum is defined in the built-in macros as:

#define ShapeTypes

enum ShapeTypes {
  TriangleA, "Triangle A"
  TriangleB, "Triangle B"
  TriangleC, "Triangle C"
  TriangleD, "Triangle D"
  Square, "Square"
  Diamond, "Diamond"
  HexagonA, "Hexagon A"
  HexagonB, "Hexagon B"
  OctagonA, "Octagon A"
  OctagonB, "Octagon B"
  Circle, "Circle"
  Star3A, "Star 3A"
  Star3B, "Star 3B"
  Star4A, "Star 4A"
  Star4B, "Star 4B"
  Star5A, "Star 5A"
  Star5B, "Star 5B"
  Star6A, "Star 6A"
  Star6B, "Star 6B"
  Star7A, "Star 7A"
  Star7B, "Star 7B"
  Star8A, "Star 8A"
  Star8B, "Star 8B"
  RoundedStar3A, "Rounded Star 3A"
  RoundedStar3B, "Rounded Star 3B"
  RoundedStar4A, "Rounded Star 4A"
  RoundedStar4B, "Rounded Star 4B"
  RoundedStar5A, "Rounded Star 5A"
  RoundedStar5B, "Rounded Star 5B"
  RoundedStar6A, "Rounded Star 6A"
  RoundedStar6B, "Rounded Star 6B"
  RoundedStar7A, "Rounded Star 7A"
  RoundedStar7B, "Rounded Star 7B"
  RoundedStar8A, "Rounded Star 8A"
  RoundedStar8B, "Rounded Star 8B"
  SharpStar3A, "Sharp Star 3A"
  SharpStar3B, "Sharp Star 3B"
  SharpStar4A, "Sharp Star 4A"
  SharpStar4B, "Sharp Star 4B"
  SharpStar5A, "Sharp Star 5A"
  SharpStar5B, "Sharp Star 5B"
  SharpStar6A, "Sharp Star 6A"
  SharpStar6B, "Sharp Star 6B"
  SharpStar7A, "Sharp Star 7A"
  SharpStar7B, "Sharp Star 7B"
  SharpStar8A, "Sharp Star 8A"
  SharpStar8B, "Sharp Star 8B"
  SpikedStar3A, "Spiked Star 3A"
  SpikedStar3B, "Spiked Star 3B"
  SpikedStar4A, "Spiked Star 4A"
  SpikedStar4B, "Spiked Star 4B"
  SpikedStar5A, "Spiked Star 5A"
  SpikedStar5B, "Spiked Star 5B"
  SpikedStar6A, "Spiked Star 6A"
  SpikedStar6B, "Spiked Star 6B"
  SpikedStar7A, "Spiked Star 7A"
  SpikedStar7B, "Spiked Star 7B"
  SpikedStar8A, "Spiked Star 8A"
  SpikedStar8B, "Spiked Star 8B"
  Nova3A, "Nova 3A"
  Nova3B, "Nova 3B"
  Nova4A, "Nova 4A"
  Nova4B, "Nova 4B"
  Nova5A, "Nova 5A"
  Nova5B, "Nova 5B"
  Nova6A, "Nova 6A"
  Nova6B, "Nova 6B"
  Nova7A, "Nova 7A"
  Nova7B, "Nova 7B"
  Nova8A, "Nova 8A"
  Nova8B, "Nova 8B"
  Boomerang3A, "Boomerang 3A"
  Boomerang3B, "Boomerang 3B"
  Boomerang4A, "Boomerang 4A"
  Boomerang4B, "Boomerang 4B"
  Boomerang5A, "Boomerang 5A"
  Boomerang5B, "Boomerang 5B"
  Boomerang6A, "Boomerang 6A"
  Boomerang6B, "Boomerang 6B"
  Boomerang7A, "Boomerang 7A"
  Boomerang7B, "Boomerang 7B"
  Boomerang8A, "Boomerang 8A"
  Boomerang8B, "Boomerang 8B"
  Windmill3A, "Windmill 3A"
  Windmill3B, "Windmill 3B"
  Windmill4A, "Windmill 4A"
  Windmill4B, "Windmill 4B"
  Windmill5A, "Windmill 5A"
  Windmill5B, "Windmill 5B"
  Windmill6A, "Windmill 6A"
  Windmill6B, "Windmill 6B"
  Windmill7A, "Windmill 7A"
  Windmill7B, "Windmill 7B"
  Windmill8A, "Windmill 8A"
  Windmill8B, "Windmill 8B"
  Thorn3A, "Thorn 3A"
  Thorn3B, "Thorn 3B"
  Thorn4A, "Thorn 4A"
  Thorn4B, "Thorn 4B"
  Thorn5A, "Thorn 5A"
  Thorn5B, "Thorn 5B"
  Thorn6A, "Thorn 6A"
  Thorn6B, "Thorn 6B"
  Thorn7A, "Thorn 7A"
  Thorn7B, "Thorn 7B"
  Thorn8A, "Thorn 8A"
  Thorn8B, "Thorn 8B"
  Gear3A, "Gear 3A"
  Gear3B, "Gear 3B"
  Gear4A, "Gear 4A"
  Gear4B, "Gear 4B"
  Gear5A, "Gear 5A"
  Gear5B, "Gear 5B"
  Gear6A, "Gear 6A"
  Gear6B, "Gear 6B"
  Gear7A, "Gear 7A"
  Gear7B, "Gear 7B"
  Gear8A, "Gear 8A"
  Gear8B, "Gear 8B"
  Thistle3A, "Thistle 3A"
  Thistle3B, "Thistle 3B"
  Thistle4A, "Thistle 4A"
  Thistle4B, "Thistle 4B"
  Thistle5A, "Thistle 5A"
  Thistle5B, "Thistle 5B"
  Thistle6A, "Thistle 6A"
  Thistle6B, "Thistle 6B"
  Thistle7A, "Thistle 7A"
  Thistle7B, "Thistle 7B"
  Thistle8A, "Thistle 8A"
  Thistle8B, "Thistle 8B"
  Flower3A, "Flower 3A"
  Flower3B, "Flower 3B"
  Flower4A, "Flower 4A"
  Flower4B, "Flower 4B"
  Flower5A, "Flower 5A"
  Flower5B, "Flower 5B"
  Flower6A, "Flower 6A"
  Flower6B, "Flower 6B"
  Flower7A, "Flower 7A"
  Flower7B, "Flower 7B"
  Flower8A, "Flower 8A"
  Flower8B, "Flower 8B"
  SharpFlower3A, "Sharp Flower 3A"
  SharpFlower3B, "Sharp Flower 3B"
  SharpFlower4A, "Sharp Flower 4A"
  SharpFlower4B, "Sharp Flower 4B"
  SharpFlower5A, "Sharp Flower 5A"
  SharpFlower5B, "Sharp Flower 5B"
  SharpFlower6A, "Sharp Flower 6A"
  SharpFlower6B, "Sharp Flower 6B"
  SharpFlower7A, "Sharp Flower 7A"
  SharpFlower7B, "Sharp Flower 7B"
  SharpFlower8A, "Sharp Flower 8A"
  SharpFlower8B, "Sharp Flower 8B"
  LobedFlower3A, "Lobed Flower 3A"
  LobedFlower3B, "Lobed Flower 3B"
  LobedFlower4A, "Lobed Flower 4A"
  LobedFlower4B, "Lobed Flower 4B"
  LobedFlower5A, "Lobed Flower 5A"
  LobedFlower5B, "Lobed Flower 5B"
  LobedFlower6A, "Lobed Flower 6A"
  LobedFlower6B, "Lobed Flower 6B"
  LobedFlower7A, "Lobed Flower 7A"
  LobedFlower7B, "Lobed Flower 7B"
  LobedFlower8A, "Lobed Flower 8A"
  LobedFlower8B, "Lobed Flower 8B"
}
#end

Example:

comment:
 
  Tranform z based on a shape's value at z.
 
global:
 
  const Complex zRotate = Cis(DegreeToRadian(Angle))
 
transform:
 
  z = (z - Center) / zRotate
  z = z/Abs(z)*Shape.Value(Shape, z)*Radius
  z = Center + z * zRotate
 
properties:
 
  #include ShapeTypes
 
  option Shape {
    type = ShapeTypes
    caption = "Shape"
    default = ShapeTypes.Square
  }
  option Center {
    type = Complex
    caption = "Center"
    details = "Center point of transformation"
    default = 0
  }
  option Angle {
    type = Float
    caption = "Angle"
    details = "Angle of rotation"
    default = 0
    range = [-360,360]
  }
  option Radius {
    type = Float
    caption = "Radius"
    details = "Radius of shape"
    default = 1
  }

This example uses the Shape.Value function to define a Transformation based on the given Shape. Properties are provided to control the type of shape, center point, angle, and radius.

Complex Shape.Transform(type, shapeR, shapeN, shapeS, z)

Shape.Transform transforms z based on the given arguments and returns the result. type is one of the values from the ShapeTransformTypes enum. shareR, shapeN, and shapeS, are arguments that alter the function results, and have different meaning based on the shape. shapeR is the shape radius unless stated otherwise. shapeN is an integer argument and shapeS is a float argument. The text in the ShapeTransformTypes enum associated with the shape details how the arguments are used. This function is used internally to handle Shape Transformation processing and is the basis for the Shape orbit trap.

You can access the list of types by including the following statement in your properties section:

#include ShapeTransformTypes

The ShapeTransformTypes enum is defined in the built-in macros as:

#define ShapeTransformTypes

enum ShapeTransformTypes {
  Circle, "Circle"
  Ellipse, "Ellipse (R = x radius, S = y radius)"
  Parabola1A, "Parabola 1A (R = focal distance)"
  Parabola1B, "Parabola 1B (R = focal distance)"
  Parabola2A, "Parabola 2A (R = focal distance)"
  Parabola2B, "Parabola 2B (R = focal distance)"
  HyperbolaA, "Hyperbola A (R = major axis, S = minor axis)"
  HyperbolaB, "Hyperbola B (R = minor axis, S = major axis)"
  Square, "Square"
  Rectangle, "Rectangle (height factor S)"
  TriangleA, "Triangle A"
  TriangleB, "Triangle B"
  Diamond, "Diamond"
  HexagonA, "Hexagon A"
  HexagonB, "Hexagon B"
  OctagonA, "Octagon A"
  OctagonB, "Octagon B"
  Astroid, "Astroid (power S)"
  CardioidA, "Cardioid A"
  CardioidB, "Cardioid B"
  Flower1A, "Flower 1A (outer radius R, N petals)"
  Flower1B, "Flower 1B (outer radius R, N petals)"
  Flower2A, "Flower 2A (inner radius R, N petals)"
  Flower2B, "Flower 2B (inner radius R, N petals)"
  Flower3A, "Flower 3A (N petals, shape control S)"
  Flower3B, "Flower 3B (N petals, shape control S)"
  Flower4A, "Flower 4A (N petals, shape control S)"
  Flower4B, "Flower 4B (N petals, shape control S)"
  Star1A, "Star 1A (N points, shape control S)"
  Star1B, "Star 1B (N points, shape control S)"
  Star2A, "Star 2A (N points, shape control S)"
  Star2B, "Star 2B (N points, shape control S)"
  GearA, "Gear A (N points, shape control S)"
  GearB, "Gear B (N points, shape control S)"
  SuperEllipse, "SuperEllipse (N points, power S)"
  ConicA, "Conic A (N sectors, eccentricity S)"
  ConicB, "Conic B (N sectors, eccentricity S)"
  CrossA, "Cross A"
  CrossB, "Cross B"
  HyperCrossA, "Hyper-Cross A"
  HyperCrossB, "Hyper-Cross B"
}
#end

Example:

comment:
 
  Tranform z based on the radial value of a shape's
  polar equation at Arg(z).
 
global:
 
  const Complex zRotate = Cis(DegreeToRadian(Angle))
 
transform:
 
  z = (z - Center) / zRotate
 
  z = Shape.Transform( \
    ShapeTransform, \
    ShapeTransformR, \
    ShapeTransformN, \
    ShapeTransformS, \
    z \
  )
  z = Center + z * zRotate
 
properties:
 
  option Center {
    type = Complex
    caption = "Center"
    details = "Center point of transformation"
    default = 0
  }
  option Angle {
    type = Float
    caption = "Angle"
    details = "Angle of rotation"
    default = 0
    range = [-360,360]
  }
  #include ShapeTransformOptions

This example defines a Transformation based on the Shape.Transform function.

The arguments to the function are define by including the following statement in the properties section:

#include ShapeTransformOptions

This includes options to define each of the function's arguments. The options are defined so that only the options applicable to a given shape are enabled when that shape is selected.

The ShapeTransformOptions enum is defined in the built-in macros as:

#define ShapeTransformOptions

#include ShapeTransformTypes

option ShapeTransform {
  type = ShapeTransformTypes
  caption = "Shape"
  default = ShapeTransformTypes.Circle
  size = Large
}
option ShapeTransformR {
  type = Float
  caption = "R"
  details = "R is the shape radius unless stated otherwise"
  default = 1
  range = (0,)
  enabled = \
    ShapeTransform <> ShapeTransformTypes.CrossA && \
    ShapeTransform <> ShapeTransformTypes.CrossB && \
    ShapeTransform <> ShapeTransformTypes.HyperCrossA && \
    ShapeTransform <> ShapeTransformTypes.HyperCrossB
}
option ShapeTransformN {
  type = IntegerEnum(1,8)
  caption = "N"
  details = "N is an integer parameter used by some shapes"
  default = 2
  enabled = \
    ShapeTransform = ShapeTransformTypes.Flower1A || \
    ShapeTransform = ShapeTransformTypes.Flower1B || \
    ShapeTransform = ShapeTransformTypes.Flower2A || \
    ShapeTransform = ShapeTransformTypes.Flower2B || \
    ShapeTransform = ShapeTransformTypes.Flower3A || \
    ShapeTransform = ShapeTransformTypes.Flower3B || \
    ShapeTransform = ShapeTransformTypes.Flower4A || \
    ShapeTransform = ShapeTransformTypes.Flower4B || \
    ShapeTransform = ShapeTransformTypes.Star1A || \
    ShapeTransform = ShapeTransformTypes.Star1B || \
    ShapeTransform = ShapeTransformTypes.Star2A || \
    ShapeTransform = ShapeTransformTypes.Star2B || \
    ShapeTransform = ShapeTransformTypes.GearA || \
    ShapeTransform = ShapeTransformTypes.GearB || \
    ShapeTransform = ShapeTransformTypes.SuperEllipse || \
    ShapeTransform = ShapeTransformTypes.ConicA || \
    ShapeTransform = ShapeTransformTypes.ConicB
}
option ShapeTransformS {
  type = Float
  caption = "S"
  details = "S is a float parameter used by some shapes"
  default = 1
  range = (0,)
  enabled = \
    ShapeTransform = ShapeTransformTypes.Ellipse || \
    ShapeTransform = ShapeTransformTypes.HyperbolaA || \
    ShapeTransform = ShapeTransformTypes.HyperbolaB || \
    ShapeTransform = ShapeTransformTypes.Rectangle || \
    ShapeTransform = ShapeTransformTypes.Astroid || \
    ShapeTransform = ShapeTransformTypes.Flower3A || \
    ShapeTransform = ShapeTransformTypes.Flower3B || \
    ShapeTransform = ShapeTransformTypes.Flower4A || \
    ShapeTransform = ShapeTransformTypes.Flower4B || \
    ShapeTransform = ShapeTransformTypes.Star1A || \
    ShapeTransform = ShapeTransformTypes.Star1B || \
    ShapeTransform = ShapeTransformTypes.Star2A || \
    ShapeTransform = ShapeTransformTypes.Star2B || \
    ShapeTransform = ShapeTransformTypes.GearA || \
    ShapeTransform = ShapeTransformTypes.GearB || \
    ShapeTransform = ShapeTransformTypes.SuperEllipse || \
    ShapeTransform = ShapeTransformTypes.ConicA || \
    ShapeTransform = ShapeTransformTypes.ConicB
}
#end

 

Copyright © 2004-2016 Hilbert, LLC
All rights reserved