|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object common:Generic common:Formula Standard:Standard_Embossed
class
Object version of the Embossed* formulas in Standard.ufm which allows any
fractal formula to be used. Creates 3D "embossed" lighting effects when
combined with the Emboss coloring algorithm in Standard.ucl.
Note: Periodicity checking needs to be off.
Originally written by Kerry Mitchell.
class Standard_Embossed(common.ulb:Formula) { ; ; Object version of the Embossed* formulas in Standard.ufm which allows any ; fractal formula to be used. Creates 3D "embossed" lighting effects when ; combined with the Emboss coloring algorithm in Standard.ucl. ; Note: Periodicity checking needs to be off. ; ; Originally written by Kerry Mitchell. ; public: func Standard_Embossed(Generic pparent) Formula(pparent) fHelper[0] = new @helperClass(this) fHelper[1] = new @helperClass(this) endfunc complex func Init(complex pz) float theta=(90-@lightangle)*pi/180.0 float size=@sizefac*0.0065/#magn dr=size*(cos(theta)+flip(sin(theta))) fHelper[0].Init(pz - dr) fHelper[1].Init(pz + dr) fIteration = 0 fRMin = 1e20 m_BailedOut = false return pz endfunc complex func Iterate(complex pz) ; We can't use the pz value because we need to keep track of two z values. fIteration = fIteration + 1 complex z1 = fHelper[0].Iterate() complex z2 = fHelper[1].Iterate() if fHelper[0].IsBailedOut() z1 = z2 ; Return second z orbit instead of first. m_BailedOut = fHelper[1].IsBailedOut() endif if m_BailedOut || fIteration == #maxiter return fHelper[0].GetResult() + flip(fHelper[1].GetResult()) else ; Return z to keep periodicity checking working. This is a trick that's ; not in the original Embossed formulas, but I borrowed it from Damien's ; Slope formulas because it's such a good idea -FS. return z1 endif endfunc ; Accessor functions for the helper class. int func getIteration() return fIteration endfunc bool func updateRMin(const float r) if r < fRMin fRMin = r return true else return false endif endfunc private: Standard_EmbossedHelper fHelper[2] int fIteration float fRMin default: title = "Embossed" helpfile = "Uf*.chm" helptopic = "Html/formulas/standard/embossed.html" heading text = "Tip: Use with the Emboss coloring algorithm, and select one of the \ Linear drawing methods." endheading Standard_EmbossedHelper param helperClass selectable = false endparam param lightangle caption="Light Angle" default=0.0 hint="Angle of apparent light source, in degrees. With 0, the light \ comes from above. Positive values give clockwise rotation." endparam param sizefac caption="Contour Size" default=1.0 hint="Specifies the relative size of the contour bands. Larger values \ give thicker bands." exponential = true endparam complex param p_power ; Hide p_power from Formula visible = false endparam }
Constructor Summary | |
---|---|
Standard_Embossed()
|
|
Standard_Embossed(Generic pparent)
|
Method Summary | |
---|---|
int |
getIteration()
Accessor functions for the helper class. |
complex |
Init(complex pz)
Set up for a sequence of values |
complex |
Iterate(complex pz)
Produce the next value in the sequence |
boolean |
updateRMin(float r)
|
Methods inherited from class common:Formula |
---|
GetLowerBailout, GetPrimaryExponent, GetUpperBailout, IsBailedOut |
Methods inherited from class common:Generic |
---|
GetParent |
Methods inherited from class Object |
---|
|
Constructor Detail |
---|
public Standard_Embossed(Generic pparent)
public Standard_Embossed()
Method Detail |
---|
public complex Init(complex pz)
Formula
This function will be called at the beginning of each sequence of values (e.g. at the beginning of each fractal orbit).
Init
in class Formula
pz
- seed value for the sequence; for a normal fractal formula, this will be #pixel
public complex Iterate(complex pz)
Formula
As long as the sequence has not bailed out, this function will be continually called to produce sequence values.
Iterate
in class Formula
pz
- previous value in the sequence; corresponds to #z in a fractal formula. Note that you should always use this value for computing the next iteration, rather than a saved value, as the calling code may modify the returned value before passing it back to the next Iterate() call.
public int getIteration()
public boolean updateRMin(float r)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |