common
Class TrapShape

Object
  extended by common:Generic
      extended by common:TrapShape
Direct Known Subclasses:
DMJ_TrapShapeAstroid, DMJ_TrapShapeCross, DMJ_TrapShapeEgg, DMJ_TrapShapeFBM, DMJ_TrapShapeFlat, DMJ_TrapShapeGridRipples, DMJ_TrapShapeHeart1, DMJ_TrapShapeHeart2, DMJ_TrapShapeHyperbola, DMJ_TrapShapeHypercross, DMJ_TrapShapeLinearWave, DMJ_TrapShapeLines, DMJ_TrapShapePinch, DMJ_TrapShapePoint, DMJ_TrapShapePolyCurve, DMJ_TrapShapeRadialWave, DMJ_TrapShapeRectangle, DMJ_TrapShapeSpiral, JLB_TrapShapeGIPlus, JLB_TrapShapeGnarl, JLB_TrapShapeRRL, KCC_AngleFunction1Trap, KCC_AngleFunction2Trap, KCC_AtanTrap, KCC_BallsTrap, KCC_BlobsTrap, KCC_BubblesTrap, KCC_ConesTrap, KCC_CurlsTrap, KCC_DimpledSpheroidsTrap, KCC_FlexballsTrap, KCC_HarlequinTrap, KCC_PetalsTrap, KCC_PlaneCurveTrapBase, KCC_PolygonTrap, KCC_RingSegmentsTrap, KCC_RingsTrap, KCC_SpheresTrap, KCC_SpheroidsTrap, KCC_SquaresTrap, KCC_StalksTrap, KCC_StarOfDavidTrap, KCC_TangentBallsTrap, KCC_TwoEllipsesTrap, MMF_TrapShapeAngle, MMF_TrapShapefBm, MMF_TrapShapeFnz, MMF_TrapShapeTriangleInequality, MMF_TrapShapeZold, Monnier_SFBM_II_Texture, MT_BumpMapsTexture, MT_CrackleTexture, MT_GnarlTexture, MT_ImageMapsTexture, MT_MarbleTexture, MT_PerlinNoise3DTexture, MT_PerlinNoiseTexture, MT_PopcornTexture, MT_TextureBlock, MT_TrapShape_Transform, MT_TrapShapeButterfly, MT_TrapShapeCardioid, MT_TrapShapeFolium, MT_TrapShapeGnarl, MT_TrapShapeHarlequin, MT_TrapShapeMartin, MT_TrapShapePopcorn, MT_TrapShapeRhodonea, MT_TrapShapeRose, MT_TrapShapeSextic, MT_TrapShapeSine, MT_TurbulenceTexture, MT_VoronoiTexture, MT_YorkeTexture, REB_ConvolutionShapeWrapper, REB_ImageTileTexture, REB_SpokesNRings, REB_TrapShape4DOrbit, REB_TrapShapeAmpersand, REB_TrapShapeArachnida1, REB_TrapShapeArachnida2, REB_TrapShapeArchimedes, REB_TrapShapeAtzemaSpiral, REB_TrapShapeBean, REB_TrapShapeBicorn, REB_TrapShapeBicuspid, REB_TrapShapeBifolium, REB_TrapShapeBow, REB_TrapShapeButterfly, REB_TrapShapeCardiod, REB_TrapShapeCassiniOvals, REB_TrapShapeCayleysSextic, REB_TrapShapeCeilFloor, REB_TrapShapeCfPlus, REB_TrapShapeChip, REB_TrapShapeChip2, REB_TrapShapeCircle, REB_TrapShapeCircleCatacaustic, REB_TrapShapeCissoidofDiocles, REB_TrapShapeCochleoid, REB_TrapShapeConchoid, REB_TrapShapeCosMartin, REB_TrapShapeCosMartin2, REB_TrapShapeCotesSpiral, REB_TrapShapeCruciform, REB_TrapShapeCurtateCycloid, REB_TrapShapeCycloid, REB_TrapShapeCycloidofSeva, REB_TrapShapeDeltoidCatacaustic, REB_TrapShapeDevilsCurve, REB_TrapShapeDiamond, REB_TrapShapeDipoleCurve, REB_TrapShapeDumbellCurve, REB_TrapShapeEightCurve, REB_TrapShapeEllipseCatacaustic, REB_TrapShapeEllipseEvolute, REB_TrapShapeEpicycloid, REB_TrapShapeEpispiral, REB_TrapShapeFibonacci, REB_TrapShapeFoliumOfDescartes, REB_TrapShapeGearCurve, REB_TrapShapeGenTexture, REB_TrapShapeGingerbread, REB_TrapShapeGnarlTexture, REB_TrapShapeHenon, REB_TrapShapeHenon2, REB_TrapShapeHipopede, REB_TrapShapeHopalong, REB_TrapShapeHopalong2, REB_TrapShapeHyperbola, REB_TrapShapeIkenaga, REB_TrapShapeInversions, REB_TrapShapeKampyleofEudoxus, REB_TrapShapeKappaCurve, REB_TrapShapeKeratoidCusp, REB_TrapShapeKnotCurve, REB_TrapShapeLatoocarfian, REB_TrapShapeLatticeTexture, REB_TrapShapeLemniscate, REB_TrapShapeLiar, REB_TrapShapeLimaconOfPascal, REB_TrapShapeLine, REB_TrapShapeLinksCurve, REB_TrapShapeLituus, REB_TrapShapeLogSpiral, REB_TrapShapeLogSpiralCatacaustic, REB_TrapShapeMalteseCross, REB_TrapShapeModPerlinTexture, REB_TrapShapeNephroid, REB_TrapShapeOphiuride, REB_TrapShapeParabola, REB_TrapShapePickover, REB_TrapShapePiriform, REB_TrapShapePoinsotSpiral1, REB_TrapShapePoinsotSpiral2, REB_TrapShapePolytrope, REB_TrapShapeProduct, REB_TrapShapeProduct2, REB_TrapShapeQuadratrixOfHippias, REB_TrapShapeQuadrifolium, REB_TrapShapeQuadruptwo, REB_TrapShapeQuotient1, REB_TrapShapeQuotient2, REB_TrapShapeQuotient3, REB_TrapShapeQuotient4, REB_TrapShapeREBAstroid, REB_TrapShapeRose, REB_TrapShapeRoseOfTroy, REB_TrapShapeScarabaeus, REB_TrapShapeSemicubicalParabola, REB_TrapShapeSerpentineCurve, REB_TrapShapeSierpinski, REB_TrapShapeSlopeBasic, REB_TrapShapeSprott3D, REB_TrapShapeSprott3D_ODE, REB_TrapShapeSprottQuad, REB_TrapShapeStirrupCurve, REB_TrapShapeStrophoid, REB_TrapShapeSum, REB_TrapShapeSum2, REB_TrapShapeSwastikaCurve, REB_TrapShapeTeardropCurve, REB_TrapShapeThreeply, REB_TrapShapeTobyGeometrixTexture, REB_TrapShapeTractrix, REB_TrapShapeTrefoil, REB_TrapShapeTrident, REB_TrapShapeTridentOfDescartes, REB_TrapShapeTrifolium, REB_TrapShapeTrisectrixOfMclaurin, REB_TrapShapeTrPlus, REB_TrapShapeTruncRound, REB_TrapShapeTschirnhausenCubic, REB_TrapShapeWitchOfAgnesi, REB_TrapShapeWorleyTextures, REB_TrapShapeZito, RKB_SSG, RKB_TrapShapeCollection, RKB_TrapShapeCombineShapes, RKB_TrapShapeDeformShape, RKB_TrapShapeFlower, Standard_TrapShapeAstroid, Standard_TrapShapeBox, Standard_TrapShapeCross, Standard_TrapShapeDiamond, Standard_TrapShapeEgg, Standard_TrapShapeGaussianInteger, Standard_TrapShapeHeart, Standard_TrapShapeHyperbola, Standard_TrapShapeHypercross, Standard_TrapShapeLines, Standard_TrapShapePinch, Standard_TrapShapePoint, Standard_TrapShapeRectangle, Standard_TrapShapeRing, Standard_TrapShapeRing2, Standard_TrapShapeRipples, Standard_TrapShapeSpiral, Standard_TrapShapeWaves, TrapShapeBlock, TrapShapeFormulaGradientColoring, TrapShapeMerge, TrapShapeNoise, TrapShapePoint, TrapShapeSuperShape

class 
Generic:TrapShape

Trap Shape base class.

This is a generic trap shape class. The purpose of a trap shape is very simple: to take one or more complex values and determine a "distance" to a trap shape for those values. There are some extra features provided to facilitate many of the things that have been done in the past with trap shapes and trapping algorithms.


Ultra Fractal Source

Toggle UF Source Code Display

 class TrapShape(Generic) {
   ; Trap Shape base class.
   ; <p>
   ; This is a generic trap shape class. The purpose of a trap shape
   ; is very simple: to take one or more complex values and determine
   ; a "distance" to a trap shape for those values. There are some
   ; extra features provided to facilitate many of the things that
   ; have been done in the past with trap shapes and trapping
   ; algorithms.
 
 public:
   ; constructor
   func TrapShape(Generic pparent)
     Generic.Generic(pparent)
   endfunc
   
   ; call this before each sequence of values to be trapped
   func Init(complex pz)
     m_Iterations = 0
     m_LastZ = pz
     m_LastChannel = 0
   endfunc
   
   ; call this for each iteration being trapped
   float func Iterate(complex pz)
     m_Iterations = m_Iterations + 1
     m_LastZ = pz
     return real(pz)
   endfunc
   
   ; Update internal counters without transforming a value
   ;
   func IterateSilent()
     ; Perform the same iteration-count update as Iterate(), but
     ; don't return a value. See the comments in Iterate() for
     ; more information on when to call this.
     m_Iterations = m_Iterations + 1
   endfunc
 
   ; call this to set the threshold selected by the user
   ; it's up to the calling code to apply the threshold,
   ; but some trap shapes or merges need to know the
   ; threshold to work properly
   func SetThreshold(float pthreshold)
     m_Threshold = pthreshold
   endfunc
 
   ; Get transformed point.
   ; <p>
   ; Some trap modes and trap coloring modes require
   ; access to the "transformed" point. This is the
   ; final point that is actually used by the trap shape
   ; class to test against the trap. For most trap shape
   ; classes this will be exactly the same as the pz
   ; passed into Iterate(), and those classes can use
   ; this base class functionality. However, some trap
   ; shape classes (e.g. TrapShapeMerge, TrapShapeBlock)
   ; perform some internal transformations on pz before
   ; passing it to the trap shape; this gives them the
   ; opportunity to call their trap shape's function to
   ; get the final transformed point.
   ;
   ; @return the last transformed point used (i.e. call GetTransformedPoint() after calling Iterate(), not before)
   complex func GetTransformedPoint()
     return m_LastZ
   endfunc
 
   ; Get texture value.
   ; <p>
   ; Ordinarily, a trap shape does not have a native texture
   ; (it is flat). Some formulas may pair trap shapes with
   ; trap textures, and may need more information about trap
   ; textures when trap shapes are nested via TrapShapeMerge.
   ; This function provides support for accessing texture
   ; information.
   ;
   ; @return the texture value for the last point used (i.e. call GetTextureValue() after calling Iterate(), not before)
   float func GetTextureValue()
     return 0
   endfunc
 
   ; Get color channel.
   ; <p>
   ; Some trap shapes may be inherently multi-colored. Such
   ; trap shapes may either override this function to return
   ; a different color index, or may simply store the index
   ; in m_LastChannel and this function will return it. The
   ; color index is just an indication of which color channel
   ; (in a GradientWrapper object) should be used.
   ;
   ; @return the color channel value for the last point used (i.e. call GetColorChannel() after calling Iterate(), not before)
   int func GetColorChannel()
     return m_LastChannel
   endfunc
 
 protected:
   int m_Iterations
   float m_Threshold
   complex m_LastZ
   int m_LastChannel
 
 default:
   int param v_trapshape
     caption = "Version (TrapShape)"
     default = 101
     hint = "This version parameter is used to detect when a change has been made to the formula that is incompatible with the previous version. When that happens, this field will reflect the old version number to alert you to the fact that an alternate rendering is being used."
     visible = @v_trapshape < 100
   endparam
 }
 


Constructor Summary
TrapShape()
           
TrapShape(Generic pparent)
          constructor
 
Method Summary
 int GetColorChannel()
          Get color channel.
 float GetTextureValue()
          Get texture value.
 complex GetTransformedPoint()
          Get transformed point.
 void Init(complex pz)
          call this before each sequence of values to be trapped
 float Iterate(complex pz)
          call this for each iteration being trapped
 void IterateSilent()
          Update internal counters without transforming a value
 void SetThreshold(float pthreshold)
          call this to set the threshold selected by the user it's up to the calling code to apply the threshold, but some trap shapes or merges need to know the threshold to work properly
 
Methods inherited from class common:Generic
GetParent
 
Methods inherited from class Object
 

Constructor Detail

TrapShape

public TrapShape(Generic pparent)
constructor


TrapShape

public TrapShape()
Method Detail

Init

public void Init(complex pz)
call this before each sequence of values to be trapped


Iterate

public float Iterate(complex pz)
call this for each iteration being trapped


IterateSilent

public void IterateSilent()
Update internal counters without transforming a value


SetThreshold

public void SetThreshold(float pthreshold)
call this to set the threshold selected by the user it's up to the calling code to apply the threshold, but some trap shapes or merges need to know the threshold to work properly


GetTransformedPoint

public complex GetTransformedPoint()
Get transformed point.

Some trap modes and trap coloring modes require access to the "transformed" point. This is the final point that is actually used by the trap shape class to test against the trap. For most trap shape classes this will be exactly the same as the pz passed into Iterate(), and those classes can use this base class functionality. However, some trap shape classes (e.g. TrapShapeMerge, TrapShapeBlock) perform some internal transformations on pz before passing it to the trap shape; this gives them the opportunity to call their trap shape's function to get the final transformed point.

Returns:
the last transformed point used (i.e. call GetTransformedPoint() after calling Iterate(), not before)

GetTextureValue

public float GetTextureValue()
Get texture value.

Ordinarily, a trap shape does not have a native texture (it is flat). Some formulas may pair trap shapes with trap textures, and may need more information about trap textures when trap shapes are nested via TrapShapeMerge. This function provides support for accessing texture information.

Returns:
the texture value for the last point used (i.e. call GetTextureValue() after calling Iterate(), not before)

GetColorChannel

public int GetColorChannel()
Get color channel.

Some trap shapes may be inherently multi-colored. Such trap shapes may either override this function to return a different color index, or may simply store the index in m_LastChannel and this function will return it. The color index is just an indication of which color channel (in a GradientWrapper object) should be used.

Returns:
the color channel value for the last point used (i.e. call GetColorChannel() after calling Iterate(), not before)