Alternate Values |
|
Alternate Values OverviewAlternate Values are Fractal Science Kit fractal generator programs that define an alternate value mappings in Mandelbrot Fractals. Alternate value mappings are available as sample data values and as SamplePointValue options in the instructions for the Classic [Master] Controllers and the Orbit Trap [Master] Controllers. See also:
Each program is composed of a set of properties and instructions. CommentsAlways remember to click the Toggle Code View toolbar button at the top of the Program Editor and read the comments given in the comment section of the program's instructions. The comment section contains usage instructions, hints, notes, documentation, and other important information that will help you understand how best to use the program. Once you are done reading the comments, click the Toggle Code View toolbar button again to view the program's properties. Properties
The following properties are supported:
InstructionsThe remainder of this page can be ignored if you are not a programmer. At the bottom of the window is an editor pane named Instructions. The editor pane is a simple text editor to view/edit your Program Instructions. See Editing Text for details. The instructions are divided into sections. Within each section are statements that conform to the Programming Language syntax. In addition to the Standard Sections, Alternate Values support 3 other sections: initialize: The initialize section is executed once per pixel, just prior to beginning the orbit. Instructions that need to execute at the beginning of each orbit should be placed here. The iterate section is executed once per iteration. The finalize section is executed at the end of each orbit and is the primary section of the program. The finalize section of the program is responsible for setting alternatePoint based on information derived from the set of orbit points associated with the pixel. alternatePoint is an AlternatePointInfo object defined as: Object AlternatePointInfo { Value is an arbitrary floating point value. Angle is a radian angle between -Math.PI and Math.PI. Index is a small integer value between 0 and 32767. Programs can set 1, 2, or all 3 of these values as required. These values are accessed by the Classic [Master] Controllers and the Orbit Trap [Master] Controllers, and used to map a given sample to a color. Example: comment: This program generates an alternate mapping using Exponential Smoothing. The Angle and Index fields are not set by the program so you cannot use those fields in the associated controller. The iterate section accumulates a value computed from the orbit points based on the fractal's type (Divergent, Convergent, or ConvergentOrDivergent). The finalize section sets the Value to the accumulated data collected in the iterate section. Example: comment: This example is identical to the 1st but is more efficient since it has no iterate section. Remember that the iterate section is run on every iteration so is far more expensive than the initialize or finalize sections that are run only once per orbit. By making use of the Orbit Function Orbit.Point and looping over the orbit in the finalize section, we are able to avoid the iterate section altogether which greatly improves performance. Example: comment: This example illustrates how to access raw orbit trap data within your program. The Trap Functions are available only in the finalize section of your program. This example computes the average of the Trap.Angle values over all trapped points for the associated pixel and sets alternatePoint.Value to this value. This feature is rarely used since it is much more convenient to use the built-in features of the Fractal Science Kit to process orbit trap data but does provide a level of flexibility not available otherwise, since you have access to the data for all the trapped points. Normally these points are processed by the Fractal Science Kit based on the orbit trap subsystem properties and a single point is available to the controllers. Built-in VariablesSeveral built-in variables are available to your instructions:
The built-in variable alternatePoint is used to return the results computed by the program. All of the remaining variables are read-only. The variables z and c are the same as given in the Fractal Equation. dwell is the current dwell value. The 1st time the iterate section is called, dwell=1, the 2nd time, dwell=2, and so on. This is different than in the Fractal Equation where the 1st time the iterate section is called dwell=0. This is due to the fact that the dwell is incremented after the Fractal Equation computes each orbit point but before the iterate section for the Alternate Value is executed. pixel is the point on the complex plane associated with the orbit. zprev1 and zprev2 are the previous 2 values of z in the current orbit. isPointInSet is true if the point is considered part of the Mandelbrot set and false if the point escaped. isPointInSet is available only in the finalize section of the program. smoothingFactor is a value that ranges from 0 to 1 within each dwell and can be used for smoothing the dwell values so the transitions between dwells are not apparent. smoothingFactor is valid only in the finalize section of the program and only if isPointInSet is false. Example: finalize: The magnitude above smoothly transitions from 0 to Max Dwell over the fractal. See the built-in alternate mapping Continuous Potential for the formula used to compute smoothingFactor. In addition to zprev1 and zprev2, you can access the entire set of orbit points computed thus far using the Orbit Functions. ConstantsThe following constants are available to your instructions:
These constants provide access to several key property values on the Mandelbrot / Julia / Newton properties page. MagnitudeBailout and MagnitudeEpsilon are the values of the Bailout and Epsilon properties. MagnitudeValueExpression, MagnitudeReferencePoint, and AngleReferencePoint, are the values of the Magnitude, Reference Point, and Angle Reference properties, respectively. The next 3 constants provide access to properties on the Fractal Equation page. FractalEquationType is the value of the Type property. FractalEquationMaxPower is the value of the Max Power property. FractalEquationPowerFactor is the value of the Power Factor property. Finally, ViewportMagnification is the current fractal's magnification. The magnification can be viewed by executing the Resize command on the View menu of the Fractal Window. Of these constants, 4 are given as enums; MagnitudeValueExpression is given as 1 of the DistanceMetricTypes, MagnitudeReferencePoint is given as 1 of the MagnitudeReferencePoints, AngleReferencePoint is given as 1 of the AngleReferencePoints, and FractalEquationType is given as 1 of the FractalEquationTypes. The definitions of these enums can be accessed by including 1 or more #include statements in your properties section as shown below. Example: properties: The above example includes all 4 enums which are defined in the built-in macros so that the other sections of your program can access the enum values. The definitions of these enums are included here for reference: #define DistanceMetricTypes The Exponential Smoothing example at the beginning of this section uses the FractalEquationType property and the FractalEquationTypes enum to control processing based on the fractal's type. |
Copyright © 2004-2019 Ross Hilbert |