|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objectcommon:Generic
common:Transform
common:UtilityTransform
common:PixelCoordinate
class
This is a utility transform which returns a pixel coordinate
for a given complex number.
class PixelCoordinate(UtilityTransform) {
; This is a utility transform which returns a pixel coordinate
; for a given complex number.
public:
func PixelCoordinate(Generic pparent)
UtilityTransform.UtilityTransform(pparent)
m_ScreenRelative = 0
m_SinAngle = sin(#angle)
m_CosAngle = cos(#angle)
if (#width*3 <= #height*4)
m_Distance = 4 / (#width*#magn)
else
m_Distance = 3 / (#height*#magn)
endif
endfunc
func Init(complex pz)
UtilityTransform.Init(pz)
endfunc
complex func Iterate(complex pz)
UtilityTransform.Iterate(pz)
float sx
float sy
complex cz
; note that in these calculations, we invert the y coordinate
; because Ultra Fractal reports #screenpixel with (0,0) in the
; upper left, not the lower left; complex numbers would place
; (0,0) in the lower left
if (m_Screenrelative == 1) ; screen-relative coordinates
sx = real(pz) * #width
sy = (1 - imag(pz)) * #height
else ; normal coordinates
cz = (pz - #center) / m_Distance
sx = m_CosAngle*real(cz) + m_SinAngle*imag(cz)
sy = m_CosAngle*imag(cz) - m_SinAngle*real(cz)
sx = sx*#stretch + sy * tan(#skew)
sx = sx + #width/2
sy = -sy + #height/2
endif
return sx + flip(sy)
endfunc
; set screen-relative style
; 0 = none, 1 = normal (0,0) .. (1,1), 2 = image (-1,-1) .. (1,1)
func SetScreenRelative(int ptype)
m_ScreenRelative = ptype
endfunc
protected:
int m_ScreenRelative
float m_SinAngle
float m_CosAngle
float m_Distance
default:
title = "Pixel Coordinate utility class"
int param v_pixelcoordinate
caption = "Version (PixelCoordinate)"
default = 100
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_pixelcoordinate < 100
endparam
}
| Constructor Summary | |
|---|---|
PixelCoordinate()
|
|
PixelCoordinate(Generic pparent)
|
|
| Method Summary | |
|---|---|
void |
Init(complex pz)
Set up for a sequence of values |
complex |
Iterate(complex pz)
Transform a single point within a sequence |
void |
SetScreenRelative(int ptype)
set screen-relative style 0 = none, 1 = normal (0,0) .. |
| Methods inherited from class common:Transform |
|---|
IsSolid, IterateSilent |
| Methods inherited from class common:Generic |
|---|
GetParent |
| Methods inherited from class Object |
|---|
|
| Constructor Detail |
|---|
public PixelCoordinate(Generic pparent)
public PixelCoordinate()
| Method Detail |
|---|
public void Init(complex pz)
TransformThis function will be called at the beginning of each sequence of values (e.g. at the beginning of each fractal orbit). It will be called even if only one value is being transformed (e.g. a normal transformation formula). Use this to perform any setup that is exactly the same for each value in the sequence being transformed.
Init in class Transformpz - the value representing the sequence; for a normal transformation formula use, this will be #pixel. In some cases this may differ from the first value passed to Iterate() if the calling code applies some other transformations.public complex Iterate(complex pz)
TransformAfter a sequence has been set up with Init(), this function will be called once for each value in the sequence. Note that all values in the sequence must be processed in order (they cannot be processed out of order). If the sequence contains only one value, Init() will still be called and then Iterate() will be called just once.
Iterate in class Transformpz - the complex value to be transformed
public void SetScreenRelative(int ptype)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||